Remove orphaned settings-dir GE-Enforce views (moved to geenforce/ section)
The earlier move copied instead of moving, leaving unreachable duplicates under views/settings/. The routed copies live in views/geenforce/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,161 +0,0 @@
|
||||
<template>
|
||||
<div class="enforcement-reports">
|
||||
<div class="page-header">
|
||||
<h2>Enforcement Reports</h2>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Latest GE-Enforce result reported by each PC. "Received" means the PC picked
|
||||
up the current published manifest; status shows self-heal and failures.
|
||||
</p>
|
||||
|
||||
<div v-if="error" class="error-message">{{ error }}</div>
|
||||
|
||||
<div class="filters">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
v-model="filterHost"
|
||||
placeholder="Filter hostname"
|
||||
@keyup.enter="load"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
v-model="filterScope"
|
||||
placeholder="Filter PC type"
|
||||
@keyup.enter="load"
|
||||
/>
|
||||
<button class="btn btn-primary" @click="load">Filter</button>
|
||||
<button class="btn btn-secondary" @click="clearFilters">Clear</button>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Host</th><th>PC type</th><th>Received</th><th>Version</th>
|
||||
<th>Status</th><th>Installed</th><th>Skipped</th><th>Failed</th>
|
||||
<th>Last check-in</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="report in reports" :key="report.reportid">
|
||||
<td>{{ report.hostname }}</td>
|
||||
<td>{{ report.scopename }}</td>
|
||||
<td>
|
||||
<span class="badge" :class="report.receivedlatest ? 'badge-success' : 'badge-warning'">
|
||||
{{ report.receivedlatest ? 'yes' : 'behind' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="muted">{{ report.appliedversion ?? '-' }} / {{ report.latestversion ?? '-' }}</td>
|
||||
<td><span class="badge" :class="statusClass(report.status)">{{ report.status }}</span></td>
|
||||
<td>{{ report.installed }}</td>
|
||||
<td class="muted">{{ report.skipped }}</td>
|
||||
<td :class="{ 'fail-count': report.failed }">{{ report.failed }}</td>
|
||||
<td class="muted">{{ formatDate(report.lastcheckin || report.receivedat) }}</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-sm btn-secondary" @click="openDetail(report.reportid)">Detail</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!reports.length"><td colspan="10" class="empty">No reports yet.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Detail modal -->
|
||||
<div v-if="detail" class="modal-overlay" @click.self="detail = null">
|
||||
<div class="modal modal-report">
|
||||
<div class="modal-header">
|
||||
<h3>{{ detail.hostname }} - {{ detail.scopename }}</h3>
|
||||
<button class="modal-close" @click="detail = null">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="setting-description">
|
||||
Applied v{{ detail.appliedversion ?? '-' }} of v{{ detail.latestversion ?? '-' }};
|
||||
status {{ detail.status }}
|
||||
</p>
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Entry</th><th>Action</th><th>Self-heal</th><th>Exit</th><th>Message</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(result, index) in detail.results" :key="index">
|
||||
<td>{{ result.entryname }}</td>
|
||||
<td><span class="badge" :class="actionClass(result.action)">{{ result.action }}</span></td>
|
||||
<td>{{ result.selfhealed ? 'yes' : '' }}</td>
|
||||
<td class="muted">{{ result.exitcode ?? '' }}</td>
|
||||
<td class="muted">{{ result.message }}</td>
|
||||
</tr>
|
||||
<tr v-if="!detail.results.length"><td colspan="5" class="empty">No per-entry detail.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="detail = null">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import api from '../../api'
|
||||
|
||||
const reports = ref([])
|
||||
const detail = ref(null)
|
||||
const error = ref('')
|
||||
const filterHost = ref('')
|
||||
const filterScope = ref('')
|
||||
|
||||
function payload(response) { return response.data.data }
|
||||
|
||||
async function load() {
|
||||
const params = {}
|
||||
if (filterHost.value) params.hostname = filterHost.value
|
||||
if (filterScope.value) params.scopename = filterScope.value
|
||||
try {
|
||||
reports.value = payload(await api.get('/geenforce/reports', { params }))
|
||||
error.value = ''
|
||||
} catch (e) { error.value = 'Failed to load reports' }
|
||||
}
|
||||
function clearFilters() { filterHost.value = ''; filterScope.value = ''; load() }
|
||||
async function openDetail(reportid) {
|
||||
try {
|
||||
detail.value = payload(await api.get(`/geenforce/reports/${reportid}`))
|
||||
} catch (e) { error.value = 'Failed to load report detail' }
|
||||
}
|
||||
|
||||
function statusClass(status) {
|
||||
return { ok: 'badge-success', selfhealed: 'badge-info', failed: 'badge-danger' }[status] || ''
|
||||
}
|
||||
function actionClass(action) {
|
||||
return { installed: 'badge-info', skipped: 'badge-success', failed: 'badge-danger',
|
||||
filtered: '' }[action] || ''
|
||||
}
|
||||
function formatDate(value) { return value ? new Date(value).toLocaleString() : '' }
|
||||
|
||||
load()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.enforcement-reports { max-width: 1100px; }
|
||||
.muted { color: var(--text-light); }
|
||||
.fail-count { color: var(--danger); font-weight: 600; }
|
||||
.empty { color: var(--text-light); text-align: center; padding: 1rem; }
|
||||
.modal-report { max-width: 640px; }
|
||||
.modal-close {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-light);
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.modal-close:hover { color: var(--text); }
|
||||
</style>
|
||||
@@ -1,857 +0,0 @@
|
||||
<template>
|
||||
<div class="imaging-pctypes">
|
||||
<div class="page-header">
|
||||
<h2>Imaging PC Types</h2>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Each imaging PC type owns a GE-Enforce install manifest. Edit the draft,
|
||||
then Publish to ship it to PCs. Nothing reaches a PC until you publish.
|
||||
</p>
|
||||
|
||||
<div v-if="error" class="error-message">{{ error }}</div>
|
||||
<div v-if="notice" class="settings-success">{{ notice }}</div>
|
||||
|
||||
<!-- Export configuration -->
|
||||
<div class="section-card">
|
||||
<h3 class="section-title">Export configuration</h3>
|
||||
<div class="setting-row full-width">
|
||||
<label>
|
||||
<span>On-share export root</span>
|
||||
<input v-model="shareRoot" placeholder="\\server\share\dt\shopfloor or /path" />
|
||||
<small class="input-hint">
|
||||
Used by Export to Share. During Milestone 1 the engine still reads
|
||||
these files; export is your push to the fleet.
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn btn-primary" @click="saveConfig">Save share root</button>
|
||||
</div>
|
||||
|
||||
<div class="editor-grid">
|
||||
<!-- Scope list -->
|
||||
<aside class="section-card scope-panel">
|
||||
<div class="section-head">
|
||||
<h3 class="section-title">PC Types</h3>
|
||||
<button class="btn btn-sm btn-primary" @click="openNewScope">+ New PC Type</button>
|
||||
</div>
|
||||
<div class="scope-list">
|
||||
<div
|
||||
v-for="scope in scopes"
|
||||
:key="scope.scopeid"
|
||||
class="scope-row"
|
||||
:class="{ active: scope.scopeid === selectedId }"
|
||||
@click="selectScope(scope.scopeid)"
|
||||
>
|
||||
<div class="scope-name">{{ scope.scopename }}</div>
|
||||
<div class="scope-meta">
|
||||
<span class="badge" :class="scope.phase === 'preinstall' ? 'badge-warning' : 'badge-info'">
|
||||
{{ scope.phase }}
|
||||
</span>
|
||||
<span>{{ scope.entrycount }} entries</span>
|
||||
<span v-if="scope.publishedversion">v{{ scope.publishedversion }}</span>
|
||||
<span v-else class="unpublished">unpublished</span>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="!scopes.length" class="empty">No PC types yet.</p>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Selected scope -->
|
||||
<div v-if="detail" class="scope-detail">
|
||||
<!-- Identity and mapping -->
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<h3 class="section-title">Identity & Mapping</h3>
|
||||
<div class="header-actions detail-actions">
|
||||
<button class="btn btn-sm btn-primary" @click="publish">Publish</button>
|
||||
<button class="btn btn-sm btn-secondary" @click="exportShare">Export to Share</button>
|
||||
<button class="btn btn-sm btn-secondary" @click="toggleVersions">Versions</button>
|
||||
<button class="btn btn-sm btn-secondary" @click="loadPreview">Preview</button>
|
||||
<button class="btn btn-sm btn-danger" @click="deleteScope">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Computer Type ID</span>
|
||||
<input type="number" v-model.number="detail.computertypeid" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Measuring Tool Type ID</span>
|
||||
<input type="number" v-model.number="detail.measuringtooltypeid" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Description</span>
|
||||
<input type="text" v-model="detail.description" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary" @click="saveScope">Save</button>
|
||||
</div>
|
||||
|
||||
<!-- Versions panel -->
|
||||
<div v-if="showVersions" class="section-card">
|
||||
<h3 class="section-title">Published versions</h3>
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Version</th><th>Published</th><th>Notes</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="version in versions" :key="version.versionnumber">
|
||||
<td>
|
||||
v{{ version.versionnumber }}
|
||||
<span v-if="version.iscurrent" class="badge badge-success">current</span>
|
||||
</td>
|
||||
<td class="muted">{{ formatDate(version.publishedat) }}</td>
|
||||
<td class="muted">{{ version.notes }}</td>
|
||||
<td class="actions">
|
||||
<button
|
||||
v-if="!version.iscurrent"
|
||||
class="btn btn-sm btn-secondary"
|
||||
@click="rollback(version.versionnumber)"
|
||||
>Roll back</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!versions.length"><td colspan="4" class="empty">No published versions.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Entries -->
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<h3 class="section-title">Manifest entries ({{ detail.entries.length }})</h3>
|
||||
<button class="btn btn-sm btn-primary" @click="openNewEntry">+ Add entry</button>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Order is execution order. Put config-restore entries after their installer.
|
||||
</p>
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Order</th><th>Name</th><th>Type</th><th>Detection</th><th>Filters</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(entry, index) in detail.entries" :key="entry.entryid">
|
||||
<td class="actions">
|
||||
<button
|
||||
class="btn btn-sm btn-secondary"
|
||||
:disabled="index === 0"
|
||||
@click="moveEntry(index, -1)"
|
||||
>Up</button>
|
||||
<button
|
||||
class="btn btn-sm btn-secondary"
|
||||
:disabled="index === detail.entries.length - 1"
|
||||
@click="moveEntry(index, 1)"
|
||||
>Down</button>
|
||||
</td>
|
||||
<td>{{ entry.Name }}</td>
|
||||
<td><span class="badge badge-info">{{ entry.Type }}</span></td>
|
||||
<td class="muted">{{ entry.DetectionMethod || 'always' }}</td>
|
||||
<td class="muted">{{ filterSummary(entry) }}</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-sm btn-secondary" @click="openEditEntry(entry)">Edit</button>
|
||||
<button class="btn btn-sm btn-danger" @click="deleteEntry(entry)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!detail.entries.length"><td colspan="6" class="empty">No entries.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Simulator -->
|
||||
<div class="section-card">
|
||||
<h3 class="section-title">Simulate: what would a PC get?</h3>
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Subtype</span><input v-model="sim.subtype" placeholder="subtype" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Hostname</span><input v-model="sim.hostname" placeholder="hostname" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Machine #</span><input v-model="sim.machinenumber" placeholder="machine #" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>CMM version</span><input v-model="sim.cmmversion" placeholder="CMM version" /></label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary" @click="runSimulate">Run</button>
|
||||
<div v-if="simResult" class="sim-result">
|
||||
<div>
|
||||
<strong>Applies ({{ simResult.applied.length }}):</strong>
|
||||
{{ simResult.applied.join(', ') || 'none' }}
|
||||
</div>
|
||||
<div class="muted">
|
||||
<strong>Filtered:</strong>
|
||||
<span v-for="filtered in simResult.filtered" :key="filtered.name">
|
||||
{{ filtered.name }} ({{ filtered.filteredby.join(',') }});
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="section-card empty-detail">
|
||||
Select a PC type, or create one.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- New scope modal -->
|
||||
<div v-if="showNewScope" class="modal-overlay" @click.self="showNewScope = false">
|
||||
<div class="modal">
|
||||
<div class="modal-header">
|
||||
<h3>New imaging PC type</h3>
|
||||
<button class="modal-close" @click="showNewScope = false">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="setting-row full-width">
|
||||
<label>
|
||||
<span>Scope name</span>
|
||||
<input v-model="newScope.scopename" placeholder="e.g. gea-shopfloor-cmm" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Phase</span>
|
||||
<select v-model="newScope.phase">
|
||||
<option value="runtime">runtime</option>
|
||||
<option value="preinstall">preinstall</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="showNewScope = false">Cancel</button>
|
||||
<button class="btn btn-primary" @click="createScope">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Entry modal -->
|
||||
<div v-if="showEntry" class="modal-overlay" @click.self="showEntry = false">
|
||||
<div class="modal modal-entry">
|
||||
<div class="modal-header">
|
||||
<h3>{{ entryForm.entryid ? 'Edit entry' : 'New entry' }}</h3>
|
||||
<button class="modal-close" @click="showEntry = false">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Name</span><input v-model="entryForm.Name" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Type</span>
|
||||
<select v-model="entryForm.Type">
|
||||
<option v-for="entryType in ENTRY_TYPES" :key="entryType" :value="entryType">{{ entryType }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- payload fields per type -->
|
||||
<div v-if="['MSI','EXE','CMD','BAT','INF'].includes(entryForm.Type)" class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Installer (relative path)</span><input v-model="entryForm.Installer" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Install args</span><input v-model="entryForm.InstallArgs" /></label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="entryForm.Type === 'PS1'" class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Script (relative path)</span><input v-model="entryForm.Script" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Args</span><input v-model="entryForm.Args" /></label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="entryForm.Type === 'File'" class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Source (relative)</span><input v-model="entryForm.Source" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Destination (absolute)</span><input v-model="entryForm.Destination" /></label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="entryForm.Type === 'Registry'" class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Reg path</span><input v-model="entryForm.RegPath" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Reg name</span><input v-model="entryForm.RegName" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Reg value</span><input v-model="entryForm.RegValue" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Reg type</span>
|
||||
<select v-model="entryForm.RegType">
|
||||
<option v-for="regType in REG_TYPES" :key="regType" :value="regType">{{ regType }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- detection -->
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Detection method</span>
|
||||
<select v-model="entryForm.DetectionMethod">
|
||||
<option value="">(none: always installs)</option>
|
||||
<option v-for="method in DETECTION_METHODS" :key="method" :value="method">{{ method }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Detection path</span><input v-model="entryForm.DetectionPath" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Detection name</span><input v-model="entryForm.DetectionName" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Detection value</span><input v-model="entryForm.DetectionValue" /></label>
|
||||
</div>
|
||||
<div v-if="entryForm.DetectionMethod === 'pnputil'" class="setting-row">
|
||||
<label><span>Detection pattern</span><input v-model="entryForm.DetectionPattern" /></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- filters -->
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>PC types (comma)</span>
|
||||
<input v-model="entryForm.PCTypes" placeholder="* or gea-shopfloor-cmm,..." />
|
||||
</label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Target hostnames (comma)</span><input v-model="entryForm.TargetHostnames" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Target machine numbers (comma)</span><input v-model="entryForm.TargetMachineNumbers" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>CMM version gate</span><input v-model="entryForm._CmmVersion" placeholder="2016 / 2019 / 2026" /></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Wait timeout (sec)</span><input type="number" v-model.number="entryForm.WaitTimeoutSec" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Log file</span><input v-model="entryForm.LogFile" /></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-row full-width">
|
||||
<label>
|
||||
<span>Comment</span>
|
||||
<textarea class="form-control" v-model="entryForm._comment" rows="2"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<details class="advanced" open>
|
||||
<summary>In-use handling + preinstall flags</summary>
|
||||
<div class="setting-row">
|
||||
<label>
|
||||
<span>Close running app before install (InUseCheck)</span>
|
||||
<select v-model="entryForm.inuseBehavior">
|
||||
<option value="">(none)</option>
|
||||
<option v-for="behavior in INUSE_BEHAVIORS" :key="behavior" :value="behavior">{{ behavior }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="entryForm.inuseBehavior" class="process-editor">
|
||||
<div class="process-head">
|
||||
<span>Processes to close</span>
|
||||
<button type="button" class="btn btn-sm btn-secondary" @click="addProcess">+ process</button>
|
||||
</div>
|
||||
<div v-for="(process, processIndex) in entryForm.inuseProcesses" :key="processIndex" class="process-row">
|
||||
<input class="form-control" v-model="process.name" placeholder="Name (no .exe)" />
|
||||
<input class="form-control" v-model="process.exepath" placeholder="ExePath (optional)" />
|
||||
<input class="form-control" type="number" v-model.number="process.timeout" placeholder="timeout s" />
|
||||
<button type="button" class="btn btn-sm btn-danger" @click="removeProcess(processIndex)">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="preinstall-flags">
|
||||
<span class="flags-label">Preinstall flags (preinstall phase only):</span>
|
||||
<label class="flag-label"><input type="checkbox" v-model="entryForm.PreEnrollment" /> PreEnrollment</label>
|
||||
<label class="flag-label"><input type="checkbox" v-model="entryForm.KillAfterDetection" /> KillAfterDetection</label>
|
||||
<label class="flag-label"><input type="checkbox" v-model="entryForm.PCTypesStrict" /> PCTypesStrict</label>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="advanced">
|
||||
<summary>Apply mode / update window (not yet enforced by the engine)</summary>
|
||||
<div class="settings-grid">
|
||||
<div class="setting-row">
|
||||
<label><span>Apply mode</span><input v-model="entryForm.ApplyMode" placeholder="Nightly / Immediate" /></label>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<label><span>Update window</span><input v-model="entryForm.UpdateWindow" placeholder="HH:MM-HH:MM" /></label>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="showEntry = false">Cancel</button>
|
||||
<button class="btn btn-primary" @click="saveEntry">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Preview modal -->
|
||||
<div v-if="showPreview" class="modal-overlay" @click.self="showPreview = false">
|
||||
<div class="modal modal-entry">
|
||||
<div class="modal-header">
|
||||
<h3>Draft manifest preview</h3>
|
||||
<button class="modal-close" @click="showPreview = false">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre class="preview">{{ previewText }}</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="showPreview = false">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import api from '../../api'
|
||||
|
||||
const ENTRY_TYPES = ['MSI', 'EXE', 'CMD', 'BAT', 'PS1', 'INF', 'File', 'Registry']
|
||||
const REG_TYPES = ['String', 'DWord', 'QWord', 'MultiString', 'ExpandString', 'Binary']
|
||||
const DETECTION_METHODS = ['Registry', 'File', 'FileVersion', 'Hash', 'MarkerFile',
|
||||
'ValueMatches', 'pnputil', 'Always']
|
||||
const INUSE_BEHAVIORS = ['Defer', 'CloseAndReopen', 'ForceClose', 'ScheduleForReboot']
|
||||
|
||||
const scopes = ref([])
|
||||
const selectedId = ref(null)
|
||||
const detail = ref(null)
|
||||
const error = ref('')
|
||||
const notice = ref('')
|
||||
const shareRoot = ref('')
|
||||
|
||||
const showNewScope = ref(false)
|
||||
const newScope = ref({ scopename: '', phase: 'runtime' })
|
||||
|
||||
const showEntry = ref(false)
|
||||
const entryForm = ref({})
|
||||
|
||||
const showVersions = ref(false)
|
||||
const versions = ref([])
|
||||
|
||||
const showPreview = ref(false)
|
||||
const previewText = ref('')
|
||||
|
||||
const sim = ref({ subtype: '', hostname: '', machinenumber: '', cmmversion: '' })
|
||||
const simResult = ref(null)
|
||||
|
||||
function payload(response) { return response.data.data }
|
||||
|
||||
function flash(message) { notice.value = message; setTimeout(() => { notice.value = '' }, 4000) }
|
||||
|
||||
async function loadScopes() {
|
||||
try {
|
||||
scopes.value = payload(await api.get('/geenforce/scopes'))
|
||||
} catch (e) { error.value = 'Failed to load PC types' }
|
||||
}
|
||||
async function loadConfig() {
|
||||
try { shareRoot.value = payload(await api.get('/geenforce/config')).shareroot } catch (e) { /* optional */ }
|
||||
}
|
||||
async function saveConfig() {
|
||||
try {
|
||||
await api.put('/geenforce/config', { shareroot: shareRoot.value })
|
||||
flash('Share root saved.')
|
||||
} catch (e) { error.value = 'Failed to save share root' }
|
||||
}
|
||||
async function exportShare() {
|
||||
try {
|
||||
const result = payload(await api.post(`/geenforce/scopes/${detail.value.scopeid}/export-share`))
|
||||
flash(`Exported to ${result.path}`)
|
||||
} catch (e) { error.value = e.response?.data?.message || 'Export failed' }
|
||||
}
|
||||
|
||||
async function selectScope(id) {
|
||||
selectedId.value = id
|
||||
showVersions.value = false
|
||||
simResult.value = null
|
||||
try {
|
||||
detail.value = payload(await api.get(`/geenforce/scopes/${id}`))
|
||||
} catch (e) { error.value = 'Failed to load PC type' }
|
||||
}
|
||||
|
||||
function openNewScope() {
|
||||
newScope.value = { scopename: '', phase: 'runtime' }
|
||||
showNewScope.value = true
|
||||
}
|
||||
async function createScope() {
|
||||
try {
|
||||
const created = payload(await api.post('/geenforce/scopes', newScope.value))
|
||||
showNewScope.value = false
|
||||
await loadScopes()
|
||||
selectScope(created.scopeid)
|
||||
} catch (e) { error.value = e.response?.data?.message || 'Create failed' }
|
||||
}
|
||||
async function saveScope() {
|
||||
try {
|
||||
await api.put(`/geenforce/scopes/${detail.value.scopeid}`, {
|
||||
description: detail.value.description,
|
||||
computertypeid: detail.value.computertypeid,
|
||||
measuringtooltypeid: detail.value.measuringtooltypeid,
|
||||
})
|
||||
await loadScopes()
|
||||
} catch (e) { error.value = 'Save failed' }
|
||||
}
|
||||
async function deleteScope() {
|
||||
if (!confirm(`Delete ${detail.value.scopename}? This removes its manifest.`)) return
|
||||
try {
|
||||
await api.delete(`/geenforce/scopes/${detail.value.scopeid}`)
|
||||
detail.value = null
|
||||
selectedId.value = null
|
||||
await loadScopes()
|
||||
} catch (e) { error.value = 'Delete failed' }
|
||||
}
|
||||
|
||||
// -- entries --
|
||||
function blankEntry() {
|
||||
return { Type: 'MSI', DetectionMethod: '', RegType: 'String',
|
||||
inuseBehavior: '', inuseProcesses: [],
|
||||
PreEnrollment: false, KillAfterDetection: false, PCTypesStrict: false }
|
||||
}
|
||||
function openNewEntry() {
|
||||
entryForm.value = blankEntry()
|
||||
showEntry.value = true
|
||||
}
|
||||
function openEditEntry(entry) {
|
||||
const form = { ...entry }
|
||||
form.PCTypes = (entry.PCTypes || []).join(', ')
|
||||
form.TargetHostnames = (entry.TargetHostnames || []).join(', ')
|
||||
form.TargetMachineNumbers = (entry.TargetMachineNumbers || []).join(', ')
|
||||
form.RegValue = entry.RegValue !== undefined ? String(entry.RegValue) : ''
|
||||
form.DetectionMethod = entry.DetectionMethod || ''
|
||||
form.inuseBehavior = entry.InUseCheck?.Behavior || ''
|
||||
// Structured processes so ExePath + timeout survive an edit (not just Name).
|
||||
form.inuseProcesses = (entry.InUseCheck?.Processes || []).map(process => ({
|
||||
name: process.Name, exepath: process.ExePath || '',
|
||||
timeout: process.GracefulCloseTimeoutSec ?? null }))
|
||||
form.PreEnrollment = !!entry.PreEnrollment
|
||||
form.KillAfterDetection = !!entry.KillAfterDetection
|
||||
form.PCTypesStrict = !!entry.PCTypesStrict
|
||||
entryForm.value = form
|
||||
showEntry.value = true
|
||||
}
|
||||
function addProcess() {
|
||||
if (!Array.isArray(entryForm.value.inuseProcesses)) entryForm.value.inuseProcesses = []
|
||||
entryForm.value.inuseProcesses.push({ name: '', exepath: '', timeout: null })
|
||||
}
|
||||
function removeProcess(index) {
|
||||
entryForm.value.inuseProcesses.splice(index, 1)
|
||||
}
|
||||
function splitList(value) {
|
||||
return (value || '').split(',').map(item => item.trim()).filter(Boolean)
|
||||
}
|
||||
function buildEntryPayload() {
|
||||
const form = entryForm.value
|
||||
const out = { Name: form.Name, Type: form.Type }
|
||||
const scalars = ['Installer', 'InstallArgs', 'Script', 'Args', 'Source',
|
||||
'Destination', 'RegPath', 'RegName', 'RegType', 'DetectionPath',
|
||||
'DetectionName', 'DetectionValue', 'DetectionPattern', '_CmmVersion',
|
||||
'LogFile', 'ApplyMode', 'UpdateWindow', '_comment']
|
||||
for (const key of scalars) {
|
||||
if (form[key] !== undefined && form[key] !== '' && form[key] !== null) out[key] = form[key]
|
||||
}
|
||||
if (form.DetectionMethod) out.DetectionMethod = form.DetectionMethod
|
||||
if (form.WaitTimeoutSec) out.WaitTimeoutSec = form.WaitTimeoutSec
|
||||
if (form.Type === 'Registry' && form.RegValue !== undefined && form.RegValue !== '') {
|
||||
out.RegValue = ['DWord', 'QWord'].includes(form.RegType) ? Number(form.RegValue) : form.RegValue
|
||||
}
|
||||
const pctypes = splitList(form.PCTypes)
|
||||
if (pctypes.length) out.PCTypes = pctypes
|
||||
const hostnames = splitList(form.TargetHostnames)
|
||||
if (hostnames.length) out.TargetHostnames = hostnames
|
||||
const machinenumbers = splitList(form.TargetMachineNumbers)
|
||||
if (machinenumbers.length) out.TargetMachineNumbers = machinenumbers
|
||||
for (const flag of ['PreEnrollment', 'KillAfterDetection', 'PCTypesStrict']) {
|
||||
if (form[flag]) out[flag] = true
|
||||
}
|
||||
if (form.inuseBehavior) {
|
||||
out.InUseCheck = {
|
||||
Behavior: form.inuseBehavior,
|
||||
Processes: (form.inuseProcesses || []).filter(process => process.name).map(process => {
|
||||
const processData = { Name: process.name }
|
||||
if (process.exepath) processData.ExePath = process.exepath
|
||||
if (process.timeout !== null && process.timeout !== '' && process.timeout !== undefined) {
|
||||
processData.GracefulCloseTimeoutSec = Number(process.timeout)
|
||||
}
|
||||
return processData
|
||||
}),
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
async function saveEntry() {
|
||||
const body = buildEntryPayload()
|
||||
try {
|
||||
if (entryForm.value.entryid) {
|
||||
await api.put(`/geenforce/entries/${entryForm.value.entryid}`, body)
|
||||
} else {
|
||||
await api.post(`/geenforce/scopes/${detail.value.scopeid}/entries`, body)
|
||||
}
|
||||
showEntry.value = false
|
||||
await selectScope(detail.value.scopeid)
|
||||
await loadScopes()
|
||||
} catch (e) { error.value = e.response?.data?.message || 'Save entry failed' }
|
||||
}
|
||||
async function deleteEntry(entry) {
|
||||
if (!confirm(`Delete entry "${entry.Name}"?`)) return
|
||||
try {
|
||||
await api.delete(`/geenforce/entries/${entry.entryid}`)
|
||||
await selectScope(detail.value.scopeid)
|
||||
await loadScopes()
|
||||
} catch (e) { error.value = 'Delete entry failed' }
|
||||
}
|
||||
async function moveEntry(index, direction) {
|
||||
const entries = detail.value.entries
|
||||
const target = index + direction
|
||||
if (target < 0 || target >= entries.length) return
|
||||
const order = entries.map(entry => entry.entryid)
|
||||
;[order[index], order[target]] = [order[target], order[index]]
|
||||
try {
|
||||
await api.put(`/geenforce/scopes/${detail.value.scopeid}/entries/reorder`, { order })
|
||||
await selectScope(detail.value.scopeid)
|
||||
} catch (e) { error.value = 'Reorder failed' }
|
||||
}
|
||||
|
||||
// -- publish / versions --
|
||||
async function publish() {
|
||||
const notes = prompt('Publish notes (optional):') ?? ''
|
||||
try {
|
||||
await api.post(`/geenforce/scopes/${detail.value.scopeid}/publish`, { notes })
|
||||
await loadScopes()
|
||||
await selectScope(detail.value.scopeid)
|
||||
if (showVersions.value) loadVersions()
|
||||
} catch (e) { error.value = e.response?.data?.message || 'Publish failed' }
|
||||
}
|
||||
async function toggleVersions() {
|
||||
showVersions.value = !showVersions.value
|
||||
if (showVersions.value) await loadVersions()
|
||||
}
|
||||
async function loadVersions() {
|
||||
try {
|
||||
versions.value = payload(await api.get(`/geenforce/scopes/${detail.value.scopeid}/versions`))
|
||||
} catch (e) { error.value = 'Failed to load versions' }
|
||||
}
|
||||
async function rollback(versionnumber) {
|
||||
if (!confirm(`Roll back to v${versionnumber}? PCs get this on their next cycle.`)) return
|
||||
try {
|
||||
await api.post(`/geenforce/scopes/${detail.value.scopeid}/rollback`, { versionnumber })
|
||||
await loadVersions()
|
||||
await loadScopes()
|
||||
} catch (e) { error.value = 'Rollback failed' }
|
||||
}
|
||||
|
||||
// -- simulate / preview --
|
||||
async function runSimulate() {
|
||||
try {
|
||||
const params = { ...sim.value }
|
||||
simResult.value = payload(await api.get(
|
||||
`/geenforce/scopes/${detail.value.scopeid}/simulate`, { params }))
|
||||
} catch (e) { error.value = 'Simulate failed' }
|
||||
}
|
||||
async function loadPreview() {
|
||||
try {
|
||||
const data = payload(await api.get(`/geenforce/scopes/${detail.value.scopeid}/preview`))
|
||||
previewText.value = JSON.stringify(data.manifest, null, 2)
|
||||
showPreview.value = true
|
||||
} catch (e) { error.value = 'Preview failed' }
|
||||
}
|
||||
|
||||
function filterSummary(entry) {
|
||||
const parts = []
|
||||
if (entry.PCTypes) parts.push(`pc:${entry.PCTypes.length}`)
|
||||
if (entry.TargetMachineNumbers) parts.push(`mach:${entry.TargetMachineNumbers.length}`)
|
||||
if (entry.TargetHostnames) parts.push(`host:${entry.TargetHostnames.length}`)
|
||||
if (entry._CmmVersion) parts.push(`cmm:${entry._CmmVersion}`)
|
||||
return parts.join(' ') || '-'
|
||||
}
|
||||
function formatDate(value) {
|
||||
return value ? new Date(value).toLocaleString() : ''
|
||||
}
|
||||
|
||||
loadScopes()
|
||||
loadConfig()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.imaging-pctypes { max-width: 1200px; }
|
||||
|
||||
/* Two-pane master-detail; both children min-width:0 to kill overflow. */
|
||||
.editor-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
|
||||
gap: 1.25rem;
|
||||
align-items: start;
|
||||
}
|
||||
.editor-grid > * { min-width: 0; }
|
||||
@media (max-width: 900px) {
|
||||
.editor-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
/* Section header carrying an action button. */
|
||||
.section-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 1rem;
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
.section-head .section-title {
|
||||
border-bottom: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.detail-actions { flex-wrap: wrap; }
|
||||
|
||||
/* Scope list */
|
||||
.scope-panel { position: sticky; top: 1rem; }
|
||||
.scope-list { display: flex; flex-direction: column; gap: 0.25rem; }
|
||||
.scope-row {
|
||||
padding: 0.5rem 0.6rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.scope-row:hover { background: var(--bg); }
|
||||
.scope-row.active { background: var(--primary); color: #fff; }
|
||||
.scope-name { font-weight: 600; font-size: 0.9rem; }
|
||||
.scope-meta {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.72rem;
|
||||
align-items: center;
|
||||
color: var(--text-light);
|
||||
margin-top: 0.25rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.scope-row.active .scope-meta { color: rgba(255, 255, 255, 0.85); }
|
||||
.unpublished { color: var(--warning); }
|
||||
|
||||
.empty-detail {
|
||||
color: var(--text-light);
|
||||
text-align: center;
|
||||
padding: 3rem 1.25rem;
|
||||
}
|
||||
.empty {
|
||||
color: var(--text-light);
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
}
|
||||
.muted { color: var(--text-light); }
|
||||
|
||||
/* Simulator result */
|
||||
.sim-result {
|
||||
margin-top: 1rem;
|
||||
font-size: 0.9rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
/* Modals */
|
||||
.modal-entry { max-width: 720px; }
|
||||
.modal-close {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-light);
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.modal-close:hover { color: var(--text); }
|
||||
|
||||
/* Advanced sections inside the entry modal */
|
||||
.advanced {
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 0.75rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
.advanced summary {
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text);
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
/* In-use process editor */
|
||||
.process-editor { margin-bottom: 1rem; }
|
||||
.process-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-light);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.process-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.4fr 0.7fr auto;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.4rem;
|
||||
align-items: center;
|
||||
}
|
||||
.process-row > * { min-width: 0; }
|
||||
@media (max-width: 560px) {
|
||||
.process-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
/* Preinstall flags */
|
||||
.preinstall-flags { margin-top: 0.5rem; }
|
||||
.flags-label {
|
||||
display: block;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-light);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.flag-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin-right: 1rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* JSON preview */
|
||||
.preview {
|
||||
background: var(--bg);
|
||||
padding: 0.75rem;
|
||||
border-radius: 6px;
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* Reorder / disabled buttons */
|
||||
.btn:disabled { opacity: 0.4; cursor: default; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user