-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathAppTableRow.vue
More file actions
154 lines (139 loc) · 3.92 KB
/
Copy pathAppTableRow.vue
File metadata and controls
154 lines (139 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import type { AppAction } from '../../actions/index.ts'
import type { IAppstoreApp, IAppstoreExApp } from '../../apps.d.ts'
import { mdiInformationOutline } from '@mdi/js'
import { t } from '@nextcloud/l10n'
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcChip from '@nextcloud/vue/components/NcChip'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import AppActions from '../AppActions.vue'
import AppIcon from '../AppIcon.vue'
import BadgeAppDaemon from '../BadgeAppDaemon.vue'
import BadgeAppLevel from '../BadgeAppLevel.vue'
import { useActions } from '../../composables/useActions.ts'
import { useLimitedGroups } from '../../composables/useLimitedGroups.ts'
const { app, isNarrow } = defineProps<{
app: IAppstoreApp | IAppstoreExApp
isNarrow?: boolean
isWide?: boolean
}>()
const route = useRoute()
const detailsRoute = computed(() => ({
...route,
params: {
...route.params,
id: app.id,
},
query: {
...route.query,
},
}))
const detailsAction = computed<AppAction>(() => ({
id: 'details',
order: 99,
enabled: () => true,
label: () => t('appstore', 'Show details'),
icon: mdiInformationOutline,
to: () => detailsRoute.value,
inline: false,
}))
const groupsAppIsLimitedTo = useLimitedGroups(() => app)
const rawActions = useActions(() => app)
const actions = computed(() => [
...rawActions.value,
detailsAction.value,
])
</script>
<template>
<tr :class="$style.appTableRow">
<td :class="$style.appTableRow__nameCell">
<NcButton
alignment="start"
:title="t('appstore', 'Show details')"
:to="detailsRoute"
variant="tertiary-no-background"
wide>
<template #icon>
<NcLoadingIcon v-if="app.loading" :size="24" />
<AppIcon v-else :app :size="24" />
</template>
{{ app.name }}
<span v-if="app.loading" class="hidden-visually">({{ t('appstore', 'is loading…') }})</span>
<span class="hidden-visually">({{ t('appstore', 'Show details') }})</span>
</NcButton>
</td>
<td>
<span :class="$style.appTableRow__versionCell">{{ app.version }}</span>
</td>
<td v-if="!isNarrow">
<div :class="$style.appTableRow__levelCell">
<BadgeAppLevel v-if="app.level" :level="app.level" />
<BadgeAppDaemon v-if="'daemon' in app && app.daemon" :daemon="app.daemon" />
</div>
</td>
<td v-if="isWide">
<ul
v-if="groupsAppIsLimitedTo.length > 0"
:class="$style.appTableRow__groupsCell"
:title="groupsAppIsLimitedTo.map((group) => group.displayName).join(', ')">
<template v-for="group, index in groupsAppIsLimitedTo" :key="group.id">
<li v-if="index === 3" aria-hidden="true">
…
</li>
<li :class="{ 'hidden-visually': index > 2 }">
<NcChip :text="group.displayName" noClose />
</li>
</template>
</ul>
</td>
<td>
<div :class="$style.appTableRow__actionsCell">
<AppActions
:class="$style.appTableRow__actionsCellActions"
:app
:actions
:iconOnly="isNarrow" />
</div>
</td>
</tr>
</template>
<style module>
.appTableRow {
height: calc(var(--default-clickable-area) + var(--default-grid-baseline));
}
.appTableRow td {
padding-block: var(--default-grid-baseline);
vertical-align: middle;
}
.appTableRow__nameCell {
/* Padding is needed to have proper focus-visible */
padding-inline: var(--default-grid-baseline);
}
.appTableRow__levelCell {
display: flex;
align-items: center;
gap: var(--default-grid-baseline)
}
.appTableRow__versionCell {
color: var(--color-text-maxcontrast);
}
.appTableRow__groupsCell {
display: flex;
gap: var(--default-grid-baseline);
}
.appTableRow__actionsCell {
display: flex;
gap: var(--default-grid-baseline);
justify-content: end;
}
.appTableRow__actionsCellActions {
width: 100%;
justify-content: end;
}
</style>