diff --git a/dist/scripts/script-static.js b/dist/scripts/script-static.js index cf363e3..f63f080 100644 --- a/dist/scripts/script-static.js +++ b/dist/scripts/script-static.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={},this._headers={}}Http.prototype.addEventListener=function(t,e){this._events[t]=e;var s=this;switch(t){case"loadend":s.oReq.addEventListener("loadend",function(){if(401==this.status){var t=new XMLHttpRequest;for(key in s._events)t.addEventListener(key,s._events[key]);for(key in s._headers)t.setRequestHeader(key,s._headers[key]);t.withCredentials=!0,t.open(s._method,s._url),t.send()}else e.bind(this)()});break;case"load":s.oReq.addEventListener("load",function(){401!==this.status&&e.bind(this)()});break;default:s.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()};var registryUI={};registryUI.url=function(){return"${URL}"},registryUI.isImageRemoveActivated=!0,registryUI.catalog={},registryUI.taglist={},riot.mount("catalog"),riot.mount("taglist"),riot.mount("app"); \ No newline at end of file +function Http(){this.oReq=new XMLHttpRequest,this.oReq.hasHeader=Http.hasHeader,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,t){this._events[e]=t;var s=this;switch(e){case"loadend":s.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;e.open(s._method,s._url);for(key in s._events)e.addEventListener(key,s._events[key]);for(key in s._headers)e.setRequestHeader(key,s._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.send()}else t.bind(this)()});break;case"load":s.oReq.addEventListener("load",function(){401!==this.status&&t.bind(this)()});break;default:s.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 t.match(new RegExp("^"+e+":"),"i")})};var registryUI={};registryUI.url=function(){return"${URL}"},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 index e7e1b07..b3b5d81 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={},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 r._events)e.addEventListener(key,r._events[key]);for(key in r._headers)e.setRequestHeader(key,r._headers[key]);e.withCredentials=!0,e.open(r._method,r._url),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()};var registryUI={};registryUI.url=function(){return registryUI.getRegistryServer(0)},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(/\/*$/,"");var r=t.indexOf(e);r==-1&&(t.push(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.changeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),t=[e].concat(t),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.removeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.isImageRemoveActivated=!0,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.oReq.hasHeader=Http.hasHeader,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.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 t.match(new RegExp("^"+e+":"),"i")})};var registryUI={};registryUI.url=function(){return registryUI.getRegistryServer(0)},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(/\/*$/,"");var r=t.indexOf(e);r==-1&&(t.push(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.changeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),t=[e].concat(t),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.removeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.isImageRemoveActivated=!0,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 index ad81af8..99961f2 100644 --- a/dist/scripts/tags-static.js +++ b/dist/scripts/tags-static.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 . */ -riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var t=new Http;registryUI.catalog.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.catalog.error=t;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog"),t.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(t){rg.router.go("taglist",{repository:t.split("/")[0],image:t.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("app"," ","","",function(t){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",t=>{switch(t.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("taglist",'
arrow_back

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

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var t=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.taglist.error=t;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(t,e){var r=new Http;r.addEventListener("load",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.getAllResponseHeaders().includes("Docker-Content-Digest"))return void registryUI.taglist.createSnackbar("You need tu add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("load",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.taglist.createSnackbar("Deleting "+t+":"+e+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+r),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.taglist.createSnackbar("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.taglist.createSnackbar("Manifest for"+t+":"+e+"not found"):registryUI.taglist.createSnackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+e),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}); \ No newline at end of file +riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var t=new Http;registryUI.catalog.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.catalog.error=t;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog"),t.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(t){rg.router.go("taglist",{repository:t.split("/")[0],image:t.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("app"," ","","",function(t){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",t=>{switch(t.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("taglist",'
arrow_back

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

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var t=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.taglist.error=t;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,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.taglist.createSnackbar("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.taglist.createSnackbar("Deleting "+t+":"+e+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+r),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.taglist.createSnackbar("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.taglist.createSnackbar("Manifest for"+t+":"+e+"not found"):registryUI.taglist.createSnackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+e),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}); \ No newline at end of file diff --git a/dist/scripts/tags.js b/dist/scripts/tags.js index 673eca3..175fcad 100644 --- a/dist/scripts/tags.js +++ b/dist/scripts/tags.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 . */ -riot.tag2("add",'

Add your Server ?

',"","",function(e){registryUI.addTag=registryUI.addTag||{},registryUI.addTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["add-server-dialog"]),registryUI.addTag.dialog=registryUI.addTag.dialog||document.querySelector("#add-server-dialog"),registryUI.addTag.addServer=registryUI.addTag.tileServerList||registryUI.addTag.dialog.querySelector("#add-server-input"),registryUI.addTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.addTag.dialog),this["add-server-input"].onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()}}),registryUI.addTag.show=function(){registryUI.addTag.dialog.showModal()},registryUI.addTag.add=function(){registryUI.addTag.addServer.value&®istryUI.addTag.addServer.value.length>0&®istryUI.addServer(registryUI.addTag.addServer.value),registryUI.addTag.addServer.value="",rg.router.go("home"),registryUI.addTag.dialog.close()},registryUI.addTag.close=function(){registryUI.addTag.addServer.value="",registryUI.addTag.dialog.close()},registryUI.addTag.update()}),riot.tag2("app"," ","","",function(e){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",e=>{switch(e.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var e=new Http;registryUI.catalog.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.catalog.error=e;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog"),e.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(e){rg.router.go("taglist",{repository:e.split("/")[0],image:e.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("change",'

Change your Server ?

',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},registryUI.changeTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["change-server-dialog"]),registryUI.changeTag.dialog=registryUI.changeTag.dialog||document.querySelector("#change-server-dialog"),registryUI.changeTag.serverList=registryUI.changeTag.serverList||registryUI.changeTag.dialog.querySelector("#server-list"),registryUI.changeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.changeTag.dialog),this["server-list"].onkeyup=function(e){13==e.keyCode&®istryUI.changeTag.change()}}),registryUI.changeTag.show=function(){registryUI.changeTag.update(),registryUI.changeTag.serverList.value=registryUI.url(),registryUI.changeTag.dialog.showModal()},registryUI.changeTag.change=function(){registryUI.changeTag.serverList.value&®istryUI.changeTag.serverList.value.length>0&®istryUI.changeServer(registryUI.changeTag.serverList.value),registryUI.changeTag.serverList.value="",rg.router.go("home"),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("menu",'
  • Add URL
  • Change URL
  • Remove URL
',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["card-menu"])}),registryUI.menuTag.update()}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(e,t){var r=new Http;r.addEventListener("load",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.getAllResponseHeaders().includes("Docker-Content-Digest"))return void registryUI.taglist.createSnackbar("You need tu add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("load",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.taglist.createSnackbar("Deleting "+e+":"+t+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(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.taglist.createSnackbar("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.taglist.createSnackbar("Manifest for"+e+":"+t+"not found"):registryUI.taglist.createSnackbar(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 ?

',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.update()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.update(),registryUI.removeTag.dialog.showModal()},this.on("updated",function(){registryUI.removeTag.dialog=this["remove-server-dialog"],registryUI.removeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.removeTag.dialog)})}),riot.tag2("taglist",'
arrow_back

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

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var e=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.taglist.error=e;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}); \ No newline at end of file +riot.tag2("add",'

Add your Server ?

',"","",function(e){registryUI.addTag=registryUI.addTag||{},registryUI.addTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["add-server-dialog"]),registryUI.addTag.dialog=registryUI.addTag.dialog||document.querySelector("#add-server-dialog"),registryUI.addTag.addServer=registryUI.addTag.tileServerList||registryUI.addTag.dialog.querySelector("#add-server-input"),registryUI.addTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.addTag.dialog),this["add-server-input"].onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()}}),registryUI.addTag.show=function(){registryUI.addTag.dialog.showModal()},registryUI.addTag.add=function(){registryUI.addTag.addServer.value&®istryUI.addTag.addServer.value.length>0&®istryUI.addServer(registryUI.addTag.addServer.value),registryUI.addTag.addServer.value="",rg.router.go("home"),registryUI.addTag.dialog.close()},registryUI.addTag.close=function(){registryUI.addTag.addServer.value="",registryUI.addTag.dialog.close()},registryUI.addTag.update()}),riot.tag2("app"," ","","",function(e){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",e=>{switch(e.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var e=new Http;registryUI.catalog.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.catalog.error=e;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog"),e.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(e){rg.router.go("taglist",{repository:e.split("/")[0],image:e.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("change",'

Change your Server ?

',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},registryUI.changeTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["change-server-dialog"]),registryUI.changeTag.dialog=registryUI.changeTag.dialog||document.querySelector("#change-server-dialog"),registryUI.changeTag.serverList=registryUI.changeTag.serverList||registryUI.changeTag.dialog.querySelector("#server-list"),registryUI.changeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.changeTag.dialog),this["server-list"].onkeyup=function(e){13==e.keyCode&®istryUI.changeTag.change()}}),registryUI.changeTag.show=function(){registryUI.changeTag.update(),registryUI.changeTag.serverList.value=registryUI.url(),registryUI.changeTag.dialog.showModal()},registryUI.changeTag.change=function(){registryUI.changeTag.serverList.value&®istryUI.changeTag.serverList.value.length>0&®istryUI.changeServer(registryUI.changeTag.serverList.value),registryUI.changeTag.serverList.value="",rg.router.go("home"),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("menu",'
  • Add URL
  • Change URL
  • Remove URL
',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["card-menu"])}),registryUI.menuTag.update()}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,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.taglist.createSnackbar("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.taglist.createSnackbar("Deleting "+e+":"+t+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(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.taglist.createSnackbar("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.taglist.createSnackbar("Manifest for"+e+":"+t+"not found"):registryUI.taglist.createSnackbar(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 ?

',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.update()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.update(),registryUI.removeTag.dialog.showModal()},this.on("updated",function(){registryUI.removeTag.dialog=this["remove-server-dialog"],registryUI.removeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.removeTag.dialog)})}),riot.tag2("taglist",'
arrow_back

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

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var e=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.taglist.error=e;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}); \ No newline at end of file diff --git a/dist/scripts/vendor.js b/dist/scripts/vendor.js index c2c7da8..b0df009 100644 --- a/dist/scripts/vendor.js +++ b/dist/scripts/vendor.js @@ -6,7 +6,7 @@ // nb. This is for IE10 and lower _only_. var supportCustomEvent = window.CustomEvent; - if (!supportCustomEvent || typeof supportCustomEvent == 'object') { + if (!supportCustomEvent || typeof supportCustomEvent === 'object') { supportCustomEvent = function CustomEvent(event, x) { x = x || {}; var ev = document.createEvent('CustomEvent'); @@ -66,7 +66,7 @@ * @param {Element} el to blur */ function safeBlur(el) { - if (el && el.blur && el != document.body) { + if (el && el.blur && el !== document.body) { el.blur(); } } @@ -78,13 +78,24 @@ */ function inNodeList(nodeList, node) { for (var i = 0; i < nodeList.length; ++i) { - if (nodeList[i] == node) { + if (nodeList[i] === node) { return true; } } return false; } + /** + * @param {HTMLFormElement} el to check + * @return {boolean} whether this form has method="dialog" + */ + function isFormMethodDialog(el) { + if (!el || !el.hasAttribute('method')) { + return false; + } + return el.getAttribute('method').toLowerCase() === 'dialog'; + } + /** * @param {!HTMLDialogElement} dialog to upgrade * @constructor @@ -121,6 +132,7 @@ }.bind(this); var timeout; var delayModel = function(ev) { + if (ev.target !== dialog) { return; } // not for a child element var cand = 'DOMNodeRemoved'; removed |= (ev.type.substr(0, cand.length) === cand); window.clearTimeout(timeout); @@ -363,7 +375,7 @@ } var cssTop = rule.style.getPropertyValue('top'); var cssBottom = rule.style.getPropertyValue('bottom'); - if ((cssTop && cssTop != 'auto') || (cssBottom && cssBottom != 'auto')) { + if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) { return true; } } @@ -373,7 +385,7 @@ dialogPolyfill.needsCentering = function(dialog) { var computedStyle = window.getComputedStyle(dialog); - if (computedStyle.position != 'absolute') { + if (computedStyle.position !== 'absolute') { return false; } @@ -381,9 +393,10 @@ // WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but // Firefox returns the used value. So we do this crazy thing instead: check // the inline style and then go through CSS rules. - if ((dialog.style.top != 'auto' && dialog.style.top != '') || - (dialog.style.bottom != 'auto' && dialog.style.bottom != '')) + if ((dialog.style.top !== 'auto' && dialog.style.top !== '') || + (dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) { return false; + } return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog); }; @@ -391,7 +404,7 @@ * @param {!Element} element to force upgrade */ dialogPolyfill.forceRegisterDialog = function(element) { - if (element.showModal) { + if (window.HTMLDialogElement || element.showModal) { console.warn('This browser already supports , the polyfill ' + 'may not work correctly', element); } @@ -449,10 +462,8 @@ continue; } else if (c.localName === 'dialog') { removed.push(c); - } else { - var q = c.querySelector('dialog'); - q && removed.push(q); } + removed = removed.concat(c.querySelectorAll('dialog')); } }); removed.length && checkDOM(removed); @@ -603,7 +614,7 @@ */ dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) { var index = this.pendingDialogStack.indexOf(dpi); - if (index == -1) { return; } + if (index === -1) { return; } this.pendingDialogStack.splice(index, 1); if (this.pendingDialogStack.length === 0) { @@ -613,33 +624,103 @@ }; dialogPolyfill.dm = new dialogPolyfill.DialogManager(); + dialogPolyfill.formSubmitter = null; + dialogPolyfill.useValue = null; /** - * Global form 'dialog' method handler. Closes a dialog correctly on submit - * and possibly sets its return value. + * Installs global handlers, such as click listers and native method overrides. These are needed + * even if a no dialog is registered, as they deal with
. */ - document.addEventListener('submit', function(ev) { - var target = ev.target; - if (!target || !target.hasAttribute('method')) { return; } - if (target.getAttribute('method').toLowerCase() !== 'dialog') { return; } - ev.preventDefault(); + if (window.HTMLDialogElement === undefined) { - var dialog = findNearestDialog(/** @type {Element} */ (ev.target)); - if (!dialog) { return; } + /** + * If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with + * one that returns the correct value. + */ + var testForm = document.createElement('form'); + testForm.setAttribute('method', 'dialog'); + if (testForm.method !== 'dialog') { + var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method'); + var realGet = methodDescriptor.get; + methodDescriptor.get = function() { + if (isFormMethodDialog(this)) { + return 'dialog'; + } + return realGet.call(this); + }; + var realSet = methodDescriptor.set; + methodDescriptor.set = function(v) { + if (typeof v === 'string' && v.toLowerCase() === 'dialog') { + return this.setAttribute('method', v); + } + return realSet.call(this, v); + }; + Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor); + } - // FIXME: The original event doesn't contain the element used to submit the - // form (if any). Look in some possible places. - var returnValue; - var cands = [document.activeElement, ev.explicitOriginalTarget]; - var els = ['BUTTON', 'INPUT']; - cands.some(function(cand) { - if (cand && cand.form == ev.target && els.indexOf(cand.nodeName.toUpperCase()) != -1) { - returnValue = cand.value; - return true; + /** + * Global 'click' handler, to capture the or