diff --git a/inertia/pages/configurations/ConfigurationDetail.vue b/inertia/pages/configurations/ConfigurationDetail.vue index 3296228..855abb1 100644 --- a/inertia/pages/configurations/ConfigurationDetail.vue +++ b/inertia/pages/configurations/ConfigurationDetail.vue @@ -13,11 +13,12 @@ const configuration = ref(null) const versionHistory = ref([]) const activeTab = ref('general') -// Dry run state +// Dry run state (modal) const dryRunDeviceId = ref('') const dryRunLoading = ref(false) const dryRunResult = ref(null) const dryRunError = ref('') +const showDryRunModal = ref(false) // Compliance state const complianceLoading = ref(false) @@ -30,7 +31,6 @@ const tabs = [ { key: 'inventory', label: t('configDetail.tabInventory') }, { key: 'parameters', label: t('configDetail.tabParameters') }, { key: 'compliance', label: t('configDetail.tabCompliance') }, - { key: 'dryrun', label: t('configDetail.tabDryRun') }, { key: 'history', label: t('configDetail.tabHistory') }, ] @@ -57,16 +57,21 @@ async function loadHistory() { } catch {} } -async function runDryRun() { - if (!dryRunDeviceId.value.trim()) return +async function runDryRun(deviceIdentifier?: string) { + const targetDevice = deviceIdentifier || dryRunDeviceId.value.trim() + if (!targetDevice) return + + dryRunDeviceId.value = targetDevice dryRunLoading.value = true dryRunResult.value = null dryRunError.value = '' + showDryRunModal.value = true + try { const res = await fetch(`/api/v1/configurations/${props.id}/dry-run`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ deviceIdentifier: dryRunDeviceId.value.trim() }), + body: JSON.stringify({ deviceIdentifier: targetDevice }), }) const data = await res.json() if (!res.ok) { @@ -81,6 +86,12 @@ async function runDryRun() { } } +function closeDryRunModal() { + showDryRunModal.value = false + dryRunResult.value = null + dryRunError.value = '' +} + async function loadCompliance() { complianceLoading.value = true complianceReport.value = null @@ -307,7 +318,7 @@ function goToDevice(identifier: string) { router.get(`/devices/${identifier}`) } {{ device.deviceId?.serialNumber ?? '—' }} {{ t('configDetail.compliant') }} - {{ t('configDetail.nonCompliant') }} + {{ t('configDetail.nonCompliant') }} {{ device.parameterDiffs.length }} diff(s) @@ -326,76 +337,6 @@ function goToDevice(identifier: string) { router.get(`/devices/${identifier}`) } - -
-
-

{{ t('configDetail.dryRunDesc') }}

-
-
- - -
-
- -
-
- -
{{ dryRunError }}
- - -
-
-
@@ -434,5 +375,85 @@ function goToDevice(identifier: string) { router.get(`/devices/${identifier}`) }
+ + + + + +