@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.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/package.json +6 -7
  3. package/src/api/ansible-service/ansible-service-client.ts +15 -0
  4. package/src/api/ansible-service/ansible-service-sse.ts +124 -0
  5. package/src/api/resource-management/resource-management-client.ts +0 -2
  6. package/src/app/navigation.ts +14 -0
  7. package/src/app/routes.ts +17 -0
  8. package/src/components/admin/ansible/AnsibleAdminImages.vue +113 -0
  9. package/src/components/admin/ansible/AnsibleAdminJobs.vue +179 -0
  10. package/src/components/admin/ansible/AnsibleAdminOperations.vue +124 -0
  11. package/src/components/capabilities/CapabilitiesTable.vue +3 -3
  12. package/src/components/capabilities/CapabilityActionCard.vue +15 -14
  13. package/src/components/capabilities/CapabilityCreateForm.vue +33 -2
  14. package/src/components/capabilities/CapabilityImportDialog.vue +16 -7
  15. package/src/components/capabilities/capabilityForm.ts +65 -22
  16. package/src/components/jobs/JobDetail.vue +395 -0
  17. package/src/components/jobs/JobStatusChip.vue +16 -0
  18. package/src/components/jobs/JobsOverview.vue +59 -72
  19. package/src/components/profilers/ProfilerDialog.vue +95 -0
  20. package/src/components/profilers/ProfilerForm.vue +102 -0
  21. package/src/components/profilers/ProfilersTable.vue +98 -0
  22. package/src/components/profilers/profilerForm.ts +46 -0
  23. package/src/docker/entrypoint.sh +2 -2
  24. package/src/localisation/en.json +90 -0
  25. package/src/pages/AdminAnsibleServicePage.vue +111 -0
  26. package/src/pages/AdminProfilersPage.vue +73 -0
  27. package/src/pages/DashboardPage.vue +28 -56
  28. package/src/pages/JobDetailPage.vue +7 -0
  29. package/src/stores/ansibleAdminStore.ts +206 -0
  30. package/src/stores/environmentStore.ts +3 -3
  31. package/src/stores/jobsStore.ts +39 -39
  32. package/src/stores/profilersStore.ts +80 -0
  33. package/src/stores/resourceDevicesStore.ts +2 -2
  34. package/src/stores/serviceInstancesStore.ts +0 -1
  35. package/src/stores/serviceOfferingsStore.ts +1 -1
  36. package/src/utils/jobStatus.ts +63 -0
  37. package/vite/dist/apiClients.d.ts +1 -1
  38. package/vite/dist/apiClients.js +1 -0
