mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-28 16:09:54 +03:00
feat(riot-v5): upgrade remove-registry-url dialog
This commit is contained in:
parent
4ff1b2fabe
commit
603b5861fa
3 changed files with 73 additions and 62 deletions
|
@ -25,14 +25,18 @@
|
||||||
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></add-registry-url>
|
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></add-registry-url>
|
||||||
<change-registry-url opened="{ state['change-registry-url'] }" on-close="{ onClose('change-registry-url') }"
|
<change-registry-url opened="{ state['change-registry-url'] }" on-close="{ onClose('change-registry-url') }"
|
||||||
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></change-registry-url>
|
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></change-registry-url>
|
||||||
|
<remove-registry-url opened="{ state['remove-registry-url'] }" on-close="{ onClose('remove-registry-url') }"
|
||||||
|
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></remove-registry-url>
|
||||||
<script>
|
<script>
|
||||||
import AddRegistryUrl from './add-registry-url.riot';
|
import AddRegistryUrl from './add-registry-url.riot';
|
||||||
import ChangeRegistryUrl from './change-registry-url.riot';
|
import ChangeRegistryUrl from './change-registry-url.riot';
|
||||||
|
import RemoveRegistryUrl from './remove-registry-url.riot';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AddRegistryUrl,
|
AddRegistryUrl,
|
||||||
ChangeRegistryUrl
|
ChangeRegistryUrl,
|
||||||
|
RemoveRegistryUrl
|
||||||
},
|
},
|
||||||
dropdownItems: [{
|
dropdownItems: [{
|
||||||
title: 'Add URL',
|
title: 'Add URL',
|
||||||
|
|
68
src/components/dialogs/remove-registry-url.riot
Normal file
68
src/components/dialogs/remove-registry-url.riot
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2016-2021 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 <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<remove-registry-url>
|
||||||
|
<material-popup opened="{ props.opened }" onClick="{ props.onClose }">
|
||||||
|
<div slot="title">Remove your Registry Server ?</div>
|
||||||
|
<div slot="content">
|
||||||
|
<ul class="list">
|
||||||
|
<li each="{ url in getRegistryServers() }">
|
||||||
|
<span>
|
||||||
|
<material-button onClick="{ remove }" url="{ url }" rounded="true" waves-color="rgba(158,158,158,.4)"
|
||||||
|
waves-center="true">
|
||||||
|
<i class="material-icons">delete</i>
|
||||||
|
</material-button>
|
||||||
|
<span class="url">{ url }</span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div slot="action">
|
||||||
|
<material-button class="dialog-button" waves-color="rgba(158,158,158,.4)" onClick="{ props.onClose }">
|
||||||
|
Close
|
||||||
|
</material-button>
|
||||||
|
</div>
|
||||||
|
</material-popup>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getRegistryServers,
|
||||||
|
updateHistory
|
||||||
|
} from '../../scripts/utils';
|
||||||
|
import router from '../../scripts/router';
|
||||||
|
export default {
|
||||||
|
remove(event) {
|
||||||
|
const url = event.currentTarget.attributes.url && event.currentTarget.attributes.url.value;
|
||||||
|
const registryServer = getRegistryServers().filter(e => e !== url);
|
||||||
|
localStorage.setItem('registryServer', JSON.stringify(registryServer));
|
||||||
|
setTimeout(() => this.update(), 100);
|
||||||
|
},
|
||||||
|
getRegistryServers
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
:host material-popup .popup {
|
||||||
|
max-height: calc(95% - 2em);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host material-popup .popup material-button {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host material-popup .popup material-button .content i.material-icons {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</remove-registry-url>
|
|
@ -1,61 +0,0 @@
|
||||||
<!--
|
|
||||||
Copyright (C) 2016-2019 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 <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
<remove>
|
|
||||||
|
|
||||||
<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.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'];
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</remove>
|
|
Loading…
Add table
Add a link
Reference in a new issue