mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-30 00:49:53 +03:00
[riot-mui] Add riot-mui in remove taf (#17)
When we remove the current server, it will update the view.
This commit is contained in:
parent
dc929951cf
commit
ab0571eaa1
3 changed files with 30 additions and 31 deletions
|
@ -18,7 +18,7 @@ var registryUI = {}
|
|||
registryUI.URL_QUERY_PARAM_REGEX = /[&?]url=/;
|
||||
registryUI.URL_PARAM_REGEX = /^url=/;
|
||||
|
||||
registryUI.url = function() {
|
||||
registryUI.url = function(byPassQueryParam) {
|
||||
if (!registryUI._url) {
|
||||
var url = registryUI.getUrlQueryParam();
|
||||
if (url) {
|
||||
|
@ -78,10 +78,14 @@ registryUI.removeServer = function(url) {
|
|||
}
|
||||
registryServer.splice(index, 1);
|
||||
localStorage.setItem('registryServer', JSON.stringify(registryServer));
|
||||
if (url == registryUI.url()) {
|
||||
registryUI.updateHistory(registryUI.getRegistryServer(0));
|
||||
rg.router.go('home');
|
||||
}
|
||||
}
|
||||
|
||||
registryUI.updateHistory = function(url) {
|
||||
history.pushState(null, '', '?url=' + registryUI.encodeURI(url) + window.location.hash);
|
||||
history.pushState(null, '', (url ? '?url=' + registryUI.encodeURI(url) : '?') + window.location.hash);
|
||||
registryUI._url = url;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ h2 {
|
|||
padding: 8px 0;
|
||||
list-style: none;
|
||||
}
|
||||
.list>li:hover {
|
||||
.list.highlight>li:hover {
|
||||
background-color: #eee;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -15,33 +15,32 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<remove>
|
||||
<dialog ref="remove-server-dialog" class="mdl-dialog">
|
||||
<h4 class="mdl-dialog__title">Remove your Registry Server ?</h4>
|
||||
<div class="mdl-dialog__content">
|
||||
<div class="mdl-textfield mdl-js-textfield">
|
||||
<ul class="mdl-list">
|
||||
<li class="mdl-list__item" each="{ url in registryUI.getRegistryServer() }">
|
||||
<span class="mdl-list__item-primary-content">
|
||||
<a href="#" onClick="registryUI.removeTag.removeUrl('{url}');">
|
||||
<i class="material-icons mdl-list__item-icon">delete</i>
|
||||
</a>
|
||||
<span class="url">{url}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions">
|
||||
<button type="button" class="mdl-button close" onClick="registryUI.removeTag.close();">Close</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<material-popup>
|
||||
<div class="material-popup-title">Remove your Registry Server ?</div>
|
||||
<div class="material-popup-content">
|
||||
<ul class="list">
|
||||
<li each="{ url in registryUI.getRegistryServer() }">
|
||||
<span>
|
||||
<a href="#" onClick="registryUI.removeTag.removeUrl('{url}');">
|
||||
<i class="material-icons">delete</i>
|
||||
</a>
|
||||
<span class="url">{ url }</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="material-popup-action">
|
||||
<material-button class="dialog-button" waves-color="rgba(158,158,158,.4)" onClick="registryUI.removeTag.close();">Close</material-button>
|
||||
</div>
|
||||
</material-popup>
|
||||
<script type="text/javascript">
|
||||
registryUI.removeTag = registryUI.removeTag || {}
|
||||
registryUI.removeTag.update = this.update;
|
||||
|
||||
registryUI.removeTag.removeUrl = function (url) {
|
||||
registryUI.removeServer(url);
|
||||
registryUI.removeTag.update();
|
||||
registryUI.removeTag.close();
|
||||
};
|
||||
|
||||
registryUI.removeTag.close = function () {
|
||||
|
@ -50,15 +49,11 @@
|
|||
};
|
||||
|
||||
registryUI.removeTag.show = function () {
|
||||
registryUI.removeTag.update();
|
||||
registryUI.removeTag.dialog.showModal();
|
||||
registryUI.removeTag.dialog.open();
|
||||
};
|
||||
|
||||
this.on('updated', function () {
|
||||
registryUI.removeTag.dialog = this.refs['remove-server-dialog'];
|
||||
if (!registryUI.removeTag.dialog.showModal) {
|
||||
dialogPolyfill.registerDialog(registryUI.removeTag.dialog);
|
||||
}
|
||||
this.one('mount', function () {
|
||||
registryUI.removeTag.dialog = this.tags['material-popup'];
|
||||
});
|
||||
</script>
|
||||
</remove>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue