feat: add new option READ_ONLY_REGISTRIES available when SINGLE_REGISTRY=false

This commit is contained in:
Joxit 2021-11-04 00:48:33 +01:00
parent 992328eae9
commit b323dc6c04
No known key found for this signature in database
GPG key ID: F526592B8E012263
4 changed files with 16 additions and 9 deletions

View file

@ -6,6 +6,8 @@ sed -i "s,\${PULL_URL},${PULL_URL}," index.html
sed -i "s,\${SINGLE_REGISTRY},${SINGLE_REGISTRY}," index.html
sed -i "s/\${CATALOG_ELEMENTS_LIMIT}/${CATALOG_ELEMENTS_LIMIT}/" index.html
sed -i "s/\${SHOW_CONTENT_DIGEST}/${SHOW_CONTENT_DIGEST}/" index.html
sed -i "s/\${DEFAULT_REGISTRIES}/${DEFAULT_REGISTRIES}/" index.html
sed -i "s/\${READ_ONLY_REGISTRIES}/${READ_ONLY_REGISTRIES}/" index.html
if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then
sed -i "s/\${DELETE_IMAGES}/false/" index.html

View file

@ -15,17 +15,17 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<dialogs-menu>
<add-registry-url opened="{ state['add-registry-url'] }" on-close="{ onClose('add-registry-url') }"
<add-registry-url if="{ !props.readOnlyRegistries }" opened="{ state['add-registry-url'] }" on-close="{ onClose('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') }"
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') }"
<remove-registry-url if="{ !props.readOnlyRegistries }" opened="{ state['remove-registry-url'] }" on-close="{ onClose('remove-registry-url') }"
on-notify="{ props.onNotify }" on-server-change="{ props.onServerChange }"></remove-registry-url>
<div class="container">
<material-button onClick="{ onClick }" waves-center="true" rounded="true" waves-opacity="0.6" waves-duration="600">
<i class="material-icons">more_vert</i>
</material-button>
<material-dropdown-list items="{ dropdownItems }" onSelect="{ onDropdownSelect }"
<material-dropdown-list items="{ dropdownItems.filter(item => item.ro || !props.readOnlyRegistries) }" onSelect="{ onDropdownSelect }"
opened="{ state.isDropdownOpened }" />
</div>
<div class="overlay" onclick="{ onClick }" if="{ state.isDropdownOpened }"></div>
@ -42,13 +42,16 @@
},
dropdownItems: [{
title: 'Add URL',
name: 'add-registry-url'
name: 'add-registry-url',
ro: false
}, {
title: 'Change URL',
name: 'change-registry-url'
name: 'change-registry-url',
ro: true
}, {
title: 'Remove URL',
name: 'remove-registry-url'
name: 'remove-registry-url',
ro: false
}],
onDropdownSelect(key, item) {
this.update({

View file

@ -20,7 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="logo">Docker Registry UI</div>
<search-bar on-search="{ onSearch }"></search-bar>
<dialogs-menu if="{props.singleRegistry !== 'true'}" on-notify="{ notifySnackbar }"
on-server-change="{ onServerChange }" default-registries="{ props.defaultRegistries }"></dialogs-menu>
on-server-change="{ onServerChange }" default-registries="{ props.defaultRegistries }"
read-only-registries="{ truthy(props.readOnlyRegistries) }"></dialogs-menu>
</material-navbar>
</header>
<main>
@ -97,7 +98,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
state.snackbarMessage = undefined;
},
onBeforeMount(props) {
if (props.defaultRegistries && props.defaultRegistries.length > 0 && getRegistryServers().length === 0) {
if ((props.defaultRegistries && props.defaultRegistries.length > 0 && getRegistryServers().length === 0) ||
truthy(props.readOnlyRegistries)) {
setRegistryServers(props.defaultRegistries);
}

View file

@ -38,7 +38,7 @@
<docker-registry-ui registry-url="${REGISTRY_URL}" name="${REGISTRY_TITLE}" pull-url="${PULL_URL}"
show-content-digest="${SHOW_CONTENT_DIGEST}" is-image-remove-activated="${DELETE_IMAGES}"
catalog-elements-limit="${CATALOG_ELEMENTS_LIMIT}" single-registry="${SINGLE_REGISTRY}"
default-registries="${DEFAULT_REGISTRIES}">
default-registries="${DEFAULT_REGISTRIES}" read-only-registries="${READ_ONLY_REGISTRIES}">
</docker-registry-ui>
<!-- endbuild -->
<!-- build:keep developement -->