Initial
This commit is contained in:
@@ -425,6 +425,7 @@
|
||||
:loading="vcenterImportLoading"
|
||||
:error="vcenterImportError"
|
||||
:status="vcenterImportStatus"
|
||||
:diagnostics="vcenterImportDiagnostics"
|
||||
@close="vcenterImportOpen = false"
|
||||
@preview="previewVCenterImport"
|
||||
@import="importVCenterHosts"
|
||||
@@ -980,6 +981,7 @@ const vcenterImportLoading = ref(false);
|
||||
const vcenterImportError = ref('');
|
||||
const vcenterPreviewRows = ref([]);
|
||||
const vcenterImportStatus = ref(null);
|
||||
const vcenterImportDiagnostics = ref(null);
|
||||
const credentialModalOpen = ref(false);
|
||||
const runPlanModalOpen = ref(false);
|
||||
const variableModalOpen = ref(false);
|
||||
@@ -2349,6 +2351,7 @@ async function saveHost() {
|
||||
async function openVCenterImport() {
|
||||
vcenterImportOpen.value = true;
|
||||
vcenterImportError.value = '';
|
||||
vcenterImportDiagnostics.value = null;
|
||||
try {
|
||||
vcenterImportStatus.value = await api.get('/api/hosts/import/vcenter/status');
|
||||
} catch (err) {
|
||||
@@ -2362,8 +2365,9 @@ async function previewVCenterImport(payload) {
|
||||
try {
|
||||
const result = await api.post('/api/hosts/import/vcenter/preview', payload);
|
||||
vcenterImportStatus.value = result.status;
|
||||
vcenterImportDiagnostics.value = result.diagnostics || null;
|
||||
vcenterPreviewRows.value = result.candidates || [];
|
||||
notify(`Found ${result.count || 0} vCenter host candidate(s)`);
|
||||
notify(`Found ${result.count || 0} vCenter host candidate(s) from ${result.diagnostics?.totalFromVCenter ?? 'unknown'} VM(s)`);
|
||||
} catch (err) {
|
||||
vcenterImportError.value = err.message;
|
||||
notify(err.message, 'error');
|
||||
@@ -2379,6 +2383,7 @@ async function importVCenterHosts(payload) {
|
||||
const result = await api.post('/api/hosts/import/vcenter', payload);
|
||||
await refreshAll();
|
||||
vcenterPreviewRows.value = [];
|
||||
vcenterImportDiagnostics.value = null;
|
||||
vcenterImportOpen.value = false;
|
||||
const skipped = result.skipped?.length || 0;
|
||||
notify(`Imported ${result.imported?.length || 0} host(s)${skipped ? `, skipped ${skipped} duplicate(s)` : ''}`);
|
||||
|
||||
Reference in New Issue
Block a user