Skip to content

Commit 2def106

Browse files
committed
Add quick info badges on AppList : pending notifications, available upgrades, flagged as deprecated on the catalog, or not in the catalog(anymoar)
1 parent d197c04 commit 2def106

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

app/src/views/app/AppList.vue

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,29 @@ const apps = await api
77
.get<AppList>({ uri: 'apps?full', initial: true })
88
.then(({ apps }) => {
99
return apps
10-
.map(({ id, name, description, manifest, logo }) => {
10+
.map(({ id, name, description, manifest, logo, upgrade, from_catalog}) => {
1111
const logoUrl = logo
1212
? `./applogos/${logo}.png`
1313
: 'data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
14-
return { id, name: manifest.name, label: name, description, logoUrl }
14+
let badges: BadgesInfos = Array();
15+
let notifications_count = Object.keys(manifest.notifications.POST_INSTALL || {}).length + Object.keys(manifest.notifications.POST_UPGRADE || {}).length
16+
if (notifications_count > 0)
17+
{
18+
badges.push({text: notifications_count + ' notifications', variant: "info", icon: 'info-circle'})
19+
}
20+
if (upgrade.status == "upgradable")
21+
{
22+
badges.push({text: 'Upgrade available', variant: "info", icon: 'arrow-up'})
23+
}
24+
else if (upgrade.status == "url_required")
25+
{
26+
badges.push({text: 'Not in catalog', variant: "danger", icon: 'chain-broken'})
27+
}
28+
if ((id == 'helloworld__2') || (from_catalog && from_catalog.antifeatures && Array(from_catalog.antifeatures).includes("deprecated-software")))
29+
{
30+
badges.push({text: 'Deprecated', variant: "warning", icon: 'exclamation-triangle'})
31+
}
32+
return { id, label: name, description, logoUrl, badges }
1533
})
1634
.sort((prev, app) => {
1735
return prev.label > app.label ? 1 : -1
@@ -38,13 +56,14 @@ const [search, filteredApps] = useSearch(apps, (s, app) =>
3856

3957
<BListGroup>
4058
<YListItem
41-
v-for="{ id, description, label, logoUrl } in filteredApps"
59+
v-for="{ id, description, label, logoUrl, badges } in filteredApps"
4260
:key="id"
4361
:to="{ name: 'app-info', params: { id } }"
4462
:label="label"
4563
:sublabel="id"
4664
:description="description"
4765
:image-src="logoUrl"
66+
:badges="badges"
4867
/>
4968
</BListGroup>
5069
</ViewSearch>

0 commit comments

Comments
 (0)