@eclipse-slm/ui 0.0.0-stage → 1.5.0-snapshot.1017
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 +278 -2
- package/index.html +19 -0
- package/package.json +105 -4
- package/public/favicon.ico +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon_white.png +0 -0
- package/public/sidebar-image.jpg +0 -0
- package/src/App.vue +40 -0
- 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/apiState.js +7 -0
- package/src/api/catalog/catalogRestApi.js +17 -0
- package/src/api/notification-service/notification-service-client.ts +7 -0
- package/src/api/notification-service/notificationServiceActuatorRestApi.js +26 -0
- package/src/api/notification-service/notificationServiceWebsocketClient.js +60 -0
- package/src/api/platform-management/platform-management-client.ts +46 -0
- package/src/api/platform-management/platformManagementActuatorRestApi.js +26 -0
- package/src/api/resource-management/resource-management-client.ts +37 -0
- package/src/api/resource-management/resourceManagementActuatorRestApi.js +26 -0
- package/src/api/restApiHelper.js +11 -0
- package/src/api/service-management/service-management-client.ts +31 -0
- package/src/api/service-management/serviceManagementActuatorRestApi.ts +26 -0
- package/src/app/appInstance.ts +8 -0
- package/src/app/navigation.ts +224 -0
- package/src/app/routes.ts +215 -0
- package/src/assets/clint-mckoy.jpg +0 -0
- package/src/assets/img/avatarImg.jpg +0 -0
- package/src/assets/img/fabos_logo.png +0 -0
- package/src/assets/img/fabos_logo_fabweiss.png +0 -0
- package/src/assets/img/fraunhofer-logo.png +0 -0
- package/src/assets/img/sidebar-1.jpg +0 -0
- package/src/assets/img/sidebar-2.jpg +0 -0
- package/src/assets/img/sidebar-3.jpg +0 -0
- package/src/assets/img/sidebar-4.jpg +0 -0
- package/src/assets/img/sidebar-5.jpg +0 -0
- package/src/assets/img/sidebar-image.jpg +0 -0
- package/src/assets/img/vue-logo.png +0 -0
- package/src/assets/lock.jpg +0 -0
- package/src/assets/login.jpg +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/pricing.jpg +0 -0
- package/src/assets/register.jpg +0 -0
- package/src/assets/vuetify.svg +1 -0
- package/src/components/admin/VersionsOverview.vue +149 -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/ActionButton.vue +63 -0
- package/src/components/base/ActionButtonType.ts +5 -0
- package/src/components/base/Card.vue +17 -0
- package/src/components/base/ConfirmDialog.vue +101 -0
- package/src/components/base/CustomDialog.vue +116 -0
- package/src/components/base/IconPickerDialog.vue +155 -0
- package/src/components/base/Item.vue +79 -0
- package/src/components/base/ItemGroup.vue +131 -0
- package/src/components/base/ItemSubGroup.vue +25 -0
- package/src/components/base/MaterialAlert.vue +56 -0
- package/src/components/base/MaterialCard.vue +166 -0
- package/src/components/base/MaterialChartCard.vue +95 -0
- package/src/components/base/MaterialSnackbar.vue +71 -0
- package/src/components/base/MaterialStatsCard.vue +115 -0
- package/src/components/base/MaterialTabs.vue +43 -0
- package/src/components/base/MaterialTestimony.vue +79 -0
- package/src/components/base/NoItemAvailableNote.vue +22 -0
- package/src/components/base/OverviewHeading.vue +25 -0
- package/src/components/base/ProgressCircular.vue +68 -0
- package/src/components/base/RowWithLabel.vue +228 -0
- package/src/components/base/Subheading.vue +35 -0
- package/src/components/base/TextWithLabel.vue +41 -0
- package/src/components/base/VComponent.vue +40 -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/charts/AasCircularChart.vue +170 -0
- package/src/components/charts/AasCircularChartFilterBar.vue +72 -0
- package/src/components/charts/LineChart.js +14 -0
- package/src/components/clusters/ClustersOverview.vue +76 -0
- package/src/components/clusters/dialogs/ClusterDeleteDialog.vue +125 -0
- package/src/components/clusters/dialogs/ClusterScaleDialog.vue +272 -0
- package/src/components/clusters/dialogs/ClustersCreateDialog.vue +112 -0
- package/src/components/clusters/dialogs/ClustersCreateDialogPage.ts +7 -0
- package/src/components/clusters/dialogs/ClustersCreateDialogPageAddExistingCluster.vue +261 -0
- package/src/components/clusters/dialogs/ClustersCreateDialogPageCreateNewCluster.vue +244 -0
- package/src/components/clusters/dialogs/ClustersCreateDialogPageStart.vue +75 -0
- package/src/components/core/AppBar.vue +301 -0
- package/src/components/core/Drawer.vue +217 -0
- package/src/components/core/Footer.vue +43 -0
- package/src/components/core/View.vue +32 -0
- package/src/components/credentials/CredentialCreateDialog.vue +121 -0
- package/src/components/credentials/CredentialDisplay.vue +105 -0
- package/src/components/credentials/CredentialForm.vue +394 -0
- package/src/components/credentials/CredentialTypes.ts +26 -0
- package/src/components/dashboard/Buttons.vue +431 -0
- package/src/components/dashboard/DashboardResourceStatistics.vue +53 -0
- package/src/components/dashboard/Grid.vue +300 -0
- package/src/components/dashboard/Icons.vue +300 -0
- package/src/components/dashboard/Notifications.vue +402 -0
- package/src/components/dashboard/Tabs.vue +418 -0
- package/src/components/dashboard/Typography.vue +120 -0
- package/src/components/discovery/DiscoverDialog.vue +186 -0
- package/src/components/discovery/DiscoveredResourcesTable.vue +176 -0
- package/src/components/discovery/DiscoveryJobDetailsDialog.vue +65 -0
- package/src/components/discovery/DiscoveryJobsDeleteDialog.vue +88 -0
- package/src/components/discovery/DiscoveryJobsTable.vue +131 -0
- package/src/components/discovery/DiscoveryOverview.vue +99 -0
- package/src/components/discovery/DriversTable.vue +70 -0
- package/src/components/discovery/OnboardingDialog.vue +82 -0
- package/src/components/jobs/JobDetail.vue +413 -0
- package/src/components/jobs/JobStatusChip.vue +16 -0
- package/src/components/jobs/JobsOverview.vue +160 -0
- package/src/components/notifications/NotificationsOverview.vue +154 -0
- 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/provider/ProviderOverview.vue +64 -0
- package/src/components/provider/ServiceHosterTable.vue +47 -0
- package/src/components/provider/VirtualResourceProviderTable.vue +73 -0
- package/src/components/provider/dialogs/VmCreateDialog.vue +99 -0
- package/src/components/provider/dialogs/VmCreateDialogForm.vue +59 -0
- package/src/components/resources/ResourceConnectionIcon.vue +40 -0
- package/src/components/resources/ResourcesDeleteDialog.vue +102 -0
- package/src/components/resources/ResourcesTableClusters.vue +192 -0
- package/src/components/resources/ResourcesTableDevices.vue +338 -0
- package/src/components/resources/ResourcesTableTypes.vue +106 -0
- package/src/components/resources/capabilities/CapabilitiesButton.vue +164 -0
- package/src/components/resources/capabilities/CapabilityIcon.vue +44 -0
- package/src/components/resources/capabilities/CapabilityParamsDialog.vue +119 -0
- package/src/components/resources/capabilities/CapabilityParamsDialogInputField.vue +51 -0
- package/src/components/resources/deviceinfo/DeviceInfoCapabilitiesView.vue +239 -0
- package/src/components/resources/deviceinfo/DeviceInfoCredentialsView.vue +205 -0
- package/src/components/resources/deviceinfo/DeviceInfoHardwareView.vue +162 -0
- package/src/components/resources/deviceinfo/DeviceInfoNameplateView.vue +201 -0
- package/src/components/resources/deviceinfo/DeviceInfoSubmodelsView.vue +173 -0
- package/src/components/resources/deviceinfo/DeviceInfoView.vue +207 -0
- package/src/components/resources/deviceinfo/common/DeviceInfoCommonBasicsSection.vue +101 -0
- package/src/components/resources/deviceinfo/common/DeviceInfoCommonRemoteAccessSection.vue +224 -0
- package/src/components/resources/deviceinfo/common/DeviceInfoCommonView.vue +43 -0
- package/src/components/resources/deviceinfo/firmware/DeviceInfoFirmwareView.vue +113 -0
- package/src/components/resources/deviceinfo/firmware/FirmwareAvailableVersionsSection.vue +193 -0
- package/src/components/resources/deviceinfo/firmware/FirmwareCredentialsSection.vue +250 -0
- package/src/components/resources/deviceinfo/firmware/FirmwareUpdateJobsSection.vue +149 -0
- package/src/components/resources/deviceinfo/firmware/FirmwareUpdateStatusSection.vue +117 -0
- package/src/components/resources/deviceinfo/firmware/sectionState.ts +12 -0
- package/src/components/resources/devicetypeinfo/DeviceTypeInfoCommonView.vue +58 -0
- package/src/components/resources/devicetypeinfo/DeviceTypeInfoFirmwareView.vue +270 -0
- package/src/components/resources/devicetypeinfo/DeviceTypeInfoView.vue +110 -0
- package/src/components/resources/dialogs/AddItemChooserDialog.vue +68 -0
- package/src/components/resources/dialogs/DeviceCreateDeviceDetailsForm.vue +109 -0
- package/src/components/resources/dialogs/DeviceCreateDialog.vue +224 -0
- package/src/components/resources/dialogs/DeviceDialogCreateTypes.ts +11 -0
- package/src/components/resources/remoteaccess/RemoteAccessDialog.vue +82 -0
- package/src/components/resources/remoteaccess/RemoteAccessForm.vue +149 -0
- package/src/components/resources/remoteaccess/RemoteAccessHandler.ts +73 -0
- package/src/components/resources/remoteaccess/RemoteAccessTypes.ts +11 -0
- package/src/components/service_offerings/ServiceCategoriesTable.vue +154 -0
- package/src/components/service_offerings/ServiceCategoryCreateOrEditDialog.vue +117 -0
- package/src/components/service_offerings/ServiceOfferingCardGrid.vue +173 -0
- package/src/components/service_offerings/ServiceOfferingCardList.vue +117 -0
- package/src/components/service_offerings/ServiceOfferingDetailsOverview.vue +89 -0
- package/src/components/service_offerings/ServiceOfferingDetailsRequirements.vue +89 -0
- package/src/components/service_offerings/ServiceOfferingTable.vue +291 -0
- package/src/components/service_offerings/ServiceOfferingToolbar.vue +133 -0
- package/src/components/service_offerings/ServiceOptionValue.vue +213 -0
- package/src/components/service_offerings/dialogs/ServiceOfferingCreateDialog.vue +70 -0
- package/src/components/service_offerings/wizard_service_offering/ServiceOfferingWizardGitStep1Common.vue +214 -0
- package/src/components/service_offerings/wizard_service_offering/ServiceOfferingWizardManualStep1Common.vue +196 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerContainerImageName.vue +112 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerContainerLabels.vue +158 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerContainerPortMappings.vue +177 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerContainerRestartPolicy.vue +63 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerContainerVolumes.vue +157 -0
- package/src/components/service_offerings/wizard_service_offering_version/Docker/DockerEnvironmentVariables.vue +163 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep1Common.vue +154 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionCodesys.vue +139 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionDockerCompose.vue +423 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionDockerContainer.vue +293 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep2DeploymentDefinitionKubernetes.vue +382 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep3ServiceOptions.vue +193 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceOfferingVersionWizardStep4Requirements.vue +238 -0
- package/src/components/service_offerings/wizard_service_offering_version/ServiceRepositorySelect.vue +90 -0
- package/src/components/service_offerings/wizard_service_offering_version/serviceOptions/serviceOptionsDefinitionTable.vue +210 -0
- package/src/components/service_vendors/ServiceRepositoryCreateDialog.vue +165 -0
- package/src/components/service_vendors/ServiceVendorCreateOrEditDialog.vue +171 -0
- package/src/components/service_vendors/ServiceVendorDevelopersTable.vue +201 -0
- package/src/components/service_vendors/ServiceVendorTable.vue +158 -0
- package/src/components/services/ServiceInstanceDeleteDialog.vue +29 -0
- package/src/components/services/ServiceInstancesOverview.vue +63 -0
- package/src/components/services/ServiceInstancesTable.vue +379 -0
- package/src/components/services/dialog/ServiceInstanceDetailsDialog.vue +369 -0
- package/src/components/services/serviceInstanceMixin.js +29 -0
- package/src/components/tables/RegularTables.vue +186 -0
- package/src/components/updates/FirmwareUpdateStatusIcon.vue +54 -0
- package/src/components/updates/FirmwareUpdateVersion.vue +65 -0
- package/src/components/user/UserCredentials.vue +278 -0
- package/src/components/user/UserProfileDetails.vue +89 -0
- package/src/customization/customizeApp.ts +6 -0
- package/src/customization/customizeMessages.ts +6 -0
- package/src/customization/customizeNavigation.ts +6 -0
- package/src/customization/customizeRoutes.ts +6 -0
- package/src/customization/deepMerge.ts +28 -0
- package/src/customization/theme.ts +15 -0
- package/src/design/overrides.sass +62 -0
- package/src/design/serviceOfferingCard.scss +38 -0
- package/src/design/variables.scss +34 -0
- package/src/design/vuetify-material/_appbar.sass +54 -0
- package/src/design/vuetify-material/_buttons.sass +67 -0
- package/src/design/vuetify-material/_card.sass +107 -0
- package/src/design/vuetify-material/_chip.sass +9 -0
- package/src/design/vuetify-material/_footer.sass +29 -0
- package/src/design/vuetify-material/_map.sass +3 -0
- package/src/design/vuetify-material/_modal.sass +25 -0
- package/src/design/vuetify-material/_notification.sass +12 -0
- package/src/design/vuetify-material/_pagination.sass +5 -0
- package/src/design/vuetify-material/_settings.sass +36 -0
- package/src/design/vuetify-material/_sidebar.sass +69 -0
- package/src/design/vuetify-material/_tab.sass +12 -0
- package/src/design/vuetify-material/_table.sass +22 -0
- package/src/design/vuetify-material/_view.sass +23 -0
- package/src/docker/entrypoint.sh +85 -0
- package/src/docker/nginx.conf +35 -0
- package/src/docker/slm.conf +15 -0
- package/src/localisation/de.json +91 -0
- package/src/localisation/en.json +387 -0
- package/src/main.ts +167 -0
- package/src/pages/AccessDeniedPage.vue +10 -0
- package/src/pages/AdminAnsibleServicePage.vue +111 -0
- package/src/pages/AdminCapabilitiesPage.vue +60 -0
- package/src/pages/AdminComponentsPage.vue +34 -0
- package/src/pages/AdminPage.vue +68 -0
- package/src/pages/AdminProfilersPage.vue +73 -0
- package/src/pages/AdminServiceCategoriesPage.vue +34 -0
- package/src/pages/AdminServiceVendorsPage.vue +53 -0
- package/src/pages/AdminUsersPage.vue +367 -0
- package/src/pages/ClustersPage.vue +64 -0
- package/src/pages/DashboardPage.vue +351 -0
- package/src/pages/DiscoveryDriversPage.vue +35 -0
- package/src/pages/DiscoveryInboxPage.vue +31 -0
- package/src/pages/DiscoveryJobsPage.vue +34 -0
- package/src/pages/IndexPage.vue +29 -0
- package/src/pages/JobDetailPage.vue +7 -0
- package/src/pages/JobsPage.vue +18 -0
- package/src/pages/NotificationsPage.vue +13 -0
- package/src/pages/ProviderPage.vue +18 -0
- package/src/pages/ResourceInstancesPage.vue +177 -0
- package/src/pages/ResourceTypesPage.vue +102 -0
- package/src/pages/ServiceInstancesPage.vue +33 -0
- package/src/pages/ServiceOfferingCreateOrEditPage.vue +197 -0
- package/src/pages/ServiceOfferingDetailsPage.vue +180 -0
- package/src/pages/ServiceOfferingOrderPage.vue +300 -0
- package/src/pages/ServiceOfferingVersionCreateOrEditPage.vue +431 -0
- package/src/pages/ServiceOfferingsPage.vue +149 -0
- package/src/pages/ServiceVendorPage.vue +431 -0
- package/src/pages/UserProfilePage.vue +64 -0
- package/src/pages/router.js +34 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/stores/ansibleAdminStore.ts +206 -0
- package/src/stores/capabilitiesStore.ts +159 -0
- package/src/stores/catalogStore.ts +50 -0
- package/src/stores/discoveryStore.ts +88 -0
- package/src/stores/environmentStore.ts +61 -0
- package/src/stores/jobsStore.ts +73 -0
- package/src/stores/notificationStore.ts +169 -0
- package/src/stores/profilersStore.ts +80 -0
- package/src/stores/providerStore.ts +52 -0
- package/src/stores/resourceClustersStore.ts +98 -0
- package/src/stores/resourceDevicesStore.ts +294 -0
- package/src/stores/serviceInstancesStore.ts +92 -0
- package/src/stores/serviceOfferingsStore.ts +208 -0
- package/src/stores/store.ts +66 -0
- package/src/stores/userStore.ts +126 -0
- package/src/utils/capabilityUtils.js +114 -0
- package/src/utils/dateUtils.js +21 -0
- package/src/utils/deviceUtils.js +74 -0
- package/src/utils/firmwareUtils.ts +35 -0
- package/src/utils/i18n.ts +28 -0
- package/src/utils/imageUtil.js +37 -0
- package/src/utils/jobStatus.ts +76 -0
- package/src/utils/mdiIcons.ts +49 -0
- package/src/utils/notificationTextGenerator.ts +108 -0
- package/src/utils/serviceOptionUtil.js +106 -0
- package/src/utils/tokenInterceptor.js +59 -0
- package/src/utils/updateToken.js +18 -0
- package/src/utils/yup.custom.js +11 -0
- package/vite/dist/apiClients.d.ts +5 -0
- package/vite/dist/apiClients.js +59 -0
- package/vite/dist/drift.d.ts +9 -0
- package/vite/dist/drift.js +57 -0
- package/vite/dist/index.d.ts +4 -0
- package/vite/dist/index.js +94 -0
- package/vite/dist/overrides.d.ts +3 -0
- package/vite/dist/overrides.js +71 -0
- package/vite/dist/paths.d.ts +18 -0
- package/vite/dist/paths.js +22 -0
- package/vite/package.json +1 -0
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import ApiState from '@/api/apiState'
|
|
2
|
+
import {defineStore} from "pinia";
|
|
3
|
+
import ResourceManagementClient from "@/api/resource-management/resource-management-client";
|
|
4
|
+
import {CapabilityServiceDTO, GetCapabilities200ResponseInner, ResourceDTO} from "@/api/resource-management/client";
|
|
5
|
+
|
|
6
|
+
export class CapabilityInUseError extends Error {
|
|
7
|
+
constructor(public installCount: number) {
|
|
8
|
+
super(`Capability is installed ${installCount} time(s)`)
|
|
9
|
+
this.name = 'CapabilityInUseError'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface CapabilitiesStoreState{
|
|
14
|
+
apiState: number,
|
|
15
|
+
|
|
16
|
+
capabilities: any[],
|
|
17
|
+
capabilityServices: CapabilityServiceDTO[],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const useCapabilitiesStore = defineStore('capabilitiesStore', {
|
|
21
|
+
persist: true,
|
|
22
|
+
state:():CapabilitiesStoreState => ({
|
|
23
|
+
apiState: ApiState.INIT,
|
|
24
|
+
|
|
25
|
+
capabilities: [],
|
|
26
|
+
capabilityServices: [],
|
|
27
|
+
}),
|
|
28
|
+
getters: {
|
|
29
|
+
availableSingleHostCapabilities: (state) => {
|
|
30
|
+
const singleHostCaps = state.capabilities.filter(cap => {
|
|
31
|
+
return !cap.type.includes("SCALE")
|
|
32
|
+
})
|
|
33
|
+
return singleHostCaps
|
|
34
|
+
},
|
|
35
|
+
availableBaseConfigurationCapabilities: (state) => {
|
|
36
|
+
return state.capabilities.filter(cap => {
|
|
37
|
+
return cap.capabilityClass === "BaseConfigurationCapability"
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
capabilityById: (state) => (capabilityId) => {
|
|
42
|
+
return state.capabilities.find(capability => capability.id === capabilityId)
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
capabilityServiceById: (state) => (capabilityServiceId: string) => {
|
|
46
|
+
return state.capabilityServices.find(capabilityService => capabilityService.id === capabilityServiceId)
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
capabilityOfCapabilityService: (state) => (capabilityServiceId) => {
|
|
50
|
+
const capabilityService = state.capabilityServices.find(capabilityService => capabilityService.id === capabilityServiceId)
|
|
51
|
+
|
|
52
|
+
const capability = state.capabilities.find(capability => capability.id === capabilityService.capabilityId)
|
|
53
|
+
|
|
54
|
+
return capability;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
installCountOfCapability: (state) => (capabilityId: string) => {
|
|
58
|
+
return state.capabilityServices.filter(capabilityService => capabilityService.capabilityId === capabilityId).length
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
isCapabilityInstalledOnResource: (state) => (resource: ResourceDTO, capabilityId) => {
|
|
62
|
+
for (const capabilityServiceId of resource.capabilityServiceIds) {
|
|
63
|
+
const capabilityService = state.capabilityServices.find(capabilityService => capabilityService.id === capabilityServiceId)
|
|
64
|
+
|
|
65
|
+
if (capabilityService?.capabilityId === capabilityId) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
actions: {
|
|
75
|
+
async getCapabilities () {
|
|
76
|
+
return await ResourceManagementClient.capabilityApi.getCapabilities()
|
|
77
|
+
.then(response => {
|
|
78
|
+
if(response){
|
|
79
|
+
const receivedCapabilities = response.data;
|
|
80
|
+
if (receivedCapabilities === undefined) {
|
|
81
|
+
this.capabilities = []
|
|
82
|
+
} else {
|
|
83
|
+
// Sort alphabetically
|
|
84
|
+
this.capabilities = receivedCapabilities.sort((a, b) => {
|
|
85
|
+
return a.name.localeCompare(b.name)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
async getCapabilityServices() {
|
|
93
|
+
return await ResourceManagementClient.capabilityApi.getAllCapabilityServices()
|
|
94
|
+
.then(
|
|
95
|
+
response => {
|
|
96
|
+
if (response.data){
|
|
97
|
+
this.capabilityServices = response.data;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
.catch(e => {
|
|
102
|
+
console.debug(e)
|
|
103
|
+
this.capabilityServices = [];
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
async createCapability(body: GetCapabilities200ResponseInner) {
|
|
108
|
+
await ResourceManagementClient.capabilityApi.createCapability(body)
|
|
109
|
+
await this.reloadAfterChange()
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
async deleteCapability(capabilityId: string) {
|
|
113
|
+
// Fetch directly (not via getCapabilityServices, which swallows errors) so a failed fetch aborts the delete
|
|
114
|
+
const response = await ResourceManagementClient.capabilityApi.getAllCapabilityServices()
|
|
115
|
+
if (!Array.isArray(response.data)) {
|
|
116
|
+
throw new Error("Could not verify where the capability is installed")
|
|
117
|
+
}
|
|
118
|
+
this.capabilityServices = response.data
|
|
119
|
+
|
|
120
|
+
const installCount = this.installCountOfCapability(capabilityId)
|
|
121
|
+
if (installCount > 0) {
|
|
122
|
+
throw new CapabilityInUseError(installCount)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
await ResourceManagementClient.capabilityApi.deleteCapability(capabilityId)
|
|
126
|
+
await this.reloadAfterChange()
|
|
127
|
+
// A successful delete is authoritative even if the list reload failed or returned stale data.
|
|
128
|
+
this.capabilities = this.capabilities.filter(capability => capability.id !== capabilityId)
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
// The change already succeeded; a failed reload must not make it look failed (a retry would duplicate it)
|
|
132
|
+
async reloadAfterChange() {
|
|
133
|
+
try {
|
|
134
|
+
await this.getCapabilities()
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.error('Failed to reload capabilities after a successful change', e)
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
async updateStore () {
|
|
141
|
+
if (this.apiState === ApiState.INIT) {
|
|
142
|
+
this.apiState = ApiState.LOADING;
|
|
143
|
+
} else {
|
|
144
|
+
this.apiState = ApiState.UPDATING;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return Promise.all([
|
|
148
|
+
this.getCapabilities(),
|
|
149
|
+
this.getCapabilityServices(),
|
|
150
|
+
]).then(() => {
|
|
151
|
+
this.apiState = ApiState.LOADED;
|
|
152
|
+
console.log("capabilitiesStore updated")
|
|
153
|
+
}).catch((e) => {
|
|
154
|
+
this.apiState = ApiState.ERROR;
|
|
155
|
+
console.log("Failed to update capabilitiesStore: ", e)
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import ApiState from '@/api/apiState.js'
|
|
2
|
+
import CatalogRestApi from "@/api/catalog/catalogRestApi";
|
|
3
|
+
import {defineStore} from 'pinia'
|
|
4
|
+
|
|
5
|
+
interface CatalogStoreState{
|
|
6
|
+
apiState: number,
|
|
7
|
+
aasSubmodelTemplates: [],
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const useCatalogStore = defineStore('catalogStore', {
|
|
12
|
+
persist: true,
|
|
13
|
+
|
|
14
|
+
state: (): CatalogStoreState => ({
|
|
15
|
+
apiState: ApiState.INIT,
|
|
16
|
+
aasSubmodelTemplates: []
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
getters:{
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
actions: {
|
|
23
|
+
async getSubmodelTemplates () {
|
|
24
|
+
await CatalogRestApi.getAASSubmodelTemplates()
|
|
25
|
+
.then(
|
|
26
|
+
receivedAasSubmodelTemplates => {
|
|
27
|
+
this.aasSubmodelTemplates = receivedAasSubmodelTemplates;
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
async updateStore () {
|
|
32
|
+
if (this.apiState === ApiState.INIT) {
|
|
33
|
+
this.apiState = ApiState.LOADING;
|
|
34
|
+
} else {
|
|
35
|
+
this.apiState = ApiState.UPDATING;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return Promise.all([
|
|
39
|
+
this.getSubmodelTemplates(),
|
|
40
|
+
]).then(() => {
|
|
41
|
+
this.apiState = ApiState.LOADED;
|
|
42
|
+
console.log("catalogStore updated")
|
|
43
|
+
}).catch((e) => {
|
|
44
|
+
this.apiState = ApiState.ERROR;
|
|
45
|
+
console.log("Failed to update catalogStore: ", e)
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import ApiState from '@/api/apiState'
|
|
2
|
+
import {defineStore} from "pinia";
|
|
3
|
+
import ResourceManagementClient from "@/api/resource-management/resource-management-client";
|
|
4
|
+
import logRequestError from "@/api/restApiHelper";
|
|
5
|
+
import {DiscoveryJob} from "@/api/resource-management/client";
|
|
6
|
+
|
|
7
|
+
interface DiscoveryStoreState{
|
|
8
|
+
apiState: number,
|
|
9
|
+
drivers: any[],
|
|
10
|
+
discoveredResources: any[],
|
|
11
|
+
discoveryJobs: DiscoveryJob[],
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const useDiscoveryStore = defineStore('discoveryStore', {
|
|
15
|
+
persist: true,
|
|
16
|
+
|
|
17
|
+
state:():DiscoveryStoreState => ({
|
|
18
|
+
apiState: ApiState.INIT,
|
|
19
|
+
drivers: [],
|
|
20
|
+
discoveredResources: [],
|
|
21
|
+
discoveryJobs: [],
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
getters: {
|
|
25
|
+
discoveredResourceByResultId: (state) => (resultId) => {
|
|
26
|
+
return state.discoveredResources.find(discoveredResource => discoveredResource.resultId === resultId)
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
discoveryJobById: (state) => (discoveryJobId): DiscoveryJob | undefined => {
|
|
30
|
+
return state.discoveryJobs.find(discoveryJob => discoveryJob.id === discoveryJobId)
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
actions: {
|
|
35
|
+
async updateDiscoveryStore () {
|
|
36
|
+
console.log("Update discovery store")
|
|
37
|
+
this.getDrivers().then();
|
|
38
|
+
this.getDiscoveredResources().then();
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
async getDrivers () {
|
|
42
|
+
|
|
43
|
+
return await ResourceManagementClient.discoveryApi.getRegisteredDrivers().then(
|
|
44
|
+
response => {
|
|
45
|
+
this.drivers = response.data;
|
|
46
|
+
}
|
|
47
|
+
).catch(logRequestError)
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
async getDiscoveredResources (removeDuplicate = false, onlyLatestJobs = false, includeIgnored = false) {
|
|
51
|
+
return await ResourceManagementClient.discoveryApi.getDiscoveredResources(removeDuplicate, onlyLatestJobs, includeIgnored).then(
|
|
52
|
+
response => {
|
|
53
|
+
this.discoveredResources = response.data;
|
|
54
|
+
}
|
|
55
|
+
).catch(logRequestError)
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async getDiscoveryJobs () {
|
|
59
|
+
|
|
60
|
+
return await ResourceManagementClient.discoveryApi.getDiscoveryJobs().then(
|
|
61
|
+
response => {
|
|
62
|
+
this.discoveryJobs = response.data;
|
|
63
|
+
}
|
|
64
|
+
).catch(logRequestError)
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
async updateStore () {
|
|
68
|
+
if (this.apiState === ApiState.INIT) {
|
|
69
|
+
this.apiState = ApiState.LOADING;
|
|
70
|
+
} else {
|
|
71
|
+
this.apiState = ApiState.UPDATING;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Promise.all([
|
|
75
|
+
this.getDrivers(),
|
|
76
|
+
this.getDiscoveredResources(),
|
|
77
|
+
this.getDiscoveryJobs(),
|
|
78
|
+
]).then(() => {
|
|
79
|
+
this.apiState = ApiState.LOADED;
|
|
80
|
+
console.log("discoveryStore updated")
|
|
81
|
+
}).catch((e) => {
|
|
82
|
+
this.apiState = ApiState.ERROR;
|
|
83
|
+
console.log("Failed to update discoveryStore: ", e)
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const isProduction = import.meta.env.MODE === 'production';
|
|
5
|
+
|
|
6
|
+
export const useEnvStore = defineStore('envStore', () => {
|
|
7
|
+
// States
|
|
8
|
+
const _appVersion = ref(import.meta.env.VITE_APP_VERSION || (isProduction ? '/__ENV_APP_VERSION__PLACEHOLDER__/' : ''));
|
|
9
|
+
|
|
10
|
+
const _i18nLocale = ref(import.meta.env.VITE_APP_I18N_LOCALE || (isProduction ? '/__ENV_I18N_LOCALE__PLACEHOLDER__/' : ''));
|
|
11
|
+
const _i18nLocaleFallback = ref(import.meta.env.VITE_APP_I18N_LOCALE_FALLBACK || (isProduction ? '/__ENV_I18N_LOCALE_FALLBACK__PLACEHOLDER__/' : ''));
|
|
12
|
+
|
|
13
|
+
const _notificationServiceUrl = ref(import.meta.env.VITE_APP_NOTIFICATION_SERVICE_URL || (isProduction ? '/__ENV_NOTIFICATION_SERVICE_URL__PLACEHOLDER__/' : ''));
|
|
14
|
+
const _platformManagementUrl = ref(import.meta.env.VITE_APP_PLATFORM_MANAGEMENT_URL || (isProduction ? '/__ENV_PLATFORM_MANAGEMENT_URL__PLACEHOLDER__/' : ''));
|
|
15
|
+
const _resourceManagementUrl = ref(import.meta.env.VITE_APP_RESOURCE_MANAGEMENT_URL || (isProduction ? '/__ENV_RESOURCE_MANAGEMENT_URL__PLACEHOLDER__/' : ''));
|
|
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__/' : ''));
|
|
18
|
+
const _catalogServiceUrl = ref(import.meta.env.VITE_APP_CATALOG_SERVICE_URL || (isProduction ? '/__ENV_CATALOG_SERVICE_URL__PLACEHOLDER__/' : ''));
|
|
19
|
+
|
|
20
|
+
const _keycloakUrl = ref(import.meta.env.VITE_APP_KEYCLOAK_URL || (isProduction ? '/__ENV_KEYCLOAK_URL__PLACEHOLDER__/' : ''));
|
|
21
|
+
const _keycloakRealm = ref(import.meta.env.VITE_APP_KEYCLOAK_REALM || (isProduction ? '/__ENV_KEYCLOAK_REALM__PLACEHOLDER__/' : ''));
|
|
22
|
+
const _keycloakClientId = ref(import.meta.env.VITE_APP_KEYCLOAK_CLIENT_ID || (isProduction ? '/__ENV_KEYCLOAK_CLIENT_ID__PLACEHOLDER__/' : ''));
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const _basyxAasGuiUrl = ref(import.meta.env.VITE_APP_BASYX_AAS_GUI_URL || (isProduction ? '/__ENV_BASYX_AAS_GUI_URL__PLACEHOLDER__/' : ''));
|
|
26
|
+
|
|
27
|
+
// Getters
|
|
28
|
+
const appVersion = computed(() => _appVersion.value);
|
|
29
|
+
|
|
30
|
+
const i18nLocale = computed(() => _i18nLocale.value);
|
|
31
|
+
const i18nLocaleFallback = computed(() => _i18nLocaleFallback.value);
|
|
32
|
+
|
|
33
|
+
const notificationServiceUrl = computed(() => _notificationServiceUrl.value);
|
|
34
|
+
const platformManagementUrl = computed(() => _platformManagementUrl.value);
|
|
35
|
+
const resourceManagementUrl = computed(() => _resourceManagementUrl.value);
|
|
36
|
+
const serviceManagementUrl = computed(() => _serviceManagementUrl.value);
|
|
37
|
+
const ansibleServiceUrl = computed(() => _ansibleServiceUrl.value);
|
|
38
|
+
const catalogServiceUrl = computed(() => _catalogServiceUrl.value);
|
|
39
|
+
|
|
40
|
+
const keycloakUrl = computed(() => _keycloakUrl.value);
|
|
41
|
+
const keycloakRealm = computed(() => _keycloakRealm.value);
|
|
42
|
+
const keycloakClientId = computed(() => _keycloakClientId.value);
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const basyxAasGuiUrl = computed(() => _basyxAasGuiUrl.value);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
appVersion,
|
|
49
|
+
i18nLocale,
|
|
50
|
+
i18nLocaleFallback,
|
|
51
|
+
notificationServiceUrl,
|
|
52
|
+
resourceManagementUrl,
|
|
53
|
+
serviceManagementUrl,
|
|
54
|
+
ansibleServiceUrl,
|
|
55
|
+
catalogServiceUrl,
|
|
56
|
+
keycloakUrl,
|
|
57
|
+
keycloakRealm,
|
|
58
|
+
keycloakClientId,
|
|
59
|
+
basyxAasGuiUrl,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {defineStore} from "pinia";
|
|
2
|
+
import AnsibleServiceClient from "@/api/ansible-service/ansible-service-client";
|
|
3
|
+
import type {AnsibleJobDTO} from "@/api/ansible-service/client";
|
|
4
|
+
import logRequestError from "@/api/restApiHelper";
|
|
5
|
+
import ApiState from "@/api/apiState";
|
|
6
|
+
import {isFinalJobStatus} from "@/utils/jobStatus";
|
|
7
|
+
|
|
8
|
+
const POLL_INTERVAL_MS = 5000;
|
|
9
|
+
|
|
10
|
+
export interface JobsStoreState {
|
|
11
|
+
apiState: number,
|
|
12
|
+
jobs: AnsibleJobDTO[],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let pollTimer: ReturnType<typeof setInterval> | null = null;
|
|
16
|
+
|
|
17
|
+
export const useJobsStore = defineStore('jobsStore', {
|
|
18
|
+
state: (): JobsStoreState => ({
|
|
19
|
+
apiState: ApiState.INIT,
|
|
20
|
+
jobs: [],
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
getters: {
|
|
24
|
+
activeJobs: (state) => state.jobs.filter(job => !isFinalJobStatus(job.status)),
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
actions: {
|
|
28
|
+
async getJobs() {
|
|
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
|
+
},
|
|
39
|
+
|
|
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
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
async cancelJob(jobId: string) {
|
|
54
|
+
await AnsibleServiceClient.jobsApi.cancelJob(jobId);
|
|
55
|
+
await this.getJobs();
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async updateStore() {
|
|
59
|
+
if (this.apiState === ApiState.INIT) {
|
|
60
|
+
this.apiState = ApiState.LOADING;
|
|
61
|
+
} else {
|
|
62
|
+
this.apiState = ApiState.UPDATING;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return this.getJobs().then(() => {
|
|
66
|
+
this.apiState = ApiState.LOADED;
|
|
67
|
+
}).catch((e) => {
|
|
68
|
+
this.apiState = ApiState.ERROR;
|
|
69
|
+
console.log("Failed to update jobsStore: ", e);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
});
|