From 6221958c78ff4c54de09dec79961420b011a3900 Mon Sep 17 00:00:00 2001 From: Joxit Date: Tue, 24 Jul 2018 00:05:45 +0200 Subject: [PATCH] Upgrade to v0.4.0 Merge tags and scripts; now it will be `docker-registry-ui.js` and `docker-registry-ui-static.js` New sort for tags; will use numerical sort when it is possible --- README.md | 2 +- arm32v7-static.dockerfile | 3 +- arm64v8-static.dockerfile | 3 +- bin/entrypoint | 6 +- debian-static.dockerfile | 3 +- dist/index.html | 2 +- dist/scripts/docker-registry-ui-static.js | 18 +++++ dist/scripts/docker-registry-ui.js | 18 +++++ dist/scripts/script-static.js | 18 ----- dist/scripts/script.js | 18 ----- dist/scripts/tags-static.js | 18 ----- dist/scripts/tags.js | 18 ----- dist/scripts/vendor.js | 4 +- gulpfile.js | 99 +++++++++++------------ package.json | 10 +-- src/index.html | 4 +- src/scripts/script.js | 4 +- src/scripts/static.js | 6 +- static.dockerfile | 3 +- 19 files changed, 106 insertions(+), 151 deletions(-) create mode 100644 dist/scripts/docker-registry-ui-static.js create mode 100644 dist/scripts/docker-registry-ui.js delete mode 100644 dist/scripts/script-static.js delete mode 100644 dist/scripts/script.js delete mode 100644 dist/scripts/tags-static.js delete mode 100644 dist/scripts/tags.js diff --git a/README.md b/README.md index f3949f4..fff5c6f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like - Use `joxit/docker-registry-ui:static` as reverse proxy to your docker registry (This will avoid CORS). - Display image size (see #30) - Add Title when using REGISTRY_URL (see #28) -- Alpine and Debian based images with supports for arm32v7 +- Alpine and Debian based images with supports for arm32v7 and arm64v8 - Copy `docker pull` command to clipbloard - Show sha256 for specific tag (hover image tag) diff --git a/arm32v7-static.dockerfile b/arm32v7-static.dockerfile index 4497d81..32a94a2 100644 --- a/arm32v7-static.dockerfile +++ b/arm32v7-static.dockerfile @@ -20,8 +20,7 @@ WORKDIR /usr/share/nginx/html/ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/script-static.js /usr/share/nginx/html/scripts/script.js -COPY dist/scripts/tags-static.js /usr/share/nginx/html/scripts/tags.js +COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY bin/entrypoint /bin ENTRYPOINT entrypoint diff --git a/arm64v8-static.dockerfile b/arm64v8-static.dockerfile index ded0efc..f10881f 100644 --- a/arm64v8-static.dockerfile +++ b/arm64v8-static.dockerfile @@ -20,8 +20,7 @@ WORKDIR /usr/share/nginx/html/ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/script-static.js /usr/share/nginx/html/scripts/script.js -COPY dist/scripts/tags-static.js /usr/share/nginx/html/scripts/tags.js +COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY bin/entrypoint /bin ENTRYPOINT entrypoint diff --git a/bin/entrypoint b/bin/entrypoint index ed78f90..c6be0ef 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -1,10 +1,10 @@ #!/bin/sh $@ -sed -i "s,\${URL},${URL}," scripts/script.js -sed -i "s,\${REGISTRY_TITLE},${REGISTRY_TITLE}," scripts/script.js +sed -i "s,\${URL},${URL}," scripts/docker-registry-ui.js +sed -i "s,\${REGISTRY_TITLE},${REGISTRY_TITLE}," scripts/docker-registry-ui.js if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then - sed -i "s/registryUI.isImageRemoveActivated *= *[^,;]*/registryUI.isImageRemoveActivated=false/" scripts/script.js + sed -i "s/registryUI.isImageRemoveActivated *= *[^,;]*/registryUI.isImageRemoveActivated=false/" scripts/docker-registry-ui.js fi if [ -n "${REGISTRY_URL}" ] ; then diff --git a/debian-static.dockerfile b/debian-static.dockerfile index bc65c44..3a6541f 100644 --- a/debian-static.dockerfile +++ b/debian-static.dockerfile @@ -20,8 +20,7 @@ WORKDIR /usr/share/nginx/html/ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/script-static.js /usr/share/nginx/html/scripts/script.js -COPY dist/scripts/tags-static.js /usr/share/nginx/html/scripts/tags.js +COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY bin/entrypoint /bin ENTRYPOINT entrypoint diff --git a/dist/index.html b/dist/index.html index 72f68b3..5caf748 100644 --- a/dist/index.html +++ b/dist/index.html @@ -13,4 +13,4 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --->Docker Registry UI \ No newline at end of file +-->Docker Registry UI \ No newline at end of file diff --git a/dist/scripts/docker-registry-ui-static.js b/dist/scripts/docker-registry-ui-static.js new file mode 100644 index 0000000..df0a324 --- /dev/null +++ b/dist/scripts/docker-registry-ui-static.js @@ -0,0 +1,18 @@ +/*! + * docker-registry-ui + * Copyright (C) 2016-2018 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.oReq.hasHeader=Http.hasHeader,this.oReq.getErrorMessage=Http.getErrorMessage,this._events={},this._headers={}}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 t.open(r._method,r._url),r._events)t.addEventListener(key,r._events[key]);for(key in r._headers)t.setRequestHeader(key,r._headers[key]);t.withCredentials=!0,t.hasHeader=Http.hasHeader,t.getErrorMessage=Http.getErrorMessage,t.send()}else e.bind(this)()});break;case"load":r.oReq.addEventListener("load",function(){401!==this.status&&e.bind(this)()});break;default:r.oReq.addEventListener(t,function(){e.bind(this)()})}},Http.prototype.setRequestHeader=function(t,e){this.oReq.setRequestHeader(t,e),this._headers[t]=e},Http.prototype.open=function(t,e){this._method=t,this._url=e,this.oReq.open(t,e)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(t){return this.getAllResponseHeaders().split("\n").some(function(e){return new RegExp("^"+t+":","i").test(e)})},Http.getErrorMessage=function(){return registryUI.url()&®istryUI.url().match("^http://")&&"https:"===window.location.protocol?"Mixed Content: The page at `"+window.location.origin+"` was loaded over HTTPS, but requested an insecure server endpoint `"+registryUI.url()+"`. This request has been blocked; the content must be served over HTTPS.":registryUI.url()?this.withCredentials&&!this.hasHeader("Access-Control-Allow-Credentials")?"The `Access-Control-Allow-Credentials` header in the response is missing and must be set to `true` when the request's credentials mode is on. Origin `"+registryUI.url()+"` is therefore not allowed access.":"An error occured: Check your connection and your registry must have `Access-Control-Allow-Origin` header set to `"+window.location.origin+"`":"Incorrect server endpoint."};var registryUI={url:function(){return"${URL}"},name:function(){return"${REGISTRY_TITLE}"},isImageRemoveActivated:!0,catalog:{},taglist:{}};window.addEventListener("DOMContentLoaded",function(){riot.mount("*")}),riot.tag2("catalog",'

Repositories of {registryUI.name()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,registryUI.catalog.display=function(){registryUI.catalog.repositories=[];var t=new Http;t.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.catalog.repositories=[]}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog?n=100000"),t.send()},registryUI.catalog.go=function(t){route("taglist/"+t)},registryUI.catalog.display()}),riot.tag2("app",'
',"","",function(t){registryUI.appTag=this,route.base("#!"),route("",function(){route.routeName="home",registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display()),registryUI.appTag.update()}),route("/taglist/*",function(t){route.routeName="taglist",registryUI.taglist.name=t,registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display()),registryUI.appTag.update()}),registryUI.home=function(){"home"==route.routeName?registryUI.catalog.display():route("")},registryUI.snackbar=function(t,e){registryUI.appTag.tags["material-snackbar"].addToast({message:t,isError:e},15e3)},registryUI.errorSnackbar=function(t){return registryUI.snackbar(t,!0)},registryUI.cleanName=function(){var t=registryUI.url()&®istryUI.url().length>0&®istryUI.url()||window.location.host;return t?t.startsWith("http")?t.replace(/https?:\/\//,""):t:""},route.parser(null,function(t,e){const r=e.replace(/\?/g,"\\?").replace(/\*/g,"([^?#]+?)").replace(/\.\./,".*"),i=new RegExp("^"+r+"$"),s=t.match(i);if(s)return s.slice(1)}),registryUI.isDigit=function(t){return t>="0"&&t<="9"},registryUI.DockerImage=function(t,e){this.name=t,this.tag=e,riot.observable(this),this.on("get-size",function(){return void 0!==this.size?this.trigger("size",this.size):this.fillInfo()}),this.on("get-sha256",function(){return void 0!==this.size?this.trigger("sha256",this.sha256):this.fillInfo()})},registryUI.DockerImage._tagReduce=function(t,e){return t.length>0&®istryUI.isDigit(t[t.length-1].charAt(0))==registryUI.isDigit(e)?t[t.length-1]+=e:t.push(e),t},registryUI.DockerImage.compare=function(t,e){for(var r=t.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce,[]),i=e.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce,[]),s=0;s
arrow_back

Tags of {registryUI.name() + \'/\' + registryUI.taglist.name}

Repository Size Tag
{image.name}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(registryUI.taglist.tags=[],"taglist"==route.routeName){var t=new Http;registryUI.taglist.instance.update(),t.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags=registryUI.taglist.tags.map(function(t){return new registryUI.DockerImage(registryUI.taglist.name,t)}).sort(registryUI.DockerImage.compare)):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),t.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.taglist.tags=[]}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+registryUI.taglist.name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(registryUI.DockerImage.compare),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.refresh=function(){route(registryUI.taglist.name)}}),riot.tag2("copy-to-clipboard",' content_copy ',"","",function(t){this.dockerCmd="docker pull "+registryUI.cleanName()+"/"+t.image.name+":"+t.image.tag,this.copy=function(){var t=this.refs.input;t.style.display="block",t.select(),document.execCommand("copy"),t.style.display="none",registryUI.snackbar("`"+this.dockerCmd+"` has been copied to clipboard.")}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.remove=function(t,e){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),i=new Http;i.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+t+":"+e+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),i.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+r),i.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),i.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),i.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+t+":"+e+" not found"):registryUI.snackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+e),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}),riot.tag2("image-size",'
{this.bytesToSize(this.size)}
',"","",function(t){var e=this;this.bytesToSize=function(t){if(null==t||isNaN(t))return"?";if(0==t)return"0 Byte";var e=parseInt(Math.floor(Math.log(t)/Math.log(1024)));return Math.ceil(t/Math.pow(1024,e))+" "+["Bytes","KB","MB","GB","TB"][e]},t.image.on("size",function(t){e.size=t,e.update()}),t.image.trigger("get-size")}),riot.tag2("image-tag",'
{opts.image.tag}
',"","",function(t){var e=this;t.image.on("sha256",function(t){e.sha256=t.substring(0,19),e.update()}),t.image.trigger("get-sha256")}); \ No newline at end of file diff --git a/dist/scripts/docker-registry-ui.js b/dist/scripts/docker-registry-ui.js new file mode 100644 index 0000000..0ec118d --- /dev/null +++ b/dist/scripts/docker-registry-ui.js @@ -0,0 +1,18 @@ +/*! + * docker-registry-ui + * Copyright (C) 2016-2018 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.oReq.hasHeader=Http.hasHeader,this.oReq.getErrorMessage=Http.getErrorMessage,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,t){this._events[e]=t;var r=this;switch(e){case"loadend":r.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;for(key in e.open(r._method,r._url),r._events)e.addEventListener(key,r._events[key]);for(key in r._headers)e.setRequestHeader(key,r._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.getErrorMessage=Http.getErrorMessage,e.send()}else t.bind(this)()});break;case"load":r.oReq.addEventListener("load",function(){401!==this.status&&t.bind(this)()});break;default:r.oReq.addEventListener(e,function(){t.bind(this)()})}},Http.prototype.setRequestHeader=function(e,t){this.oReq.setRequestHeader(e,t),this._headers[e]=t},Http.prototype.open=function(e,t){this._method=e,this._url=t,this.oReq.open(e,t)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(e){return this.getAllResponseHeaders().split("\n").some(function(t){return new RegExp("^"+e+":","i").test(t)})},Http.getErrorMessage=function(){return registryUI.url()&®istryUI.url().match("^http://")&&"https:"===window.location.protocol?"Mixed Content: The page at `"+window.location.origin+"` was loaded over HTTPS, but requested an insecure server endpoint `"+registryUI.url()+"`. This request has been blocked; the content must be served over HTTPS.":registryUI.url()?this.withCredentials&&!this.hasHeader("Access-Control-Allow-Credentials")?"The `Access-Control-Allow-Credentials` header in the response is missing and must be set to `true` when the request's credentials mode is on. Origin `"+registryUI.url()+"` is therefore not allowed access.":"An error occured: Check your connection and your registry must have `Access-Control-Allow-Origin` header set to `"+window.location.origin+"`":"Incorrect server endpoint."};var registryUI={URL_QUERY_PARAM_REGEX:/[&?]url=/,URL_PARAM_REGEX:/^url=/};registryUI.name=registryUI.url=function(e){if(!registryUI._url){var t=registryUI.getUrlQueryParam();if(t)try{return registryUI._url=registryUI.decodeURI(t),registryUI._url}catch(e){console.log(e)}registryUI._url=registryUI.getRegistryServer(0)}return registryUI._url},registryUI.getRegistryServer=function(e){try{var t=JSON.parse(localStorage.getItem("registryServer"));if(t instanceof Array)return isNaN(e)?t.map(function(e){return e.trim().replace(/\/*$/,"")}):t[e]}catch(e){}return isNaN(e)?[]:""},registryUI.addServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,""),-1==t.indexOf(e)&&(t.push(e),registryUI._url||registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.changeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);-1!=r&&(t.splice(r,1),t=[e].concat(t),registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.removeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);-1!=r&&(t.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(t)),e==registryUI.url()&&(registryUI.updateHistory(registryUI.getRegistryServer(0)),route("")))},registryUI.updateHistory=function(e){history.pushState(null,"",(e?"?url="+registryUI.encodeURI(e):"?")+window.location.hash),registryUI._url=e},registryUI.getUrlQueryParam=function(){var e=window.location.search;if(registryUI.URL_QUERY_PARAM_REGEX.test(e)){var t=e.split(/^\?|&/).find(function(e){return e&®istryUI.URL_PARAM_REGEX.test(e)});return t?t.replace(registryUI.URL_PARAM_REGEX,""):t}},registryUI.encodeURI=function(e){return e.indexOf("&")<0?window.encodeURIComponent(e):btoa(e)},registryUI.decodeURI=function(e){return e.startsWith("http")?window.decodeURIComponent(e):atob(e)},registryUI.isImageRemoveActivated=!0,registryUI.catalog={},registryUI.taglist={},window.addEventListener("DOMContentLoaded",function(){riot.mount("*")}),riot.tag2("add",'
Add your Server ?
Write your URL without /v2
Add Cancel
',"","",function(e){registryUI.addTag=registryUI.addTag||{},this.one("mount",function(){registryUI.addTag.dialog=this.tags["material-popup"],registryUI.addTag.dialog.getAddServer=function(){return this.tags["material-input"]?this.tags["material-input"].value:""}}),registryUI.addTag.onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()},registryUI.addTag.show=function(){registryUI.addTag.dialog.open()},registryUI.addTag.add=function(){registryUI.addTag.dialog.getAddServer().length>0&®istryUI.addServer(registryUI.addTag.dialog.getAddServer()),registryUI.home(),registryUI.addTag.close()},registryUI.addTag.close=function(){registryUI.addTag.dialog.tags["material-input"].value="",registryUI.addTag.dialog.close()}}),riot.tag2("app",'
',"","",function(e){registryUI.appTag=this,route.base("#!"),route("",function(){route.routeName="home",registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display()),registryUI.appTag.update()}),route("/taglist/*",function(e){route.routeName="taglist",registryUI.taglist.name=e,registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display()),registryUI.appTag.update()}),registryUI.home=function(){"home"==route.routeName?registryUI.catalog.display():route("")},registryUI.snackbar=function(e,t){registryUI.appTag.tags["material-snackbar"].addToast({message:e,isError:t},15e3)},registryUI.errorSnackbar=function(e){return registryUI.snackbar(e,!0)},registryUI.cleanName=function(){var e=registryUI.url()&®istryUI.url().length>0&®istryUI.url()||window.location.host;return e?e.startsWith("http")?e.replace(/https?:\/\//,""):e:""},route.parser(null,function(e,t){const r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^?#]+?)").replace(/\.\./,".*"),i=new RegExp("^"+r+"$"),a=e.match(i);if(a)return a.slice(1)}),registryUI.isDigit=function(e){return e>="0"&&e<="9"},registryUI.DockerImage=function(e,t){this.name=e,this.tag=t,riot.observable(this),this.on("get-size",function(){return void 0!==this.size?this.trigger("size",this.size):this.fillInfo()}),this.on("get-sha256",function(){return void 0!==this.size?this.trigger("sha256",this.sha256):this.fillInfo()})},registryUI.DockerImage._tagReduce=function(e,t){return e.length>0&®istryUI.isDigit(e[e.length-1].charAt(0))==registryUI.isDigit(t)?e[e.length-1]+=t:e.push(t),e},registryUI.DockerImage.compare=function(e,t){for(var r=e.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce,[]),i=t.tag.match(/./g).reduce(registryUI.DockerImage._tagReduce,[]),a=0;a

Repositories of {registryUI.name()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,registryUI.catalog.display=function(){registryUI.catalog.repositories=[];var e=new Http;e.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.catalog.repositories=[]}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog?n=100000"),e.send()},registryUI.catalog.go=function(e){route("taglist/"+e)},registryUI.catalog.display()}),riot.tag2("change",'
Change your Server ?
Change Cancel
',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},this.one("mount",function(){registryUI.changeTag.dialog=this.tags["material-popup"],registryUI.changeTag.dialog.getServerUrl=function(){return this.refs["server-list"]?this.refs["server-list"].value:""},registryUI.changeTag.dialog.on("updated",function(){this.refs["server-list"]&&(this.refs["server-list"].value=registryUI.url())})}),registryUI.changeTag.show=function(){registryUI.changeTag.dialog.open()},registryUI.changeTag.change=function(){registryUI.changeTag.dialog.getServerUrl().length>0&®istryUI.changeServer(registryUI.changeTag.dialog.getServerUrl()),registryUI.home(),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("copy-to-clipboard",' content_copy ',"","",function(e){this.dockerCmd="docker pull "+registryUI.cleanName()+"/"+e.image.name+":"+e.image.tag,this.copy=function(){var e=this.refs.input;e.style.display="block",e.select(),document.execCommand("copy"),e.style.display="none",registryUI.snackbar("`"+this.dockerCmd+"` has been copied to clipboard.")}}),riot.tag2("image-size",'
{this.bytesToSize(this.size)}
',"","",function(e){var t=this;this.bytesToSize=function(e){if(null==e||isNaN(e))return"?";if(0==e)return"0 Byte";var t=parseInt(Math.floor(Math.log(e)/Math.log(1024)));return Math.ceil(e/Math.pow(1024,t))+" "+["Bytes","KB","MB","GB","TB"][t]},e.image.on("size",function(e){t.size=e,t.update()}),e.image.trigger("get-size")}),riot.tag2("image-tag",'
{opts.image.tag}
',"","",function(e){var t=this;e.image.on("sha256",function(e){t.sha256=e.substring(0,19),t.update()}),e.image.trigger("get-sha256")}),riot.tag2("menu",' more_vert

Add URL

Change URL

Remove URL

',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.one("mount",function(e){var t=this;registryUI.menuTag.close=function(){t.tags["material-dropdown"].close(),t.update()},registryUI.menuTag.isOpen=function(){return t.tags["material-dropdown"].opened},registryUI.menuTag.toggle=function(){t.tags["material-dropdown"].opened?t.tags["material-dropdown"].close():t.tags["material-dropdown"].open(),t.update()}})}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.remove=function(e,t){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),i=new Http;i.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+e+":"+t+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),i.open("DELETE",registryUI.url()+"/v2/"+e+"/manifests/"+r),i.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),i.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),i.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+e+":"+t+" not found"):registryUI.snackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+e+"/manifests/"+t),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}),riot.tag2("remove",'
Remove your Registry Server ?
Close
',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.close()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.dialog.open()},this.one("mount",function(){registryUI.removeTag.dialog=this.tags["material-popup"]})}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.name() + \'/\' + registryUI.taglist.name}

Repository Size Tag
{image.name}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(registryUI.taglist.tags=[],"taglist"==route.routeName){var e=new Http;registryUI.taglist.instance.update(),e.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags=registryUI.taglist.tags.map(function(e){return new registryUI.DockerImage(registryUI.taglist.name,e)}).sort(registryUI.DockerImage.compare)):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),e.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.taglist.tags=[]}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+registryUI.taglist.name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(registryUI.DockerImage.compare),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.refresh=function(){route(registryUI.taglist.name)}}); \ No newline at end of file diff --git a/dist/scripts/script-static.js b/dist/scripts/script-static.js deleted file mode 100644 index 9169771..0000000 --- a/dist/scripts/script-static.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * docker-registry-ui - * Copyright (C) 2016-2018 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.oReq.hasHeader=Http.hasHeader,this.oReq.getErrorMessage=Http.getErrorMessage,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,t){this._events[e]=t;var r=this;switch(e){case"loadend":r.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;e.open(r._method,r._url);for(key in r._events)e.addEventListener(key,r._events[key]);for(key in r._headers)e.setRequestHeader(key,r._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.getErrorMessage=Http.getErrorMessage,e.send()}else t.bind(this)()});break;case"load":r.oReq.addEventListener("load",function(){401!==this.status&&t.bind(this)()});break;default:r.oReq.addEventListener(e,function(){t.bind(this)()})}},Http.prototype.setRequestHeader=function(e,t){this.oReq.setRequestHeader(e,t),this._headers[e]=t},Http.prototype.open=function(e,t){this._method=e,this._url=t,this.oReq.open(e,t)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(e){return this.getAllResponseHeaders().split("\n").some(function(t){return new RegExp("^"+e+":","i").test(t)})},Http.getErrorMessage=function(){return registryUI.url()&®istryUI.url().match("^http://")&&"https:"===window.location.protocol?"Mixed Content: The page at `"+window.location.origin+"` was loaded over HTTPS, but requested an insecure server endpoint `"+registryUI.url()+"`. This request has been blocked; the content must be served over HTTPS.":registryUI.url()?this.withCredentials&&!this.hasHeader("Access-Control-Allow-Credentials")?"The `Access-Control-Allow-Credentials` header in the response is missing and must be set to `true` when the request's credentials mode is on. Origin `"+registryUI.url()+"` is therefore not allowed access.":"An error occured: Check your connection and your registry must have `Access-Control-Allow-Origin` header set to `"+window.location.origin+"`":"Incorrect server endpoint."};var registryUI={};registryUI.url=function(){return"${URL}"},registryUI.name=function(){return"${REGISTRY_TITLE}"},registryUI.isImageRemoveActivated=!0,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 deleted file mode 100644 index 9d13e01..0000000 --- a/dist/scripts/script.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * docker-registry-ui - * Copyright (C) 2016-2018 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.oReq.hasHeader=Http.hasHeader,this.oReq.getErrorMessage=Http.getErrorMessage,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,r){this._events[e]=r;var t=this;switch(e){case"loadend":t.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;e.open(t._method,t._url);for(key in t._events)e.addEventListener(key,t._events[key]);for(key in t._headers)e.setRequestHeader(key,t._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.getErrorMessage=Http.getErrorMessage,e.send()}else r.bind(this)()});break;case"load":t.oReq.addEventListener("load",function(){401!==this.status&&r.bind(this)()});break;default:t.oReq.addEventListener(e,function(){r.bind(this)()})}},Http.prototype.setRequestHeader=function(e,r){this.oReq.setRequestHeader(e,r),this._headers[e]=r},Http.prototype.open=function(e,r){this._method=e,this._url=r,this.oReq.open(e,r)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(e){return this.getAllResponseHeaders().split("\n").some(function(r){return new RegExp("^"+e+":","i").test(r)})},Http.getErrorMessage=function(){return registryUI.url()&®istryUI.url().match("^http://")&&"https:"===window.location.protocol?"Mixed Content: The page at `"+window.location.origin+"` was loaded over HTTPS, but requested an insecure server endpoint `"+registryUI.url()+"`. This request has been blocked; the content must be served over HTTPS.":registryUI.url()?this.withCredentials&&!this.hasHeader("Access-Control-Allow-Credentials")?"The `Access-Control-Allow-Credentials` header in the response is missing and must be set to `true` when the request's credentials mode is on. Origin `"+registryUI.url()+"` is therefore not allowed access.":"An error occured: Check your connection and your registry must have `Access-Control-Allow-Origin` header set to `"+window.location.origin+"`":"Incorrect server endpoint."};var registryUI={};registryUI.URL_QUERY_PARAM_REGEX=/[&?]url=/,registryUI.URL_PARAM_REGEX=/^url=/,registryUI.name=registryUI.url=function(e){if(!registryUI._url){var r=registryUI.getUrlQueryParam();if(r)try{return registryUI._url=registryUI.decodeURI(r),registryUI._url}catch(e){console.log(e)}registryUI._url=registryUI.getRegistryServer(0)}return registryUI._url},registryUI.getRegistryServer=function(e){try{var r=JSON.parse(localStorage.getItem("registryServer"));if(r instanceof Array)return isNaN(e)?r.map(function(e){return e.trim().replace(/\/*$/,"")}):r[e]}catch(e){}return isNaN(e)?[]:""},registryUI.addServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t==-1&&(r.push(e),registryUI._url||registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(r)))},registryUI.changeServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t!=-1&&(r.splice(t,1),r=[e].concat(r),registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(r)))},registryUI.removeServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t!=-1&&(r.splice(t,1),localStorage.setItem("registryServer",JSON.stringify(r)),e==registryUI.url()&&(registryUI.updateHistory(registryUI.getRegistryServer(0)),route("")))},registryUI.updateHistory=function(e){history.pushState(null,"",(e?"?url="+registryUI.encodeURI(e):"?")+window.location.hash),registryUI._url=e},registryUI.getUrlQueryParam=function(){var e=window.location.search;if(registryUI.URL_QUERY_PARAM_REGEX.test(e)){var r=e.split(/^\?|&/).find(function(e){return e&®istryUI.URL_PARAM_REGEX.test(e)});return r?r.replace(registryUI.URL_PARAM_REGEX,""):r}},registryUI.encodeURI=function(e){return e.indexOf("&")<0?window.encodeURIComponent(e):btoa(e)},registryUI.decodeURI=function(e){return e.startsWith("http")?window.decodeURIComponent(e):atob(e)},registryUI.isImageRemoveActivated=!0,registryUI.catalog={},registryUI.taglist={},riot.mount("*"); \ No newline at end of file diff --git a/dist/scripts/tags-static.js b/dist/scripts/tags-static.js deleted file mode 100644 index 3fe68ac..0000000 --- a/dist/scripts/tags-static.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * docker-registry-ui - * Copyright (C) 2016-2018 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.name()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,registryUI.catalog.display=function(){registryUI.catalog.repositories=[];var t=new Http;t.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.catalog.repositories=[]}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog?n=100000"),t.send()},registryUI.catalog.go=function(t){route("taglist/"+t)},registryUI.catalog.display()}),riot.tag2("app",'
',"","",function(t){registryUI.appTag=this,route.base("#!"),route("",function(){route.routeName="home",registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display()),registryUI.appTag.update()}),route("/taglist/*",function(t){route.routeName="taglist",registryUI.taglist.name=t,registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display()),registryUI.appTag.update()}),registryUI.home=function(){"home"==route.routeName?registryUI.catalog.display():route("")},registryUI.snackbar=function(t,e){registryUI.appTag.tags["material-snackbar"].addToast({message:t,isError:e},15e3)},registryUI.errorSnackbar=function(t){return registryUI.snackbar(t,!0)},registryUI.cleanName=function(){var t=registryUI.url()&®istryUI.url().length>0&®istryUI.url()||window.location.host;return t?t.startsWith("http")?t.replace(/https?:\/\//,""):t:""},route.parser(null,function(t,e){const r=e.replace(/\?/g,"\\?").replace(/\*/g,"([^?#]+?)").replace(/\.\./,".*"),i=new RegExp("^"+r+"$"),a=t.match(i);if(a)return a.slice(1)}),registryUI.DockerImage=function(t,e){this.name=t,this.tag=e,riot.observable(this),this.on("get-size",function(){return void 0!==this.size?this.trigger("size",this.size):this.fillInfo()}),this.on("get-sha256",function(){return void 0!==this.size?this.trigger("sha256",this.sha256):this.fillInfo()})},registryUI.DockerImage.compare=function(t,e){return t.tag.localeCompare(e.tag)},registryUI.DockerImage.prototype.fillInfo=function(){if(!this._fillInfoWaiting){this._fillInfoWaiting=!0;var t=new Http,e=this;t.addEventListener("loadend",function(){if(200==this.status||202==this.status){var t=JSON.parse(this.responseText);e.size=t.layers.reduce(function(t,e){return t+e.size},0),e.sha256=t.config.digest,e.trigger("size",e.size),e.trigger("sha256",e.sha256)}else 404==this.status?registryUI.errorSnackbar("Manifest for "+e.name+":"+e.tag+" not found"):registryUI.snackbar(this.responseText)}),t.open("GET",registryUI.url()+"/v2/"+e.name+"/manifests/"+e.tag),t.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),t.send()}},route.start(!0)}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.name() + \'/\' + registryUI.taglist.name}

Repository Size Tag
{image.name}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(registryUI.taglist.tags=[],"taglist"==route.routeName){var t=new Http;registryUI.taglist.instance.update(),t.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags=registryUI.taglist.tags.map(function(t){return new registryUI.DockerImage(registryUI.taglist.name,t)}).sort(registryUI.DockerImage.compare)):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),t.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.taglist.tags=[]}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+registryUI.taglist.name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(registryUI.DockerImage.compare),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.refresh=function(){route(registryUI.taglist.name)}}),riot.tag2("copy-to-clipboard",' content_copy ',"","",function(t){this.dockerCmd="docker pull "+registryUI.cleanName()+"/"+t.image.name+":"+t.image.tag,this.copy=function(){var t=this.refs.input;t.style.display="block",t.select(),document.execCommand("copy"),t.style.display="none",registryUI.snackbar("`"+this.dockerCmd+"` has been copied to clipboard.")}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.remove=function(t,e){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),i=new Http;i.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+t+":"+e+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),i.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+r),i.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),i.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),i.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+t+":"+e+" not found"):registryUI.snackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+e),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}),riot.tag2("image-size",'
{this.bytesToSize(this.size)}
',"","",function(t){var e=this;this.bytesToSize=function(t){var e=["Bytes","KB","MB","GB","TB"];if(void 0==t||isNaN(t))return"?";if(0==t)return"0 Byte";var r=parseInt(Math.floor(Math.log(t)/Math.log(1024)));return Math.ceil(t/Math.pow(1024,r))+" "+e[r]},t.image.on("size",function(t){e.size=t,e.update()}),t.image.trigger("get-size")}),riot.tag2("image-tag",'
{opts.image.tag}
',"","",function(t){var e=this;t.image.on("sha256",function(t){e.sha256=t.substring(0,19),e.update()}),t.image.trigger("get-sha256")}); \ No newline at end of file diff --git a/dist/scripts/tags.js b/dist/scripts/tags.js deleted file mode 100644 index 5850e58..0000000 --- a/dist/scripts/tags.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * docker-registry-ui - * Copyright (C) 2016-2018 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("add",'
Add your Server ?
Write your URL without /v2
Add Cancel
',"","",function(e){registryUI.addTag=registryUI.addTag||{},this.one("mount",function(){registryUI.addTag.dialog=this.tags["material-popup"],registryUI.addTag.dialog.getAddServer=function(){return this.tags["material-input"]?this.tags["material-input"].value:""}}),registryUI.addTag.onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()},registryUI.addTag.show=function(){registryUI.addTag.dialog.open()},registryUI.addTag.add=function(){registryUI.addTag.dialog.getAddServer().length>0&®istryUI.addServer(registryUI.addTag.dialog.getAddServer()),registryUI.home(),registryUI.addTag.close()},registryUI.addTag.close=function(){registryUI.addTag.dialog.tags["material-input"].value="",registryUI.addTag.dialog.close()}}),riot.tag2("app",'
',"","",function(e){registryUI.appTag=this,route.base("#!"),route("",function(){route.routeName="home",registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display()),registryUI.appTag.update()}),route("/taglist/*",function(e){route.routeName="taglist",registryUI.taglist.name=e,registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display()),registryUI.appTag.update()}),registryUI.home=function(){"home"==route.routeName?registryUI.catalog.display():route("")},registryUI.snackbar=function(e,t){registryUI.appTag.tags["material-snackbar"].addToast({message:e,isError:t},15e3)},registryUI.errorSnackbar=function(e){return registryUI.snackbar(e,!0)},registryUI.cleanName=function(){var e=registryUI.url()&®istryUI.url().length>0&®istryUI.url()||window.location.host;return e?e.startsWith("http")?e.replace(/https?:\/\//,""):e:""},route.parser(null,function(e,t){const r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^?#]+?)").replace(/\.\./,".*"),a=new RegExp("^"+r+"$"),i=e.match(a);if(i)return i.slice(1)}),registryUI.DockerImage=function(e,t){this.name=e,this.tag=t,riot.observable(this),this.on("get-size",function(){return void 0!==this.size?this.trigger("size",this.size):this.fillInfo()}),this.on("get-sha256",function(){return void 0!==this.size?this.trigger("sha256",this.sha256):this.fillInfo()})},registryUI.DockerImage.compare=function(e,t){return e.tag.localeCompare(t.tag)},registryUI.DockerImage.prototype.fillInfo=function(){if(!this._fillInfoWaiting){this._fillInfoWaiting=!0;var e=new Http,t=this;e.addEventListener("loadend",function(){if(200==this.status||202==this.status){var e=JSON.parse(this.responseText);t.size=e.layers.reduce(function(e,t){return e+t.size},0),t.sha256=e.config.digest,t.trigger("size",t.size),t.trigger("sha256",t.sha256)}else 404==this.status?registryUI.errorSnackbar("Manifest for "+t.name+":"+t.tag+" not found"):registryUI.snackbar(this.responseText)}),e.open("GET",registryUI.url()+"/v2/"+t.name+"/manifests/"+t.tag),e.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),e.send()}},route.start(!0)}),riot.tag2("catalog",'

Repositories of {registryUI.name()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,registryUI.catalog.display=function(){registryUI.catalog.repositories=[];var e=new Http;e.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.catalog.repositories=[]}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog?n=100000"),e.send()},registryUI.catalog.go=function(e){route("taglist/"+e)},registryUI.catalog.display()}),riot.tag2("change",'
Change your Server ?
Change Cancel
',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},this.one("mount",function(){registryUI.changeTag.dialog=this.tags["material-popup"],registryUI.changeTag.dialog.getServerUrl=function(){return this.refs["server-list"]?this.refs["server-list"].value:""},registryUI.changeTag.dialog.on("updated",function(){this.refs["server-list"]&&(this.refs["server-list"].value=registryUI.url())})}),registryUI.changeTag.show=function(){registryUI.changeTag.dialog.open()},registryUI.changeTag.change=function(){registryUI.changeTag.dialog.getServerUrl().length>0&®istryUI.changeServer(registryUI.changeTag.dialog.getServerUrl()),registryUI.home(),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("copy-to-clipboard",' content_copy ',"","",function(e){this.dockerCmd="docker pull "+registryUI.cleanName()+"/"+e.image.name+":"+e.image.tag,this.copy=function(){var e=this.refs.input;e.style.display="block",e.select(),document.execCommand("copy"),e.style.display="none",registryUI.snackbar("`"+this.dockerCmd+"` has been copied to clipboard.")}}),riot.tag2("image-size",'
{this.bytesToSize(this.size)}
',"","",function(e){var t=this;this.bytesToSize=function(e){var t=["Bytes","KB","MB","GB","TB"];if(void 0==e||isNaN(e))return"?";if(0==e)return"0 Byte";var r=parseInt(Math.floor(Math.log(e)/Math.log(1024)));return Math.ceil(e/Math.pow(1024,r))+" "+t[r]},e.image.on("size",function(e){t.size=e,t.update()}),e.image.trigger("get-size")}),riot.tag2("image-tag",'
{opts.image.tag}
',"","",function(e){var t=this;e.image.on("sha256",function(e){t.sha256=e.substring(0,19),t.update()}),e.image.trigger("get-sha256")}),riot.tag2("menu",' more_vert

Add URL

Change URL

Remove URL

',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.one("mount",function(e){var t=this;registryUI.menuTag.close=function(){t.tags["material-dropdown"].close(),t.update()},registryUI.menuTag.isOpen=function(){return t.tags["material-dropdown"].opened},registryUI.menuTag.toggle=function(){t.tags["material-dropdown"].opened?t.tags["material-dropdown"].close():t.tags["material-dropdown"].open(),t.update()}})}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.remove=function(e,t){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+e+":"+t+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+e+"/manifests/"+r),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),a.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+e+":"+t+" not found"):registryUI.snackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+e+"/manifests/"+t),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}),riot.tag2("remove",'
Remove your Registry Server ?
Close
',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.close()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.dialog.open()},this.one("mount",function(){registryUI.removeTag.dialog=this.tags["material-popup"]})}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.name() + \'/\' + registryUI.taglist.name}

Repository Size Tag
{image.name}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(registryUI.taglist.tags=[],"taglist"==route.routeName){var e=new Http;registryUI.taglist.instance.update(),e.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags=registryUI.taglist.tags.map(function(e){return new registryUI.DockerImage(registryUI.taglist.name,e)}).sort(registryUI.DockerImage.compare)):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),e.addEventListener("error",function(){registryUI.snackbar(this.getErrorMessage(),!0),registryUI.taglist.tags=[]}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+registryUI.taglist.name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(registryUI.DockerImage.compare),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.refresh=function(){route(registryUI.taglist.name)}}); \ No newline at end of file diff --git a/dist/scripts/vendor.js b/dist/scripts/vendor.js index 486b91d..cb0944d 100644 --- a/dist/scripts/vendor.js +++ b/dist/scripts/vendor.js @@ -1,5 +1,5 @@ -/* Riot v3.10.3, @license MIT */ -var t,e;t=this,e=function(t){"use strict";function a(t,e){return(e||document).querySelector(t)}var e,n,y=[],w={},s="yield",_="__global_mixin",N="riot-",u=["ref","data-ref"],f="data-is",p="if",d="each",r="no-reorder",A="show",C="hide",i="key",x="__riot-events__",o="string",$="object",l="undefined",c="function",h="http://www.w3.org/1999/xlink",m="http://www.w3.org/2000/svg",g=/^xlink:(\w+)/,v=typeof window===l?void 0:window,b=/^on/,O=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g,k={viewbox:"viewBox",preserveaspectratio:"preserveAspectRatio"},E=/^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/,L=0|(v&&v.document||{}).documentMode;function T(t){return"svg"===t?document.createElementNS(m,t):document.createElement(t)}function j(t,e,n){var r=g.exec(e);r&&r[1]?t.setAttributeNS(h,r[1],n):t.setAttribute(e,n)}var M,S,I={},R=!1;v&&(M=T("style"),S=a("style[type=riot]"),j(M,"type","text/css"),S?(S.id&&(M.id=S.id),S.parentNode.replaceChild(M,S)):document.head.appendChild(M),n=(e=M).styleSheet);var P={styleNode:e,add:function(t,e){I[e]=t,R=!0},inject:function(){if(v&&R){R=!1;var t=Object.keys(I).map(function(t){return I[t]}).join("\n");n?n.cssText=t:e.innerHTML=t}},remove:function(t){delete I[t],R=!0}},V=function(){var u=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],l=u.reduce(function(t,e){return t+e.slice(-1)},""),c=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,f=/[$\w]/;function p(t,e){for(;0<=--e&&/\s/.test(t[e]););return e}return function(t,e){var n=/.*/g,r=n.lastIndex=e++,i=n.exec(t)[0].match(c);if(i){var o=r+i[0].length,a=t[r=p(t,r)];if(r<0||~"[{(,;:?=|&!^~>%*/".indexOf(a))return o;if("."===a)"."===t[r-1]&&(e=o);else if("+"===a||"-"===a)(t[--r]!==a||(r=p(t,r))<0||!f.test(t[r]))&&(e=o);else if(~l.indexOf(a)){for(var s=r+1;0<=--r&&f.test(t[r]););~u.indexOf(t.slice(r+1,s))&&(e=o)}}return e}}(),H=function(t){var e,n,r="g",i=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,o=i.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,a=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),s=/(?=[[\]()*+?.^$|])/g,u=i.source+"|"+/(\/)(?![*\/])/.source,y={"(":RegExp("([()])|"+u,r),"[":RegExp("([[\\]])|"+u,r),"{":RegExp("([{}])|"+u,r)},l="{ }",c=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+u,r),l,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],f=void 0,_=[];function p(t){return t}function d(t,e){return e||(e=_),new RegExp(t.source.replace(/{/g,e[2]).replace(/}/g,e[3]),t.global?r:"")}function h(t){if(t===l)return c;var e=t.split(" ");if(2!==e.length||a.test(t))throw new Error('Unsupported brackets "'+t+'"');return(e=e.concat(t.replace(s,"\\").split(" ")))[4]=d(1 %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:e,tmpl:t})):t}r.hasExpr=H.hasExpr,r.loopKeys=H.loopKeys,r.clearCache=function(){n={}},r.errorHandler=null;var s=/\u2057/g,u=/\u2057(\d+)~/g;var c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g};function l(o,t,e){if(o=o.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var n,r=[],i=0;o&&(n=o.match(c))&&!n.index;){var a,s,u=/,|([[{(])|$/g;for(o=RegExp.rightContext,a=n[2]?e[n[2]].slice(1,-1).trim().replace(/\s+/g," "):n[1];s=(n=u.exec(o))[1];)l(s,u);s=o.slice(0,n.index),o=RegExp.rightContext,r[i++]=d(s,1,a)}o=i?1'+e+"","application/xml").documentElement,!0);t.appendChild(r)}else t.innerHTML=e}function tt(t,e){if(t)for(var n;n=O.exec(t);)e(n[1].toLowerCase(),n[2]||n[3]||n[4])}function et(){return document.createDocumentFragment()}function nt(t,e,n){t.insertBefore(e,n.parentNode&&n)}function rt(n){return Object.keys(n).reduce(function(t,e){return t+" "+e+": "+n[e]+";"},"")}function it(t,e,n){if(t){var r,i=e(t,n);if(!1===i)return;for(t=t.firstChild;t;)r=t.nextSibling,it(t,e,i),t=r}}var ot=Object.freeze({$$:Z,$:a,createDOMPlaceholder:G,mkEl:T,setAttr:j,toggleVisibility:Q,getAttr:J,remAttr:X,setInnerHTML:Y,walkAttrs:tt,createFrag:et,safeInsert:nt,styleObjectToString:rt,walkNodes:it});function at(t){return D(t)||null===t}function st(t){return at(t)||""===t}function ut(t){return typeof t===c}function lt(t){return t&&typeof t===$}function ct(t){var e=t.ownerSVGElement;return!!e||null===e}function ft(t){return Array.isArray(t)||t instanceof Array}function pt(t){return E.test(t)}function dt(t){return typeof t===o}var ht=Object.freeze({isBlank:st,isFunction:ut,isObject:lt,isSvg:ct,isWritable:F,isArray:ft,isBoolAttr:pt,isNil:at,isString:dt,isUndefined:D});function mt(t,e){return-1!==t.indexOf(e)}function gt(t,e){for(var n=t?t.length:0,r=0;r|>([\S\s]*?)<\/yield\s*>|>)/gi,Tt=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,jt=/|>([\S\s]*?)<\/yield\s*>)/gi,Mt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},St=L&&L<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,It="div",Rt="svg";function Pt(t,e,n){var r=t&&t.match(/^\s*<([-\w]+)/),i=r&&r[1].toLowerCase(),o=T(n?Rt:It);return t=function(t,n){if(!Et.test(t))return t;var r={};return n=n&&n.replace(Tt,function(t,e,n){return r[e]=r[e]||n,""}).trim(),t.replace(jt,function(t,e,n){return r[e]||n||""}).replace(Lt,function(t,e){return n||e||""})}(t,e),St.test(i)?o=function(t,e,n){var r="o"===n[0],i=r?"select>":"table>";if(t.innerHTML="<"+i+e.trim()+"=V.length,m=l&&f||!l&&!d||!S[n];m?((d=ye(T,{parent:A,isLoop:!0,isAnonymous:R,tagName:L,root:N.cloneNode(R),item:r,index:n},I)).mount(),h?function(t,e){e?zt.call(this,t):t.appendChild(this.root)}.apply(d,[v||_,P]):function(t,e,n){n?zt.apply(this,[t,e]):nt(t,this.root,e.root)}.apply(d,[_,S[n],P]),h||V.splice(n,0,r),S.splice(n,0,d),j&&At(A.tags,L,d,!0)):p!==n&&l&&((k||mt(g,V[p]))&&(function(t,e,n){n?ae.apply(this,[t,e]):nt(t,this.root,e.root)}.apply(d,[_,S[n],P]),S.splice(n,0,S.splice(p,1)[0]),V.splice(n,0,V.splice(p,1)[0])),C.pos&&(d[C.pos]=n),!j&&d.tags&&function(e){var n=this;gt(Object.keys(this.tags),function(t){oe.apply(n.tags[t],[t,e])})}.call(d,n)),K(d.__,{item:r,index:n,parent:A}),x[n]=u,m||d.update(r)}else w++}),function(t,e,n){for(var r=e.length,i=t.length-n;i/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,f=/[$\w]/;function p(t,e){for(;0<=--e&&/\s/.test(t[e]););return e}return function(t,e){var n=/.*/g,r=n.lastIndex=e++,i=n.exec(t)[0].match(c);if(i){var o=r+i[0].length,a=t[r=p(t,r)];if(r<0||~"[{(,;:?=|&!^~>%*/".indexOf(a))return o;if("."===a)"."===t[r-1]&&(e=o);else if("+"===a||"-"===a)(t[--r]!==a||(r=p(t,r))<0||!f.test(t[r]))&&(e=o);else if(~l.indexOf(a)){for(var s=r+1;0<=--r&&f.test(t[r]););~u.indexOf(t.slice(r+1,s))&&(e=o)}}return e}}(),H=function(t){var e,n,r="g",i=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,o=i.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,a=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),s=/(?=[[\]()*+?.^$|])/g,u=i.source+"|"+/(\/)(?![*\/])/.source,y={"(":RegExp("([()])|"+u,r),"[":RegExp("([[\\]])|"+u,r),"{":RegExp("([{}])|"+u,r)},l="{ }",c=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+u,r),l,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],f=void 0,_=[];function p(t){return t}function d(t,e){return e||(e=_),new RegExp(t.source.replace(/{/g,e[2]).replace(/}/g,e[3]),t.global?r:"")}function h(t){if(t===l)return c;var e=t.split(" ");if(2!==e.length||a.test(t))throw new Error('Unsupported brackets "'+t+'"');return(e=e.concat(t.replace(s,"\\").split(" ")))[4]=d(1 %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:e,tmpl:t})):t}r.hasExpr=H.hasExpr,r.loopKeys=H.loopKeys,r.clearCache=function(){n={}},r.errorHandler=null;var s=/\u2057/g,u=/\u2057(\d+)~/g;var c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g};function l(o,t,e){if(o=o.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var n,r=[],i=0;o&&(n=o.match(c))&&!n.index;){var a,s,u=/,|([[{(])|$/g;for(o=RegExp.rightContext,a=n[2]?e[n[2]].slice(1,-1).trim().replace(/\s+/g," "):n[1];s=(n=u.exec(o))[1];)l(s,u);s=o.slice(0,n.index),o=RegExp.rightContext,r[i++]=d(s,1,a)}o=i?1'+e+"","application/xml").documentElement,!0);t.appendChild(r)}else t.innerHTML=e}function tt(t,e){if(t)for(var n;n=O.exec(t);)e(n[1].toLowerCase(),n[2]||n[3]||n[4])}function et(){return document.createDocumentFragment()}function nt(t,e,n){t.insertBefore(e,n.parentNode&&n)}function rt(n){return Object.keys(n).reduce(function(t,e){return t+" "+e+": "+n[e]+";"},"")}function it(t,e,n){if(t){var r,i=e(t,n);if(!1===i)return;for(t=t.firstChild;t;)r=t.nextSibling,it(t,e,i),t=r}}var ot=Object.freeze({$$:Z,$:a,createDOMPlaceholder:G,mkEl:T,setAttr:j,toggleVisibility:Q,getAttr:J,remAttr:X,setInnerHTML:Y,walkAttrs:tt,createFrag:et,safeInsert:nt,styleObjectToString:rt,walkNodes:it});function at(t){return D(t)||null===t}function st(t){return at(t)||""===t}function ut(t){return typeof t===c}function lt(t){return t&&typeof t===$}function ct(t){var e=t.ownerSVGElement;return!!e||null===e}function ft(t){return Array.isArray(t)||t instanceof Array}function pt(t){return E.test(t)}function dt(t){return typeof t===o}var ht=Object.freeze({isBlank:st,isFunction:ut,isObject:lt,isSvg:ct,isWritable:F,isArray:ft,isBoolAttr:pt,isNil:at,isString:dt,isUndefined:D});function mt(t,e){return-1!==t.indexOf(e)}function gt(t,e){for(var n=t?t.length:0,r=0;r|>([\S\s]*?)<\/yield\s*>|>)/gi,Tt=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,jt=/|>([\S\s]*?)<\/yield\s*>)/gi,Mt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},St=L&&L<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,It="div",Rt="svg";function Pt(t,e,n){var r=t&&t.match(/^\s*<([-\w]+)/),i=r&&r[1].toLowerCase(),o=T(n?Rt:It);return t=function(t,n){if(!Et.test(t))return t;var r={};return n=n&&n.replace(Tt,function(t,e,n){return r[e]=r[e]||n,""}).trim(),t.replace(jt,function(t,e,n){return r[e]||n||""}).replace(Lt,function(t,e){return n||e||""})}(t,e),St.test(i)?o=function(t,e,n){var r="o"===n[0],i=r?"select>":"table>";if(t.innerHTML="<"+i+e.trim()+"=V.length,m=l&&f||!l&&!d||!S[n];m?((d=ye(T,{parent:A,isLoop:!0,isAnonymous:R,tagName:L,root:N.cloneNode(R),item:r,index:n},I)).mount(),h?function(t,e){e?zt.call(this,t):t.appendChild(this.root)}.apply(d,[v||_,P]):function(t,e,n){n?zt.apply(this,[t,e]):nt(t,this.root,e.root)}.apply(d,[_,S[n],P]),h||V.splice(n,0,r),S.splice(n,0,d),j&&At(A.tags,L,d,!0)):p!==n&&l&&((k||mt(g,V[p]))&&(function(t,e,n){n?ae.apply(this,[t,e]):nt(t,this.root,e.root)}.apply(d,[_,S[n],P]),S.splice(n,0,S.splice(p,1)[0]),V.splice(n,0,V.splice(p,1)[0])),C.pos&&(d[C.pos]=n),!j&&d.tags&&function(e){var n=this;gt(Object.keys(this.tags),function(t){oe.apply(n.tags[t],[t,e])})}.call(d,n)),K(d.__,{item:r,index:n,parent:A}),x[n]=u,m||d.update(r)}else w++}),function(t,e,n){for(var r=e.length,i=t.length-n;i
',"","",function(t){var e=this;this.dynamicAttributes=["disabled"],this.disabled=t.disabled||!1,this.launch=function(t){e.disabled||e.refs["material-waves"].trigger("launch",t)},this.on("mount",function(){e.refs["material-waves"].on("wavestart",function(t){e.trigger("wavestart",t)}),e.refs["material-waves"].on("waveend",function(){e.trigger("waveend")})}),this.click=function(){t.link&&(window.location.href=t.link),e.trigger("click")},this.mixin("dynamicAttributes")})},function(t,e,i){"use strict";riot.tag2("material-card",'
',"","",function(t){var e=this;this.titleExist=!1,this.on("mount",function(){e.update({titleExist:!!e.root.querySelector(".material-card-title")})}),this.mixin("content")})},function(t,e,i){"use strict";riot.tag2("material-checkbox",'
',"","",function(t){var e=this;this.checked=t.checked||!1,this.disabled=t.disabled||!1,this.toggle=function(){if(e.disabled)return!1;e.update({checked:!e.checked}),e.trigger("toggle",e.checked)}})},function(module,exports,__webpack_require__){"use strict";riot.tag2("material-combo",' ',"","",function(opts){var _this=this;this.items=[],this.title=null;var lastValue=this.value,valueChanged=function(){_this.value!==lastValue&&(lastValue=_this.value,_this.root.dispatchEvent(new CustomEvent("change",{value:_this.value})))};if(this.getOptions=function(){Array.prototype.forEach.call(_this.refs.options.children,function(t,e){if("option"==t.tagName.toLowerCase()){var i={title:t.innerHTML,value:t.getAttribute("value")};_this.items.push(i),null!=t.getAttribute("isSelected")&&(_this.refs.dropdown.update({selected:e}),_this.update({value:i.value||i.title}),valueChanged(),_this.title=i.title)}}),_this.refs.dropdown.update({items:_this.items}),_this.refs.dropdown.selected&&_this.update({hValue:_this.refs.dropdown.items[_this.refs.dropdown.selected].value||_this.refs.dropdown.items[_this.refs.dropdown.selected].title}),_this.update({isParsed:!0}),valueChanged()},opts.items)try{this.items=eval(opts.items)||[],this.items.length&&this.refs.dropdown.update({items:this.items})}catch(t){console.error("Something wrong with your items. For details look at it - "+t)}this.on("mount",function(){_this.getOptions(),_this.refs.dropdown.on("selectChanged",function(t){_this.update({value:_this.refs.dropdown.items[t].value||_this.refs.dropdown.items[t].title}),valueChanged(),_this.refs.input.update({value:_this.refs.dropdown.items[t].title}),setTimeout(function(){_this.refs.dropdown.update({items:_this.items})},200)}),_this.refs.input.on("valueChanged",function(t){_this.refs.dropdown.update({items:_this.filter("items",{title:t})})}),_this.refs.input.on("focusChanged",function(t){_this.refs.input.value==(opts.defaulttext||"Choose item")&&t&&_this.refs.input.update({value:""}),""!=_this.refs.input.value||t||_this.refs.input.update({value:opts.defaulttext||"Choose item"}),t&&_this.refs.dropdown.open()}),_this.refs.dropdown.root.style.top=_this.refs.input.root.getBoundingClientRect().height+"px",_this.refs.input.update({value:_this.title||opts.defaulttext||"Choose item"})}),this.mixin("collection")})},function(module,exports,__webpack_require__){"use strict";riot.tag2("material-dropdown-list",'
',"","",function(opts){var _this=this;if(this.opened=!1,opts.items){try{this.items=eval(opts.items)||[]}catch(t){console.error("Something wrong with your items. For details look at it - "+t)}this.update({items:this.items})}opts.selected&&this.update({selected:opts.selected}),this.select=function(t){return _this.update({selected:t.item.key}),_this.close(),_this.trigger("selectChanged",t.item.key,t.item.item),!0},this.open=function(){_this.update({opened:!0,opening:!0}),_this.opts.extraclose&&document.body.appendChild(_this.refs.overlay),setTimeout(function(){_this.update({opening:!1})},0)},this.close=function(){_this.update({opening:!0}),setTimeout(function(){_this.update({opened:!1})},200)}})},function(t,e,i){"use strict";riot.tag2("material-dropdown",'
',"","",function(t){var e=this;this.opened=t.opened||!1,this.open=function(){e.update({opened:!0,opening:!0}),setTimeout(function(){e.update({opening:!1})},0)},this.close=function(){e.update({opening:!0}),setTimeout(function(){e.update({opened:!1})},200)}})},function(t,e,i){"use strict";riot.tag2("material-footer",' ',"","",function(t){this.mixin("content")})},function(t,e,i){"use strict";riot.tag2("material-input",'
',"","",function(t){var e=this;if(this.opts=t,this.required="",this.name=t.ref||"input",this.notSupportedTypes=["date","color","datetime","month","range","time"],-1!=this.notSupportedTypes.indexOf(t.type))throw new Error("Sorry but we do not support "+t.type+" type yet!");this.update({showIcon:!1}),this.on("mount",function(){e.update({value:t.value||"",disabled:t.disabled||!1,required:t.required||!1}),e.n=t.ref||"default-input",e.refs[e.n].addEventListener("focus",e.changeFocus),e.refs[e.n].addEventListener("blur",e.changeFocus)}),this.changeFocus=function(i){if(e.disabled)return!1;e.update({focused:e.refs[e.n]==document.activeElement}),e.trigger("focusChanged",e.focused,i),t.focuschanged&&"function"==typeof t.focuschanged&&t.focuschanged(e.focused)},this.changeValue=function(i){e.update({value:e.refs[e.n].value}),e.trigger("valueChanged",e.refs[e.n].value,i),t.valuechanged&&"function"==typeof t.valuechanged&&t.valuechanged(e.refs[e.n].value)},this.iconClickHandler=function(t){e.opts.iconclicked&&"function"==typeof e.opts.iconclicked&&e.opts.iconclicked.call(e,t),e.trigger("iconclicked",t)},this.on("update",function(t){t&&void 0!=t.value&&e.validationType&&e.isValid(e.validate(t.value))}),this.isValid=function(t){e.update({error:!t})},this.mixin("validate")})},function(t,e,i){"use strict";riot.tag2("material-navbar",'',"",'role="toolbar"',function(t){})},function(t,e,i){"use strict";riot.tag2("material-pane",'
',"","",function(t){this.mixin("content")})},function(t,e,i){"use strict";riot.tag2("material-popup",'
',"","",function(t){var e=this;this.opened=t.opened||!1,this.on("mount",function(){document.body.appendChild(e.root)}),this.open=function(){e.update({opened:!0,opening:!0}),setTimeout(function(){e.update({opening:!1})},0)},this.close=function(){e.update({opening:!0}),setTimeout(function(){e.update({opened:!1})},200)},this.mixin("content")})},function(t,e,i){"use strict";riot.tag2("material-snackbar",'
{toast.message}
',"","",function(t){var e=this;this.toasts=[],this.intervals={},this.addToast=function(i,n){var o=e.toastID=Math.random().toString(36).substring(7);e.toasts.push(Object.assign(i,{opening:!0,_id:o})),e.update({toasts:e.toasts}),setTimeout(function(){e.toasts[e.findToastKeyByID(o)].opening=!1,e.update({toasts:e.toasts})},50),e.intervals[o]=setTimeout(function(){e.removeToast(o)},t.duration||n||5e3)},this.removeToastAfterDurationEnding=function(t){e.removeToast(t)},this.findToastKeyByID=function(t){var i=null;return e.toasts.forEach(function(e,n){e._id==t&&(i=n)}),i},this.removeToastByClick=function(t){var i=t.item.toast._id;clearInterval(e.intervals[i]),e.removeToast(i)},this.removeToast=function(t){null!=e.findToastKeyByID(t)&&(e.toasts[e.findToastKeyByID(t)].opening=!0,e.update({toasts:e.toasts}),setTimeout(function(){e.toasts.splice(e.findToastKeyByID(t),1),e.update({toasts:e.toasts})},200))}})},function(t,e,i){"use strict";riot.tag2("material-spinner",' ',"","",function(t){})},function(module,exports,__webpack_require__){"use strict";riot.tag2("material-tabs",'
{parent.opts.cut ? parent.cut(tab.title) : tab.title}
',"","",function(opts){var _this=this;if(this.selected=0,this.tabs=[],opts.tabs){var tabs=[];try{tabs=opts.tabs?eval(opts.tabs):[],this.tabs=tabs}catch(t){}}this.on("mount",function(){_this.setWidth(),_this.setLinePosition()}),this.setWidth=function(){[].forEach.call(_this.root.querySelectorAll("material-button"),function(t){t.style.width=_this.refs.line.style.width=(100/_this.tabs.length).toFixed(2)+"%"})},this.onChangeTab=function(t){var e=_this.tabs.indexOf(t.item.tab);_this.changeTab(e)},this.changeTab=function(t){_this.update({selected:t}),_this.setLinePosition(),_this.trigger("tabChanged",_this.tabs[t],t),opts.tabchanged&&"function"==typeof opts.tabchanged&&opts.tabchanged(_this.tabs[t],t)},this.setLinePosition=function(){_this.refs.line.style.left=(100/_this.tabs.length).toFixed(2)*_this.selected+"%"},this.cut=function(t){return t.length>opts.cut?t.substr(0,opts.cut)+"...":t}})},function(t,e,i){"use strict";riot.tag2("material-textarea",'
',"","",function(t){var e=this;this.opts=t,this.disabled=t.disabled||!1,this.on("mount",function(){t.maxRows&&(e.refs.mirror.style.maxHeight=t.maxRows*e.refs[e.n].getBoundingClientRect().height+"px"),e.n=t.ref||"default-textarea",e.value=t.value||"",e.refs.mirror.innerHTML=e.format(e.value),e.refs[e.n].value=e.value,e.refs[e.n].scrollTop=e.refs[e.n].scrollHeight,e.refs[e.n].addEventListener("focus",e.changeFocus),e.refs[e.n].addEventListener("blur",e.changeFocus),e.refs[e.n].addEventListener("input",e.inputHandler),e.update({value:e.value})}),this.changeFocus=function(t){if(e.disabled)return!1;var i=e.refs[e.n]==document.activeElement;e.update({focused:i}),e.trigger("focusChanged",i)},this.inputHandler=function(t){var i=e.refs[e.n].value;e.refs.mirror.innerHTML=e.format(i),e.update({value:i})},this.changeValue=function(i){e.trigger("valueChanged",e.refs[e.n].value,i),t.valuechanged&&"function"==typeof t.valuechanged&&t.valuechanged(e.refs[e.n].value)},this.isValid=function(t){e.update({error:!t})},this.format=function(t){return t.replace(/\n/g,"
 ")},this.on("update",function(t){t&&void 0!=t.value&&e.validationType&&e.isValid(e.validate(t.value))}),this.mixin("validate")})},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=i(0),r=function(t){return t&&t.__esModule?t:{default:t}}(s);riot.tag2("material-waves",'
',"","",function(t){var e=this,i=function(t){function e(i,a,s){n(this,e);var r=o(this,t.call(this));return i||console.error("You should set container to the wave!"),r.container=i,r.maxOpacity=a.opacity||.6,r.duration=a.duration||750,r.color=a.color||"#fff",r.center=a.center||!1,r.event=s,r.containerBound=r.receiveBound(),r.maxScale=r.containerBound.size/100*10,r.created=Date.now(),r.start={},r.createNode(),r.waveIn(),r}return a(e,t),e.prototype.createNode=function(){this.wave=document.createElement("div"),this.wave.classList.add("wave"),this.container.appendChild(this.wave)},e.prototype.waveIn=function(){var t=this;this.center&&!this.event&&console.error("Setup at least mouse event... Or just set center attribute"),this.start.x=this.center?this.containerBound.height/2:this.event.pageY-this.containerBound.offsetTop,this.start.y=this.center?this.containerBound.width/2:this.event.pageX-this.containerBound.offsetLeft;var e=-1!==window.navigator.userAgent.indexOf("Trident");setTimeout(function(){return t.setStyles(t.maxOpacity)},e?50:0)},e.prototype.waveOut=function(t){var e=this,i=Date.now()-this.created,n=Math.round(this.duration/2)-i,o=n>0?n:0;setTimeout(function(){e.setStyles(0),setTimeout(function(){e.wave.parentNode===e.container&&(e.container.removeChild(e.wave),t())},e.duration)},o)},e.prototype.setStyles=function(t){this.wave.setAttribute("style",this.convertStyle({top:this.start.x+"px",left:this.start.y+"px",transform:"scale("+this.maxScale+")","transition-duration":this.duration+"ms","transition-timing-function":"cubic-bezier(0.250, 0.460, 0.450, 0.940)",background:this.color,opacity:t}))},e.prototype.convertStyle=function(t){var e="";return Object.keys(t).forEach(function(i){t.hasOwnProperty(i)&&(e+=i+":"+t[i]+";")}),e},e}(r.default);this._waves=[],this._events=[],this.on("launch",function(n){var o=new i(e.refs.waves,t,n);e._waves.push(o),e.trigger("wavestart",o),e.parent&&e.parent.opts&&e.parent.opts.wavestart&&e.parent.opts.wavestart(o),e._events.length||(e._events.push(n.target.addEventListener("mouseup",function(){return e.trigger("hold")})),e._events.push(n.target.addEventListener("mouseleave",function(){return e.trigger("hold")})))}),this.on("hold",function(){e._waves[e._waves.length-1]&&e._waves[e._waves.length-1].waveOut(e.waveOut),e._waves[e._waves.length-1]&&e._waves.slice(e._waves.length-1,1)}),this.waveOut=function(){e.trigger("waveend"),e.parent&&e.parent.opts&&e.parent.opts.waveend&&e.parent.opts.waveend()}})},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){n(this,t)}return t.prototype.filter=function(t,e){return this[t].filter(function(t){var i=!1;return Object.keys(e).forEach(function(n){var o=e[n],a=new RegExp(""+o,"i");i=a.test(t[n])}),i})},t.prototype.find=function(t,e){var i={},n=0;return t.forEach(function(t){Object.keys(e).forEach(function(o){var a=e[o];t[o]==a&&(i.e=t,i.k=n)}),n++}),i},t}();e.default=o,riot.mixin("collection",o)},function(t,e,i){"use strict";var n={init:function(){var t=this;this.on("mount",function(){[].forEach.call(t.root.querySelectorAll("content"),function(e){var i=e.getAttribute("select");[].forEach.call(t.root.querySelectorAll(i),function(t){e.parentNode.insertBefore(t,e.nextSibling)}),e.parentNode.removeChild(e)})})}};riot.mixin("content",n)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){n(this,t)}return t.prototype.init=function(){var t=this;this.on("update",function(e){e&&t.dynamicAttributes&&t.dynamicAttributes.forEach(function(i){void 0!=e[i]&&t.root.setAttribute(i,e[i])})})},t}();e.default=o,riot.mixin("dynamicAttributes",o)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){n(this,t)}return t.prototype.findTag=function(t,e){var i=null;return t.forEach(function(t){t.root.getAttribute("name").toLowerCase()!=e.toLowerCase()&&t.root.tagName.toLowerCase()!=e.toLowerCase()&&t.root.getAttribute("ref").toLowerCase()!=e.toLowerCase()||(i=t)}),i},t.prototype.turnHyphensOptsToCamelCase=function(t){for(var e in t)if(/-/.test(e)){var i=e.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()});t[i]=t[e],delete t[e]}},t}();e.default=o,riot.findTag=o.findTag,riot.mixin("helpers",o)},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function t(t,e){for(var i=0;i - + @@ -49,8 +49,6 @@ - - diff --git a/src/scripts/script.js b/src/scripts/script.js index ab1e3ec..25e9de7 100644 --- a/src/scripts/script.js +++ b/src/scripts/script.js @@ -111,4 +111,6 @@ registryUI.isImageRemoveActivated = true; registryUI.catalog = {}; registryUI.taglist = {}; -riot.mount('*'); +window.addEventListener('DOMContentLoaded', function() { + riot.mount('*'); +}); diff --git a/src/scripts/static.js b/src/scripts/static.js index 90c7f8c..744fa40 100644 --- a/src/scripts/static.js +++ b/src/scripts/static.js @@ -25,6 +25,6 @@ registryUI.isImageRemoveActivated = true; registryUI.catalog = {}; registryUI.taglist = {}; -riot.mount('catalog'); -riot.mount('taglist'); -riot.mount('app'); +window.addEventListener('DOMContentLoaded', function() { + riot.mount('*'); +}); diff --git a/static.dockerfile b/static.dockerfile index 21db25d..6349af2 100644 --- a/static.dockerfile +++ b/static.dockerfile @@ -20,8 +20,7 @@ WORKDIR /usr/share/nginx/html/ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/script-static.js /usr/share/nginx/html/scripts/script.js -COPY dist/scripts/tags-static.js /usr/share/nginx/html/scripts/tags.js +COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY bin/entrypoint /bin ENTRYPOINT entrypoint