@eclipse-slm/ui 1.5.0-snapshot.883 → 1.5.0-snapshot.956
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 +1 -0
- package/package.json +6 -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/resource-management/resource-management-client.ts +0 -2
- package/src/app/navigation.ts +14 -0
- package/src/app/routes.ts +17 -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/capabilities/CapabilitiesTable.vue +3 -3
- package/src/components/capabilities/CapabilityActionCard.vue +15 -14
- package/src/components/capabilities/CapabilityCreateForm.vue +33 -2
- package/src/components/capabilities/CapabilityImportDialog.vue +16 -7
- package/src/components/capabilities/capabilityForm.ts +65 -22
- package/src/components/jobs/JobDetail.vue +395 -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 +46 -0
- package/src/docker/entrypoint.sh +2 -2
- package/src/localisation/en.json +90 -0
- package/src/pages/AdminAnsibleServicePage.vue +111 -0
- package/src/pages/AdminProfilersPage.vue +73 -0
- package/src/pages/DashboardPage.vue +28 -56
- package/src/pages/JobDetailPage.vue +7 -0
- package/src/stores/ansibleAdminStore.ts +206 -0
- package/src/stores/environmentStore.ts +3 -3
- package/src/stores/jobsStore.ts +39 -39
- 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/utils/jobStatus.ts +63 -0
- package/vite/dist/apiClients.d.ts +1 -1
- package/vite/dist/apiClients.js +1 -0
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
:footer-props="{'items-per-page-options':[jobCount]}"
|
|
119
119
|
:headers="DataTableHeaders"
|
|
120
120
|
item-key="id"
|
|
121
|
-
:items="
|
|
121
|
+
:items="latestJobs"
|
|
122
122
|
style="border-bottom:1px solid #E0E0E0"
|
|
123
123
|
>
|
|
124
124
|
<template #header.id="{ column }">
|
|
@@ -132,17 +132,17 @@
|
|
|
132
132
|
</v-icon>
|
|
133
133
|
{{ column.title }}
|
|
134
134
|
</template>
|
|
135
|
-
<template #header.
|
|
135
|
+
<template #header.startedAt="{ column }">
|
|
136
136
|
<v-icon size="small">
|
|
137
137
|
mdi-clock-start
|
|
138
138
|
</v-icon> {{ column.title }}
|
|
139
139
|
</template>
|
|
140
|
-
<template #header.
|
|
140
|
+
<template #header.finishedAt="{ column }">
|
|
141
141
|
<v-icon size="small">
|
|
142
142
|
mdi-clock-end
|
|
143
143
|
</v-icon> {{ column.title }}
|
|
144
144
|
</template>
|
|
145
|
-
<template #header.
|
|
145
|
+
<template #header.duration="{ column }">
|
|
146
146
|
<v-icon size="small">
|
|
147
147
|
mdi-alarm
|
|
148
148
|
</v-icon> {{ column.title }}
|
|
@@ -154,59 +154,25 @@
|
|
|
154
154
|
</template>
|
|
155
155
|
|
|
156
156
|
<template #item.id="{item}">
|
|
157
|
-
{
|
|
157
|
+
<router-link :to="`/jobs/${item.id}`">
|
|
158
|
+
{{ item.id.substring(0, 8) }}
|
|
159
|
+
</router-link>
|
|
158
160
|
</template>
|
|
159
161
|
|
|
160
|
-
<template #item.
|
|
161
|
-
{{ item.
|
|
162
|
+
<template #item.startedAt="{item}">
|
|
163
|
+
{{ getFormattedDate(item.startedAt) }}
|
|
162
164
|
</template>
|
|
163
165
|
|
|
164
|
-
<template #item.
|
|
165
|
-
{{ getFormattedDate(item.
|
|
166
|
+
<template #item.finishedAt="{item}">
|
|
167
|
+
{{ getFormattedDate(item.finishedAt) }}
|
|
166
168
|
</template>
|
|
167
169
|
|
|
168
|
-
<template #item.
|
|
169
|
-
{{
|
|
170
|
+
<template #item.duration="{item}">
|
|
171
|
+
{{ formatDuration(jobDurationMs(item)) }}
|
|
170
172
|
</template>
|
|
171
173
|
|
|
172
174
|
<template #item.status="{item}">
|
|
173
|
-
<
|
|
174
|
-
{{ getFormattedTime(new Date().getTime() - new Date(item.started).getTime()) }}
|
|
175
|
-
</span>
|
|
176
|
-
<span v-else>
|
|
177
|
-
{{ getFormattedTime(new Date(item.finished).getTime() - new Date(item.started).getTime()) }}
|
|
178
|
-
</span>
|
|
179
|
-
<v-tooltip location="right">
|
|
180
|
-
<template #activator="{ props }">
|
|
181
|
-
<v-icon
|
|
182
|
-
v-if="item.status === 'successful'"
|
|
183
|
-
v-bind="props"
|
|
184
|
-
>
|
|
185
|
-
mdi-check-circle-outline
|
|
186
|
-
</v-icon>
|
|
187
|
-
<v-icon
|
|
188
|
-
v-if="item.status === 'running'"
|
|
189
|
-
v-bind="props"
|
|
190
|
-
>
|
|
191
|
-
mdi-run-fast
|
|
192
|
-
</v-icon>
|
|
193
|
-
<v-icon
|
|
194
|
-
v-else-if="item.status === 'pending'"
|
|
195
|
-
v-bind="props"
|
|
196
|
-
>
|
|
197
|
-
mdi-timer-sand-empty
|
|
198
|
-
</v-icon>
|
|
199
|
-
<v-icon
|
|
200
|
-
v-else-if="item.status === 'canceled' || item.status === 'failed'|| item.status === 'error'"
|
|
201
|
-
v-bind="props"
|
|
202
|
-
>
|
|
203
|
-
mdi-alert-circle-outline
|
|
204
|
-
</v-icon>
|
|
205
|
-
</template>
|
|
206
|
-
<span>
|
|
207
|
-
{{ item.status }}
|
|
208
|
-
</span>
|
|
209
|
-
</v-tooltip>
|
|
175
|
+
<job-status-chip :status="item.status" />
|
|
210
176
|
</template>
|
|
211
177
|
</v-data-table>
|
|
212
178
|
<v-card-subtitle>Total Job Count: {{ jobs.length }}</v-card-subtitle>
|
|
@@ -232,6 +198,8 @@ import {useServiceInstancesStore} from "@/stores/serviceInstancesStore";
|
|
|
232
198
|
import {useResourceClustersStore} from "@/stores/resourceClustersStore";
|
|
233
199
|
import {useUserStore} from "@/stores/userStore";
|
|
234
200
|
import {useJobsStore} from "@/stores/jobsStore";
|
|
201
|
+
import JobStatusChip from "@/components/jobs/JobStatusChip.vue";
|
|
202
|
+
import {formatDuration, jobDurationMs} from "@/utils/jobStatus";
|
|
235
203
|
import {useResourceDevicesStore} from "@/stores/resourceDevicesStore";
|
|
236
204
|
|
|
237
205
|
export default {
|
|
@@ -239,6 +207,7 @@ export default {
|
|
|
239
207
|
components: {
|
|
240
208
|
DashboardResourceStatistics,
|
|
241
209
|
NoItemAvailableNote,
|
|
210
|
+
JobStatusChip,
|
|
242
211
|
},
|
|
243
212
|
|
|
244
213
|
setup(){
|
|
@@ -248,12 +217,12 @@ export default {
|
|
|
248
217
|
const userStore = useUserStore();
|
|
249
218
|
const jobsStore = useJobsStore();
|
|
250
219
|
const resourceDevicesStore = useResourceDevicesStore();
|
|
251
|
-
return {serviceInstancesStore, serviceOfferingsStore, resourceClustersStore, userStore, jobsStore, resourceDevicesStore};
|
|
220
|
+
return {serviceInstancesStore, serviceOfferingsStore, resourceClustersStore, userStore, jobsStore, resourceDevicesStore, formatDuration, jobDurationMs};
|
|
252
221
|
},
|
|
253
222
|
|
|
254
223
|
data () {
|
|
255
224
|
return {
|
|
256
|
-
sortBy: [{key: '
|
|
225
|
+
sortBy: [{key: 'startedAt', order: 'desc'}],
|
|
257
226
|
sortDesc: true,
|
|
258
227
|
jobCount: 5,
|
|
259
228
|
dataCompletedTasksChart: {
|
|
@@ -329,15 +298,18 @@ export default {
|
|
|
329
298
|
jobs() {
|
|
330
299
|
return this.jobsStore.jobs
|
|
331
300
|
},
|
|
301
|
+
latestJobs() {
|
|
302
|
+
return this.jobsStore.jobs.slice(0, this.jobCount)
|
|
303
|
+
},
|
|
332
304
|
|
|
333
305
|
DataTableHeaders () {
|
|
334
306
|
return [
|
|
335
|
-
{ title: 'ID',
|
|
336
|
-
{ title: 'Name',
|
|
337
|
-
{ title: 'Started at',
|
|
338
|
-
{ title: 'Finished at',
|
|
339
|
-
{ title: 'Duration',
|
|
340
|
-
{ title: 'Status',
|
|
307
|
+
{ title: 'ID', key: 'id', sortable: true },
|
|
308
|
+
{ title: 'Name', key: 'name', value: item => item.serviceName || item.playbook, sortable: true },
|
|
309
|
+
{ title: 'Started at', key: 'startedAt', sortable: true },
|
|
310
|
+
{ title: 'Finished at', key: 'finishedAt', sortable: true },
|
|
311
|
+
{ title: 'Duration', key: 'duration', sortable: false },
|
|
312
|
+
{ title: 'Status', key: 'status', sortable: true },
|
|
341
313
|
]
|
|
342
314
|
},
|
|
343
315
|
},
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {defineStore} from "pinia";
|
|
2
|
+
import AnsibleServiceClient from "@/api/ansible-service/ansible-service-client";
|
|
3
|
+
import type {
|
|
4
|
+
AnsibleImageDTO,
|
|
5
|
+
AnsibleJobDTO,
|
|
6
|
+
AnsibleJobStatus,
|
|
7
|
+
AnsibleServiceStatusDTO,
|
|
8
|
+
} from "@/api/ansible-service/client";
|
|
9
|
+
import logRequestError from "@/api/restApiHelper";
|
|
10
|
+
import ApiState from "@/api/apiState";
|
|
11
|
+
|
|
12
|
+
const POLL_INTERVAL_MS = 5000;
|
|
13
|
+
const PULL_POLL_INTERVAL_MS = 3000;
|
|
14
|
+
|
|
15
|
+
export type SinceRange = '1h' | '24h' | '7d' | '30d' | 'all';
|
|
16
|
+
|
|
17
|
+
const SINCE_MS: Record<Exclude<SinceRange, 'all'>, number> = {
|
|
18
|
+
'1h': 3600_000,
|
|
19
|
+
'24h': 24 * 3600_000,
|
|
20
|
+
'7d': 7 * 24 * 3600_000,
|
|
21
|
+
'30d': 30 * 24 * 3600_000,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
25
|
+
|
|
26
|
+
export function isUuid(value: string): boolean {
|
|
27
|
+
return UUID_PATTERN.test(value.trim());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AdminJobFilter {
|
|
31
|
+
status: AnsibleJobStatus | null,
|
|
32
|
+
resourceId: string,
|
|
33
|
+
user: string,
|
|
34
|
+
since: SinceRange,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type AdminNoticeKind =
|
|
38
|
+
'pull-started' | 'pull-success' | 'pull-failed' | 'pull-conflict' | 'pull-not-allowed' | 'pull-unavailable' | 'pull-error';
|
|
39
|
+
|
|
40
|
+
export interface AdminNotice {
|
|
41
|
+
id: number,
|
|
42
|
+
kind: AdminNoticeKind,
|
|
43
|
+
image: string,
|
|
44
|
+
detail?: string,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface AnsibleAdminStoreState {
|
|
48
|
+
apiState: number,
|
|
49
|
+
jobs: AnsibleJobDTO[],
|
|
50
|
+
status: AnsibleServiceStatusDTO | null,
|
|
51
|
+
images: AnsibleImageDTO[],
|
|
52
|
+
filter: AdminJobFilter,
|
|
53
|
+
watchedImages: string[],
|
|
54
|
+
notice: AdminNotice | null,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let pollTimer: ReturnType<typeof setInterval> | null = null;
|
|
58
|
+
let pullTimer: ReturnType<typeof setInterval> | null = null;
|
|
59
|
+
let noticeCounter = 0;
|
|
60
|
+
|
|
61
|
+
export const useAnsibleAdminStore = defineStore('ansibleAdminStore', {
|
|
62
|
+
state: (): AnsibleAdminStoreState => ({
|
|
63
|
+
apiState: ApiState.INIT,
|
|
64
|
+
jobs: [],
|
|
65
|
+
status: null,
|
|
66
|
+
images: [],
|
|
67
|
+
filter: {status: null, resourceId: '', user: '', since: '24h'},
|
|
68
|
+
watchedImages: [],
|
|
69
|
+
notice: null,
|
|
70
|
+
}),
|
|
71
|
+
|
|
72
|
+
actions: {
|
|
73
|
+
async loadStatus() {
|
|
74
|
+
try {
|
|
75
|
+
this.status = (await AnsibleServiceClient.adminApi.getStatus()).data ?? null;
|
|
76
|
+
} catch (e) {
|
|
77
|
+
logRequestError(e);
|
|
78
|
+
throw e;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
async loadImages() {
|
|
83
|
+
try {
|
|
84
|
+
this.images = (await AnsibleServiceClient.adminApi.getImages()).data ?? [];
|
|
85
|
+
} catch (e) {
|
|
86
|
+
logRequestError(e);
|
|
87
|
+
throw e;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
async loadAdminJobs(filter: AdminJobFilter = this.filter) {
|
|
92
|
+
this.filter = {...filter};
|
|
93
|
+
const resourceId = filter.resourceId.trim();
|
|
94
|
+
const user = filter.user.trim();
|
|
95
|
+
const since = filter.since === 'all'
|
|
96
|
+
? undefined
|
|
97
|
+
: new Date(Date.now() - SINCE_MS[filter.since]).toISOString();
|
|
98
|
+
try {
|
|
99
|
+
const result = await AnsibleServiceClient.jobsApi.getJobs(
|
|
100
|
+
resourceId && isUuid(resourceId) ? resourceId : undefined,
|
|
101
|
+
filter.status ?? undefined,
|
|
102
|
+
user || undefined,
|
|
103
|
+
since);
|
|
104
|
+
this.jobs = [...(result.data ?? [])].sort(
|
|
105
|
+
(a, b) => new Date(b.createdAt ?? 0).getTime() - new Date(a.createdAt ?? 0).getTime());
|
|
106
|
+
} catch (e) {
|
|
107
|
+
logRequestError(e);
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
async cancelJob(jobId: string) {
|
|
113
|
+
await AnsibleServiceClient.jobsApi.cancelJob(jobId);
|
|
114
|
+
await this.loadAdminJobs();
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
async refreshAll() {
|
|
118
|
+
this.apiState = this.apiState === ApiState.INIT ? ApiState.LOADING : ApiState.UPDATING;
|
|
119
|
+
const results = await Promise.allSettled([this.loadAdminJobs(), this.loadStatus(), this.loadImages()]);
|
|
120
|
+
const failed = results.every(r => r.status === 'rejected');
|
|
121
|
+
this.apiState = failed ? ApiState.ERROR : ApiState.LOADED;
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
/** Starts the periodic refresh; to be called when the admin page is shown. */
|
|
125
|
+
startPolling() {
|
|
126
|
+
this.refreshAll().catch(() => undefined);
|
|
127
|
+
if (pollTimer === null) {
|
|
128
|
+
pollTimer = setInterval(() => {
|
|
129
|
+
this.refreshAll().catch(() => undefined);
|
|
130
|
+
}, POLL_INTERVAL_MS);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/** Stops all timers; to be called when the admin page is left. */
|
|
135
|
+
stopPolling() {
|
|
136
|
+
if (pollTimer !== null) {
|
|
137
|
+
clearInterval(pollTimer);
|
|
138
|
+
pollTimer = null;
|
|
139
|
+
}
|
|
140
|
+
if (pullTimer !== null) {
|
|
141
|
+
clearInterval(pullTimer);
|
|
142
|
+
pullTimer = null;
|
|
143
|
+
}
|
|
144
|
+
this.watchedImages = [];
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
pushNotice(kind: AdminNoticeKind, image: string, detail?: string) {
|
|
148
|
+
this.notice = {id: ++noticeCounter, kind, image, detail};
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
async pullImage(image: string) {
|
|
152
|
+
try {
|
|
153
|
+
await AnsibleServiceClient.adminApi.pullImage({image});
|
|
154
|
+
} catch (e: any) {
|
|
155
|
+
logRequestError(e);
|
|
156
|
+
const code = e?.response?.status;
|
|
157
|
+
const kind: AdminNoticeKind =
|
|
158
|
+
code === 409 ? 'pull-conflict'
|
|
159
|
+
: code === 400 ? 'pull-not-allowed'
|
|
160
|
+
: code === 503 ? 'pull-unavailable'
|
|
161
|
+
: 'pull-error';
|
|
162
|
+
this.pushNotice(kind, image, e?.response?.data?.message);
|
|
163
|
+
if (code === 409) {
|
|
164
|
+
this.watchPull(image);
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.pushNotice('pull-started', image);
|
|
169
|
+
this.watchPull(image);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/** Polls the images every 3 s until none of the watched images is pulling any more. */
|
|
173
|
+
watchPull(image: string) {
|
|
174
|
+
if (!this.watchedImages.includes(image)) {
|
|
175
|
+
this.watchedImages.push(image);
|
|
176
|
+
}
|
|
177
|
+
// reflect the running pull immediately
|
|
178
|
+
this.images = this.images.map(i => i.image === image ? {...i, pulling: true} : i);
|
|
179
|
+
if (pullTimer === null) {
|
|
180
|
+
pullTimer = setInterval(() => {
|
|
181
|
+
this.checkWatchedPulls().catch(() => undefined);
|
|
182
|
+
}, PULL_POLL_INTERVAL_MS);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
async checkWatchedPulls() {
|
|
187
|
+
await this.loadImages();
|
|
188
|
+
for (const name of [...this.watchedImages]) {
|
|
189
|
+
const image = this.images.find(i => i.image === name);
|
|
190
|
+
if (image && image.pulling) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
this.watchedImages = this.watchedImages.filter(n => n !== name);
|
|
194
|
+
if (image?.lastPullError) {
|
|
195
|
+
this.pushNotice('pull-failed', name, image.lastPullError);
|
|
196
|
+
} else {
|
|
197
|
+
this.pushNotice('pull-success', name);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (this.watchedImages.length === 0 && pullTimer !== null) {
|
|
201
|
+
clearInterval(pullTimer);
|
|
202
|
+
pullTimer = null;
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
}
|
|
206
|
+
});
|
|
@@ -14,13 +14,13 @@ export const useEnvStore = defineStore('envStore', () => {
|
|
|
14
14
|
const _platformManagementUrl = ref(import.meta.env.VITE_APP_PLATFORM_MANAGEMENT_URL || (isProduction ? '/__ENV_PLATFORM_MANAGEMENT_URL__PLACEHOLDER__/' : ''));
|
|
15
15
|
const _resourceManagementUrl = ref(import.meta.env.VITE_APP_RESOURCE_MANAGEMENT_URL || (isProduction ? '/__ENV_RESOURCE_MANAGEMENT_URL__PLACEHOLDER__/' : ''));
|
|
16
16
|
const _serviceManagementUrl = ref(import.meta.env.VITE_APP_SERVICE_MANAGEMENT_URL || (isProduction ? '/__ENV_SERVICE_MANAGEMENT_URL__PLACEHOLDER__/' : ''));
|
|
17
|
+
const _ansibleServiceUrl = ref(import.meta.env.VITE_APP_ANSIBLE_SERVICE_URL || (isProduction ? '/__ENV_ANSIBLE_SERVICE_URL__PLACEHOLDER__/' : ''));
|
|
17
18
|
const _catalogServiceUrl = ref(import.meta.env.VITE_APP_CATALOG_SERVICE_URL || (isProduction ? '/__ENV_CATALOG_SERVICE_URL__PLACEHOLDER__/' : ''));
|
|
18
19
|
|
|
19
20
|
const _keycloakUrl = ref(import.meta.env.VITE_APP_KEYCLOAK_URL || (isProduction ? '/__ENV_KEYCLOAK_URL__PLACEHOLDER__/' : ''));
|
|
20
21
|
const _keycloakRealm = ref(import.meta.env.VITE_APP_KEYCLOAK_REALM || (isProduction ? '/__ENV_KEYCLOAK_REALM__PLACEHOLDER__/' : ''));
|
|
21
22
|
const _keycloakClientId = ref(import.meta.env.VITE_APP_KEYCLOAK_CLIENT_ID || (isProduction ? '/__ENV_KEYCLOAK_CLIENT_ID__PLACEHOLDER__/' : ''));
|
|
22
23
|
|
|
23
|
-
const _awxUrl = ref(import.meta.env.VITE_APP_AWX_URL || (isProduction ? '/__ENV_AWX_URL__PLACEHOLDER__/' : ''));
|
|
24
24
|
|
|
25
25
|
const _basyxAasGuiUrl = ref(import.meta.env.VITE_APP_BASYX_AAS_GUI_URL || (isProduction ? '/__ENV_BASYX_AAS_GUI_URL__PLACEHOLDER__/' : ''));
|
|
26
26
|
|
|
@@ -34,13 +34,13 @@ export const useEnvStore = defineStore('envStore', () => {
|
|
|
34
34
|
const platformManagementUrl = computed(() => _platformManagementUrl.value);
|
|
35
35
|
const resourceManagementUrl = computed(() => _resourceManagementUrl.value);
|
|
36
36
|
const serviceManagementUrl = computed(() => _serviceManagementUrl.value);
|
|
37
|
+
const ansibleServiceUrl = computed(() => _ansibleServiceUrl.value);
|
|
37
38
|
const catalogServiceUrl = computed(() => _catalogServiceUrl.value);
|
|
38
39
|
|
|
39
40
|
const keycloakUrl = computed(() => _keycloakUrl.value);
|
|
40
41
|
const keycloakRealm = computed(() => _keycloakRealm.value);
|
|
41
42
|
const keycloakClientId = computed(() => _keycloakClientId.value);
|
|
42
43
|
|
|
43
|
-
const awxUrl = computed(() => _awxUrl.value);
|
|
44
44
|
|
|
45
45
|
const basyxAasGuiUrl = computed(() => _basyxAasGuiUrl.value);
|
|
46
46
|
|
|
@@ -51,11 +51,11 @@ export const useEnvStore = defineStore('envStore', () => {
|
|
|
51
51
|
notificationServiceUrl,
|
|
52
52
|
resourceManagementUrl,
|
|
53
53
|
serviceManagementUrl,
|
|
54
|
+
ansibleServiceUrl,
|
|
54
55
|
catalogServiceUrl,
|
|
55
56
|
keycloakUrl,
|
|
56
57
|
keycloakRealm,
|
|
57
58
|
keycloakClientId,
|
|
58
|
-
awxUrl,
|
|
59
59
|
basyxAasGuiUrl,
|
|
60
60
|
};
|
|
61
61
|
});
|
package/src/stores/jobsStore.ts
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
import {defineStore} from "pinia";
|
|
2
|
-
import
|
|
2
|
+
import AnsibleServiceClient from "@/api/ansible-service/ansible-service-client";
|
|
3
|
+
import type {AnsibleJobDTO} from "@/api/ansible-service/client";
|
|
3
4
|
import logRequestError from "@/api/restApiHelper";
|
|
4
5
|
import ApiState from "@/api/apiState";
|
|
6
|
+
import {isFinalJobStatus} from "@/utils/jobStatus";
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const POLL_INTERVAL_MS = 5000;
|
|
9
|
+
|
|
10
|
+
export interface JobsStoreState {
|
|
11
|
+
apiState: number,
|
|
12
|
+
jobs: AnsibleJobDTO[],
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
persist: true,
|
|
15
|
+
let pollTimer: ReturnType<typeof setInterval> | null = null;
|
|
15
16
|
|
|
17
|
+
export const useJobsStore = defineStore('jobsStore', {
|
|
16
18
|
state: (): JobsStoreState => ({
|
|
17
19
|
apiState: ApiState.INIT,
|
|
18
20
|
jobs: [],
|
|
19
|
-
jobs_running: [],
|
|
20
|
-
timeoutObject: null,
|
|
21
21
|
}),
|
|
22
22
|
|
|
23
|
-
getters: {
|
|
23
|
+
getters: {
|
|
24
|
+
activeJobs: (state) => state.jobs.filter(job => !isFinalJobStatus(job.status)),
|
|
25
|
+
},
|
|
24
26
|
|
|
25
27
|
actions: {
|
|
26
28
|
async getJobs() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
try {
|
|
30
|
+
const result = await AnsibleServiceClient.jobsApi.getJobs();
|
|
31
|
+
this.jobs = [...(result.data ?? [])].sort(
|
|
32
|
+
(a, b) => new Date(b.createdAt ?? 0).getTime() - new Date(a.createdAt ?? 0).getTime());
|
|
33
|
+
} catch (e) {
|
|
34
|
+
logRequestError(e);
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
this.updatePolling();
|
|
38
|
+
},
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}).catch(logRequestError)
|
|
40
|
+
/** Polls while at least one job is not finished; stops otherwise. */
|
|
41
|
+
updatePolling() {
|
|
42
|
+
const needed = this.jobs.some(job => !isFinalJobStatus(job.status));
|
|
43
|
+
if (needed && pollTimer === null) {
|
|
44
|
+
pollTimer = setInterval(() => {
|
|
45
|
+
this.getJobs().catch(() => undefined);
|
|
46
|
+
}, POLL_INTERVAL_MS);
|
|
47
|
+
} else if (!needed && pollTimer !== null) {
|
|
48
|
+
clearInterval(pollTimer);
|
|
49
|
+
pollTimer = null;
|
|
50
|
+
}
|
|
45
51
|
},
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.jobs_running.find(j => j.id === job.id).elapsed = elapsed;
|
|
51
|
-
})
|
|
53
|
+
async cancelJob(jobId: string) {
|
|
54
|
+
await AnsibleServiceClient.jobsApi.cancelJob(jobId);
|
|
55
|
+
await this.getJobs();
|
|
52
56
|
},
|
|
53
57
|
|
|
54
58
|
async updateStore() {
|
|
@@ -58,16 +62,12 @@ export const useJobsStore = defineStore('jobsStore', {
|
|
|
58
62
|
this.apiState = ApiState.UPDATING;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
return
|
|
62
|
-
this.getJobs(),
|
|
63
|
-
]).then(() => {
|
|
65
|
+
return this.getJobs().then(() => {
|
|
64
66
|
this.apiState = ApiState.LOADED;
|
|
65
|
-
console.log("jobsStore updated")
|
|
66
67
|
}).catch((e) => {
|
|
67
68
|
this.apiState = ApiState.ERROR;
|
|
68
|
-
console.log("Failed to update jobsStore: ", e)
|
|
69
|
+
console.log("Failed to update jobsStore: ", e);
|
|
69
70
|
});
|
|
70
71
|
},
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
|
-
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import ApiState from '@/api/apiState'
|
|
2
|
+
import {defineStore} from "pinia";
|
|
3
|
+
import ResourceManagementClient from "@/api/resource-management/resource-management-client";
|
|
4
|
+
import {Profiler, ProfilerDTOApi} from "@/api/resource-management/client";
|
|
5
|
+
|
|
6
|
+
interface ProfilersStoreState {
|
|
7
|
+
apiState: number,
|
|
8
|
+
|
|
9
|
+
profilers: Profiler[],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useProfilersStore = defineStore('profilersStore', {
|
|
13
|
+
persist: true,
|
|
14
|
+
state: (): ProfilersStoreState => ({
|
|
15
|
+
apiState: ApiState.INIT,
|
|
16
|
+
|
|
17
|
+
profilers: [],
|
|
18
|
+
}),
|
|
19
|
+
|
|
20
|
+
actions: {
|
|
21
|
+
async getProfilers() {
|
|
22
|
+
return await ResourceManagementClient.profilerApi.getProfiler()
|
|
23
|
+
.then(response => {
|
|
24
|
+
if (response) {
|
|
25
|
+
const receivedProfilers = response.data;
|
|
26
|
+
if (receivedProfilers === undefined) {
|
|
27
|
+
this.profilers = []
|
|
28
|
+
} else {
|
|
29
|
+
// Sort alphabetically
|
|
30
|
+
this.profilers = receivedProfilers.sort((a, b) => {
|
|
31
|
+
return a.name.localeCompare(b.name)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
async createProfiler(body: ProfilerDTOApi) {
|
|
39
|
+
await ResourceManagementClient.profilerApi.createProfiler(body)
|
|
40
|
+
await this.reloadAfterChange()
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async updateProfiler(profilerId: string, body: ProfilerDTOApi) {
|
|
44
|
+
await ResourceManagementClient.profilerApi.updateProfiler(profilerId, body)
|
|
45
|
+
await this.reloadAfterChange()
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
async deleteProfiler(profilerId: string) {
|
|
49
|
+
await ResourceManagementClient.profilerApi.deleteProfiler(profilerId)
|
|
50
|
+
await this.reloadAfterChange()
|
|
51
|
+
// A successful delete is authoritative even if the list reload failed or returned stale data.
|
|
52
|
+
this.profilers = this.profilers.filter(profiler => profiler.id !== profilerId)
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// The change already succeeded; a failed reload must not make it look failed (a retry would duplicate it)
|
|
56
|
+
async reloadAfterChange() {
|
|
57
|
+
try {
|
|
58
|
+
await this.getProfilers()
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.error('Failed to reload profilers after a successful change', e)
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
async updateStore() {
|
|
65
|
+
if (this.apiState === ApiState.INIT) {
|
|
66
|
+
this.apiState = ApiState.LOADING;
|
|
67
|
+
} else {
|
|
68
|
+
this.apiState = ApiState.UPDATING;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.getProfilers().then(() => {
|
|
72
|
+
this.apiState = ApiState.LOADED;
|
|
73
|
+
console.log("profilersStore updated")
|
|
74
|
+
}).catch((e) => {
|
|
75
|
+
this.apiState = ApiState.ERROR;
|
|
76
|
+
console.log("Failed to update profilersStore: ", e)
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -2,7 +2,7 @@ import ApiState from '@/api/apiState'
|
|
|
2
2
|
import {defineStore} from "pinia";
|
|
3
3
|
import ResourceManagementClient from "@/api/resource-management/resource-management-client";
|
|
4
4
|
import logRequestError from "@/api/restApiHelper";
|
|
5
|
-
import
|
|
5
|
+
import {JSONPath} from "jsonpath-plus";
|
|
6
6
|
import { Base64 } from "js-base64";
|
|
7
7
|
|
|
8
8
|
interface ResourceDevicesStoreState{
|
|
@@ -163,7 +163,7 @@ export const useResourceDevicesStore = defineStore('resourceDevicesStore', {
|
|
|
163
163
|
|
|
164
164
|
getSubmodelElementValueOfResourceSubmodel (resourceId, submodelIdShort, submodelElementJsonPath) {
|
|
165
165
|
try {
|
|
166
|
-
var value =
|
|
166
|
+
var value = JSONPath({path: submodelElementJsonPath, json: this.resourceAASValues[resourceId][submodelIdShort]["valuesOnlyMap"], wrap: true})[0];
|
|
167
167
|
if (value == undefined) {
|
|
168
168
|
value = "N/A";
|
|
169
169
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ApiState from '@/api/apiState.js'
|
|
2
|
-
|
|
2
|
+
type UUID = string;
|
|
3
3
|
import {defineStore} from "pinia";
|
|
4
4
|
import logRequestError from "@/api/restApiHelper";
|
|
5
5
|
import ServiceManagementClient from "@/api/service-management/service-management-client";
|