Skip to content

Commit

Permalink
web/satellite: hide latest version of objects
Browse files Browse the repository at this point in the history
This change removes the first element of the list of an object's
versions, which is the latest version, to prevent duplicate listing. It
also adds a text to indicate if an object has no older versions.

Issue: #6833

Change-Id: I4cee9d4d2bb92a74ae8cedf0e20c5ae1264b027b
  • Loading branch information
wilfred-asomanii authored and Storj Robot committed Apr 22, 2024
1 parent 9b8bd4b commit d90e730
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions web/satellite/src/components/BrowserTableComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@
@update:page="onPageChange"
@update:itemsPerPage="onLimitChange"
>
<template #expanded-row="{ internalItem: {key} }">
<tr v-for="file in versionsCache.get(key) as BrowserObject[]" :key="file.VersionId" class="bg-altbg">
<template #expanded-row="{ columns, internalItem: {key} }">
<template v-if="!versionsCache.get(key)?.length">
<tr>
<td :colspan="columns.length">
<p class="text-center">No older versions stored</p>
</td>
</tr>
</template>
<tr v-for="file in versionsCache.get(key) as BrowserObject[]" v-else :key="file.VersionId" class="bg-altbg">
<td />
<td>
<v-list-item class="rounded-lg text-caption pl-1 ml-n1" link>
Expand Down
11 changes: 8 additions & 3 deletions web/satellite/src/store/modules/objectBrowserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,14 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
type: 'file',
});

const files: BrowserObject[] = [
...versions.map(makeFileRelative),
];
const files = versions.map(file => ({
...file,
Key,
path,
type: 'file',
})) as BrowserObject[];
// remove the first element which is the current version of the object
files.shift();

state.objectVersions.set(objectKey, files);
}
Expand Down

0 comments on commit d90e730

Please sign in to comment.