@@ -0,0 +1,95 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, toRef, watch } from 'vue';
3
+ import { useToast } from 'vue-toast-notification';
4
+ import logRequestError from '@/api/restApiHelper';
5
+ import type { Profiler } from '@/api/resource-management/client';
6
+ import ConfirmDialog from '@/components/base/ConfirmDialog.vue';
7
+ import ProfilerForm from '@/components/profilers/ProfilerForm.vue';
8
+ import {
9
+ buildProfilerRequest,
10
+ newProfilerFormData,
11
+ profilerToFormData,
12
+ } from '@/components/profilers/profilerForm';
13
+ import type { ProfilerForm as ProfilerFormState } from './profilerForm';
14
+ import { useProfilersStore } from '@/stores/profilersStore';
15
+
16
+ const props = defineProps<{ show: boolean; profiler: Profiler | null }>();
17
+ const emit = defineEmits(['canceled', 'confirmed']);
18
+
19
+ const $toast = useToast();
20
+ const profilersStore = useProfilersStore();
21
+
22
+ const active = toRef(props, 'show');
23
+ const isEdit = computed(() => props.profiler !== null);
24
+ const loading = ref(false);
25
+ const formKey = ref(0);
26
+ const form = ref<ProfilerFormState>({ isFormValid: false, formData: newProfilerFormData() });
27
+
28
+ function loadForm() {
29
+ formKey.value++; // remount the form to reset vee-validate state
30
+ form.value = {
31
+ isFormValid: false,
32
+ formData: props.profiler ? profilerToFormData(props.profiler) : newProfilerFormData(),
33
+ };
34
+ }
35
+
36
+ watch(() => props.show, (show) => {
37
+ if (show) loadForm();
38
+ }, { immediate: true });
39
+
40
+ function closeDialog() {
41
+ emit('canceled');
42
+ }
43
+
44
+ async function save() {
45
+ if (!form.value.isFormValid) {
46
+ $toast.error('Please fill in all required fields correctly');
47
+ return;
48
+ }
49
+ loading.value = true;
50
+ try {
51
+ const profiler = props.profiler;
52
+ if (profiler) {
53
+ await profilersStore.updateProfiler(
54
+ profiler.id,
55
+ buildProfilerRequest(form.value.formData, profiler.id, profiler),
56
+ );
57
+ $toast.info('Profiler updated successfully');
58
+ } else {
59
+ await profilersStore.createProfiler(
60
+ buildProfilerRequest(form.value.formData, globalThis.crypto.randomUUID()),
61
+ );
62
+ $toast.info('Profiler created successfully');
63
+ }
64
+ emit('confirmed');
65
+ } catch (e) {
66
+ logRequestError(e);
67
+ $toast.error(isEdit.value ? 'Failed to update profiler' : 'Failed to create profiler');
68
+ } finally {
69
+ loading.value = false;
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <template>
75
+ <ConfirmDialog
76
+ :show="active"
77
+ :title="isEdit ? 'Edit profiler' : 'Add profiler'"
78
+ width="800px"
79
+ cancel-button-label="Cancel"
80
+ :confirm-button-label="isEdit ? 'Save changes' : 'Create profiler'"
81
+ :confirm-button-disabled="!form.isFormValid"
82
+ :confirm-loading="loading"
83
+ @canceled="closeDialog"
84
+ @confirmed="save"
85
+ >
86
+ <template #content>
87
+ <ProfilerForm
88
+ :key="formKey"
89
+ v-model="form"
90
+ :edit="isEdit"
91
+ :profiler="profiler"
92
+ />
93
+ </template>
94
+ </ConfirmDialog>
95
+ </template>
@@ -0,0 +1,102 @@
1
+ <script setup lang="ts">
2
+ import { nextTick, watch } from 'vue';
3
+ import { useField, useForm } from 'vee-validate';
4
+ import type { Profiler } from '@/api/resource-management/client';
5
+ import { useProfilersStore } from '@/stores/profilersStore';
6
+ import { isNameTaken } from './profilerForm';
7
+ import type { ProfilerForm, ProfilerFormData } from './profilerForm';
8
+
9
+ const props = defineProps<{ modelValue: ProfilerForm; edit: boolean; profiler?: Profiler | null }>();
10
+ const emit = defineEmits<{ (e: 'update:modelValue', value: ProfilerForm): void }>();
11
+
12
+ const profilersStore = useProfilersStore();
13
+
14
+ const parameterNames = (props.profiler?.action?.parameter ?? []).map((p) => p.variable);
15
+
16
+ const { validate } = useForm();
17
+
18
+ function required(label: string) {
19
+ return (v: string) => !!v && v.trim() !== '' || `${label} is required`;
20
+ }
21
+
22
+ const { value: name, errorMessage: nameError } = useField<string>('name', (v: string) => {
23
+ if (!v || !v.trim()) return 'Name is required';
24
+ return !isNameTaken(v, profilersStore.profilers, props.profiler?.id) || 'A profiler with this name already exists';
25
+ }, { initialValue: props.modelValue.formData.name, validateOnMount: props.edit });
26
+ const { value: repo, errorMessage: repoError } = useField<string>('repo', required('Repository'),
27
+ { initialValue: props.modelValue.formData.repo });
28
+ const { value: gitRef, errorMessage: branchError } = useField<string>('ref', required('Branch'),
29
+ { initialValue: props.modelValue.formData.ref });
30
+ const { value: playbook, errorMessage: playbookError } = useField<string>('playbook', required('Playbook'),
31
+ { initialValue: props.modelValue.formData.playbook });
32
+
33
+ function currentFormData(): ProfilerFormData {
34
+ return {
35
+ name: name.value ?? '',
36
+ repo: repo.value ?? '',
37
+ ref: gitRef.value ?? '',
38
+ playbook: playbook.value ?? '',
39
+ };
40
+ }
41
+
42
+ // Sync incoming modelValue (e.g. dialog reset) to fields
43
+ watch(() => props.modelValue, (val) => {
44
+ if (JSON.stringify(val.formData) === JSON.stringify(currentFormData())) return;
45
+ const f = val.formData;
46
+ name.value = f.name;
47
+ repo.value = f.repo;
48
+ gitRef.value = f.ref;
49
+ playbook.value = f.playbook;
50
+ });
51
+
52
+ // Emit changes to parent
53
+ let validationRun = 0;
54
+ watch([name, repo, gitRef, playbook], async () => {
55
+ const run = ++validationRun;
56
+ await nextTick();
57
+ const result = await validate({ mode: 'silent' }); // silent: do not flag untouched fields as errors
58
+ if (run !== validationRun) return; // a newer change superseded this run
59
+ emit('update:modelValue', { isFormValid: result.valid, formData: currentFormData() });
60
+ }, { immediate: true });
61
+ </script>
62
+
63
+ <template>
64
+ <form @submit.prevent>
65
+ <v-text-field
66
+ v-model="name"
67
+ label="Name"
68
+ required
69
+ :error-messages="nameError"
70
+ />
71
+ <v-text-field
72
+ v-model="repo"
73
+ label="Repository"
74
+ required
75
+ :error-messages="repoError"
76
+ />
77
+ <v-text-field
78
+ v-model="gitRef"
79
+ label="Branch"
80
+ required
81
+ :error-messages="branchError"
82
+ />
83
+ <v-text-field
84
+ v-model="playbook"
85
+ label="Playbook"
86
+ required
87
+ :error-messages="playbookError"
88
+ />
89
+
90
+ <div v-if="parameterNames.length" class="mt-2">
91
+ <div class="text-subtitle-2 mb-1">Parameters</div>
92
+ <v-chip
93
+ v-for="variable in parameterNames"
94
+ :key="variable"
95
+ class="mr-1"
96
+ size="small"
97
+ >
98
+ {{ variable }}
99
+ </v-chip>
100
+ </div>
101
+ </form>
102
+ </template>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <base-material-card>
3
+ <template #heading>
4
+ <overview-heading text="Profilers" />
5
+ </template>
6
+
7
+ <no-item-available-note
8
+ v-if="profilers.length === 0"
9
+ item="Profiler"
10
+ />
11
+
12
+ <v-data-table
13
+ v-else
14
+ :headers="headers"
15
+ :items="profilers"
16
+ item-value="id"
17
+ >
18
+ <template #item.actions="{ item }">
19
+ <div class="d-flex flex-wrap justify-end ga-3 py-2">
20
+ <v-btn
21
+ prepend-icon="mdi-pencil"
22
+ size="small"
23
+ @click.stop="emit('edit', item)"
24
+ >
25
+ Edit
26
+ </v-btn>
27
+ <v-btn
28
+ prepend-icon="mdi-delete"
29
+ size="small"
30
+ color="error"
31
+ @click.stop="profilerToDelete = item"
32
+ >
33
+ Delete
34
+ </v-btn>
35
+ </div>
36
+ </template>
37
+ </v-data-table>
38
+
39
+ <ConfirmDialog
40
+ :show="profilerToDelete !== null"
41
+ attention
42
+ title="Delete profiler"
43
+ :text="`Delete profiler '${profilerToDelete?.name}'?`"
44
+ confirm-button-label="Delete"
45
+ cancel-button-label="Cancel"
46
+ :confirm-loading="deleting"
47
+ @canceled="profilerToDelete = null"
48
+ @confirmed="onDeleteConfirmed"
49
+ />
50
+ </base-material-card>
51
+ </template>
52
+
53
+ <script setup lang="ts">
54
+ import { computed, ref } from 'vue';
55
+ import { useToast } from 'vue-toast-notification';
56
+ import logRequestError from '@/api/restApiHelper';
57
+ import type { Profiler } from '@/api/resource-management/client';
58
+ import ConfirmDialog from '@/components/base/ConfirmDialog.vue';
59
+ import NoItemAvailableNote from '@/components/base/NoItemAvailableNote.vue';
60
+ import OverviewHeading from '@/components/base/OverviewHeading.vue';
61
+ import { useProfilersStore } from '@/stores/profilersStore';
62
+
63
+ const emit = defineEmits<{ (e: 'edit', profiler: Profiler): void }>();
64
+
65
+ const $toast = useToast();
66
+ const profilersStore = useProfilersStore();
67
+
68
+ const profilerToDelete = ref<Profiler | null>(null);
69
+ const deleting = ref(false);
70
+
71
+ const profilers = computed(() => profilersStore.profilers);
72
+
73
+ const headers = [
74
+ { title: 'Name', key: 'name' },
75
+ { title: 'Repository', key: 'action.repo' },
76
+ { title: 'Branch', key: 'action.ref' },
77
+ { title: 'Playbook', key: 'action.playbook' },
78
+ { title: '', key: 'actions', sortable: false, cellProps: { class: 'px-6' } },
79
+ ];
80
+
81
+ async function onDeleteConfirmed() {
82
+ const profiler = profilerToDelete.value;
83
+ if (!profiler) {
84
+ return;
85
+ }
86
+ deleting.value = true;
87
+ try {
88
+ await profilersStore.deleteProfiler(profiler.id);
89
+ $toast.success('Profiler deleted');
90
+ } catch (e) {
91
+ logRequestError(e);
92
+ $toast.error('Failed to delete profiler');
93
+ } finally {
94
+ deleting.value = false;
95
+ profilerToDelete.value = null;
96
+ }
97
+ }
98
+ </script>
@@ -0,0 +1,46 @@
1
+ import type { AnsibleAction, Profiler, ProfilerDTOApi } from '@/api/resource-management/client'
2
+
3
+ export interface ProfilerFormData {
4
+ name: string
5
+ repo: string
6
+ ref: string
7
+ playbook: string
8
+ }
9
+
10
+ export interface ProfilerForm {
11
+ isFormValid: boolean
12
+ formData: ProfilerFormData
13
+ }
14
+
15
+ export const DEFAULT_BRANCH = 'main'
16
+ export const DEFAULT_PLAYBOOK = 'run.yml'
17
+
18
+ export function newProfilerFormData(): ProfilerFormData {
19
+ return { name: '', repo: '', ref: DEFAULT_BRANCH, playbook: DEFAULT_PLAYBOOK }
20
+ }
21
+
22
+ export function profilerToFormData(profiler: Profiler): ProfilerFormData {
23
+ return {
24
+ name: profiler.name,
25
+ repo: profiler.action?.repo ?? '',
26
+ ref: profiler.action?.ref ?? DEFAULT_BRANCH,
27
+ playbook: profiler.action?.playbook ?? DEFAULT_PLAYBOOK,
28
+ }
29
+ }
30
+
31
+ export function buildProfilerRequest(form: ProfilerFormData, id: string, original?: Profiler): ProfilerDTOApi {
32
+ const action: Record<string, unknown> = {
33
+ ...original?.action,
34
+ actionClass: 'AnsibleAction',
35
+ actionType: 'RUN',
36
+ repo: form.repo.trim(),
37
+ ref: form.ref.trim(),
38
+ playbook: form.playbook.trim(),
39
+ }
40
+ return { id, name: form.name.trim(), action: action as unknown as AnsibleAction }
41
+ }
42
+
43
+ export function isNameTaken(name: string, profilers: Profiler[], ownId?: string): boolean {
44
+ const wanted = name.trim().toLowerCase()
45
+ return profilers.some(p => p.id !== ownId && p.name.trim().toLowerCase() === wanted)
46
+ }
@@ -27,11 +27,11 @@ printf "%-38s %s\n" "NOTIFICATION_SERVICE_URL:" "$NOTIFICATION_SERVICE_URL"
27
27
  printf "%-38s %s\n" "PLATFORM_MANAGEMENT_URL:" "$PLATFORM_MANAGEMENT_URL"
28
28
  printf "%-38s %s\n" "RESOURCE_MANAGEMENT_URL:" "$RESOURCE_MANAGEMENT_URL"
29
29
  printf "%-38s %s\n" "SERVICE_MANAGEMENT_URL:" "$SERVICE_MANAGEMENT_URL"
30
+ printf "%-38s %s\n" "ANSIBLE_SERVICE_URL:" "$ANSIBLE_SERVICE_URL"
30
31
  printf "%-38s %s\n" "CATALOG_SERVICE_URL:" "$CATALOG_SERVICE_URL"
31
32
  printf "%-38s %s\n" "KEYCLOAK_URL:" "$KEYCLOAK_URL"
32
33
  printf "%-38s %s\n" "KEYCLOAK_REALM:" "$KEYCLOAK_REALM"
33
34
  printf "%-38s %s\n" "KEYCLOAK_CLIENT_ID:" "$KEYCLOAK_CLIENT_ID"
34
- printf "%-38s %s\n" "AWX_URL:" "$AWX_URL"
35
35
  printf "%-38s %s\n" "BASYX_AAS_GUI_URL:" "$BASYX_AAS_GUI_URL"
36
36
 
37
37
  # Replace the placeholders in all relevant files (.js, .html, .css)
@@ -43,11 +43,11 @@ find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.html' -o -name '*
43
43
  -e "s|/__ENV_PLATFORM_MANAGEMENT_URL__PLACEHOLDER__/|$PLATFORM_MANAGEMENT_URL|g" \
44
44
  -e "s|/__ENV_RESOURCE_MANAGEMENT_URL__PLACEHOLDER__/|$RESOURCE_MANAGEMENT_URL|g" \
45
45
  -e "s|/__ENV_SERVICE_MANAGEMENT_URL__PLACEHOLDER__/|$SERVICE_MANAGEMENT_URL|g" \
46
+ -e "s|/__ENV_ANSIBLE_SERVICE_URL__PLACEHOLDER__/|$ANSIBLE_SERVICE_URL|g" \
46
47
  -e "s|/__ENV_CATALOG_SERVICE_URL__PLACEHOLDER__/|$CATALOG_SERVICE_URL|g" \
47
48
  -e "s|/__ENV_KEYCLOAK_URL__PLACEHOLDER__/|$KEYCLOAK_URL|g" \
48
49
  -e "s|/__ENV_KEYCLOAK_REALM__PLACEHOLDER__/|$KEYCLOAK_REALM|g" \
49
50
  -e "s|/__ENV_KEYCLOAK_CLIENT_ID__PLACEHOLDER__/|$KEYCLOAK_CLIENT_ID|g" \
50
- -e "s|/__ENV_AWX_URL__PLACEHOLDER__/|$AWX_URL|g" \
51
51
  -e "s|/__ENV_BASYX_AAS_GUI_URL__PLACEHOLDER__/|$BASYX_AAS_GUI_URL|g" \
52
52
  {} \;
53
53
 
@@ -60,6 +60,96 @@
60
60
  },
61
61
  "capabilities":{
62
62
  "title": "Capabilities"
63
+ },
64
+ "profilers":{
65
+ "title": "Profilers"
66
+ },
67
+ "ansible-service":{
68
+ "title": "Ansible Service",
69
+ "tabs": {
70
+ "jobs": "Jobs",
71
+ "operations": "Operations",
72
+ "images": "Execution environments"
73
+ },
74
+ "jobs": {
75
+ "filter": {
76
+ "status": "Status",
77
+ "resourceId": "Resource ID",
78
+ "resourceIdInvalid": "Not a valid UUID",
79
+ "user": "User",
80
+ "since": "Created",
81
+ "since1h": "Last hour",
82
+ "since24h": "Last 24 hours",
83
+ "since7d": "Last 7 days",
84
+ "since30d": "Last 30 days",
85
+ "sinceAll": "All time"
86
+ },
87
+ "column": {
88
+ "status": "Status",
89
+ "owner": "Owner",
90
+ "service": "Service / capability",
91
+ "playbook": "Repository / playbook",
92
+ "image": "Image",
93
+ "createdAt": "Created",
94
+ "duration": "Duration",
95
+ "errorCode": "Error",
96
+ "actions": "Actions"
97
+ },
98
+ "cancel": "Cancel",
99
+ "cancelFailed": "Job {id} could not be canceled",
100
+ "empty": "No jobs match the filter"
101
+ },
102
+ "operations": {
103
+ "counters": "Jobs by status",
104
+ "running": "Running",
105
+ "queued": "Queued",
106
+ "failed24h": "Failed in the last 24 hours",
107
+ "config": {
108
+ "title": "Configuration",
109
+ "playbookContract": "Playbook contract",
110
+ "defaultImage": "Default image",
111
+ "allowedImagePrefixes": "Allowed image prefixes",
112
+ "parallelism": "Parallel jobs",
113
+ "maxQueued": "Max. queued jobs",
114
+ "defaultTimeoutMinutes": "Default timeout (minutes)",
115
+ "maxTimeoutMinutes": "Max. timeout (minutes)",
116
+ "maxCpus": "Max. CPUs per job",
117
+ "maxMemoryMb": "Max. memory per job (MB)"
118
+ },
119
+ "links": {
120
+ "title": "API documentation",
121
+ "swagger": "Swagger UI",
122
+ "openapi": "OpenAPI documentation"
123
+ }
124
+ },
125
+ "images": {
126
+ "column": {
127
+ "image": "Image",
128
+ "present": "Available",
129
+ "usedByJobs": "Used by",
130
+ "lastUsedAt": "Last used",
131
+ "pulling": "Pull state",
132
+ "lastPullError": "Last pull error",
133
+ "actions": "Actions"
134
+ },
135
+ "default": "Default",
136
+ "present": "Present",
137
+ "missing": "Not present",
138
+ "usedByJobs": "{count} jobs",
139
+ "pulling": "Pulling",
140
+ "pullFailed": "Failed",
141
+ "pull": "Pull image",
142
+ "empty": "No images known",
143
+ "notice": {
144
+ "pull-started": "Pull of {image} started",
145
+ "pull-success": "Image {image} pulled successfully",
146
+ "pull-failed": "Pull of {image} failed: {detail}",
147
+ "pull-conflict": "A pull of {image} is already running",
148
+ "pull-not-allowed": "Image {image} is not allowed by the service configuration",
149
+ "pull-unavailable": "The Docker engine is not available",
150
+ "pull-error": "Pull of {image} could not be started"
151
+ }
152
+ }
63
153
  }
64
154
  }
