Skip to content

Commit

Permalink
feat(riot-v5): upgrade remove-registry-url dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxit committed Mar 28, 2021
1 parent 4ff1b2f commit 603b586
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 62 deletions.
6 changes: 5 additions & 1 deletion src/components/dialogs/dialogs-menu.riot
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
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') }"
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>
import AddRegistryUrl from './add-registry-url.riot';
import ChangeRegistryUrl from './change-registry-url.riot';
import RemoveRegistryUrl from './remove-registry-url.riot';
export default {
components: {
AddRegistryUrl,
ChangeRegistryUrl
ChangeRegistryUrl,
RemoveRegistryUrl
},
dropdownItems: [{
title: 'Add URL',
Expand Down
68 changes: 68 additions & 0 deletions src/components/dialogs/remove-registry-url.riot
Original file line number Diff line number Diff line change
@@ -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>
61 changes: 0 additions & 61 deletions src/tags/dialogs/remove.riot

This file was deleted.

0 comments on commit 603b586

Please sign in to comment.