diff --git a/dashboard/src/components/app/Storage.vue b/dashboard/src/components/app/Storage.vue index 26ae977ac..5cd79d02f 100644 --- a/dashboard/src/components/app/Storage.vue +++ b/dashboard/src/components/app/Storage.vue @@ -27,6 +27,7 @@ const selectedMountType = computed(() => { }); const mounts = ref([]); +const originalMounts = ref([]); const mountsBusy = ref(false); const mountsError = ref(''); @@ -80,9 +81,35 @@ async function onSubmitMounts() { return console.error(error); } - mountsBusy.value = false; + // make a copy, cannot clone due to Proxy objects + originalMounts.value = mounts.value.map(m => { return { volumeId: m.volumeId, readOnly: m.readOnly }; }); + + setTimeout(() => mountsBusy.value = false, 2000); } +const mountsValid = computed(() => { + const uniques = {}; + for (const m of mounts.value) { + if (!m.volumeId) return false; + + if (uniques[m.volumeId]) return false; + else uniques[m.volumeId] = true; + } + + return true; +}); + +const mountsChanged = computed(() => { + if (mounts.value.length !== originalMounts.value.length) return true; + + for (const m in mounts.value) { + if (originalMounts.value[m].readOnly !== mounts.value[m].readOnly) return true; + if (originalMounts.value[m].volumeId !== mounts.value[m].volumeId) return true; + } + + return false; +}); + onMounted(async () => { const [error, result] = await volumesModel.list(); if (error) return console.error(error); @@ -92,6 +119,9 @@ onMounted(async () => { mounts.value.push({ volumeId: volume.id, readOnly: mount.readOnly ? 'true' : 'false' }); }); + // make a copy, cannot clone due to Proxy objects + originalMounts.value = mounts.value.map(m => { return { volumeId: m.volumeId, readOnly: m.readOnly }; }); + volumes.value = [{ id: DEFAULT_VOLUME_ID, label: 'Default - /home/yellowtent/appsdata/', @@ -150,9 +180,9 @@ onMounted(async () => { - - - + + + @@ -160,13 +190,13 @@ onMounted(async () => { - - @@ -181,7 +211,7 @@ onMounted(async () => {
- +
{{ $t('app.storage.mounts.volume') }}{{ $t('main.actions') }}{{ $t('app.storage.mounts.volume') }}{{ $t('app.storage.mounts.permissions.label') }}{{ $t('main.actions') }}
+ +