[rg-router] Fix taglist update

This commit is contained in:
Joxit 2016-06-03 22:37:22 +02:00
parent 28649c6893
commit e45c107fe7
3 changed files with 28 additions and 12 deletions

15
app.tag
View file

@ -22,7 +22,22 @@
this.mixin('rg.router');
this.router.add({name: 'home', url: ''});
this.router.add({name: 'taglist', url: '/taglist/:repository/:image'});
this.router.on('go', state => {
switch (state.name) {
case 'taglist':
if (registryUI.taglist.display) {
registryUI.taglist.display();
}
break;
case 'home':
if (catalog.display) {
catalog.display();
}
break;
default:
}
})
this.router.start();
</script>
</app>

View file

@ -80,8 +80,7 @@
componentHandler.upgradeElements(this['catalog-tag']);
});
catalog.go = function (image) {
rg.router.go('taglist',
{
rg.router.go('taglist', {
repository: image.split('/')[0],
image: image.split('/')[1]
});

View file

@ -48,10 +48,7 @@
<script>
registryUI.taglist.instance = this;
registryUI.taglist.instance.update();
this.on('updated', function () {
componentHandler.upgradeElements(this['taglist-tag']);
registryUI.taglist.display = function () {
if (rg.router.current && rg.router.current.name == 'taglist') {
name = rg.router.current.params.repository + (rg.router.current.params.image
? '/' + rg.router.current.params.image
@ -92,8 +89,13 @@
oReq.withCredentials = false;
oReq.send();
}
};
registryUI.taglist.display();
registryUI.taglist.instance.update();
this.on('updated', function () {
componentHandler.upgradeElements(this['taglist-tag']);
});
registryUI.taglist.reverse = function (th) {
if (th.className == 'mdl-data-table__header--sorted-ascending') {
th.className = 'mdl-data-table__header--sorted-descending';