mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
Merge develop into local application icon discovery
This commit is contained in:
@@ -23,11 +23,13 @@ const candidate = {
|
||||
evidence: [{kind: 'installation_file', value: '/opt/handmade/server'}], default_ports: [],
|
||||
}
|
||||
|
||||
function fixture({nativeCandidate = candidate, apps = []} = {}) {
|
||||
function fixture({nativeCandidate = candidate, dockerCandidate = null, apps = []} = {}) {
|
||||
let cursor = 0, tree, props, effects = [], states = [], refs = [], effectStates = [], memoStates = []
|
||||
const calls = [], cachedWrites = []
|
||||
let native = {vmid: 101, status: 'not_scanned', candidates: [], stale: false}
|
||||
let holdScan, scanGate, holdSave, saveGate, scanStatus = 'complete', scanIssues
|
||||
let dockerStatus = "complete", dockerCached = {vmid:101,status:"not_scanned",candidates:[],stale:false}
|
||||
let holdDocker, dockerGate
|
||||
let cacheGate, resolveCache, cachePending = false
|
||||
let iconGate, resolveIcon, iconResult = {logo_url: '/api/vms/101/apps/logo-cache/' + 'b'.repeat(32)}, iconError
|
||||
const seed = {sidecar: {vmid: 101, apps}, suggestions: {extras: [], port_suggestions: []}}
|
||||
@@ -68,10 +70,18 @@ function fixture({nativeCandidate = candidate, apps = []} = {}) {
|
||||
}
|
||||
if (options.method === 'POST') {
|
||||
if (scanGate) await scanGate
|
||||
native = {...native, status: scanStatus, issues: scanIssues, candidates: [nativeCandidate]}
|
||||
native = {...native, status: scanStatus, issues: scanIssues, candidates: nativeCandidate ? [nativeCandidate] : []}
|
||||
}
|
||||
return structuredClone(native)
|
||||
}
|
||||
if (url.endsWith('/docker-discovery')) {
|
||||
if (options.method === 'POST') {
|
||||
if (dockerGate) await dockerGate
|
||||
dockerCached = {vmid:Number(url.split('/')[3]),status:dockerStatus,
|
||||
stale:dockerStatus !== 'complete',candidates:dockerCandidate ? [dockerCandidate] : []}
|
||||
}
|
||||
return structuredClone(dockerCached)
|
||||
}
|
||||
if (url.endsWith('/apps/suggestions')) return seed.suggestions
|
||||
if (url.endsWith('/apps') && options.method === 'POST') {
|
||||
if (saveGate) await saveGate
|
||||
@@ -138,6 +148,8 @@ function fixture({nativeCandidate = candidate, apps = []} = {}) {
|
||||
holdInitialCache: () => {cachePending = true; cacheGate = new Promise(resolve => {resolveCache = resolve})},
|
||||
resolveInitialCache: () => resolveCache(),
|
||||
setScanStatus: value => {scanStatus = value},
|
||||
setDockerStatus: value => {dockerStatus = value},
|
||||
holdDocker: () => {dockerGate = new Promise(resolve => {holdDocker = resolve})}, resolveDocker: () => holdDocker(),
|
||||
setScanIssues: value => {scanIssues = value},
|
||||
holdScan: () => {scanGate = new Promise(resolve => {holdScan = resolve})}, resolveScan: () => holdScan(),
|
||||
holdSave: () => {saveGate = new Promise(resolve => {holdSave = resolve})}, resolveSave: () => holdSave(),
|
||||
|
||||
Reference in New Issue
Block a user