diff --git a/static/entrypoint b/bin/entrypoint
similarity index 100%
rename from static/entrypoint
rename to bin/entrypoint
diff --git a/dist/scripts/script-static.js b/dist/scripts/script-static.js
new file mode 100644
index 0000000..dfadb17
--- /dev/null
+++ b/dist/scripts/script-static.js
@@ -0,0 +1,18 @@
+/*!
+ * docker-registry-ui
+ * Copyright (C) 2016 Jones Magloire @Joxit
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+function Http(){this.oReq=new XMLHttpRequest,this._events={}}Http.prototype.addEventListener=function(t,e){this._events[t]=e;var i=this;switch(t){case"loadend":i.oReq.addEventListener("loadend",function(){if(401==this.status){var t=new XMLHttpRequest;for(key in this.http._events)t.addEventListener(key,this.http._events[key]);t.withCredentials=!0,t.open(this.http._method,this.http._url),t.send()}else e.bind(this)()});break;default:i.oReq.addEventListener(t,function(){e.bind(this)()})}},Http.prototype.open=function(t,e){this._method=t,this._url=e,this.oReq.open(t,e)},Http.prototype.send=function(){this.oReq.http=this,this.oReq.send()};var registryUI={};registryUI.url=function(){return"${URL}"},registryUI.catalog={},registryUI.taglist={},riot.mount("catalog"),riot.mount("taglist"),riot.mount("app");
\ No newline at end of file
diff --git a/dist/scripts/script.js b/dist/scripts/script.js
index 648d3dd..7bd2e95 100644
--- a/dist/scripts/script.js
+++ b/dist/scripts/script.js
@@ -15,4 +15,4 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-function Http(){this.oReq=new XMLHttpRequest,this._events={}}Http.prototype.addEventListener=function(t,e){switch(this._events[t]=e,t){case"loadend":this.oReq.addEventListener("loadend",function(){if(401==this.status){var t=new XMLHttpRequest;for(key in this.http._events)t.addEventListener(key,this.http._events[key]);t.withCredentials=!0,t.open(this.http._method,this.http._url),t.send()}else e.bind(this.oReq)});break;default:this.oReq.addEventListener(t,function(){e.bind(this.oReq)})}},Http.prototype.open=function(t,e){this._method=t,this._url=e,this.oReq.open(t,e)},Http.prototype.send=function(){this.oReq.http=this,this.oReq.send()};var registryUI={};registryUI.url=function(){return registryUI.getRegistryServer(0)},registryUI.getRegistryServer=function(t){try{var e=JSON.parse(localStorage.getItem("registryServer"));if(e instanceof Array)return isNaN(t)?e.map(function(t){return t.trim().replace(/\/*$/,"")}):e[t]}catch(r){}return isNaN(t)?[]:""},registryUI.addServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r==-1&&(e.push(t),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.changeServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r!=-1&&(e.splice(r,1),e=[t].concat(e),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.removeServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r!=-1&&(e.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.catalog={},registryUI.taglist={},riot.mount("add"),riot.mount("change"),riot.mount("remove"),riot.mount("menu"),riot.mount("app");
\ No newline at end of file
+function Http(){this.oReq=new XMLHttpRequest,this._events={}}Http.prototype.addEventListener=function(t,e){this._events[t]=e;var r=this;switch(t){case"loadend":r.oReq.addEventListener("loadend",function(){if(401==this.status){var t=new XMLHttpRequest;for(key in this.http._events)t.addEventListener(key,this.http._events[key]);t.withCredentials=!0,t.open(this.http._method,this.http._url),t.send()}else e.bind(this)()});break;default:r.oReq.addEventListener(t,function(){e.bind(this)()})}},Http.prototype.open=function(t,e){this._method=t,this._url=e,this.oReq.open(t,e)},Http.prototype.send=function(){this.oReq.http=this,this.oReq.send()};var registryUI={};registryUI.url=function(){return registryUI.getRegistryServer(0)},registryUI.getRegistryServer=function(t){try{var e=JSON.parse(localStorage.getItem("registryServer"));if(e instanceof Array)return isNaN(t)?e.map(function(t){return t.trim().replace(/\/*$/,"")}):e[t]}catch(r){}return isNaN(t)?[]:""},registryUI.addServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r==-1&&(e.push(t),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.changeServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r!=-1&&(e.splice(r,1),e=[t].concat(e),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.removeServer=function(t){var e=registryUI.getRegistryServer();t=t.trim().replace(/\/*$/,"");var r=e.indexOf(t);r!=-1&&(e.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(e)))},registryUI.catalog={},registryUI.taglist={},riot.mount("add"),riot.mount("change"),riot.mount("remove"),riot.mount("menu"),riot.mount("app");
\ No newline at end of file
diff --git a/dist/scripts/tags-static.js b/dist/scripts/tags-static.js
new file mode 100644
index 0000000..bc56d08
--- /dev/null
+++ b/dist/scripts/tags-static.js
@@ -0,0 +1,152 @@
+/*!
+ * docker-registry-ui
+ * Copyright (C) 2016 Jones Magloire @Joxit
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+riot.tag2('catalog', '
Repositories of {registryUI.url()}
', '', '', function(opts) {
+ registryUI.catalog.instance = this;
+ this.mixin('rg.router');
+ registryUI.catalog.display = function () {
+ var oReq = new Http();
+ registryUI.catalog.createSnackbar = function (msg) {
+ var snackbar = document.querySelector('#error-snackbar');
+ registryUI.catalog.error = msg;
+ var data = {
+ message: registryUI.catalog.error,
+ timeout: 100000,
+ actionHandler: function () {
+ snackbar.classList.remove('mdl-snackbar--active');
+ },
+ actionText: 'Undo'
+ };
+ snackbar.MaterialSnackbar.showSnackbar(data);
+ };
+ oReq.addEventListener('load', function () {
+ if (this.status == 200) {
+ registryUI.catalog.repositories = JSON.parse(this.responseText).repositories.sort();
+ } else if (this.status == 404) {
+ registryUI.catalog.createSnackbar('Server not found');
+ } else {
+ registryUI.catalog.createSnackbar(this.responseText);
+ }
+ });
+ oReq.addEventListener('error', function () {
+ registryUI.catalog.createSnackbar('An error occured');
+ });
+ oReq.addEventListener('loadend', function () {
+ registryUI.catalog.loadend = true;
+ registryUI.catalog.instance.update();
+ });
+ oReq.open('GET', registryUI.url() + '/v2/_catalog');
+ oReq.send();
+ };
+ this.on('updated', function () {
+ componentHandler.upgradeElements(this['catalog-tag']);
+ });
+ registryUI.catalog.go = function (image) {
+ rg.router.go('taglist', {
+ repository: image.split('/')[0],
+ image: image.split('/')[1]
+ });
+ };
+ registryUI.catalog.display();
+});
+
+
+riot.tag2('app', ' ', '', '', function(opts) {
+
+ 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 (registryUI.catalog.display) {
+ registryUI.catalog.display();
+ }
+ break;
+ }
+ })
+ this.router.start();
+});
+
+
+riot.tag2('taglist', ' arrow_back Tags of {registryUI.url() + \'/\' + registryUI.taglist.name}
| Repository |
| {registryUI.taglist.name} | {item} |
', '', '', function(opts) {
+ registryUI.taglist.instance = this;
+ 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
+ : '');
+ var oReq = new Http();
+ registryUI.taglist.name = name;
+ registryUI.taglist.createSnackbar = function (msg) {
+ var snackbar = document.querySelector('#error-snackbar');
+ registryUI.taglist.error = msg;
+ var data = {
+ message: registryUI.taglist.error,
+ timeout: 100000,
+ actionHandler: function () {
+ snackbar.classList.remove('mdl-snackbar--active');
+ },
+ actionText: 'Undo'
+ };
+ snackbar.MaterialSnackbar.showSnackbar(data);
+ };
+ oReq.addEventListener('load', function () {
+ if (this.status == 200) {
+ registryUI.taglist.tags = JSON.parse(this.responseText).tags.sort();
+ } else if (this.status == 404) {
+ registryUI.taglist.createSnackbar('Server not found');
+ } else {
+ registryUI.taglist.createSnackbar(this.responseText);
+ }
+ });
+ oReq.addEventListener('error', function () {
+ registryUI.taglist.createSnackbar('An error occured');
+ });
+ oReq.addEventListener('loadend', function () {
+ registryUI.taglist.loadend = true;
+ registryUI.taglist.instance.update();
+ });
+ oReq.open('GET', registryUI.url() + '/v2/' + name + '/tags/list');
+ 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';
+ } else {
+ th.className = 'mdl-data-table__header--sorted-ascending';
+ }
+ registryUI.taglist.tags.reverse();
+ registryUI.taglist.instance.update();
+ };
+ registryUI.taglist.back = function () {
+ rg.router.go('home');
+ };
+});
diff --git a/gulpfile.js b/gulpfile.js
index 3068fcc..89b067a 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -43,8 +43,34 @@ gulp.task('riot-tag', ['html'], function() {
.pipe(gulp.dest('dist/scripts'));
});
+gulp.task('riot-static-tag', ['html'], function() {
+ return gulp.src(['src/tags/catalog.tag', 'src/tags/app.tag', 'src/tags/taglist.tag'])
+ .pipe(concat('tags-static.js'))
+ .pipe(riot())
+ .pipe(license('agpl3', {
+ tiny: false,
+ project: 'docker-registry-ui',
+ year: '2016',
+ organization: 'Jones Magloire @Joxit'
+ }))
+ .pipe(gulp.dest('dist/scripts'));
+});
+
+gulp.task('scripts-static', ['html'], function() {
+ return gulp.src(['src/scripts/http.js', 'src/scripts/static.js'])
+ .pipe(concat('script-static.js'))
+ .pipe(uglify())
+ .pipe(license('agpl3', {
+ tiny: false,
+ project: 'docker-registry-ui',
+ year: '2016',
+ organization: 'Jones Magloire @Joxit'
+ }))
+ .pipe(gulp.dest('dist/scripts'));
+});
+
gulp.task('scripts', ['html'], function() {
- return gulp.src(['src/scripts/http.js','src/scripts/script.js'])
+ return gulp.src(['src/scripts/http.js', 'src/scripts/script.js'])
.pipe(concat('script.js'))
.pipe(uglify())
.pipe(license('agpl3', {
@@ -59,7 +85,9 @@ gulp.task('scripts', ['html'], function() {
gulp.task('styles', ['html'], function() {
return gulp.src(['src/*.css'])
.pipe(concat('style.css'))
- .pipe(cleanCSS({compatibility: 'ie8'}))
+ .pipe(cleanCSS({
+ compatibility: 'ie8'
+ }))
.pipe(license('agpl3', {
tiny: false,
project: 'docker-registry-ui',
@@ -75,7 +103,7 @@ gulp.task('fonts', function() {
.pipe(gulp.dest('dist/fonts'));
});
-gulp.task('sources', ['riot-tag', 'scripts', 'styles'], function() {
+gulp.task('sources', ['riot-tag', 'riot-static-tag', 'scripts', 'scripts-static', 'styles'], function() {
gulp.start();
});
diff --git a/static/script.js b/src/scripts/static.js
similarity index 100%
rename from static/script.js
rename to src/scripts/static.js
diff --git a/static/add.tag b/static/add.tag
deleted file mode 100644
index f9c1210..0000000
--- a/static/add.tag
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
diff --git a/static/change.tag b/static/change.tag
deleted file mode 100644
index 9ba0fc3..0000000
--- a/static/change.tag
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
diff --git a/static/menu.tag b/static/menu.tag
deleted file mode 100644
index 4199dd1..0000000
--- a/static/menu.tag
+++ /dev/null
@@ -1,19 +0,0 @@
-
-