dsh-ris-ide 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +258 -26
- package/lib/index.js +169 -16
- package/lib/redirector.js +34 -2
- package/lib/risd/lifecycle.js +50 -12
- package/lib/risd/ping.js +136 -17
- package/lib/risd/server.js +122 -15
- package/lib/risd/ui.js +74 -22
- package/package.json +1 -1
- package/test/client-viewer.test.mjs +82 -0
- package/test/host-tail.test.mjs +71 -1
- package/test/proxy.test.mjs +27 -10
- package/test/redirector.test.mjs +30 -0
- package/test/risd-api.test.mjs +2 -1
- package/test/risd-cli-home.test.mjs +41 -4
- package/test/risd-follow-start.test.mjs +9 -8
- package/test/risd-lifecycle.test.mjs +195 -50
- package/test/risd-ping.test.mjs +77 -1
- package/test/risd-ui.test.mjs +36 -1
package/lib/client.js
CHANGED
|
@@ -286,6 +286,43 @@ window.__ModuleLoader__.load({
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Where the host last answered that ONE session's workspace is.
|
|
291
|
+
*
|
|
292
|
+
* `knownWorkspaceCwd()` is a single slot shared by every document on this
|
|
293
|
+
* origin — the dsh page, the IDE in a risd-ui tab, a standalone window — so it
|
|
294
|
+
* names whichever panel talked to the host LAST. Reading it as "my workspace"
|
|
295
|
+
* is what made the sidebar console follow an IDE workspace switch made
|
|
296
|
+
* somewhere else (and the other way round). Per-session keys keep each panel
|
|
297
|
+
* on the workspace its own session belongs to (m04873).
|
|
298
|
+
*/
|
|
299
|
+
var SESSION_CWD_PREFIX = 'dsh-ris-ide:cwd:'
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Remember the workspace of one session (absolute paths only).
|
|
303
|
+
* @param {string} value - absolute workspace path.
|
|
304
|
+
* @param {string} sessionId - the session the answer belongs to.
|
|
305
|
+
*/
|
|
306
|
+
function rememberSessionCwd(value, sessionId) {
|
|
307
|
+
if (typeof value !== 'string' || value === '' || value[0] !== '/') return
|
|
308
|
+
if (typeof sessionId !== 'string' || sessionId === '') return
|
|
309
|
+
try { window.localStorage.setItem(SESSION_CWD_PREFIX + sessionId, value) } catch { /* private mode */ }
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @param {string|undefined} sessionId - the session to look up.
|
|
314
|
+
* @returns {string|undefined} that session's remembered workspace.
|
|
315
|
+
*/
|
|
316
|
+
function knownSessionCwd(sessionId) {
|
|
317
|
+
if (typeof sessionId !== 'string' || sessionId === '') return undefined
|
|
318
|
+
try {
|
|
319
|
+
var value = window.localStorage.getItem(SESSION_CWD_PREFIX + sessionId)
|
|
320
|
+
return typeof value === 'string' && value[0] === '/' ? value : undefined
|
|
321
|
+
} catch {
|
|
322
|
+
return undefined
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
289
326
|
/**
|
|
290
327
|
* A scope with a usable `cwd`, falling back to the remembered workspace.
|
|
291
328
|
* @param {{sessionId?: string, cwd?: string}|undefined} scope - caller scope.
|
|
@@ -2234,7 +2271,13 @@ window.__ModuleLoader__.load({
|
|
|
2234
2271
|
// poll timer far more often than once a second.
|
|
2235
2272
|
var sessionId = scope ? scope.sessionId : undefined
|
|
2236
2273
|
var cwd = scope ? scope.cwd : undefined
|
|
2237
|
-
|
|
2274
|
+
// Same rule as the console: a log pane follows ITS scope, never another
|
|
2275
|
+
// document's remembered workspace (m04873).
|
|
2276
|
+
if (typeof cwd !== 'string' || cwd === '') {
|
|
2277
|
+
var scopedCwd = knownSessionCwd(sessionId)
|
|
2278
|
+
cwd = typeof scopedCwd === 'string' && scopedCwd !== '' ? scopedCwd
|
|
2279
|
+
: (typeof sessionId === 'string' && sessionId !== '' ? undefined : knownWorkspaceCwd())
|
|
2280
|
+
}
|
|
2238
2281
|
var [view, setView] = useState(function () { return stateFromPayload(props.customData) })
|
|
2239
2282
|
// These controls live in the LOG PANE'S TITLE BAR inside the IDE, so the
|
|
2240
2283
|
// workbench passes them down (value + change callback) and the viewer body
|
|
@@ -11901,6 +11944,12 @@ var [ui, setUi] = useState(function () {
|
|
|
11901
11944
|
var session = payload.session !== null && payload.session !== undefined ? payload.session : null
|
|
11902
11945
|
var live = session !== null ? session.id : undefined
|
|
11903
11946
|
if (typeof live !== 'string' || live === '' || live === sessionId) return
|
|
11947
|
+
// This window is pinned to the workspace in its URL: a hello that
|
|
11948
|
+
// resolved to a DIFFERENT workspace belongs to another dsh window, and
|
|
11949
|
+
// following it is how the embedded IDE's console used to jump to
|
|
11950
|
+
// whatever workspace dsh had just switched to (m04873).
|
|
11951
|
+
if (typeof props.cwd === 'string' && props.cwd !== '' &&
|
|
11952
|
+
typeof payload.root === 'string' && payload.root !== '' && payload.root !== props.cwd) return
|
|
11904
11953
|
var mine = payload.windowSession !== null && payload.windowSession !== undefined ? payload.windowSession : null
|
|
11905
11954
|
// Still live: this window belongs to a session that exists, so the
|
|
11906
11955
|
// newer session in the same workspace is a DIFFERENT thread — leave it.
|
|
@@ -13715,6 +13764,49 @@ var [ui, setUi] = useState(function () {
|
|
|
13715
13764
|
openIdeTab(ctx)
|
|
13716
13765
|
}
|
|
13717
13766
|
|
|
13767
|
+
/**
|
|
13768
|
+
* Resolve the URL "open in browser" should use for one program.
|
|
13769
|
+
*
|
|
13770
|
+
* The host decides: the dev-server URL the program printed into its log, or —
|
|
13771
|
+
* when dsh-ris-yds is installed and the workspace is a yds project — yds'
|
|
13772
|
+
* injecting proxy, which also attaches a YYCToken to the page's gateway calls.
|
|
13773
|
+
* @param {object} program - one row from the programs panel.
|
|
13774
|
+
* @param {{sessionId: string, cwd?: string}} scope - owning session.
|
|
13775
|
+
* @returns {Promise<{ok: boolean, url?: string, message?: string, code?: string}>}
|
|
13776
|
+
*/
|
|
13777
|
+
async function requestOpenTarget(program, scope) {
|
|
13778
|
+
var query = new URLSearchParams()
|
|
13779
|
+
query.set('sessionId', scope.sessionId)
|
|
13780
|
+
if (typeof scope.cwd === 'string' && scope.cwd !== '') query.set('cwd', scope.cwd)
|
|
13781
|
+
if (typeof program.id === 'string' && program.id !== '') query.set('id', program.id)
|
|
13782
|
+
var response = await fetch(routeUrl('dsh-ris-ide/open-target?' + query.toString()).href, { headers: { accept: 'application/json' } })
|
|
13783
|
+
var parsed = await response.json().catch(function () { return null })
|
|
13784
|
+
if (parsed !== null && typeof parsed === 'object') return parsed
|
|
13785
|
+
return { ok: false, code: 'http', message: 'HTTP ' + response.status }
|
|
13786
|
+
}
|
|
13787
|
+
|
|
13788
|
+
/**
|
|
13789
|
+
* Is the workspace a yds project? The console asks dsh-ris-yds, so a bare
|
|
13790
|
+
* workspace never sees yds wording and the row cannot promise a token it will
|
|
13791
|
+
* not get. A missing plugin (404) is "not a yds project", never an error.
|
|
13792
|
+
* @param {{sessionId: string, cwd?: string}} scope - owning session.
|
|
13793
|
+
* @returns {Promise<boolean>} whether dsh-ris-yds found a `yds.*` project here.
|
|
13794
|
+
*/
|
|
13795
|
+
async function requestYdsProject(scope) {
|
|
13796
|
+
var workspace = typeof scope.cwd === 'string' ? scope.cwd : ''
|
|
13797
|
+
if (workspace === '') return false
|
|
13798
|
+
try {
|
|
13799
|
+
var query = new URLSearchParams()
|
|
13800
|
+
query.set('workspace', workspace)
|
|
13801
|
+
var response = await fetch(routeUrl('dsh-ris-yds/probe?' + query.toString()).href, { headers: { accept: 'application/json' } })
|
|
13802
|
+
if (!response.ok) return false
|
|
13803
|
+
var parsed = await response.json()
|
|
13804
|
+
return parsed !== null && typeof parsed === 'object' && parsed.yds === true
|
|
13805
|
+
} catch (error) {
|
|
13806
|
+
return false
|
|
13807
|
+
}
|
|
13808
|
+
}
|
|
13809
|
+
|
|
13718
13810
|
/**
|
|
13719
13811
|
* Ask the host to start one discovered program.
|
|
13720
13812
|
*
|
|
@@ -14002,9 +14094,21 @@ var [ui, setUi] = useState(function () {
|
|
|
14002
14094
|
// can still name the PREVIOUS session, so the store's value wins when the
|
|
14003
14095
|
// slot hands us `useSessions`.
|
|
14004
14096
|
var storeCwd = sessionWorkspaceCwd(props ? props.useSessions : undefined, sessionId)
|
|
14005
|
-
|
|
14006
|
-
//
|
|
14007
|
-
|
|
14097
|
+
// A workspace we are SURE about: the session store's answer, or what the host
|
|
14098
|
+
// answered for this same session earlier. Anything else (a prop inherited from
|
|
14099
|
+
// a retained tab, the origin-wide last-cwd slot) is a guess, and a guess must
|
|
14100
|
+
// never override the host's own session → workspace resolution (m04873).
|
|
14101
|
+
var cwdKnown = false
|
|
14102
|
+
if (typeof storeCwd === 'string' && storeCwd !== '') {
|
|
14103
|
+
cwd = storeCwd
|
|
14104
|
+
cwdKnown = true
|
|
14105
|
+
} else {
|
|
14106
|
+
var sessionCwd = knownSessionCwd(sessionId)
|
|
14107
|
+
if (typeof sessionCwd === 'string' && sessionCwd !== '') {
|
|
14108
|
+
cwd = sessionCwd
|
|
14109
|
+
cwdKnown = true
|
|
14110
|
+
}
|
|
14111
|
+
}
|
|
14008
14112
|
/**
|
|
14009
14113
|
* Publish the freshest (Session, workspace) pair to `fsOp`'s one-shot retry.
|
|
14010
14114
|
* A mutation refused as `outside-workspace` means the host fenced it against a
|
|
@@ -14027,6 +14131,30 @@ var [ui, setUi] = useState(function () {
|
|
|
14027
14131
|
useEffect(function () {
|
|
14028
14132
|
setCompactPick(undefined)
|
|
14029
14133
|
setActive(undefined)
|
|
14134
|
+
// The console rows and the tree root are workspace data as well: until the
|
|
14135
|
+
// first scan of the NEW scope lands, show "scanning" instead of the previous
|
|
14136
|
+
// workspace's rows. A stale row also feeds a stale absolute log path into
|
|
14137
|
+
// the compact LogTail, which then reads the old project's log under the new
|
|
14138
|
+
// session id ("new scope + old path").
|
|
14139
|
+
setState(function (prev) {
|
|
14140
|
+
if (prev.loading === true && prev.programs.length === 0 && prev.root === undefined) return prev
|
|
14141
|
+
return { loading: true, programs: [], root: undefined, dir: undefined, config: undefined, error: undefined, note: prev.note }
|
|
14142
|
+
})
|
|
14143
|
+
}, [sessionIdentity, cwd])
|
|
14144
|
+
// A workspace switch opens a blank DSH session, and a sidebar layout is stored
|
|
14145
|
+
// per session — so the blank one has no IDE tab and the panel would sit on an
|
|
14146
|
+
// empty pane. Put the tab back on the new session. Capability-checked: hosts
|
|
14147
|
+
// without the right-Sidebar service keep working (nothing happens).
|
|
14148
|
+
useEffect(function () {
|
|
14149
|
+
if (sessionIdentity === '' || props.compact !== true) return
|
|
14150
|
+
var sidebar = props.clientCtx !== null && props.clientCtx !== undefined ? props.clientCtx.sidebarRight : undefined
|
|
14151
|
+
if (sidebar === undefined || sidebar === null || typeof sidebar.openTab !== 'function') return
|
|
14152
|
+
try {
|
|
14153
|
+
sidebar.openTab(IDE_TAB_KIND)
|
|
14154
|
+
} catch (error) {
|
|
14155
|
+
// A host that refuses the tab kind must not break the switch itself.
|
|
14156
|
+
void error
|
|
14157
|
+
}
|
|
14030
14158
|
}, [sessionIdentity])
|
|
14031
14159
|
/** Warm the compact ⧉'s address; a fresh cache makes the click synchronous. */
|
|
14032
14160
|
function warmCompactRisd() {
|
|
@@ -14090,11 +14218,28 @@ var [ui, setUi] = useState(function () {
|
|
|
14090
14218
|
}, [state.note])
|
|
14091
14219
|
|
|
14092
14220
|
var [busyId, setBusyId] = useState(undefined)
|
|
14221
|
+
// Which row's 🌐 is in flight: a second click while the host resolves the URL
|
|
14222
|
+
// would open two tabs at the same address.
|
|
14223
|
+
var [busySiteId, setBusySiteId] = useState(undefined)
|
|
14224
|
+
// "Open in browser" is a frontend-only affordance; only a yds project may
|
|
14225
|
+
// mention the token (m04354: a backend row has no page to open, and a plain
|
|
14226
|
+
// workspace must never read yds wording).
|
|
14227
|
+
var [ydsProject, setYdsProject] = useState(false)
|
|
14228
|
+
useEffect(function () {
|
|
14229
|
+
var alive = true
|
|
14230
|
+
requestYdsProject({ sessionId: sessionId, cwd: cwd }).then(function (found) {
|
|
14231
|
+
if (alive) setYdsProject(found === true)
|
|
14232
|
+
})
|
|
14233
|
+
return function () { alive = false }
|
|
14234
|
+
}, [cwd, props.visible])
|
|
14093
14235
|
/** The compact ⧉ is opening the page: disable it and show progress. */
|
|
14094
14236
|
var [openingIde, setOpeningIde] = useState(false)
|
|
14095
14237
|
/** Which action `busyId` is running, for the row mask's wording. */
|
|
14096
14238
|
var [busyKind, setBusyKind] = useState('')
|
|
14097
|
-
|
|
14239
|
+
// Which (session, workspace) scope the in-flight scan belongs to. A switch
|
|
14240
|
+
// must be able to start a scan of the NEW scope even while the OLD one is
|
|
14241
|
+
// still in flight, and the late answer of the old one must not be rendered.
|
|
14242
|
+
var busyScopeRef = useRef('')
|
|
14098
14243
|
/** A start-all/stop-all pass in flight: `{kind, index, total}` or null. */
|
|
14099
14244
|
var [bulk, setBulk] = useState(null)
|
|
14100
14245
|
/**
|
|
@@ -14112,16 +14257,32 @@ var [ui, setUi] = useState(function () {
|
|
|
14112
14257
|
var panelDismissals = useDismissedNotices()
|
|
14113
14258
|
|
|
14114
14259
|
var refresh = React.useCallback(async function (force) {
|
|
14115
|
-
if (typeof sessionId !== 'string' || sessionId === ''
|
|
14116
|
-
|
|
14260
|
+
if (typeof sessionId !== 'string' || sessionId === '') return
|
|
14261
|
+
var scope = sessionId + '|' + (typeof cwd === 'string' ? cwd : '')
|
|
14262
|
+
if (busyScopeRef.current === scope) return
|
|
14263
|
+
busyScopeRef.current = scope
|
|
14117
14264
|
try {
|
|
14118
14265
|
var url = routeUrl('dsh-ris-ide/programs')
|
|
14119
14266
|
url.searchParams.set('sessionId', sessionId)
|
|
14120
|
-
|
|
14267
|
+
// Only a CERTAIN workspace may steer the host: a guessed cwd (a retained
|
|
14268
|
+
// prop, the origin-wide last-cwd slot) is exactly how one panel used to
|
|
14269
|
+
// drag another panel's console to its own workspace. Without it the host
|
|
14270
|
+
// resolves the workspace from the session header, which is the truth.
|
|
14271
|
+
if (cwdKnown === true && typeof cwd === 'string' && cwd !== '') url.searchParams.set('cwd', cwd)
|
|
14121
14272
|
if (force === true) url.searchParams.set('refresh', '1')
|
|
14122
14273
|
var response = await fetch(url.href, { headers: { accept: 'application/json' } })
|
|
14123
14274
|
var payload = await response.json().catch(function () { return undefined })
|
|
14124
|
-
|
|
14275
|
+
// The user switched workspace while this request was on the wire: its
|
|
14276
|
+
// rows belong to the previous scope, so drop them instead of rendering
|
|
14277
|
+
// them under the new session id.
|
|
14278
|
+
if (busyScopeRef.current !== scope) return
|
|
14279
|
+
if (payload !== undefined && payload !== null) {
|
|
14280
|
+
// Remember the answer twice: under this session (what a panel of this
|
|
14281
|
+
// session may reuse) and in the origin-wide slot (the default workspace
|
|
14282
|
+
// when a window is opened without a session).
|
|
14283
|
+
rememberSessionCwd(payload.root, sessionId)
|
|
14284
|
+
rememberWorkspaceCwd(payload.root)
|
|
14285
|
+
}
|
|
14125
14286
|
if (!response.ok || payload === undefined || payload.ok !== true) {
|
|
14126
14287
|
setState(function (prev) {
|
|
14127
14288
|
return Object.assign({}, prev, {
|
|
@@ -14145,9 +14306,9 @@ var [ui, setUi] = useState(function () {
|
|
|
14145
14306
|
} catch (error) {
|
|
14146
14307
|
setState(function (prev) { return Object.assign({}, prev, { loading: false, error: messageOf(error) }) })
|
|
14147
14308
|
} finally {
|
|
14148
|
-
|
|
14309
|
+
if (busyScopeRef.current === scope) busyScopeRef.current = ''
|
|
14149
14310
|
}
|
|
14150
|
-
}, [sessionId, cwd])
|
|
14311
|
+
}, [sessionId, cwd, cwdKnown])
|
|
14151
14312
|
|
|
14152
14313
|
// After a `dsh web` restart the console keeps its error row ("扫描失败…")
|
|
14153
14314
|
// until something re-reads. The stream reopening IS that signal.
|
|
@@ -14308,6 +14469,53 @@ var [ui, setUi] = useState(function () {
|
|
|
14308
14469
|
})
|
|
14309
14470
|
}
|
|
14310
14471
|
|
|
14472
|
+
/**
|
|
14473
|
+
* Open one program in the user's own browser (🌐).
|
|
14474
|
+
*
|
|
14475
|
+
* A browser page cannot add headers to the tab it opens, so the token work
|
|
14476
|
+
* lives on the host side (dsh-ris-yds' proxy) and this only asks where to go.
|
|
14477
|
+
*/
|
|
14478
|
+
function openSite(program) {
|
|
14479
|
+
if (busySiteId !== undefined) return
|
|
14480
|
+
setBusySiteId(program.id)
|
|
14481
|
+
requestOpenTarget(program, { sessionId: sessionId, cwd: cwd }).then(function (result) {
|
|
14482
|
+
setBusySiteId(undefined)
|
|
14483
|
+
if (result.ok !== true) {
|
|
14484
|
+
setState(function (prev) {
|
|
14485
|
+
return Object.assign({}, prev, { note: result.message || '这个程序还没有可打开的地址:先启动它' })
|
|
14486
|
+
})
|
|
14487
|
+
return
|
|
14488
|
+
}
|
|
14489
|
+
// yds started its own private browser (extension + CDP): nothing to open here.
|
|
14490
|
+
if (result.mode === 'debug') {
|
|
14491
|
+
setState(function (prev) {
|
|
14492
|
+
return Object.assign({}, prev, {
|
|
14493
|
+
note: result.pid !== undefined
|
|
14494
|
+
? '已在专用调试浏览器打开(pid ' + result.pid + ',DevTools 127.0.0.1:' + result.port + ')'
|
|
14495
|
+
: '已在专用调试浏览器打开',
|
|
14496
|
+
})
|
|
14497
|
+
})
|
|
14498
|
+
return
|
|
14499
|
+
}
|
|
14500
|
+
var handle = null
|
|
14501
|
+
try {
|
|
14502
|
+
handle = window.open(String(result.url), 'dsh-ris-ide-site-' + String(program.id).replace(/[^A-Za-z0-9_-]/g, '-'))
|
|
14503
|
+
} catch (error) {
|
|
14504
|
+
handle = null
|
|
14505
|
+
}
|
|
14506
|
+
if (handle === null) {
|
|
14507
|
+
setState(function (prev) {
|
|
14508
|
+
return Object.assign({}, prev, { note: '浏览器拦截了新窗口:允许本站弹窗后再点一次 🌐' })
|
|
14509
|
+
})
|
|
14510
|
+
}
|
|
14511
|
+
}).catch(function (error) {
|
|
14512
|
+
setBusySiteId(undefined)
|
|
14513
|
+
setState(function (prev) {
|
|
14514
|
+
return Object.assign({}, prev, { note: '打开失败:' + messageOf(error) })
|
|
14515
|
+
})
|
|
14516
|
+
})
|
|
14517
|
+
}
|
|
14518
|
+
|
|
14311
14519
|
/** Write or update the user-editable config from a scan. */
|
|
14312
14520
|
function generateConfigFile(mode) {
|
|
14313
14521
|
if (busyId !== undefined) return
|
|
@@ -14381,13 +14589,10 @@ var [ui, setUi] = useState(function () {
|
|
|
14381
14589
|
text: '已按扫描结果自动生成配置 ' + path + '(可编辑,保存后生效)',
|
|
14382
14590
|
})
|
|
14383
14591
|
}
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
text: '配置已与工作区同步(新增程序已补、失效条目已删;你改过的字段保留)',
|
|
14389
|
-
})
|
|
14390
|
-
}
|
|
14592
|
+
// m03291: the automatic-sync row (status 'updated') is NOT shown any
|
|
14593
|
+
// more — it was pure noise after every workspace switch, and the sync
|
|
14594
|
+
// itself is silent anyway. The drift notice below is the actionable
|
|
14595
|
+
// one and stays; the compact panel dropped its own copy too.
|
|
14391
14596
|
var drift = config.drift
|
|
14392
14597
|
if (drift !== undefined && drift !== null && drift.stale === true) {
|
|
14393
14598
|
items.push({
|
|
@@ -14590,6 +14795,21 @@ var [ui, setUi] = useState(function () {
|
|
|
14590
14795
|
onClick: function (event) { event.stopPropagation(); void act('restart', program) },
|
|
14591
14796
|
}, busy ? '…' : '⟳')
|
|
14592
14797
|
: null,
|
|
14798
|
+
// Open the page the program serves, in the user's own browser. The URL
|
|
14799
|
+
// (and the token, for a yds project) is resolved by the host: a page
|
|
14800
|
+
// cannot add headers to a tab it opens itself.
|
|
14801
|
+
startable && program.kind === 'frontend'
|
|
14802
|
+
? h('button', {
|
|
14803
|
+
type: 'button', style: busySiteId === program.id ? S.paneIconOff : S.paneIcon, disabled: busySiteId === program.id,
|
|
14804
|
+
'data-action': 'open-site',
|
|
14805
|
+
title: '在系统浏览器打开 ' + program.name + ' 的页面'
|
|
14806
|
+
+ (ydsProject ? '(yds 项目:请求自动带上登录 token,免登录)' : ''),
|
|
14807
|
+
onClick: function (event) {
|
|
14808
|
+
event.stopPropagation()
|
|
14809
|
+
openSite(program)
|
|
14810
|
+
},
|
|
14811
|
+
}, busySiteId === program.id ? '…' : '🌐')
|
|
14812
|
+
: null,
|
|
14593
14813
|
program.kind === 'spring'
|
|
14594
14814
|
? h('button', {
|
|
14595
14815
|
type: 'button', style: S.debugIcon, 'data-action': 'debug-window',
|
|
@@ -14795,8 +15015,10 @@ var [ui, setUi] = useState(function () {
|
|
|
14795
15015
|
// A different file is a different viewer: remount it, exactly like
|
|
14796
15016
|
// the IDE's log pane (`key: activePath`). Without the key the pane
|
|
14797
15017
|
// kept the previous file's text while the title bar already showed
|
|
14798
|
-
// the new program, so a pick looked like it did nothing.
|
|
14799
|
-
|
|
15018
|
+
// the new program, so a pick looked like it did nothing. A new
|
|
15019
|
+
// (session, workspace) scope is a different viewer even when the
|
|
15020
|
+
// path string happens to be equal.
|
|
15021
|
+
key: sessionIdentity + '|' + (typeof cwd === 'string' ? cwd : '') + '|' + logPath,
|
|
14800
15022
|
scope: { sessionId: sessionId, cwd: cwd },
|
|
14801
15023
|
path: logPath,
|
|
14802
15024
|
// One source of truth for the follow switch, exactly like the IDE:
|
|
@@ -14903,6 +15125,15 @@ var [ui, setUi] = useState(function () {
|
|
|
14903
15125
|
onClick: function () { openWorkbench(program, true) },
|
|
14904
15126
|
}, '调试')
|
|
14905
15127
|
: null,
|
|
15128
|
+
program.kind === 'frontend'
|
|
15129
|
+
? h('button', {
|
|
15130
|
+
type: 'button', style: busySiteId === program.id ? S.paneIconOff : S.buttonOff, 'data-action': 'open-site',
|
|
15131
|
+
disabled: busySiteId === program.id,
|
|
15132
|
+
title: '在系统浏览器打开 ' + program.name + ' 的页面'
|
|
15133
|
+
+ (ydsProject ? '(yds 项目:请求自动带上登录 token,免登录)' : ''),
|
|
15134
|
+
onClick: function (event) { event.stopPropagation(); openSite(program) },
|
|
15135
|
+
}, busySiteId === program.id ? '…' : '🌐')
|
|
15136
|
+
: null,
|
|
14906
15137
|
h('button', {
|
|
14907
15138
|
type: 'button', style: S.button, 'data-action': 'enter',
|
|
14908
15139
|
title: '进入 IDE:文件树 / 源码(行号断点)/ 调试 / 实时日志',
|
|
@@ -14946,12 +15177,6 @@ var [ui, setUi] = useState(function () {
|
|
|
14946
15177
|
styles: S, kind: 'config-generated', signature: 'generated:' + String(state.config.path), onDismiss: panelDismissals.dismiss,
|
|
14947
15178
|
}, '已按扫描结果自动生成配置 ' + state.config.path + '(可编辑,保存后生效)')
|
|
14948
15179
|
: null,
|
|
14949
|
-
state.config !== undefined && state.config !== null && state.config.status === 'updated'
|
|
14950
|
-
&& panelDismissals.isOpen('config-updated', 'updated')
|
|
14951
|
-
? h(ClosableNotice, {
|
|
14952
|
-
styles: S, kind: 'config-updated', signature: 'updated', onDismiss: panelDismissals.dismiss,
|
|
14953
|
-
}, '配置已与工作区同步(新增程序已补、失效条目已删;你改过的字段保留)')
|
|
14954
|
-
: null,
|
|
14955
15180
|
state.config !== undefined && state.config !== null && state.config.drift !== undefined
|
|
14956
15181
|
&& state.config.drift !== null && state.config.drift.stale === true
|
|
14957
15182
|
&& panelDismissals.isOpen('drift', driftSignature(state.config.drift))
|
|
@@ -15001,6 +15226,13 @@ var [ui, setUi] = useState(function () {
|
|
|
15001
15226
|
RisIdeWindowAction: RisIdeWindowAction,
|
|
15002
15227
|
/** The header button's cwd source: the session store, never the remembered one. */
|
|
15003
15228
|
sessionWorkspaceCwd: sessionWorkspaceCwd,
|
|
15229
|
+
// Per-session workspace memory: what keeps the console and a log pane on
|
|
15230
|
+
// THEIR workspace while other documents on the same origin remember another.
|
|
15231
|
+
rememberSessionCwd: rememberSessionCwd,
|
|
15232
|
+
knownSessionCwd: knownSessionCwd,
|
|
15233
|
+
SESSION_CWD_PREFIX: SESSION_CWD_PREFIX,
|
|
15234
|
+
rememberWorkspaceCwd: rememberWorkspaceCwd,
|
|
15235
|
+
knownWorkspaceCwd: knownWorkspaceCwd,
|
|
15004
15236
|
openStandaloneWindow: openStandaloneWindow,
|
|
15005
15237
|
mountStandalone: mountStandalone,
|
|
15006
15238
|
StandaloneWindow: StandaloneWindow,
|