@linxin666/dsh-client-ui-task-board-ssh 0.0.0-stage → 0.4.20
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/LICENSE +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +85 -2
- package/README.zh.md +86 -0
- package/cordis.patch.yml +15 -0
- package/icon.svg +5 -0
- package/lib/client.js +4429 -0
- package/lib/index.js +6100 -0
- package/lib/types/client/PluginSettingsCard.d.ts +255 -0
- package/lib/types/client/RangeBubble.d.ts +46 -0
- package/lib/types/client/SegmentGroup.d.ts +28 -0
- package/lib/types/client/index.d.ts +100 -0
- package/lib/types/client/locales.d.ts +125 -0
- package/lib/types/client/seat-props.d.ts +53 -0
- package/lib/types/client/settings-entry-form.d.ts +49 -0
- package/lib/types/client/settings-form.d.ts +237 -0
- package/lib/types/client/ssh/card-decoration.d.ts +23 -0
- package/lib/types/client/ssh/compose-section.d.ts +7 -0
- package/lib/types/client/ssh/detail-section.d.ts +7 -0
- package/lib/types/client/ssh/extension.d.ts +54 -0
- package/lib/types/client/ssh/log-buffer.d.ts +128 -0
- package/lib/types/client/ssh/log-view.d.ts +37 -0
- package/lib/types/client/ssh/model.d.ts +130 -0
- package/lib/types/client/ssh/settings-section.d.ts +134 -0
- package/lib/types/client/ssh/summary.d.ts +160 -0
- package/lib/types/client/ssh/target-form.d.ts +60 -0
- package/lib/types/core/action.d.ts +89 -0
- package/lib/types/core/adapters/claude.d.ts +15 -0
- package/lib/types/core/adapters/codex.d.ts +15 -0
- package/lib/types/core/adapters/custom.d.ts +29 -0
- package/lib/types/core/adapters/dsh.d.ts +21 -0
- package/lib/types/core/adapters/index.d.ts +25 -0
- package/lib/types/core/adapters/types.d.ts +76 -0
- package/lib/types/core/contract.d.ts +445 -0
- package/lib/types/core/launcher-script.d.ts +13 -0
- package/lib/types/core/launcher.d.ts +153 -0
- package/lib/types/core/ledger.d.ts +123 -0
- package/lib/types/core/shell.d.ts +61 -0
- package/lib/types/core/target.d.ts +143 -0
- package/lib/types/core/task-record.d.ts +63 -0
- package/lib/types/core/workspace.d.ts +74 -0
- package/lib/types/host/board.d.ts +71 -0
- package/lib/types/host/engine.d.ts +418 -0
- package/lib/types/host/extension.d.ts +59 -0
- package/lib/types/host/logs.d.ts +135 -0
- package/lib/types/host/payload.d.ts +75 -0
- package/lib/types/host/prompt.d.ts +44 -0
- package/lib/types/host/queue.d.ts +53 -0
- package/lib/types/host/remote.d.ts +120 -0
- package/lib/types/host/settings.d.ts +149 -0
- package/lib/types/host/timers.d.ts +20 -0
- package/lib/types/host/tools.d.ts +15 -0
- package/lib/types/host/workspace/errors.d.ts +29 -0
- package/lib/types/host/workspace/git.d.ts +108 -0
- package/lib/types/host/workspace/in-place.d.ts +36 -0
- package/lib/types/host/workspace/index.d.ts +28 -0
- package/lib/types/host/workspace/layout.d.ts +62 -0
- package/lib/types/host/workspace/local-git.d.ts +72 -0
- package/lib/types/host/workspace/remote-git.d.ts +111 -0
- package/lib/types/host/workspace/remote.d.ts +85 -0
- package/lib/types/host/workspace/types.d.ts +28 -0
- package/lib/types/host/workspace-seam.d.ts +100 -0
- package/lib/types/index.d.ts +97 -0
- package/lib/types/mount-once.d.ts +55 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +89 -3
- package/src/client/PluginSettingsCard.tsx +838 -0
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +195 -0
- package/src/client/locales.ts +257 -0
- package/src/client/seat-props.ts +58 -0
- package/src/client/settings-card.module.css +821 -0
- package/src/client/settings-entry-form.ts +141 -0
- package/src/client/settings-form.ts +529 -0
- package/src/client/ssh/card-decoration.tsx +55 -0
- package/src/client/ssh/compose-section.tsx +147 -0
- package/src/client/ssh/detail-section.tsx +345 -0
- package/src/client/ssh/extension.ts +271 -0
- package/src/client/ssh/log-buffer.ts +224 -0
- package/src/client/ssh/log-view.tsx +149 -0
- package/src/client/ssh/model.ts +299 -0
- package/src/client/ssh/settings-section.tsx +401 -0
- package/src/client/ssh/summary.ts +388 -0
- package/src/client/ssh/target-form.tsx +380 -0
- package/src/client/ssh.module.css +617 -0
- package/src/core/action.ts +270 -0
- package/src/core/adapters/claude.ts +64 -0
- package/src/core/adapters/codex.ts +83 -0
- package/src/core/adapters/custom.ts +88 -0
- package/src/core/adapters/dsh.ts +87 -0
- package/src/core/adapters/index.ts +74 -0
- package/src/core/adapters/types.ts +95 -0
- package/src/core/contract.ts +510 -0
- package/src/core/launcher-script.ts +313 -0
- package/src/core/launcher.ts +283 -0
- package/src/core/ledger.ts +372 -0
- package/src/core/shell.ts +77 -0
- package/src/core/target.ts +413 -0
- package/src/core/task-record.ts +65 -0
- package/src/core/workspace.ts +78 -0
- package/src/host/board.ts +103 -0
- package/src/host/engine.ts +1602 -0
- package/src/host/extension.ts +304 -0
- package/src/host/logs.ts +297 -0
- package/src/host/payload.ts +134 -0
- package/src/host/prompt.ts +89 -0
- package/src/host/queue.ts +73 -0
- package/src/host/remote.ts +328 -0
- package/src/host/settings.ts +294 -0
- package/src/host/timers.ts +33 -0
- package/src/host/tools.ts +259 -0
- package/src/host/workspace/errors.ts +43 -0
- package/src/host/workspace/git.ts +305 -0
- package/src/host/workspace/in-place.ts +58 -0
- package/src/host/workspace/index.ts +37 -0
- package/src/host/workspace/layout.ts +122 -0
- package/src/host/workspace/local-git.ts +164 -0
- package/src/host/workspace/remote-git.ts +244 -0
- package/src/host/workspace/remote.ts +181 -0
- package/src/host/workspace/types.ts +34 -0
- package/src/host/workspace-seam.ts +132 -0
- package/src/index.ts +243 -0
- package/src/mount-once.ts +142 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The provider's settings section, rendered inside the task board's own
|
|
3
|
+
* settings card.
|
|
4
|
+
*
|
|
5
|
+
* It is the surface that turns this provider on: the board declares the
|
|
6
|
+
* provider-settings seat, and this extension is a provider of that board, so its
|
|
7
|
+
* configuration belongs where the board it configures is configured. The section
|
|
8
|
+
* is therefore NOT gated by the extension's own switch — a section gated by the
|
|
9
|
+
* switch could never turn it back on — and it reads nothing but the settings
|
|
10
|
+
* namespace and the board service.
|
|
11
|
+
*
|
|
12
|
+
* The field names are the Host's own Config schema (`src/index.ts`): `enabled`,
|
|
13
|
+
* `defaultHost`, `defaultAgent`, `defaultMode`, `perHostCap` and the
|
|
14
|
+
* `agentCommands` rows. They are volatile on the Host side, so every write here
|
|
15
|
+
* binds the next run without a restart, and every control is staged by the
|
|
16
|
+
* family card's form: a pick writes when it is made, typed text writes once
|
|
17
|
+
* typing pauses or the field is left.
|
|
18
|
+
*
|
|
19
|
+
* @module dsh-task-board-ssh/client/ssh/settings-section
|
|
20
|
+
*/
|
|
21
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
22
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
23
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
24
|
+
import { BooleanField, ChoiceField, PluginSettingsCard, ValueField } from '../PluginSettingsCard.tsx'
|
|
25
|
+
import {
|
|
26
|
+
booleanField,
|
|
27
|
+
CardForm,
|
|
28
|
+
choiceField,
|
|
29
|
+
numberField,
|
|
30
|
+
textField,
|
|
31
|
+
type CardActions,
|
|
32
|
+
type CardShell,
|
|
33
|
+
type FieldSpec,
|
|
34
|
+
type FieldState,
|
|
35
|
+
} from '../settings-form.ts'
|
|
36
|
+
import { validateCustomTemplate } from '../../core/adapters/index.ts'
|
|
37
|
+
import { HOST_ALIAS_RE, SSH_AGENT_KINDS, type SshAgentKind, type SshExecutionMode } from '../../core/target.ts'
|
|
38
|
+
import type { TaskBoardSshKey } from '../locales.ts'
|
|
39
|
+
import css from '../ssh.module.css'
|
|
40
|
+
|
|
41
|
+
/** One agent whose built-in command line an operator may replace. */
|
|
42
|
+
export const OVERRIDE_AGENTS: readonly SshAgentKind[] = ['dsh', 'claude', 'codex']
|
|
43
|
+
|
|
44
|
+
/** One stored command override, as the Host's Config carries it. */
|
|
45
|
+
export interface SshAgentCommandRow {
|
|
46
|
+
/** Agent the override applies to. */
|
|
47
|
+
kind: SshAgentKind
|
|
48
|
+
/** Start template; must reference `{prompt_file}`. */
|
|
49
|
+
command: string
|
|
50
|
+
/** Resume template, kept as stored when the card does not edit it. */
|
|
51
|
+
resumeCommand?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The extension fields this section edits (the Host's Config schema). */
|
|
55
|
+
export interface SshSettings {
|
|
56
|
+
/** Master switch for the extension. */
|
|
57
|
+
enabled?: boolean
|
|
58
|
+
/** Host alias a card's target form opens with. */
|
|
59
|
+
defaultHost?: string
|
|
60
|
+
/** Execution mode a new target opens on. */
|
|
61
|
+
defaultMode?: SshExecutionMode
|
|
62
|
+
/** Agent CLI a new target opens on. */
|
|
63
|
+
defaultAgent?: SshAgentKind
|
|
64
|
+
/** How many cards may run at once on one host. */
|
|
65
|
+
perHostCap?: number
|
|
66
|
+
/** Per-agent command templates that replace the built-in command line. */
|
|
67
|
+
agentCommands?: SshAgentCommandRow[]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** What the section renders. */
|
|
71
|
+
export interface SshSettingsCardState extends CardShell {
|
|
72
|
+
/** The master switch. */
|
|
73
|
+
enabled: FieldState
|
|
74
|
+
/** The default host alias. */
|
|
75
|
+
defaultHost: FieldState
|
|
76
|
+
/** The default execution mode. */
|
|
77
|
+
defaultMode: FieldState
|
|
78
|
+
/** The default agent CLI. */
|
|
79
|
+
defaultAgent: FieldState
|
|
80
|
+
/** The per-host running cap. */
|
|
81
|
+
perHostCap: FieldState
|
|
82
|
+
/** The agent command overrides, as one JSON draft. */
|
|
83
|
+
agentCommands: FieldState
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The registration-side face the section's slot entry injects. */
|
|
87
|
+
export interface SshSettingsCardFace extends CardActions {
|
|
88
|
+
hooks: {
|
|
89
|
+
/** Section snapshot bound by the renderer as useSshSettingsCard. */
|
|
90
|
+
sshSettingsCard: SnapshotStore<SshSettingsCardState>
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Bounds of the per-host cap, restated from the Host's own normalization
|
|
96
|
+
* (`src/host/queue.ts`'s `PER_HOST_CAP_MIN`/`PER_HOST_CAP_MAX`, which the Config
|
|
97
|
+
* schema in `src/index.ts` bounds too). The client may not import the host half,
|
|
98
|
+
* so `tests/client-limits.spec.ts` pins the two restatements against each other.
|
|
99
|
+
*/
|
|
100
|
+
export const HOST_CAP = { min: 1, max: 16, step: 1, fallback: 2 } as const
|
|
101
|
+
|
|
102
|
+
/** Whether a value is a plain object (not an array, not null). */
|
|
103
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
104
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Read the stored override rows; anything unreadable reads as no override.
|
|
109
|
+
* @param value - the stored field value.
|
|
110
|
+
* @returns the rows, one per agent at most.
|
|
111
|
+
*/
|
|
112
|
+
export function readAgentRows(value: unknown): SshAgentCommandRow[] {
|
|
113
|
+
if (!Array.isArray(value)) return []
|
|
114
|
+
const rows: SshAgentCommandRow[] = []
|
|
115
|
+
for (const entry of value) {
|
|
116
|
+
if (!isPlainObject(entry)) continue
|
|
117
|
+
const kind = SSH_AGENT_KINDS.find(candidate => candidate === entry.kind)
|
|
118
|
+
const command = typeof entry.command === 'string' ? entry.command : ''
|
|
119
|
+
if (kind === undefined || command.trim() === '') continue
|
|
120
|
+
const row: SshAgentCommandRow = { kind, command }
|
|
121
|
+
if (typeof entry.resumeCommand === 'string' && entry.resumeCommand.trim() !== '') row.resumeCommand = entry.resumeCommand
|
|
122
|
+
rows.push(row)
|
|
123
|
+
}
|
|
124
|
+
return rows
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Read the override rows out of their JSON draft.
|
|
129
|
+
* @param text - the field's draft text.
|
|
130
|
+
* @returns the rows; an unreadable draft reads as no override.
|
|
131
|
+
*/
|
|
132
|
+
export function parseAgentRowsText(text: string): SshAgentCommandRow[] {
|
|
133
|
+
if (text.trim() === '') return []
|
|
134
|
+
try {
|
|
135
|
+
return readAgentRows(JSON.parse(text))
|
|
136
|
+
} catch {
|
|
137
|
+
return []
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Replace one agent's start template, keeping everything else the row stores.
|
|
143
|
+
*
|
|
144
|
+
* A cleared template removes the row: an override without a command means "use
|
|
145
|
+
* the built-in command line", and storing an empty one would ask the Host to
|
|
146
|
+
* start nothing.
|
|
147
|
+
* @param text - the field's current draft text.
|
|
148
|
+
* @param kind - agent the edit belongs to.
|
|
149
|
+
* @param command - the new template.
|
|
150
|
+
* @returns the new draft text.
|
|
151
|
+
*/
|
|
152
|
+
export function withAgentCommand(text: string, kind: SshAgentKind, command: string): string {
|
|
153
|
+
const existing = parseAgentRowsText(text)
|
|
154
|
+
const previous = existing.find(row => row.kind === kind)
|
|
155
|
+
const rest = existing.filter(row => row.kind !== kind)
|
|
156
|
+
if (command.trim() !== '') {
|
|
157
|
+
rest.push({
|
|
158
|
+
kind,
|
|
159
|
+
command,
|
|
160
|
+
...(previous?.resumeCommand === undefined ? {} : { resumeCommand: previous.resumeCommand }),
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
const knownOrder = OVERRIDE_AGENTS
|
|
164
|
+
.map(candidate => rest.find(row => row.kind === candidate))
|
|
165
|
+
.filter((row): row is SshAgentCommandRow => row !== undefined)
|
|
166
|
+
// Preserve any extra non-form rows (e.g. `custom`) stored in settings.yaml.
|
|
167
|
+
const extra = rest.filter(row => !OVERRIDE_AGENTS.includes(row.kind))
|
|
168
|
+
const ordered = [...knownOrder, ...extra]
|
|
169
|
+
return ordered.length === 0 ? '' : JSON.stringify(ordered)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Validate `defaultHost`: empty clears to inherited default, non-empty must be a valid dsh-ssh alias. */
|
|
173
|
+
function defaultHostField(): FieldSpec {
|
|
174
|
+
const base = textField('defaultHost')
|
|
175
|
+
return {
|
|
176
|
+
...base,
|
|
177
|
+
parse: text => {
|
|
178
|
+
const trimmed = text.trim()
|
|
179
|
+
if (trimmed === '') return { kind: 'clear' }
|
|
180
|
+
return HOST_ALIAS_RE.test(trimmed) ? { kind: 'set', value: trimmed } : undefined
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The list field as one JSON draft, so the card's form stays the only writer.
|
|
187
|
+
*
|
|
188
|
+
* A draft whose template cannot start anything (it does not reference the
|
|
189
|
+
* prompt file) stays unwritten and shows as an unacceptable value, which is the
|
|
190
|
+
* card's own way of refusing a draft.
|
|
191
|
+
*/
|
|
192
|
+
function agentCommandsField(): FieldSpec {
|
|
193
|
+
return {
|
|
194
|
+
field: 'agentCommands',
|
|
195
|
+
entry: 'type',
|
|
196
|
+
format: value => {
|
|
197
|
+
const rows = readAgentRows(value)
|
|
198
|
+
return rows.length === 0 ? '' : JSON.stringify(rows)
|
|
199
|
+
},
|
|
200
|
+
parse: text => {
|
|
201
|
+
if (text.trim() === '') return { kind: 'clear' }
|
|
202
|
+
const rows = parseAgentRowsText(text)
|
|
203
|
+
if (rows.length === 0) return { kind: 'clear' }
|
|
204
|
+
for (const row of rows) {
|
|
205
|
+
if (validateCustomTemplate(row.command) !== undefined) return undefined
|
|
206
|
+
if (row.resumeCommand !== undefined && validateCustomTemplate(row.resumeCommand) !== undefined) return undefined
|
|
207
|
+
}
|
|
208
|
+
return { kind: 'set', value: rows }
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Bridges the extension's settings form onto the card's staged form. */
|
|
214
|
+
export class SshSettingsCardController {
|
|
215
|
+
private readonly form: CardForm<SshSettings>
|
|
216
|
+
private readonly store: SnapshotStore<SshSettingsCardState>
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @param scope - the bound configuration form of the entry that owns this namespace.
|
|
220
|
+
*/
|
|
221
|
+
constructor(scope: ConfigForm<SshSettings>) {
|
|
222
|
+
this.form = new CardForm(scope, [
|
|
223
|
+
booleanField('enabled'),
|
|
224
|
+
defaultHostField(),
|
|
225
|
+
choiceField('defaultMode', ['direct', 'proxy']),
|
|
226
|
+
choiceField('defaultAgent', [...SSH_AGENT_KINDS]),
|
|
227
|
+
numberField('perHostCap', { integer: true, min: HOST_CAP.min, max: HOST_CAP.max }),
|
|
228
|
+
agentCommandsField(),
|
|
229
|
+
])
|
|
230
|
+
this.store = this.form.bind(() => this.projection())
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private projection(): SshSettingsCardState {
|
|
234
|
+
return {
|
|
235
|
+
...this.form.shell(),
|
|
236
|
+
enabled: this.form.field('enabled'),
|
|
237
|
+
defaultHost: this.form.field('defaultHost'),
|
|
238
|
+
defaultMode: this.form.field('defaultMode'),
|
|
239
|
+
defaultAgent: this.form.field('defaultAgent'),
|
|
240
|
+
perHostCap: this.form.field('perHostCap'),
|
|
241
|
+
agentCommands: this.form.field('agentCommands'),
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Build the face the section's slot registration injects.
|
|
247
|
+
* @returns the section's snapshot store and its form actions.
|
|
248
|
+
*/
|
|
249
|
+
inject(): SshSettingsCardFace {
|
|
250
|
+
return { hooks: { sshSettingsCard: this.store }, ...this.form.actions() }
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Release the card's scope subscription and bound stores. */
|
|
254
|
+
dispose(): void {
|
|
255
|
+
this.form.dispose()
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Props the renderer binds for the board's provider-settings seat. */
|
|
260
|
+
export type SshSettingsSectionProps =
|
|
261
|
+
PropsRuntime<'task-board.settings.section'>
|
|
262
|
+
& PropsLocale<'task-board-ssh'>
|
|
263
|
+
& InjectFace<SshSettingsCardFace>
|
|
264
|
+
|
|
265
|
+
/** Hint of one agent's command row: what its built-in command line is. */
|
|
266
|
+
function agentCommandHint(kind: SshAgentKind): TaskBoardSshKey {
|
|
267
|
+
if (kind === 'claude') return 'settings.agentCommandHint.claude'
|
|
268
|
+
if (kind === 'codex') return 'settings.agentCommandHint.codex'
|
|
269
|
+
return 'settings.agentCommandHint.dsh'
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Render the SSH provider's settings section.
|
|
274
|
+
* @param props - locale copy, the section snapshot, and its form actions.
|
|
275
|
+
* @returns the section.
|
|
276
|
+
*/
|
|
277
|
+
export function SshSettingsSection(props: SshSettingsSectionProps) {
|
|
278
|
+
const { t: translate } = props
|
|
279
|
+
const label = (key: TaskBoardSshKey): string => translate(key)
|
|
280
|
+
const agentName = (kind: SshAgentKind): string => label(`detail.agent.${kind}`)
|
|
281
|
+
const modeName = (mode: SshExecutionMode): string => label(mode === 'direct' ? 'detail.mode.direct' : 'detail.mode.proxy')
|
|
282
|
+
const state = props.useSshSettingsCard((snapshot: SshSettingsCardState) => snapshot)
|
|
283
|
+
const enabled = state.enabled.text !== 'false'
|
|
284
|
+
const fieldCopy = {
|
|
285
|
+
overriddenLabel: label('settings.overridden'),
|
|
286
|
+
resetLabel: label('settings.reset'),
|
|
287
|
+
invalidLabel: label('settings.invalidValue'),
|
|
288
|
+
disabled: !state.writable,
|
|
289
|
+
}
|
|
290
|
+
const rows = parseAgentRowsText(state.agentCommands.text)
|
|
291
|
+
return (
|
|
292
|
+
<PluginSettingsCard
|
|
293
|
+
t={translate}
|
|
294
|
+
titleKey="settings.title"
|
|
295
|
+
descriptionKey="settings.description"
|
|
296
|
+
// One topic inside the board's own settings card: the compact chrome its
|
|
297
|
+
// sibling topic cards use, closed on arrival like them.
|
|
298
|
+
density="nested"
|
|
299
|
+
defaultOpen={false}
|
|
300
|
+
state={state}
|
|
301
|
+
onSave={props.save}
|
|
302
|
+
onDiscard={props.discard}
|
|
303
|
+
>
|
|
304
|
+
<BooleanField
|
|
305
|
+
id="settings-task-board-ssh-enabled"
|
|
306
|
+
label={label('settings.enabled')}
|
|
307
|
+
hint={label('settings.enabledConsequence')}
|
|
308
|
+
hintTitle={label('settings.enabledHint')}
|
|
309
|
+
onLabel={label('settings.on')}
|
|
310
|
+
offLabel={label('settings.offLabel')}
|
|
311
|
+
inheritLabel={label('settings.inherit')}
|
|
312
|
+
{...fieldCopy}
|
|
313
|
+
{...state.enabled}
|
|
314
|
+
onEdit={text => props.edit('enabled', text)}
|
|
315
|
+
onReset={() => props.resetField('enabled')}
|
|
316
|
+
/>
|
|
317
|
+
{enabled
|
|
318
|
+
? (
|
|
319
|
+
<>
|
|
320
|
+
<div className={css.quietField}>
|
|
321
|
+
<ChoiceField
|
|
322
|
+
id="settings-task-board-ssh-mode"
|
|
323
|
+
label={label('settings.defaultMode')}
|
|
324
|
+
hint=""
|
|
325
|
+
presentation="segment"
|
|
326
|
+
inheritLabel={label('settings.inherit')}
|
|
327
|
+
choices={[
|
|
328
|
+
{ value: 'direct', label: modeName('direct') },
|
|
329
|
+
{ value: 'proxy', label: modeName('proxy') },
|
|
330
|
+
]}
|
|
331
|
+
{...fieldCopy}
|
|
332
|
+
{...state.defaultMode}
|
|
333
|
+
onEdit={text => props.edit('defaultMode', text)}
|
|
334
|
+
onReset={() => props.resetField('defaultMode')}
|
|
335
|
+
/>
|
|
336
|
+
</div>
|
|
337
|
+
<div className={css.quietField}>
|
|
338
|
+
<ChoiceField
|
|
339
|
+
id="settings-task-board-ssh-agent"
|
|
340
|
+
label={label('settings.defaultAgent')}
|
|
341
|
+
hint=""
|
|
342
|
+
inheritLabel={label('settings.inherit')}
|
|
343
|
+
choices={SSH_AGENT_KINDS.map(kind => ({ value: kind, label: agentName(kind) }))}
|
|
344
|
+
{...fieldCopy}
|
|
345
|
+
{...state.defaultAgent}
|
|
346
|
+
onEdit={text => props.edit('defaultAgent', text)}
|
|
347
|
+
onReset={() => props.resetField('defaultAgent')}
|
|
348
|
+
/>
|
|
349
|
+
</div>
|
|
350
|
+
<div className={css.quietField}>
|
|
351
|
+
<ValueField
|
|
352
|
+
id="settings-task-board-ssh-host"
|
|
353
|
+
label={label('settings.defaultHost')}
|
|
354
|
+
hint=""
|
|
355
|
+
placeholder={label('settings.defaultHostPlaceholder')}
|
|
356
|
+
{...fieldCopy}
|
|
357
|
+
{...state.defaultHost}
|
|
358
|
+
onEdit={text => props.edit('defaultHost', text)}
|
|
359
|
+
onReset={() => props.resetField('defaultHost')}
|
|
360
|
+
/>
|
|
361
|
+
</div>
|
|
362
|
+
<ValueField
|
|
363
|
+
id="settings-task-board-ssh-cap"
|
|
364
|
+
label={label('settings.perHostCap')}
|
|
365
|
+
hint={label('settings.perHostCapHint')}
|
|
366
|
+
numeric
|
|
367
|
+
placeholder={String(HOST_CAP.fallback)}
|
|
368
|
+
range={{ min: HOST_CAP.min, max: HOST_CAP.max, step: HOST_CAP.step }}
|
|
369
|
+
{...fieldCopy}
|
|
370
|
+
{...state.perHostCap}
|
|
371
|
+
onEdit={text => props.edit('perHostCap', text)}
|
|
372
|
+
onReset={() => props.resetField('perHostCap')}
|
|
373
|
+
/>
|
|
374
|
+
{OVERRIDE_AGENTS.map(kind => {
|
|
375
|
+
const row = rows.find(entry => entry.kind === kind)
|
|
376
|
+
const rowInvalid = row !== undefined && (
|
|
377
|
+
validateCustomTemplate(row.command) !== undefined
|
|
378
|
+
|| (row.resumeCommand !== undefined && validateCustomTemplate(row.resumeCommand) !== undefined)
|
|
379
|
+
)
|
|
380
|
+
return (
|
|
381
|
+
<ValueField
|
|
382
|
+
key={kind}
|
|
383
|
+
id={`settings-task-board-ssh-command-${kind}`}
|
|
384
|
+
label={agentName(kind)}
|
|
385
|
+
hint={label(agentCommandHint(kind))}
|
|
386
|
+
{...fieldCopy}
|
|
387
|
+
{...state.agentCommands}
|
|
388
|
+
text={row?.command ?? ''}
|
|
389
|
+
overridden={row !== undefined}
|
|
390
|
+
invalid={rowInvalid}
|
|
391
|
+
onEdit={text => props.edit('agentCommands', withAgentCommand(state.agentCommands.text, kind, text))}
|
|
392
|
+
onReset={() => props.edit('agentCommands', withAgentCommand(state.agentCommands.text, kind, ''))}
|
|
393
|
+
/>
|
|
394
|
+
)
|
|
395
|
+
})}
|
|
396
|
+
</>
|
|
397
|
+
)
|
|
398
|
+
: <p className={css.sectionHint}>{label('settings.disabledNotice')}</p>}
|
|
399
|
+
</PluginSettingsCard>
|
|
400
|
+
)
|
|
401
|
+
}
|