[taglist] Add back fonctionnality, go to catalog again.

This commit is contained in:
Joxit 2016-05-03 00:08:39 +02:00
parent f72e030dad
commit 7f008b87f3
3 changed files with 38 additions and 33 deletions

View File

@ -37,40 +37,44 @@
<script>
catalog.instance = this;
var oReq = new XMLHttpRequest();
catalog.createSnackbar = function (msg) {
var snackbar = document.querySelector('#error-snackbar');
catalog.error = msg;
var data = {
message: catalog.error,
timeout: 100000,
actionHandler: function(){
snackbar.classList.remove('mdl-snackbar--active');
},
actionText: 'Undo'
catalog.display = function () {
registryUI.content = 'catalog';
var oReq = new XMLHttpRequest();
catalog.createSnackbar = function (msg) {
var snackbar = document.querySelector('#error-snackbar');
catalog.error = msg;
var data = {
message: catalog.error,
timeout: 100000,
actionHandler: function(){
snackbar.classList.remove('mdl-snackbar--active');
},
actionText: 'Undo'
};
snackbar.MaterialSnackbar.showSnackbar(data);
};
snackbar.MaterialSnackbar.showSnackbar(data);
oReq.addEventListener('load', function () {
if (this.status == 200) {
catalog.repositories = JSON.parse(this.responseText).repositories;
} else if (this.status == 404) {
catalog.createSnackbar('Server not found');
} else {
catalog.createSnackbar(this.responseText);
}
});
oReq.addEventListener('error', function () {
catalog.createSnackbar('An error occured');
});
oReq.addEventListener('loadend', function () {
catalog.loadend = true;
catalog.instance.update();
});
oReq.open('GET', registryUI.url() + '/v2/_catalog');
oReq.withCredentials = false;
oReq.send();
riot.update();
};
oReq.addEventListener('load', function () {
if (this.status == 200) {
catalog.repositories = JSON.parse(this.responseText).repositories;
} else if (this.status == 404) {
catalog.createSnackbar('Server not found');
} else {
catalog.createSnackbar(this.responseText);
}
});
oReq.addEventListener('error', function () {
catalog.createSnackbar('An error occured');
});
oReq.addEventListener('loadend', function () {
catalog.loadend = true;
catalog.instance.update();
});
oReq.open('GET', registryUI.url() + '/v2/_catalog');
oReq.withCredentials = false;
oReq.send();
catalog.instance.update();
catalog.display();
</script>
<!-- End of tag -->
</catalog>

View File

@ -20,6 +20,6 @@ registryUI.url = function () {
}
var catalog = {};
registryUI.taglist = {};
registryUI.content = 'catalog';
riot.mount('catalog');
riot.mount('taglist');

View File

@ -19,6 +19,7 @@
<div class="taglist" if="{ registryUI.content == 'taglist' }">
<div class="section-centerd mdl-card mdl-shadow--2dp mdl-cell--6-col">
<div class="mdl-card__title">
<a href="#" onclick="catalog.display();"><i class="material-icons mdl-list__item-icon">arrow_back</i></a>
<h2 class="mdl-card__title-text">Tags of { registryUI.url() + '/' + registryUI.taglist.name }</h2>
</div>
<div id="taglist-spinner" style="{ registryUI.taglist.loadend ? 'display:none;': '' }"