65
155
  }
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <v-container
3
+ id="admin-ansible-service"
4
+ fluid
5
+ tag="section"
6
+ >
7
+ <div
8
+ v-if="loading"
9
+ class="text-center"
10
+ >
11
+ <v-progress-circular
12
+ :size="70"
13
+ :width="7"
14
+ color="primary"
15
+ indeterminate
16
+ />
17
+ </div>
18
+ <div v-if="failed">
19
+ Error
20
+ </div>
21
+
22
+ <base-material-card v-if="loaded">
23
+ <template #heading>
24
+ <overview-heading :text="t(`${prefix}.title`)" />
25
+ </template>
26
+
27
+ <v-tabs
28
+ v-model="tab"
29
+ color="primary"
30
+ >
31
+ <v-tab value="jobs">
32
+ {{ t(`${prefix}.tabs.jobs`) }}
33
+ </v-tab>
34
+ <v-tab value="operations">
35
+ {{ t(`${prefix}.tabs.operations`) }}
36
+ </v-tab>
37
+ <v-tab value="images">
38
+ {{ t(`${prefix}.tabs.images`) }}
39
+ </v-tab>
40
+ </v-tabs>
41
+
42
+ <v-window
43
+ v-model="tab"
44
+ class="mt-4"
45
+ >
46
+ <v-window-item value="jobs">
47
+ <ansible-admin-jobs @cancel-failed="onCancelFailed" />
48
+ </v-window-item>
49
+ <v-window-item value="operations">
50
+ <ansible-admin-operations />
51
+ </v-window-item>
52
+ <v-window-item value="images">
53
+ <ansible-admin-images />
54
+ </v-window-item>
55
+ </v-window>
56
+ </base-material-card>
57
+
58
+ <v-snackbar
59
+ v-model="snackbar"
60
+ :color="snackbarColor"
61
+ :timeout="6000"
62
+ >
63
+ {{ snackbarText }}
64
+ </v-snackbar>
65
+ </v-container>
66
+ </template>
67
+
68
+ <script setup lang="ts">
69
+ import {computed, onBeforeUnmount, onMounted, ref, watch} from "vue";
70
+ import {useI18n} from "vue-i18n";
71
+ import ApiState from "@/api/apiState";
72
+ import OverviewHeading from "@/components/base/OverviewHeading.vue";
73
+ import AnsibleAdminImages from "@/components/admin/ansible/AnsibleAdminImages.vue";
74
+ import AnsibleAdminJobs from "@/components/admin/ansible/AnsibleAdminJobs.vue";
75
+ import AnsibleAdminOperations from "@/components/admin/ansible/AnsibleAdminOperations.vue";
76
+ import {useAnsibleAdminStore} from "@/stores/ansibleAdminStore";
77
+
78
+ const {t} = useI18n();
79
+ const store = useAnsibleAdminStore();
80
+ const prefix = 'drawer.section.admin.ansible-service';
81
+
82
+ const tab = ref('jobs');
83
+ const snackbar = ref(false);
84
+ const snackbarText = ref('');
85
+ const snackbarColor = ref('info');
86
+
87
+ const loaded = computed(() => store.apiState === ApiState.LOADED || store.apiState === ApiState.UPDATING);
88
+ const loading = computed(() => store.apiState === ApiState.LOADING || store.apiState === ApiState.INIT);
89
+ const failed = computed(() => store.apiState === ApiState.ERROR);
90
+
91
+ function show(text: string, color: string) {
92
+ snackbarText.value = text;
93
+ snackbarColor.value = color;
94
+ snackbar.value = true;
95
+ }
96
+
97
+ function onCancelFailed(id: string) {
98
+ show(t(`${prefix}.jobs.cancelFailed`, {id: id.substring(0, 8)}), 'error');
99
+ }
100
+
101
+ watch(() => store.notice, (notice) => {
102
+ if (!notice) return;
103
+ const color = notice.kind === 'pull-success' ? 'success'
104
+ : notice.kind === 'pull-started' ? 'info'
105
+ : 'error';
106
+ show(t(`${prefix}.images.notice.${notice.kind}`, {image: notice.image, detail: notice.detail ?? ''}), color);
107
+ });
108
+
109
+ onMounted(() => store.startPolling());
110
+ onBeforeUnmount(() => store.stopPolling());
111
+ </script>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <v-container
3
+ id="admin-profilers"
4
+ fluid
5
+ tag="section"
6
+ >
7
+ <div
8
+ v-if="apiStateLoading"
9
+ class="text-center"
10
+ >
11
+ <v-progress-circular
12
+ :size="70"
13
+ :width="7"
14
+ color="primary"
15
+ indeterminate
16
+ />
17
+ </div>
18
+ <div v-if="apiStateError">
19
+ Error
20
+ </div>
21
+
22
+ <div v-if="apiStateLoaded">
23
+ <ProfilersTable @edit="onEdit" />
24
+ <ProfilerDialog
25
+ :show="showDialog"
26
+ :profiler="selectedProfiler"
27
+ @canceled="showDialog = false"
28
+ @confirmed="showDialog = false"
29
+ />
30
+ <v-fab
31
+ icon="mdi-plus"
32
+ class="mx-4"
33
+ elevation="15"
34
+ color="primary"
35
+ location="right bottom"
36
+ :app="true"
37
+ @click="onCreate"
38
+ />
39
+ </div>
40
+ </v-container>
41
+ </template>
42
+
43
+ <script setup lang="ts">
44
+ import { computed, onMounted, ref } from 'vue';
45
+ import ApiState from '@/api/apiState';
46
+ import type { Profiler } from '@/api/resource-management/client';
47
+ import ProfilerDialog from '@/components/profilers/ProfilerDialog.vue';
48
+ import ProfilersTable from '@/components/profilers/ProfilersTable.vue';
49
+ import { useProfilersStore } from '@/stores/profilersStore';
50
+
51
+ const profilersStore = useProfilersStore();
52
+
53
+ const showDialog = ref(false);
54
+ const selectedProfiler = ref<Profiler | null>(null);
55
+
56
+ const apiStateLoaded = computed(() => profilersStore.apiState === ApiState.LOADED || profilersStore.apiState === ApiState.UPDATING);
57
+ const apiStateLoading = computed(() => profilersStore.apiState === ApiState.LOADING || profilersStore.apiState === ApiState.INIT);
58
+ const apiStateError = computed(() => profilersStore.apiState === ApiState.ERROR);
59
+
60
+ function onCreate() {
61
+ selectedProfiler.value = null;
62
+ showDialog.value = true;
63
+ }
64
+
65
+ function onEdit(profiler: Profiler) {
66
+ selectedProfiler.value = profiler;
67
+ showDialog.value = true;
68
+ }
69
+
70
+ onMounted(() => {
71
+ profilersStore.updateStore();
72
+ });
73
+ </script>