@eclipse-slm/ui 1.5.0-snapshot.1 → 1.5.0-snapshot.1024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/package.json +9 -7
- package/src/api/ansible-service/ansible-service-client.ts +15 -0
- package/src/api/ansible-service/ansible-service-sse.ts +124 -0
- package/src/api/notification-service/notificationServiceWebsocketClient.js +5 -5
- package/src/api/platform-management/platform-management-client.ts +2 -2
- package/src/api/resource-management/resource-management-client.ts +0 -2
- package/src/app/appInstance.ts +8 -0
- package/src/app/navigation.ts +21 -0
- package/src/app/routes.ts +23 -0
- package/src/components/admin/ansible/AnsibleAdminImages.vue +113 -0
- package/src/components/admin/ansible/AnsibleAdminJobs.vue +179 -0
- package/src/components/admin/ansible/AnsibleAdminOperations.vue +124 -0
- package/src/components/base/ConfirmDialog.vue +39 -25
- package/src/components/base/CustomDialog.vue +31 -3
- package/src/components/base/IconPickerDialog.vue +155 -0
- package/src/components/capabilities/CapabilitiesTable.vue +209 -0
- package/src/components/capabilities/CapabilityActionCard.vue +77 -0
- package/src/components/capabilities/CapabilityCreateDialog.vue +86 -0
- package/src/components/capabilities/CapabilityCreateForm.vue +306 -0
- package/src/components/capabilities/CapabilityImportDialog.vue +108 -0
- package/src/components/capabilities/capabilityForm.ts +244 -0
- package/src/components/core/AppBar.vue +1 -1
- package/src/components/core/Drawer.vue +12 -2
- package/src/components/jobs/JobDetail.vue +413 -0
- package/src/components/jobs/JobStatusChip.vue +16 -0
- package/src/components/jobs/JobsOverview.vue +59 -72
- package/src/components/profilers/ProfilerDialog.vue +95 -0
- package/src/components/profilers/ProfilerForm.vue +102 -0
- package/src/components/profilers/ProfilersTable.vue +98 -0
- package/src/components/profilers/profilerForm.ts +61 -0
- package/src/components/resources/deviceinfo/DeviceInfoView.vue +9 -1
- package/src/components/resources/dialogs/AddItemChooserDialog.vue +68 -0
- package/src/components/service_offerings/ServiceOfferingCardGrid.vue +1 -1
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionDockerCompose.vue +1 -2
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionKubernetes.vue +1 -2
- package/src/components/service_vendors/ServiceVendorDevelopersTable.vue +1 -1
- package/src/docker/entrypoint.sh +2 -2
- package/src/localisation/en.json +93 -0
- package/src/main.ts +3 -6
- package/src/pages/AdminAnsibleServicePage.vue +111 -0
- package/src/pages/AdminCapabilitiesPage.vue +60 -0
- package/src/pages/AdminProfilersPage.vue +73 -0
- package/src/pages/DashboardPage.vue +28 -56
- package/src/pages/JobDetailPage.vue +7 -0
- package/src/pages/ResourceInstancesPage.vue +71 -0
- package/src/pages/ServiceOfferingCreateOrEditPage.vue +2 -2
- package/src/stores/ansibleAdminStore.ts +206 -0
- package/src/stores/capabilitiesStore.ts +45 -2
- package/src/stores/environmentStore.ts +3 -3
- package/src/stores/jobsStore.ts +39 -39
- package/src/stores/notificationStore.ts +15 -1
- package/src/stores/profilersStore.ts +80 -0
- package/src/stores/resourceDevicesStore.ts +2 -2
- package/src/stores/serviceInstancesStore.ts +0 -1
- package/src/stores/serviceOfferingsStore.ts +1 -1
- package/src/stores/userStore.ts +1 -1
- package/src/utils/i18n.ts +4 -2
- package/src/utils/imageUtil.js +1 -1
- package/src/utils/jobStatus.ts +76 -0
- package/src/utils/mdiIcons.ts +49 -0
- package/src/utils/notificationTextGenerator.ts +27 -1
- package/src/utils/tokenInterceptor.js +1 -1
- package/src/utils/updateToken.js +1 -1
- package/vite/dist/apiClients.d.ts +1 -1
- package/vite/dist/apiClients.js +1 -0
- package/vite/dist/index.js +25 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="ansible-admin-operations">
|
|
3
|
+
<v-row>
|
|
4
|
+
<v-col
|
|
5
|
+
v-for="card in statCards"
|
|
6
|
+
:key="card.key"
|
|
7
|
+
cols="6"
|
|
8
|
+
md="3"
|
|
9
|
+
>
|
|
10
|
+
<v-card
|
|
11
|
+
:color="card.highlight ? card.color : undefined"
|
|
12
|
+
:variant="card.highlight ? 'tonal' : 'outlined'"
|
|
13
|
+
>
|
|
14
|
+
<v-card-text>
|
|
15
|
+
<div class="text-caption">
|
|
16
|
+
{{ card.title }}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="text-h4">
|
|
19
|
+
{{ card.value }}
|
|
20
|
+
</div>
|
|
21
|
+
</v-card-text>
|
|
22
|
+
</v-card>
|
|
23
|
+
</v-col>
|
|
24
|
+
</v-row>
|
|
25
|
+
|
|
26
|
+
<v-row>
|
|
27
|
+
<v-col
|
|
28
|
+
cols="12"
|
|
29
|
+
md="8"
|
|
30
|
+
>
|
|
31
|
+
<v-card variant="outlined">
|
|
32
|
+
<v-card-title>{{ t('drawer.section.admin.ansible-service.operations.config.title') }}</v-card-title>
|
|
33
|
+
<v-list
|
|
34
|
+
v-if="config"
|
|
35
|
+
density="compact"
|
|
36
|
+
>
|
|
37
|
+
<v-list-item
|
|
38
|
+
v-for="entry in configEntries"
|
|
39
|
+
:key="entry.key"
|
|
40
|
+
:title="entry.title"
|
|
41
|
+
:subtitle="entry.value"
|
|
42
|
+
/>
|
|
43
|
+
</v-list>
|
|
44
|
+
</v-card>
|
|
45
|
+
</v-col>
|
|
46
|
+
<v-col
|
|
47
|
+
cols="12"
|
|
48
|
+
md="4"
|
|
49
|
+
>
|
|
50
|
+
<v-card variant="outlined">
|
|
51
|
+
<v-card-title>{{ t('drawer.section.admin.ansible-service.operations.links.title') }}</v-card-title>
|
|
52
|
+
<v-list density="compact">
|
|
53
|
+
<v-list-item
|
|
54
|
+
href="/ansible-service/swagger-ui/index.html"
|
|
55
|
+
target="_blank"
|
|
56
|
+
rel="noopener"
|
|
57
|
+
prepend-icon="mdi-api"
|
|
58
|
+
:title="t('drawer.section.admin.ansible-service.operations.links.swagger')"
|
|
59
|
+
/>
|
|
60
|
+
<v-list-item
|
|
61
|
+
href="/ansible-service/v3/api-docs"
|
|
62
|
+
target="_blank"
|
|
63
|
+
rel="noopener"
|
|
64
|
+
prepend-icon="mdi-code-json"
|
|
65
|
+
:title="t('drawer.section.admin.ansible-service.operations.links.openapi')"
|
|
66
|
+
/>
|
|
67
|
+
</v-list>
|
|
68
|
+
</v-card>
|
|
69
|
+
</v-col>
|
|
70
|
+
</v-row>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import {computed} from "vue";
|
|
76
|
+
import {useI18n} from "vue-i18n";
|
|
77
|
+
import {useAnsibleAdminStore} from "@/stores/ansibleAdminStore";
|
|
78
|
+
import {JOB_STATUSES, jobStatusLabel} from "@/utils/jobStatus";
|
|
79
|
+
|
|
80
|
+
const {t} = useI18n();
|
|
81
|
+
const store = useAnsibleAdminStore();
|
|
82
|
+
const prefix = 'drawer.section.admin.ansible-service.operations';
|
|
83
|
+
|
|
84
|
+
const config = computed(() => store.status?.config);
|
|
85
|
+
|
|
86
|
+
const statCards = computed(() => {
|
|
87
|
+
const status = store.status;
|
|
88
|
+
const counts = status?.jobCounts ?? {};
|
|
89
|
+
const num = (n?: number) => n ?? 0;
|
|
90
|
+
return [
|
|
91
|
+
{key: 'running', title: t(`${prefix}.running`), value: num(status?.runningJobs), highlight: num(status?.runningJobs) > 0, color: 'primary'},
|
|
92
|
+
{key: 'queued', title: t(`${prefix}.queued`), value: num(status?.queuedJobs), highlight: num(status?.queuedJobs) > 0, color: 'warning'},
|
|
93
|
+
{key: 'failed24h', title: t(`${prefix}.failed24h`), value: num(status?.failedLast24h), highlight: num(status?.failedLast24h) > 0, color: 'error'},
|
|
94
|
+
...JOB_STATUSES.map(s => ({
|
|
95
|
+
key: s,
|
|
96
|
+
title: jobStatusLabel(s),
|
|
97
|
+
value: num((counts as Record<string, number>)[s]),
|
|
98
|
+
highlight: false,
|
|
99
|
+
color: 'primary',
|
|
100
|
+
})),
|
|
101
|
+
];
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const configEntries = computed(() => {
|
|
105
|
+
const c = config.value;
|
|
106
|
+
if (!c) return [];
|
|
107
|
+
const row = (key: string, value: unknown) => ({
|
|
108
|
+
key,
|
|
109
|
+
title: t(`${prefix}.config.${key}`),
|
|
110
|
+
value: Array.isArray(value) ? value.join(', ') : String(value ?? ''),
|
|
111
|
+
});
|
|
112
|
+
return [
|
|
113
|
+
row('playbookContract', store.status?.playbookContract),
|
|
114
|
+
row('defaultImage', c.defaultImage),
|
|
115
|
+
row('allowedImagePrefixes', c.allowedImagePrefixes),
|
|
116
|
+
row('parallelism', c.parallelism),
|
|
117
|
+
row('maxQueued', c.maxQueued),
|
|
118
|
+
row('defaultTimeoutMinutes', c.defaultTimeoutMinutes),
|
|
119
|
+
row('maxTimeoutMinutes', c.maxTimeoutMinutes),
|
|
120
|
+
row('maxCpus', c.maxCpus),
|
|
121
|
+
row('maxMemoryMb', c.maxMemoryMb),
|
|
122
|
+
];
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
@@ -10,33 +10,40 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<template #actions>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
<!-- Three equal columns keep the optional centre action centred regardless of button widths -->
|
|
14
|
+
<div class="confirm-dialog-action justify-start">
|
|
15
|
+
<v-btn
|
|
16
|
+
id="button-confirm-dialog"
|
|
17
|
+
variant="text"
|
|
18
|
+
:disabled="confirmLoading"
|
|
19
|
+
@click="$emit('canceled')"
|
|
20
|
+
>
|
|
21
|
+
{{ cancelButtonLabel }}
|
|
22
|
+
</v-btn>
|
|
23
|
+
</div>
|
|
21
24
|
|
|
22
|
-
<
|
|
25
|
+
<div class="confirm-dialog-action justify-center">
|
|
26
|
+
<slot name="actions-center" />
|
|
27
|
+
</div>
|
|
23
28
|
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
v-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
<div class="confirm-dialog-action justify-end">
|
|
30
|
+
<v-btn
|
|
31
|
+
id="button-confirm-dialog"
|
|
32
|
+
variant="text"
|
|
33
|
+
:color="attention ? 'error' : ''"
|
|
34
|
+
:disabled="confirmButtonDisabled || confirmLoading"
|
|
35
|
+
@click="$emit('confirmed')"
|
|
36
|
+
>
|
|
37
|
+
<v-progress-circular
|
|
38
|
+
v-if="confirmLoading"
|
|
39
|
+
size="16"
|
|
40
|
+
width="2"
|
|
41
|
+
indeterminate
|
|
42
|
+
class="mr-2"
|
|
43
|
+
/>
|
|
44
|
+
{{ confirmButtonLabel }}
|
|
45
|
+
</v-btn>
|
|
46
|
+
</div>
|
|
40
47
|
</template>
|
|
41
48
|
</CustomDialog>
|
|
42
49
|
</template>
|
|
@@ -85,3 +92,10 @@ const props = defineProps({
|
|
|
85
92
|
}
|
|
86
93
|
});
|
|
87
94
|
</script>
|
|
95
|
+
|
|
96
|
+
<style scoped>
|
|
97
|
+
.confirm-dialog-action {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex: 1 1 0;
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -36,16 +36,26 @@ const showProp = toRef(props,'show'); // react to prop
|
|
|
36
36
|
watch(showProp, (value) => {
|
|
37
37
|
dialogActive.value = Boolean(value);
|
|
38
38
|
}, { immediate: true });
|
|
39
|
+
|
|
40
|
+
// Esc and outside click close the v-dialog by setting its v-model to false; tell the parent
|
|
41
|
+
// (which still has show=true) exactly once. When the parent closes via show=false, no emit.
|
|
42
|
+
watch(dialogActive, (active) => {
|
|
43
|
+
if (!active && props.show) {
|
|
44
|
+
emit('canceled');
|
|
45
|
+
}
|
|
46
|
+
});
|
|
39
47
|
</script>
|
|
40
48
|
|
|
41
49
|
<template>
|
|
42
50
|
<v-dialog
|
|
43
51
|
v-model="dialogActive"
|
|
44
52
|
:width="width"
|
|
45
|
-
@click:outside="emit('canceled')"
|
|
46
53
|
>
|
|
47
54
|
<template #default="{}">
|
|
48
|
-
<v-card
|
|
55
|
+
<v-card
|
|
56
|
+
v-if="dialogActive"
|
|
57
|
+
class="custom-dialog-card"
|
|
58
|
+
>
|
|
49
59
|
<v-toolbar color="primary" theme="dark">
|
|
50
60
|
<slot name="header">
|
|
51
61
|
<div class="dialog-toolbar">
|
|
@@ -61,7 +71,7 @@ watch(showProp, (value) => {
|
|
|
61
71
|
</div>
|
|
62
72
|
</slot>
|
|
63
73
|
</v-toolbar>
|
|
64
|
-
<v-card-text class="mt-8 mx-4">
|
|
74
|
+
<v-card-text class="custom-dialog-content mt-8 mx-4">
|
|
65
75
|
<slot name="content">
|
|
66
76
|
{{ text }}
|
|
67
77
|
</slot>
|
|
@@ -75,6 +85,18 @@ watch(showProp, (value) => {
|
|
|
75
85
|
</template>
|
|
76
86
|
|
|
77
87
|
<style scoped>
|
|
88
|
+
.custom-dialog-card {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
max-height: min(90vh, calc(100vh - 48px));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.custom-dialog-content {
|
|
95
|
+
flex: 1 1 auto;
|
|
96
|
+
min-height: 0;
|
|
97
|
+
overflow-y: auto;
|
|
98
|
+
}
|
|
99
|
+
|
|
78
100
|
.dialog-toolbar {
|
|
79
101
|
display: flex;
|
|
80
102
|
align-items: center;
|
|
@@ -82,6 +104,12 @@ watch(showProp, (value) => {
|
|
|
82
104
|
position: relative;
|
|
83
105
|
width: 100%;
|
|
84
106
|
}
|
|
107
|
+
|
|
108
|
+
.v-toolbar,
|
|
109
|
+
.v-card-actions {
|
|
110
|
+
flex: 0 0 auto;
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
.close-btn {
|
|
86
114
|
margin-left: auto;
|
|
87
115
|
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
|
3
|
+
import CustomDialog from '@/components/base/CustomDialog.vue'
|
|
4
|
+
import { filterIcons, loadMdiIcons } from '@/utils/mdiIcons'
|
|
5
|
+
import type { MdiIconMeta } from '@/utils/mdiIcons'
|
|
6
|
+
|
|
7
|
+
const ICONS_PER_ROW = 8
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
show: boolean
|
|
11
|
+
modelValue?: string
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const emit = defineEmits<{
|
|
15
|
+
(e: 'selected', icon: string): void
|
|
16
|
+
(e: 'canceled'): void
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const icons = ref<MdiIconMeta[]>([])
|
|
20
|
+
const loading = ref(false)
|
|
21
|
+
const loadFailed = ref(false)
|
|
22
|
+
const searchInput = ref<string | null>('')
|
|
23
|
+
const query = ref('')
|
|
24
|
+
const manualName = ref('')
|
|
25
|
+
|
|
26
|
+
let debounceTimer: ReturnType<typeof setTimeout> | undefined
|
|
27
|
+
|
|
28
|
+
watch(searchInput, (value) => {
|
|
29
|
+
clearTimeout(debounceTimer)
|
|
30
|
+
debounceTimer = setTimeout(() => {
|
|
31
|
+
query.value = value ?? ''
|
|
32
|
+
}, 150)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
onBeforeUnmount(() => clearTimeout(debounceTimer))
|
|
36
|
+
|
|
37
|
+
async function load() {
|
|
38
|
+
loading.value = true
|
|
39
|
+
loadFailed.value = false
|
|
40
|
+
try {
|
|
41
|
+
icons.value = await loadMdiIcons()
|
|
42
|
+
} catch {
|
|
43
|
+
loadFailed.value = true
|
|
44
|
+
} finally {
|
|
45
|
+
loading.value = false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
watch(
|
|
50
|
+
() => props.show,
|
|
51
|
+
(visible) => {
|
|
52
|
+
if (!visible) return
|
|
53
|
+
searchInput.value = ''
|
|
54
|
+
query.value = ''
|
|
55
|
+
manualName.value = ''
|
|
56
|
+
if (icons.value.length === 0) load()
|
|
57
|
+
},
|
|
58
|
+
{ immediate: true },
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
const rows = computed(() => {
|
|
62
|
+
const filtered = filterIcons(icons.value, query.value)
|
|
63
|
+
const result: { id: number; icons: MdiIconMeta[] }[] = []
|
|
64
|
+
for (let i = 0; i < filtered.length; i += ICONS_PER_ROW) {
|
|
65
|
+
result.push({ id: i, icons: filtered.slice(i, i + ICONS_PER_ROW) })
|
|
66
|
+
}
|
|
67
|
+
return result
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
function select(name: string) {
|
|
71
|
+
emit('selected', `mdi-${name}`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function useManualName() {
|
|
75
|
+
const name = manualName.value.trim()
|
|
76
|
+
if (!name) return
|
|
77
|
+
emit('selected', name.startsWith('mdi-') ? name : `mdi-${name}`)
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<template>
|
|
82
|
+
<CustomDialog
|
|
83
|
+
:show="show"
|
|
84
|
+
title="Select icon"
|
|
85
|
+
width="720"
|
|
86
|
+
hide-actions
|
|
87
|
+
@canceled="emit('canceled')"
|
|
88
|
+
>
|
|
89
|
+
<template #content>
|
|
90
|
+
<div v-if="loading" class="d-flex justify-center pa-8">
|
|
91
|
+
<v-progress-circular indeterminate color="primary" />
|
|
92
|
+
</div>
|
|
93
|
+
<div v-else-if="loadFailed">
|
|
94
|
+
<v-alert type="warning" variant="tonal" class="mb-4">
|
|
95
|
+
Icon list could not be loaded. Enter an icon name instead.
|
|
96
|
+
</v-alert>
|
|
97
|
+
<div class="d-flex align-center ga-2">
|
|
98
|
+
<v-text-field
|
|
99
|
+
v-model="manualName"
|
|
100
|
+
placeholder="mdi-docker"
|
|
101
|
+
variant="outlined"
|
|
102
|
+
density="compact"
|
|
103
|
+
hide-details
|
|
104
|
+
@keyup.enter="useManualName"
|
|
105
|
+
/>
|
|
106
|
+
<v-btn color="primary" :disabled="!manualName.trim()" @click="useManualName">Use</v-btn>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<div v-else>
|
|
110
|
+
<v-text-field
|
|
111
|
+
v-model="searchInput"
|
|
112
|
+
placeholder="Search icons"
|
|
113
|
+
aria-label="Search icons"
|
|
114
|
+
prepend-inner-icon="mdi-magnify"
|
|
115
|
+
variant="outlined"
|
|
116
|
+
density="compact"
|
|
117
|
+
clearable
|
|
118
|
+
autofocus
|
|
119
|
+
hide-details
|
|
120
|
+
class="mb-4"
|
|
121
|
+
/>
|
|
122
|
+
<v-virtual-scroll :items="rows" :height="320" :item-height="48" item-key="id">
|
|
123
|
+
<template #default="{ item }">
|
|
124
|
+
<div class="icon-row">
|
|
125
|
+
<v-btn
|
|
126
|
+
v-for="icon in item.icons"
|
|
127
|
+
:key="icon.name"
|
|
128
|
+
:icon="`mdi-${icon.name}`"
|
|
129
|
+
:color="modelValue === `mdi-${icon.name}` ? 'primary' : undefined"
|
|
130
|
+
:variant="modelValue === `mdi-${icon.name}` ? 'flat' : 'text'"
|
|
131
|
+
@click="select(icon.name)"
|
|
132
|
+
>
|
|
133
|
+
<v-icon :icon="`mdi-${icon.name}`" />
|
|
134
|
+
<v-tooltip activator="parent" location="top">mdi-{{ icon.name }}</v-tooltip>
|
|
135
|
+
</v-btn>
|
|
136
|
+
</div>
|
|
137
|
+
</template>
|
|
138
|
+
</v-virtual-scroll>
|
|
139
|
+
<div v-if="rows.length === 0" class="text-center text-medium-emphasis pa-4">
|
|
140
|
+
No icons found
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
</CustomDialog>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<style scoped>
|
|
148
|
+
.icon-row {
|
|
149
|
+
display: grid;
|
|
150
|
+
grid-template-columns: repeat(8, 1fr);
|
|
151
|
+
justify-items: center;
|
|
152
|
+
height: 48px;
|
|
153
|
+
align-items: center;
|
|
154
|
+
}
|
|
155
|
+
</style>
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<base-material-card>
|
|
3
|
+
<template #heading>
|
|
4
|
+
<overview-heading text="Capabilities" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<no-item-available-note
|
|
8
|
+
v-if="capabilities.length === 0"
|
|
9
|
+
item="Capability"
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
<v-data-table
|
|
13
|
+
v-else
|
|
14
|
+
:headers="headers"
|
|
15
|
+
:items="capabilities"
|
|
16
|
+
item-value="id"
|
|
17
|
+
show-expand
|
|
18
|
+
v-model:expanded="expanded"
|
|
19
|
+
@click:row="onRowClick"
|
|
20
|
+
>
|
|
21
|
+
<template #item.logo="{ item }">
|
|
22
|
+
<v-icon>{{ item.logo }}</v-icon>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<template #item.capabilityClass="{ item }">
|
|
26
|
+
{{ item.capabilityClass === 'DeploymentCapability' ? 'Deployment' : 'Base configuration' }}
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<template #item.type="{ item }">
|
|
30
|
+
<v-chip
|
|
31
|
+
v-for="type in item.type"
|
|
32
|
+
:key="type"
|
|
33
|
+
class="mr-1"
|
|
34
|
+
size="small"
|
|
35
|
+
>
|
|
36
|
+
{{ type }}
|
|
37
|
+
</v-chip>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<template #item.supportedDeploymentTypes="{ item }">
|
|
41
|
+
<template v-if="item.capabilityClass === 'DeploymentCapability' && item.supportedDeploymentTypes?.length">
|
|
42
|
+
<v-chip
|
|
43
|
+
v-for="deploymentType in item.supportedDeploymentTypes"
|
|
44
|
+
:key="deploymentType"
|
|
45
|
+
class="mr-1"
|
|
46
|
+
size="small"
|
|
47
|
+
>
|
|
48
|
+
{{ deploymentType }}
|
|
49
|
+
</v-chip>
|
|
50
|
+
</template>
|
|
51
|
+
<template v-else>
|
|
52
|
+
–
|
|
53
|
+
</template>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<template #item.installCount="{ item }">
|
|
57
|
+
{{ capabilitiesStore.installCountOfCapability(item.id) }} device(s)
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<template #item.deleteAction="{ item }">
|
|
61
|
+
<v-tooltip
|
|
62
|
+
:disabled="capabilitiesStore.installCountOfCapability(item.id) === 0"
|
|
63
|
+
location="top"
|
|
64
|
+
>
|
|
65
|
+
<template #activator="{ props: tooltipProps }">
|
|
66
|
+
<span v-bind="tooltipProps">
|
|
67
|
+
<v-btn
|
|
68
|
+
prepend-icon="mdi-delete"
|
|
69
|
+
size="small"
|
|
70
|
+
color="error"
|
|
71
|
+
:disabled="capabilitiesStore.installCountOfCapability(item.id) > 0"
|
|
72
|
+
@click.stop="capabilityToDelete = item"
|
|
73
|
+
>
|
|
74
|
+
Delete
|
|
75
|
+
</v-btn>
|
|
76
|
+
</span>
|
|
77
|
+
</template>
|
|
78
|
+
Installed on {{ capabilitiesStore.installCountOfCapability(item.id) }} device(s). Uninstall it first.
|
|
79
|
+
</v-tooltip>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<template #expanded-row="{ columns, item }">
|
|
83
|
+
<tr>
|
|
84
|
+
<td
|
|
85
|
+
:colspan="columns.length"
|
|
86
|
+
class="expanded-actions-cell"
|
|
87
|
+
>
|
|
88
|
+
<table class="action-details-table">
|
|
89
|
+
<thead>
|
|
90
|
+
<tr>
|
|
91
|
+
<th>Action type</th>
|
|
92
|
+
<th>Repository</th>
|
|
93
|
+
<th>Branch</th>
|
|
94
|
+
<th>Playbook</th>
|
|
95
|
+
</tr>
|
|
96
|
+
</thead>
|
|
97
|
+
<tbody>
|
|
98
|
+
<tr
|
|
99
|
+
v-for="[actionType, action] in Object.entries(item.actions ?? {})"
|
|
100
|
+
:key="actionType"
|
|
101
|
+
>
|
|
102
|
+
<td>{{ actionType }}</td>
|
|
103
|
+
<td>{{ action.repo }}</td>
|
|
104
|
+
<td>{{ action.ref }}</td>
|
|
105
|
+
<td>{{ action.playbook }}</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
</template>
|
|
112
|
+
</v-data-table>
|
|
113
|
+
|
|
114
|
+
<ConfirmDialog
|
|
115
|
+
:show="capabilityToDelete !== null"
|
|
116
|
+
attention
|
|
117
|
+
title="Delete capability"
|
|
118
|
+
:text="`Delete capability '${capabilityToDelete?.name}'?`"
|
|
119
|
+
confirm-button-label="Delete"
|
|
120
|
+
cancel-button-label="Cancel"
|
|
121
|
+
:confirm-loading="deleting"
|
|
122
|
+
@canceled="capabilityToDelete = null"
|
|
123
|
+
@confirmed="onDeleteConfirmed"
|
|
124
|
+
/>
|
|
125
|
+
</base-material-card>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script setup lang="ts">
|
|
129
|
+
import { computed, ref } from 'vue';
|
|
130
|
+
import { useToast } from 'vue-toast-notification';
|
|
131
|
+
import logRequestError from '@/api/restApiHelper';
|
|
132
|
+
import ConfirmDialog from '@/components/base/ConfirmDialog.vue';
|
|
133
|
+
import NoItemAvailableNote from '@/components/base/NoItemAvailableNote.vue';
|
|
134
|
+
import OverviewHeading from '@/components/base/OverviewHeading.vue';
|
|
135
|
+
import { CapabilityInUseError, useCapabilitiesStore } from '@/stores/capabilitiesStore';
|
|
136
|
+
|
|
137
|
+
const $toast = useToast();
|
|
138
|
+
const capabilitiesStore = useCapabilitiesStore();
|
|
139
|
+
|
|
140
|
+
const capabilityToDelete = ref<any>(null);
|
|
141
|
+
const deleting = ref(false);
|
|
142
|
+
const expanded = ref<Array<string | number>>([]);
|
|
143
|
+
|
|
144
|
+
const capabilities = computed(() => capabilitiesStore.capabilities);
|
|
145
|
+
|
|
146
|
+
const headers = [
|
|
147
|
+
{ title: '', key: 'data-table-expand', sortable: false },
|
|
148
|
+
{ title: 'Logo', key: 'logo', sortable: false },
|
|
149
|
+
{ title: 'Name', key: 'name' },
|
|
150
|
+
{ title: 'Class', key: 'capabilityClass' },
|
|
151
|
+
{ title: 'Types', key: 'type', sortable: false },
|
|
152
|
+
{ title: 'Deployment types', key: 'supportedDeploymentTypes', sortable: false },
|
|
153
|
+
{ title: 'In use', key: 'installCount', sortable: false },
|
|
154
|
+
{ title: '', key: 'deleteAction', sortable: false },
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
function onRowClick(_event: MouseEvent, { item }: { item: { id: string | number } }) {
|
|
158
|
+
expanded.value = expanded.value.includes(item.id)
|
|
159
|
+
? expanded.value.filter((id) => id !== item.id)
|
|
160
|
+
: [...expanded.value, item.id];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function onDeleteConfirmed() {
|
|
164
|
+
const capability = capabilityToDelete.value;
|
|
165
|
+
if (!capability) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
deleting.value = true;
|
|
169
|
+
try {
|
|
170
|
+
await capabilitiesStore.deleteCapability(capability.id);
|
|
171
|
+
$toast.success('Capability deleted');
|
|
172
|
+
} catch (e) {
|
|
173
|
+
if (e instanceof CapabilityInUseError) {
|
|
174
|
+
$toast.error(`Capability is installed on ${e.installCount} device(s) and cannot be deleted`);
|
|
175
|
+
} else {
|
|
176
|
+
logRequestError(e);
|
|
177
|
+
$toast.error('Failed to delete capability');
|
|
178
|
+
}
|
|
179
|
+
} finally {
|
|
180
|
+
deleting.value = false;
|
|
181
|
+
capabilityToDelete.value = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<style scoped>
|
|
187
|
+
.action-details-table {
|
|
188
|
+
border-collapse: collapse;
|
|
189
|
+
max-width: 100%;
|
|
190
|
+
margin: 8px 0 8px 48px;
|
|
191
|
+
text-align: left;
|
|
192
|
+
white-space: nowrap;
|
|
193
|
+
width: auto;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.expanded-actions-cell {
|
|
197
|
+
background-color: rgba(var(--v-theme-on-surface), 0.04);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.action-details-table th,
|
|
201
|
+
.action-details-table td {
|
|
202
|
+
border: 0;
|
|
203
|
+
padding: 4px 8px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.action-details-table th {
|
|
207
|
+
font-weight: 700;
|
|
208
|
+
}
|
|
209
|
+
</style>
|