Remediate the 2026-09-03 feature-test findings
This commit is contained in:
@@ -2,7 +2,14 @@
|
||||
<div>
|
||||
<div class="page-header">
|
||||
<h2>Configuration Policies</h2>
|
||||
<button class="btn btn-primary" @click="openModal()">+ Add Policy</button>
|
||||
<button v-if="!featureOff" class="btn btn-primary" @click="openModal()">+ Add Policy</button>
|
||||
</div>
|
||||
|
||||
<div v-if="featureOff" class="card feature-off-notice">
|
||||
<strong>Configuration policies are not enabled on this site.</strong>
|
||||
<p>Nothing can be created here until the feature is turned on. The
|
||||
list is empty because the feature is off, not because nothing
|
||||
has been configured.</p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
@@ -123,6 +130,7 @@ const apps = ref([])
|
||||
const actionCatalog = ref([])
|
||||
const monitors = ref([])
|
||||
const loading = ref(true)
|
||||
const featureOff = ref(false)
|
||||
|
||||
const showModal = ref(false)
|
||||
const editing = ref(null)
|
||||
@@ -145,8 +153,8 @@ async function loadData() {
|
||||
// 500'd, which looked like data loss.
|
||||
const [pol, types, appList, actions, monitorList] = await Promise.allSettled([
|
||||
computersApi.policies.configuration.list(),
|
||||
computersApi.types.list({ perpage: 200 }),
|
||||
applicationsApi.listAll({ perpage: 200 }),
|
||||
computersApi.types.listAll(),
|
||||
applicationsApi.listAll(),
|
||||
computersApi.policies.actions(),
|
||||
endpointsApi.monitors.list()
|
||||
])
|
||||
@@ -155,8 +163,13 @@ async function loadData() {
|
||||
|
||||
if (pol.status === 'fulfilled') {
|
||||
policies.value = pol.value.data.data || []
|
||||
featureOff.value = false
|
||||
} else {
|
||||
failures.push('policies')
|
||||
// The API answers 404 'Policy feature is not enabled' when the flag is
|
||||
// off. Without telling them apart the page rendered an empty table and
|
||||
// an Add button for a feature that cannot accept one.
|
||||
featureOff.value = pol.reason?.response?.status === 404
|
||||
if (!featureOff.value) failures.push('policies')
|
||||
console.error('Error loading policies:', pol.reason)
|
||||
}
|
||||
|
||||
@@ -284,6 +297,13 @@ async function remove(p) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.feature-off-notice {
|
||||
border-left: 3px solid var(--warning);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.feature-off-notice p {
|
||||
margin: 0.4rem 0 0 0;
|
||||
}
|
||||
.modal-lg {
|
||||
max-width: 760px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user