From d9419c3f7852bfbf5d3898bd570c6ef99c8c2c88 Mon Sep 17 00:00:00 2001 From: sulmo Date: Mon, 9 Dec 2024 18:06:20 +0900 Subject: [PATCH 1/4] refactor(collector): update API calls to use inventoryV2 Signed-off-by: sulmo --- .../asset-inventory/components/CollectorBaseInfoSection.vue | 4 ++-- .../asset-inventory/components/CollectorCreateStep4.vue | 4 ++-- .../asset-inventory/components/CollectorDataModal.vue | 2 +- .../components/CollectorDetailNameEditModal.vue | 2 +- .../components/CollectorDetailOptionsSection.vue | 2 +- .../components/CollectorDetailScheduleSection.vue | 2 +- .../components/CollectorDetailServiceAccountsSection.vue | 2 +- .../asset-inventory/components/CollectorFormSchedule.vue | 2 +- .../services/asset-inventory/pages/CollectorDetailPage.vue | 4 ++-- .../services/asset-inventory/pages/CollectorMainPage.vue | 2 +- .../pages/admin/AdminCollectorDetailPage.vue | 4 ++-- .../asset-inventory/pages/admin/AdminCollectorMainPage.vue | 2 +- .../asset-inventory/stores/collector-detail-page-store.ts | 2 +- .../services/asset-inventory/stores/collector-page-store.ts | 2 +- apps/web/src/store/reference/collector-reference-store.ts | 6 +++++- 15 files changed, 23 insertions(+), 19 deletions(-) diff --git a/apps/web/src/services/asset-inventory/components/CollectorBaseInfoSection.vue b/apps/web/src/services/asset-inventory/components/CollectorBaseInfoSection.vue index d84ab2e179..8058a7b7b5 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorBaseInfoSection.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorBaseInfoSection.vue @@ -137,7 +137,7 @@ const fetchCollectorPluginUpdate = async (): Promise => { version: collectorFormState.version, upgrade_mode: collectorFormState.autoUpgrade ? 'AUTO' : 'MANUAL', }; - return SpaceConnector.clientV2.inventory.collector.updatePlugin(params); + return SpaceConnector.clientV2.inventoryV2.collector.updatePlugin(params); }; const fetchCollectorUpdate = async (): Promise => { if (!collectorFormState.collectorId) throw new Error('collector_id is required'); @@ -145,7 +145,7 @@ const fetchCollectorUpdate = async (): Promise => { collector_id: collectorFormState.collectorId, tags: collectorFormState.tags, }; - return SpaceConnector.clientV2.inventory.collector.update(params); + return SpaceConnector.clientV2.inventoryV2.collector.update(params); }; const getRepositoryPlugin = async (pluginId: string) => { try { diff --git a/apps/web/src/services/asset-inventory/components/CollectorCreateStep4.vue b/apps/web/src/services/asset-inventory/components/CollectorCreateStep4.vue index 8fd8fad440..8d65c8ff8f 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorCreateStep4.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorCreateStep4.vue @@ -141,7 +141,7 @@ const handleClickCreateButton = async () => { exclude_service_accounts: collectorFormState.serviceAccounts, }; Object.assign(params.secret_filter ?? {}, serviceAccountParams); - const res:CollectorModel = await SpaceConnector.clientV2.inventory.collector.create(params); + const res:CollectorModel = await SpaceConnector.clientV2.inventoryV2.collector.create(params); state.createdCollectorId = res?.collector_id; state.visibleCreateCompleteModal = true; showSuccessMessage(i18n.t('INVENTORY.COLLECTOR.CREATE.ALT_S_CREATE_COLLECTOR'), ''); @@ -166,7 +166,7 @@ const handleConfirmCreateCollector = async () => { state.collectLoading = true; // After the collector created, if the user clicks the collect button, the collector will be executed. if (state.createdCollectorId) { - await SpaceConnector.clientV2.inventory.collector.collect({ + await SpaceConnector.clientV2.inventoryV2.collector.collect({ collector_id: state.createdCollectorId, }); } else { diff --git a/apps/web/src/services/asset-inventory/components/CollectorDataModal.vue b/apps/web/src/services/asset-inventory/components/CollectorDataModal.vue index 1a0abc2c74..cc6c92de8d 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorDataModal.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorDataModal.vue @@ -125,7 +125,7 @@ const handleClickConfirm = async () => { state.loading = true; try { - await SpaceConnector.clientV2.inventory.collector.collect({ + await SpaceConnector.clientV2.inventoryV2.collector.collect({ collector_id: collectorDataModalState.selectedCollector.collector_id, secret_id: collectorDataModalState.selectedSecret?.secret_id, }); diff --git a/apps/web/src/services/asset-inventory/components/CollectorDetailNameEditModal.vue b/apps/web/src/services/asset-inventory/components/CollectorDetailNameEditModal.vue index 0d50c52b0d..6d56557d7b 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorDetailNameEditModal.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorDetailNameEditModal.vue @@ -57,7 +57,7 @@ const fetchUpdateCollectorName = async (): Promise => { collector_id: collectorFormState.collectorId, name: collectorFormState.name, }; - return SpaceConnector.clientV2.inventory.collector.update(params); + return SpaceConnector.clientV2.inventoryV2.collector.update(params); }; const handleUpdateIsValid = (value: boolean) => { diff --git a/apps/web/src/services/asset-inventory/components/CollectorDetailOptionsSection.vue b/apps/web/src/services/asset-inventory/components/CollectorDetailOptionsSection.vue index 24b63e0121..6dedece129 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorDetailOptionsSection.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorDetailOptionsSection.vue @@ -125,7 +125,7 @@ const fetchCollectorPluginUpdate = async (): Promise => { collector_id: collectorFormState.collectorId, options: collectorFormState.options, }; - return SpaceConnector.clientV2.inventory.collector.updatePlugin(params); + return SpaceConnector.clientV2.inventoryV2.collector.updatePlugin(params); }; const handleClickEdit = () => { state.isEditMode = true; diff --git a/apps/web/src/services/asset-inventory/components/CollectorDetailScheduleSection.vue b/apps/web/src/services/asset-inventory/components/CollectorDetailScheduleSection.vue index 548a63c9f6..f2488a8896 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorDetailScheduleSection.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorDetailScheduleSection.vue @@ -83,7 +83,7 @@ const fetchCollectorUpdate = async (): Promise => { hours: collectorFormState.scheduleHours, }, }; - return SpaceConnector.clientV2.inventory.collector.update(params); + return SpaceConnector.clientV2.inventoryV2.collector.update(params); }; const handleClickEdit = () => { diff --git a/apps/web/src/services/asset-inventory/components/CollectorDetailServiceAccountsSection.vue b/apps/web/src/services/asset-inventory/components/CollectorDetailServiceAccountsSection.vue index a49af6d6d7..143977a246 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorDetailServiceAccountsSection.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorDetailServiceAccountsSection.vue @@ -110,7 +110,7 @@ const fetchCollectorUpdate = async (): Promise => { service_accounts: [], }; Object.assign(params.secret_filter ?? {}, serviceAccountParams); - return SpaceConnector.clientV2.inventory.collector.update(params); + return SpaceConnector.clientV2.inventoryV2.collector.update(params); }; diff --git a/apps/web/src/services/asset-inventory/components/CollectorFormSchedule.vue b/apps/web/src/services/asset-inventory/components/CollectorFormSchedule.vue index 28781cc9bb..a6aa931411 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorFormSchedule.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorFormSchedule.vue @@ -116,7 +116,7 @@ const fetchCollectorUpdate = async (): Promise => { state: collectorFormState.schedulePower ? 'ENABLED' : 'DISABLED', }, }; - return SpaceConnector.clientV2.inventory.collector.update(params); + return SpaceConnector.clientV2.inventoryV2.collector.update(params); }; const handleChangeToggle = async (value: boolean) => { diff --git a/apps/web/src/services/asset-inventory/pages/CollectorDetailPage.vue b/apps/web/src/services/asset-inventory/pages/CollectorDetailPage.vue index 9188b6247d..b4ac24e71a 100644 --- a/apps/web/src/services/asset-inventory/pages/CollectorDetailPage.vue +++ b/apps/web/src/services/asset-inventory/pages/CollectorDetailPage.vue @@ -145,7 +145,7 @@ defineExpose({ setPathFrom }); const getCollector = async (): Promise => { state.loading = true; try { - return await SpaceConnector.clientV2.inventory.collector.get({ + return await SpaceConnector.clientV2.inventoryV2.collector.get({ collector_id: props.collectorId, }); } catch (e) { @@ -156,7 +156,7 @@ const getCollector = async (): Promise => { } }; -const fetchDeleteCollector = async () => (collectorFormState.collectorId ? SpaceConnector.clientV2.inventory.collector.delete({ +const fetchDeleteCollector = async () => (collectorFormState.collectorId ? SpaceConnector.clientV2.inventoryV2.collector.delete({ collector_id: collectorFormState.collectorId, }) : undefined); diff --git a/apps/web/src/services/asset-inventory/pages/CollectorMainPage.vue b/apps/web/src/services/asset-inventory/pages/CollectorMainPage.vue index 32c0b9d502..be2c7c8d4f 100644 --- a/apps/web/src/services/asset-inventory/pages/CollectorMainPage.vue +++ b/apps/web/src/services/asset-inventory/pages/CollectorMainPage.vue @@ -90,7 +90,7 @@ const handleSelectedProvider = (providerName: string) => { const collectorCountApiQueryHelper = new ApiQueryHelper().setCountOnly(); const fetchCollectorCount = async () => { try { - const { total_count } = await SpaceConnector.clientV2.inventory.collector.list>({ + const { total_count } = await SpaceConnector.clientV2.inventoryV2.collector.list>({ query: collectorCountApiQueryHelper.data, }); state.hasCollectorList = (total_count ?? 0) > 0; diff --git a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorDetailPage.vue b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorDetailPage.vue index 43bebc6fd3..c4541d9493 100644 --- a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorDetailPage.vue +++ b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorDetailPage.vue @@ -228,7 +228,7 @@ defineExpose({ setPathFrom }); const getCollector = async (): Promise => { state.loading = true; try { - return await SpaceConnector.clientV2.inventory.collector.get({ + return await SpaceConnector.clientV2.inventoryV2.collector.get({ collector_id: props.collectorId, }); } catch (e) { @@ -239,7 +239,7 @@ const getCollector = async (): Promise => { } }; -const fetchDeleteCollector = async () => (collectorFormState.collectorId ? SpaceConnector.clientV2.inventory.collector.delete({ +const fetchDeleteCollector = async () => (collectorFormState.collectorId ? SpaceConnector.clientV2.inventoryV2.collector.delete({ collector_id: collectorFormState.collectorId, }) : undefined); diff --git a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorMainPage.vue b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorMainPage.vue index 26a8551932..e149fd8ccf 100644 --- a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorMainPage.vue +++ b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorMainPage.vue @@ -92,7 +92,7 @@ const handleSelectedProvider = (providerName: string) => { const collectorCountApiQueryHelper = new ApiQueryHelper().setCountOnly(); const fetchCollectorCount = async () => { try { - const { total_count } = await SpaceConnector.clientV2.inventory.collector.list>({ + const { total_count } = await SpaceConnector.clientV2.inventoryV2.collector.list>({ query: collectorCountApiQueryHelper.data, }); state.hasCollectorList = (total_count ?? 0) > 0; diff --git a/apps/web/src/services/asset-inventory/stores/collector-detail-page-store.ts b/apps/web/src/services/asset-inventory/stores/collector-detail-page-store.ts index d2727670dd..4a8f843fbd 100644 --- a/apps/web/src/services/asset-inventory/stores/collector-detail-page-store.ts +++ b/apps/web/src/services/asset-inventory/stores/collector-detail-page-store.ts @@ -33,7 +33,7 @@ export const useCollectorDetailPageStore = defineStore('page-collector-detail', const action = { fetchCollector: async (collectorId: string) => { try { - state.collector = await SpaceConnector.clientV2.inventory.collector.get({ + state.collector = await SpaceConnector.clientV2.inventoryV2.collector.get({ collector_id: collectorId, }); } catch (e) { diff --git a/apps/web/src/services/asset-inventory/stores/collector-page-store.ts b/apps/web/src/services/asset-inventory/stores/collector-page-store.ts index 7bfc9ff1b4..2360cc7821 100644 --- a/apps/web/src/services/asset-inventory/stores/collector-page-store.ts +++ b/apps/web/src/services/asset-inventory/stores/collector-page-store.ts @@ -131,7 +131,7 @@ export const useCollectorPageStore = defineStore('page-collector', () => { }, async updateCollectorSchedule(params) { try { - const response = await SpaceConnector.clientV2.inventory.collector.update(params); + const response = await SpaceConnector.clientV2.inventoryV2.collector.update(params); const updatedCollectorIndex = state.collectors.findIndex((collector) => collector.collector_id === response.collector_id); state.collectors[updatedCollectorIndex] = response; showSuccessMessage(i18n.t('INVENTORY.COLLECTOR.ALT_S_UPDATE_SCHEDULE'), ''); diff --git a/apps/web/src/store/reference/collector-reference-store.ts b/apps/web/src/store/reference/collector-reference-store.ts index e97309aeb9..d9f6376277 100644 --- a/apps/web/src/store/reference/collector-reference-store.ts +++ b/apps/web/src/store/reference/collector-reference-store.ts @@ -14,6 +14,7 @@ import type { } from '@/store/reference/type'; import { useUserStore } from '@/store/user/user-store'; +import config from '@/lib/config'; import { assetUrlConverter } from '@/lib/helper/asset-helper'; import { MANAGED_VARIABLE_MODELS } from '@/lib/variable-models/managed-model-config/base-managed-model-config'; @@ -58,7 +59,10 @@ export const useCollectorReferenceStore = defineStore('reference-collector', () const referenceMap: CollectorReferenceMap = {}; try { - const response = await SpaceConnector.clientV2.inventory.collector.list>({ + const isResourceManagerVersionV2 = config.get('RESOURCE_MANAGER_VERSION') === 'v2'; + const collectorFetcher = isResourceManagerVersionV2 ? SpaceConnector.clientV2.inventoryV2.collector.list : SpaceConnector.clientV2.inventory.collector.list; + + const response = await collectorFetcher>({ query: { only: ['collector_id', 'name', 'tags'], }, From 938469963904364d0aed3dc7cec38302d4e53731 Mon Sep 17 00:00:00 2001 From: sulmo Date: Tue, 10 Dec 2024 15:13:10 +0900 Subject: [PATCH 2/4] refactor: use user store for language state management - Replace direct store access with `useUserStore` for language. - Update components to use computed property for language. Signed-off-by: sulmo --- .../asset-inventory/components/CollectorFormOptions.vue | 6 +++++- .../components/ServiceAccountBaseInformationForm.vue | 6 +++++- .../asset-inventory/pages/ServiceAccountAddPage.vue | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/web/src/services/asset-inventory/components/CollectorFormOptions.vue b/apps/web/src/services/asset-inventory/components/CollectorFormOptions.vue index c43a3b793b..602f75325b 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorFormOptions.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorFormOptions.vue @@ -11,7 +11,7 @@ > (() => collectorFormState.repositoryPlugin?.plugin_id), schema: null as null|JsonSchema|object, + language: computed(() => userStore.state.language), }); const fetchGetPluginMetadata = (provider: string|undefined): Promise => { diff --git a/apps/web/src/services/asset-inventory/components/ServiceAccountBaseInformationForm.vue b/apps/web/src/services/asset-inventory/components/ServiceAccountBaseInformationForm.vue index 370ecb105e..cc06969f0b 100644 --- a/apps/web/src/services/asset-inventory/components/ServiceAccountBaseInformationForm.vue +++ b/apps/web/src/services/asset-inventory/components/ServiceAccountBaseInformationForm.vue @@ -14,6 +14,8 @@ import type { ServiceAccountModel } from '@/schema/identity/service-account/mode import type { TrustedAccountModel } from '@/schema/identity/trusted-account/model'; import { i18n } from '@/translations'; +import { useUserStore } from '@/store/user/user-store'; + import type { Tag } from '@/common/components/forms/tags-input-group/type'; import TagsInput from '@/common/components/inputs/TagsInput.vue'; import { useFormValidator } from '@/common/composables/form-validator'; @@ -34,6 +36,7 @@ const props = withDefaults(defineProps(), { mode: 'CREATE', }); +const userStore = useUserStore(); const serviceAccountPageStore = useServiceAccountPageStore(); const serviceAccountPageGetters = serviceAccountPageStore.getters; @@ -85,6 +88,7 @@ const state = reactive({ && (serviceAccountPageGetters.isTrustedAccount ? true : (state.isProjectFormValid || state.originForm?.projectForm?.selectedProjectId)) && state.isTagsValid && (isEmpty(props.schema) ? true : state.isCustomSchemaFormValid))), + language: computed(() => userStore.state.language), }); /* Util */ @@ -166,7 +170,7 @@ watch(() => state.originForm, (originForm) => { class="p-json-schema-form" :form-data.sync="state.customSchemaForm" :schema="props.schema" - :language="$store.state.user.language" + :language="state.language" @validate="handleAccountValidate" /> (() => allReferenceStore.getters.provider), trustedAccounts: computed(() => allReferenceStore.getters.trustedAccount), + language: computed(() => userStore.state.language), }); const state = reactive({ @@ -261,7 +264,7 @@ const handleRouteToServiceAccountDetailPage = () => { From 31fe776fca43515e759d702906ca4723fb99faad Mon Sep 17 00:00:00 2001 From: sulmo Date: Tue, 10 Dec 2024 15:36:23 +0900 Subject: [PATCH 3/4] refactor(job): update API calls to use inventoryV2 endpoint - Changed all job-related API calls from `inventory` to `inventoryV2`. - Updated methods in various components and stores for consistency. Signed-off-by: sulmo --- .../services/asset-inventory/pages/CollectHistoryJobPage.vue | 2 +- .../services/asset-inventory/pages/CollectorHistoryPage.vue | 2 +- .../pages/admin/AdminCollectHistoryJobPage.vue | 2 +- .../asset-inventory/pages/admin/AdminCollectorHistoryPage.vue | 2 +- .../asset-inventory/stores/collector-data-modal-store.ts | 2 +- .../services/asset-inventory/stores/collector-job-store.ts | 4 ++-- .../services/asset-inventory/stores/collector-page-store.ts | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/web/src/services/asset-inventory/pages/CollectHistoryJobPage.vue b/apps/web/src/services/asset-inventory/pages/CollectHistoryJobPage.vue index 43f556f803..6019d42389 100644 --- a/apps/web/src/services/asset-inventory/pages/CollectHistoryJobPage.vue +++ b/apps/web/src/services/asset-inventory/pages/CollectHistoryJobPage.vue @@ -39,7 +39,7 @@ const apiQuery = new ApiQueryHelper(); const getJob = async () => { try { apiQuery.setFilters([{ k: 'job_id', v: props.jobId, o: '=' }]); - const { results } = await SpaceConnector.clientV2.inventory.job.list({ + const { results } = await SpaceConnector.clientV2.inventoryV2.job.list({ query: apiQuery.data, }); state.job = results[0] || {}; diff --git a/apps/web/src/services/asset-inventory/pages/CollectorHistoryPage.vue b/apps/web/src/services/asset-inventory/pages/CollectorHistoryPage.vue index 1f778d3c5e..9c8cb8b92d 100644 --- a/apps/web/src/services/asset-inventory/pages/CollectorHistoryPage.vue +++ b/apps/web/src/services/asset-inventory/pages/CollectorHistoryPage.vue @@ -163,7 +163,7 @@ const handleChangePagination = () => { const getJobs = async () => { state.loading = true; try { - const res = await SpaceConnector.clientV2.inventory.job.list>({ query: getQuery() }); + const res = await SpaceConnector.clientV2.inventoryV2.job.list>({ query: getQuery() }); state.totalCount = res.total_count ?? 0; state.items = (res.results ?? []).map((job) => { const collector = storeState.collectors[job.collector_id]; diff --git a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectHistoryJobPage.vue b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectHistoryJobPage.vue index d45849e994..d28ff7d184 100644 --- a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectHistoryJobPage.vue +++ b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectHistoryJobPage.vue @@ -39,7 +39,7 @@ const apiQuery = new ApiQueryHelper(); const getJob = async () => { try { apiQuery.setFilters([{ k: 'job_id', v: props.jobId, o: '=' }]); - const { results } = await SpaceConnector.clientV2.inventory.job.list({ + const { results } = await SpaceConnector.clientV2.inventoryV2.job.list({ query: apiQuery.data, }); state.job = results[0] || {}; diff --git a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorHistoryPage.vue b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorHistoryPage.vue index 1241d3ce6f..de7aba21c1 100644 --- a/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorHistoryPage.vue +++ b/apps/web/src/services/asset-inventory/pages/admin/AdminCollectorHistoryPage.vue @@ -173,7 +173,7 @@ const handleChangePagination = () => { const getJobs = async () => { state.loading = true; try { - const res = await SpaceConnector.clientV2.inventory.job.list>({ query: getQuery() }); + const res = await SpaceConnector.clientV2.inventoryV2.job.list>({ query: getQuery() }); state.totalCount = res.total_count ?? 0; state.items = (res.results ?? []).map((job) => { const collector = storeState.collectors[job.collector_id]; diff --git a/apps/web/src/services/asset-inventory/stores/collector-data-modal-store.ts b/apps/web/src/services/asset-inventory/stores/collector-data-modal-store.ts index 9e377ebced..b4d0137e86 100644 --- a/apps/web/src/services/asset-inventory/stores/collector-data-modal-store.ts +++ b/apps/web/src/services/asset-inventory/stores/collector-data-modal-store.ts @@ -46,7 +46,7 @@ export const useCollectorDataModalStore = defineStore('collector-data-modal', { async getJobs(collectorId: string) { this.initLoading = true; try { - const { results } = await SpaceConnector.clientV2.inventory.job.list>({ collector_id: collectorId }); + const { results } = await SpaceConnector.clientV2.inventoryV2.job.list>({ collector_id: collectorId }); if ((results ?? []).length > 0 && results) { if (this.selectedSecret) { const filteredJobs = results.filter((job) => job.secret_id); diff --git a/apps/web/src/services/asset-inventory/stores/collector-job-store.ts b/apps/web/src/services/asset-inventory/stores/collector-job-store.ts index cb9e29fb8c..4aa052a67b 100644 --- a/apps/web/src/services/asset-inventory/stores/collector-job-store.ts +++ b/apps/web/src/services/asset-inventory/stores/collector-job-store.ts @@ -48,7 +48,7 @@ export const useCollectorJobStore = defineStore('collector-job', { allJobsCountQueryHelper.setFilters([ { k: 'collector_id', v: this.collector.collector_id, o: '=' }, ]); - const { total_count } = await SpaceConnector.clientV2.inventory.job.list({ + const { total_count } = await SpaceConnector.clientV2.inventoryV2.job.list({ query: allJobsCountQueryHelper.data, }); this.allJobsCount = total_count ?? 0; @@ -65,7 +65,7 @@ export const useCollectorJobStore = defineStore('collector-job', { { k: 'collector_id', v: this.collector.collector_id, o: '=' }, { k: 'created_at', v: fiveDaysAgo, o: '>' }, ]); - const { results } = await SpaceConnector.clientV2.inventory.job.list>({ + const { results } = await SpaceConnector.clientV2.inventoryV2.job.list>({ query: jobQueryHelper.data, }); this.recentJobs = results ?? []; diff --git a/apps/web/src/services/asset-inventory/stores/collector-page-store.ts b/apps/web/src/services/asset-inventory/stores/collector-page-store.ts index 2360cc7821..23634de7e9 100644 --- a/apps/web/src/services/asset-inventory/stores/collector-page-store.ts +++ b/apps/web/src/services/asset-inventory/stores/collector-page-store.ts @@ -87,7 +87,7 @@ export const useCollectorPageStore = defineStore('page-collector', () => { }, async getCollectorJobs(ids) { try { - const { results } = await SpaceConnector.clientV2.inventory.job.analyze({ + const { results } = await SpaceConnector.clientV2.inventoryV2.job.analyze({ query: { filter: [ { @@ -123,7 +123,7 @@ export const useCollectorPageStore = defineStore('page-collector', () => { }, async getJobs() { try { - const res = await SpaceConnector.clientV2.inventory.job.list(); + const res = await SpaceConnector.clientV2.inventoryV2.job.list(); state.recentJobs = res.results; } catch (e) { ErrorHandler.handleError(e); From 9ac73daec263fc8ee5cdb3c87d56736d7e1606e3 Mon Sep 17 00:00:00 2001 From: sulmo Date: Tue, 10 Dec 2024 15:50:46 +0900 Subject: [PATCH 4/4] refactor(job-task): update API calls to use inventoryV2 endpoint - Corrected the API endpoint to use the updated version. - Ensured compatibility with the new inventoryV2 client. Signed-off-by: sulmo --- .../asset-inventory/components/CollectorHistoryJobTaskTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/services/asset-inventory/components/CollectorHistoryJobTaskTable.vue b/apps/web/src/services/asset-inventory/components/CollectorHistoryJobTaskTable.vue index 492f5c1d39..8b44339426 100644 --- a/apps/web/src/services/asset-inventory/components/CollectorHistoryJobTaskTable.vue +++ b/apps/web/src/services/asset-inventory/components/CollectorHistoryJobTaskTable.vue @@ -173,7 +173,7 @@ const handleChange = async (options: any = {}) => { const getJobTasks = async () => { state.loading = true; try { - const res = await SpaceConnector.clientV2.inventory.jobTask.list>({ + const res = await SpaceConnector.clientV2.inventoryV2.jobTask.list>({ query: getQuery(), job_id: props.jobId, });