fix(ui): offer an extension update only when the catalogue has one
An installed extension showed its own version and an Update button whether or not the catalogue pinned anything newer, so a published update was invisible. The row now offers 'Update to <version>' when the catalogue's digest differs from the installed one and no update is already pending.
This commit is contained in:
1 parent
be47311883
commit
6c2ab54f65
2 files changed
+20
-2
No files matched your search
@@ -33,6 +33,17 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
const available = computed(() => store.catalogue.filter((entry) => !entry.installed));
|
||||
// The catalogue entry an installed package would move to on Update, when the
|
||||
// catalogue pins a different digest than the one installed.
|
||||
const updates = computed(() => {
|
||||
const byName = new Map(store.catalogue.map((entry) => [entry.name, entry]));
|
||||
return new Map(
|
||||
store.extensions.flatMap((extension) => {
|
||||
const entry = byName.get(extension.name);
|
||||
return entry && entry.digest !== extension.digest ? [[extension.name, entry] as const] : [];
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
const name = ref("");
|
||||
const reference = ref("");
|
||||
@@ -108,7 +119,14 @@ const tones = {
|
||||
</ul>
|
||||
<Button size="sm" class="mt-2" :disabled="!!store.busy" @click="store.approveUpdate(extension.name)">Approve</Button>
|
||||
</div>
|
||||
<Button variant="ghost" size="sm" :disabled="!!store.busy" @click="store.update(extension.name)">Update</Button>
|
||||
<Button
|
||||
v-if="updates.has(extension.name) && !extension.pending"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
:disabled="!!store.busy"
|
||||
@click="store.update(extension.name)"
|
||||
>Update to {{ updates.get(extension.name)?.version }}</Button
|
||||
>
|
||||
<Switch
|
||||
:model-value="extension.update_policy === 'auto'"
|
||||
:disabled="!!store.busy"
|
||||
|
||||
Reference in new issue
Block a user