dsh-mcp-manager-plus 0.4.5 → 0.5.0
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/CHANGELOG.md +71 -0
- package/README.en.md +128 -6
- package/README.md +102 -7
- package/lib/client.js +278 -38
- package/lib/index.js +504 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -114,7 +114,6 @@ window.__ModuleLoader__.load({
|
|
|
114
114
|
phaseFailed: '连接失败',
|
|
115
115
|
phaseDisabled: '已停用',
|
|
116
116
|
phaseUnloading: '卸载中',
|
|
117
|
-
sourceUser: '配置文件',
|
|
118
117
|
sourceBundle: '部署内置',
|
|
119
118
|
sourceBuiltin: '内置能力',
|
|
120
119
|
notWritable: '配置文件不可写,改动无法保存:{path}',
|
|
@@ -128,6 +127,17 @@ window.__ModuleLoader__.load({
|
|
|
128
127
|
collapse: '收起',
|
|
129
128
|
langLabel: '语言',
|
|
130
129
|
langAuto: '自动',
|
|
130
|
+
bindTitle: '项目绑定',
|
|
131
|
+
bindHint:
|
|
132
|
+
'把该服务器锁定到指定项目目录:只有工作目录位于这些目录(含其子目录)下的会话,才能看到并调用它的工具;其它项目里这些工具会被隐藏,调用也会被拒绝。留空即解除绑定,恢复全局可用。',
|
|
133
|
+
bindPathsLabel: '项目目录',
|
|
134
|
+
bindPathsHint: '每行一个绝对路径,例如 D:\\work\\my-project',
|
|
135
|
+
bindScopeAll: '全局可用',
|
|
136
|
+
bindScopeLimited: '仅限 {n} 个项目',
|
|
137
|
+
bindSaved: '已更新项目绑定',
|
|
138
|
+
bindUnbound: '已解除项目绑定',
|
|
139
|
+
bindNote: '绑定对正在运行的会话立即生效,无需重启,也不影响 MCP 连接本身。',
|
|
140
|
+
bindLoadHint: '支持 ~ 开头的家目录路径。',
|
|
131
141
|
},
|
|
132
142
|
en: {
|
|
133
143
|
nav: 'MCP',
|
|
@@ -187,7 +197,6 @@ window.__ModuleLoader__.load({
|
|
|
187
197
|
phaseFailed: 'Failed',
|
|
188
198
|
phaseDisabled: 'Disabled',
|
|
189
199
|
phaseUnloading: 'Unloading',
|
|
190
|
-
sourceUser: 'Config file',
|
|
191
200
|
sourceBundle: 'Deployment',
|
|
192
201
|
sourceBuiltin: 'Built-in',
|
|
193
202
|
notWritable: 'The configuration file is not writable, so changes cannot be saved: {path}',
|
|
@@ -201,6 +210,17 @@ window.__ModuleLoader__.load({
|
|
|
201
210
|
collapse: 'Collapse',
|
|
202
211
|
langLabel: 'Language',
|
|
203
212
|
langAuto: 'Auto',
|
|
213
|
+
bindTitle: 'Project binding',
|
|
214
|
+
bindHint:
|
|
215
|
+
'Lock this server to specific project directories: only sessions whose working directory is one of these directories (or inside one) can see and call its tools. In any other project the tools are hidden and refused. Leave it empty to clear the binding and make the server global again.',
|
|
216
|
+
bindPathsLabel: 'Project directories',
|
|
217
|
+
bindPathsHint: 'One absolute path per line, for example D:\\work\\my-project',
|
|
218
|
+
bindScopeAll: 'All projects',
|
|
219
|
+
bindScopeLimited: 'Bound to {n} project(s)',
|
|
220
|
+
bindSaved: 'Project binding updated',
|
|
221
|
+
bindUnbound: 'Project binding cleared',
|
|
222
|
+
bindNote: 'Applies immediately to running sessions — no restart needed, and the MCP connection itself is untouched.',
|
|
223
|
+
bindLoadHint: 'A path may start with ~ for your home directory.',
|
|
204
224
|
},
|
|
205
225
|
};
|
|
206
226
|
|
|
@@ -249,9 +269,32 @@ window.__ModuleLoader__.load({
|
|
|
249
269
|
'.mcpmp-btn-danger{color:var(--dsw-alias-state-error-primary)}',
|
|
250
270
|
'.mcpmp-btn-sm{height:26px;padding:0 9px;font-size:12px}',
|
|
251
271
|
'.mcpmp-icon{width:30px;padding:0}',
|
|
272
|
+
// Row actions are icon-only, so their label has to come from somewhere
|
|
273
|
+
// on hover. The shell may clip a panel, so the tip is positioned against
|
|
274
|
+
// the button and allowed to escape upward; `pointer-events:none` keeps it
|
|
275
|
+
// out of the hit area, or hovering the tip would hide it.
|
|
276
|
+
'.mcpmp-icon[data-tip]{position:relative}',
|
|
277
|
+
'.mcpmp-icon[data-tip]::after{content:attr(data-tip);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%) translateY(2px);padding:3px 7px;border-radius:6px;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);box-shadow:0 4px 14px rgba(0,0,0,.16);color:var(--dsw-alias-label-primary);font-size:11px;line-height:1.4;font-weight:400;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .12s ease,transform .12s ease;z-index:5}',
|
|
278
|
+
'.mcpmp-icon[data-tip]:hover::after,.mcpmp-icon[data-tip]:focus-visible::after{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)}',
|
|
279
|
+
// The row's last action sits next to the switch; anchoring the tip to the
|
|
280
|
+
// right edge keeps it inside the card instead of hanging off it.
|
|
281
|
+
'.mcpmp-row-actions{display:flex;gap:6px;flex:0 0 auto}',
|
|
282
|
+
'.mcpmp-row-actions>.mcpmp-icon:last-child[data-tip]::after{left:auto;right:0;transform:translateY(2px)}',
|
|
283
|
+
'.mcpmp-row-actions>.mcpmp-icon:last-child[data-tip]:hover::after,.mcpmp-row-actions>.mcpmp-icon:last-child[data-tip]:focus-visible::after{transform:translateY(0)}',
|
|
252
284
|
'.mcpmp-list{display:flex;flex-direction:column;gap:8px}',
|
|
253
|
-
|
|
254
|
-
|
|
285
|
+
// No `overflow:hidden` here: the row's icon buttons draw their labels as
|
|
286
|
+
// ::after tips, and a clipping card would cut them off. The expanded body
|
|
287
|
+
// is the only child that paints to the edge, so it carries the bottom
|
|
288
|
+
// corner itself rather than being clipped by the card.
|
|
289
|
+
'.mcpmp-card{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
|
|
290
|
+
'.mcpmp-card>*:last-child{border-bottom-left-radius:9px;border-bottom-right-radius:9px}',
|
|
291
|
+
// The tip reaches above the row, so the card it belongs to must paint
|
|
292
|
+
// over the card above it while one of its buttons is hovered.
|
|
293
|
+
'.mcpmp-card{position:relative}',
|
|
294
|
+
'.mcpmp-card:hover,.mcpmp-card:focus-within{z-index:1}',
|
|
295
|
+
// The tip is drawn above the button and must survive the card's
|
|
296
|
+
// neighbours, so the row itself must not clip either.
|
|
297
|
+
'.mcpmp-row{display:flex;align-items:center;gap:10px;padding:10px 12px;min-height:52px;position:relative}',
|
|
255
298
|
'.mcpmp-avatar{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#fff;flex:0 0 auto;text-transform:uppercase}',
|
|
256
299
|
'.mcpmp-name{display:flex;align-items:center;gap:6px;font-weight:500;min-width:0}',
|
|
257
300
|
'.mcpmp-name span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
@@ -274,6 +317,13 @@ window.__ModuleLoader__.load({
|
|
|
274
317
|
'.mcpmp-tool code{font-size:12px;color:var(--dsw-alias-label-primary);word-break:break-all}',
|
|
275
318
|
'.mcpmp-tool p{margin:0;color:var(--dsw-alias-label-secondary);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
276
319
|
'.mcpmp-tools-empty{padding:10px 14px;color:var(--dsw-alias-label-secondary);font-size:12px}',
|
|
320
|
+
'.mcpmp-tag-bound{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-state-success-primary)}',
|
|
321
|
+
'.mcpmp-btn-bound{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}',
|
|
322
|
+
'.mcpmp-binding{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;padding:8px 14px;border-bottom:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);font-size:11px}',
|
|
323
|
+
'.mcpmp-binding-label{font-weight:500;color:var(--dsw-alias-label-secondary)}',
|
|
324
|
+
'.mcpmp-binding-paths{display:inline-flex;flex-wrap:wrap;gap:4px}',
|
|
325
|
+
'.mcpmp-binding-paths code{background:var(--dsw-alias-bg-layer-2);border-radius:5px;padding:1px 6px;font-size:11px}',
|
|
326
|
+
'.mcpmp-binding-all{color:var(--dsw-alias-label-secondary)}',
|
|
277
327
|
'.mcpmp-note{padding:9px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);font-size:12px}',
|
|
278
328
|
'.mcpmp-note-warn{color:var(--dsw-alias-state-warn-primary)}',
|
|
279
329
|
'.mcpmp-note-error{color:var(--dsw-alias-state-error-primary)}',
|
|
@@ -493,6 +543,15 @@ window.__ModuleLoader__.load({
|
|
|
493
543
|
refresh: h('path', { d: 'M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2.5V5H11' }),
|
|
494
544
|
chevron: h('path', { d: 'M4 6l4 4 4-4' }),
|
|
495
545
|
close: h('path', { d: 'M4 4l8 8M12 4l-8 8' }),
|
|
546
|
+
// Row-action glyphs. Each is one <path> of plain line segments so the
|
|
547
|
+
// stroke width stays uniform at 14px, where a multi-shape icon turns to
|
|
548
|
+
// mush.
|
|
549
|
+
edit: h('path', { d: 'M10.6 2.9l2.5 2.5-8 8L2 14.2l.8-3.1 7.8-8.2z' }),
|
|
550
|
+
trash: h('path', { d: 'M2.6 4.4h10.8M6.2 4.4V2.9h3.6v1.5M4.4 4.4l.6 8.7h6l.6-8.7' }),
|
|
551
|
+
// Project binding: a folder (the project) with a padlock on it.
|
|
552
|
+
bind: h('path', {
|
|
553
|
+
d: 'M2.4 12.8V3.6h3.5l1.3 1.6h6.4v3M7.6 9.2h4.6v3.6H7.6zM8.4 9.2V8.4a1.5 1.5 0 0 1 3 0v.8',
|
|
554
|
+
}),
|
|
496
555
|
// Mode-switch glyphs: a form (label rows) and code brackets. Each is a
|
|
497
556
|
// single <path> with several subpaths, so no React `key` is needed —
|
|
498
557
|
// `key` is not forwarded to the DOM, but avoiding it keeps the elements
|
|
@@ -667,51 +726,81 @@ window.__ModuleLoader__.load({
|
|
|
667
726
|
unloading: t('phaseUnloading'),
|
|
668
727
|
}[phase] || phase;
|
|
669
728
|
var tools = Array.isArray(live.tools) ? live.tools : [];
|
|
729
|
+
// Only non-user rows wear this tag now; a user row's origin is the
|
|
730
|
+
// "config file" text this row used to spend a chip on.
|
|
670
731
|
var sourceLabel =
|
|
671
|
-
server.source === '
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
732
|
+
server.source === 'builtin' ? t('sourceBuiltin') : t('sourceBundle');
|
|
733
|
+
var boundPaths =
|
|
734
|
+
server.binding && Array.isArray(server.binding.paths) ? server.binding.paths : [];
|
|
735
|
+
var bindingLabel =
|
|
736
|
+
boundPaths.length === 0 ? t('bindScopeAll') : t('bindScopeLimited', { n: boundPaths.length });
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* One row action: an icon-only button whose label lives in `title` and
|
|
740
|
+
* `aria-label`, plus a CSS tooltip of its own.
|
|
741
|
+
*
|
|
742
|
+
* `title` alone would be the accessible name AND the tooltip, but the
|
|
743
|
+
* native tooltip waits about a second and is invisible in screenshots, so
|
|
744
|
+
* the stylesheet paints one from `data-tip` on hover/focus. `title` is
|
|
745
|
+
* kept as the fallback for touch and for anything that ignores CSS, and
|
|
746
|
+
* `aria-label` is the accessible name — a button holding only an <svg>
|
|
747
|
+
* would otherwise announce as nothing.
|
|
748
|
+
*/
|
|
749
|
+
function actionButton(spec) {
|
|
750
|
+
var label = t(spec.labelKey);
|
|
751
|
+
return h(
|
|
752
|
+
'button',
|
|
753
|
+
{
|
|
754
|
+
key: spec.key,
|
|
755
|
+
type: 'button',
|
|
756
|
+
className: 'mcpmp-btn mcpmp-btn-sm mcpmp-icon' +
|
|
757
|
+
(spec.danger === true ? ' mcpmp-btn-danger' : '') +
|
|
758
|
+
(spec.active === true ? ' mcpmp-btn-bound' : ''),
|
|
759
|
+
disabled: busy,
|
|
760
|
+
onClick: spec.onClick,
|
|
761
|
+
title: label,
|
|
762
|
+
'aria-label': label,
|
|
763
|
+
'data-tip': label,
|
|
764
|
+
},
|
|
765
|
+
h(Icon, { path: spec.path, size: 14 }),
|
|
766
|
+
);
|
|
767
|
+
}
|
|
676
768
|
|
|
677
769
|
var actions = [];
|
|
678
770
|
if (server.editable) {
|
|
679
771
|
actions.push(
|
|
680
|
-
|
|
681
|
-
'button',
|
|
682
|
-
{ key: 'edit', type: 'button', className: 'mcpmp-btn mcpmp-btn-sm', disabled: busy, onClick: props.onEdit },
|
|
683
|
-
t('edit'),
|
|
684
|
-
),
|
|
772
|
+
actionButton({ key: 'edit', labelKey: 'edit', path: ICON_PATH.edit, onClick: props.onEdit }),
|
|
685
773
|
);
|
|
686
774
|
}
|
|
687
775
|
if (live.mounted) {
|
|
688
776
|
actions.push(
|
|
689
|
-
|
|
690
|
-
'button',
|
|
691
|
-
{
|
|
692
|
-
key: 'restart',
|
|
693
|
-
type: 'button',
|
|
694
|
-
className: 'mcpmp-btn mcpmp-btn-sm',
|
|
695
|
-
disabled: busy,
|
|
696
|
-
onClick: props.onRestart,
|
|
697
|
-
},
|
|
698
|
-
t('restart'),
|
|
699
|
-
),
|
|
777
|
+
actionButton({ key: 'restart', labelKey: 'restart', path: ICON_PATH.refresh, onClick: props.onRestart }),
|
|
700
778
|
);
|
|
701
779
|
}
|
|
702
780
|
if (server.removable) {
|
|
703
781
|
actions.push(
|
|
704
|
-
|
|
705
|
-
'
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
782
|
+
actionButton({
|
|
783
|
+
key: 'remove',
|
|
784
|
+
labelKey: 'remove',
|
|
785
|
+
path: ICON_PATH.trash,
|
|
786
|
+
onClick: props.onRemove,
|
|
787
|
+
danger: true,
|
|
788
|
+
}),
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// Binding is offered for every row that carries a serverName, including
|
|
793
|
+
// bundle-provided ones: the binding table is this plugin's own data, so it
|
|
794
|
+
// can scope a server the user must not edit or delete.
|
|
795
|
+
if (server.serverName) {
|
|
796
|
+
actions.push(
|
|
797
|
+
actionButton({
|
|
798
|
+
key: 'bind',
|
|
799
|
+
labelKey: 'bindTitle',
|
|
800
|
+
path: ICON_PATH.bind,
|
|
801
|
+
onClick: props.onBind,
|
|
802
|
+
active: boundPaths.length > 0,
|
|
803
|
+
}),
|
|
715
804
|
);
|
|
716
805
|
}
|
|
717
806
|
|
|
@@ -753,10 +842,25 @@ window.__ModuleLoader__.load({
|
|
|
753
842
|
h('span', { className: 'mcpmp-dot mcpmp-dot-' + phase }),
|
|
754
843
|
h('span', null, phaseLabel),
|
|
755
844
|
h('span', { className: 'mcpmp-tag' }, t('toolCount', { n: tools.length })),
|
|
756
|
-
|
|
845
|
+
// The binding state sits where the source tag used to be. A
|
|
846
|
+
// user-managed server is the overwhelmingly common row, so its
|
|
847
|
+
// "config file" label was noise that pushed the useful state onto
|
|
848
|
+
// a second line; where the row came from still matters for the
|
|
849
|
+
// rows that are not the user's own, so those keep their tag.
|
|
850
|
+
h(
|
|
851
|
+
'span',
|
|
852
|
+
{
|
|
853
|
+
className: 'mcpmp-tag' + (boundPaths.length > 0 ? ' mcpmp-tag-bound' : ''),
|
|
854
|
+
title: boundPaths.length > 0 ? boundPaths.join('\n') : t('bindScopeAll'),
|
|
855
|
+
},
|
|
856
|
+
bindingLabel,
|
|
857
|
+
),
|
|
858
|
+
server.source === 'user'
|
|
859
|
+
? null
|
|
860
|
+
: h('span', { className: 'mcpmp-tag' }, sourceLabel),
|
|
757
861
|
),
|
|
758
862
|
),
|
|
759
|
-
actions.length > 0 ? h('div', {
|
|
863
|
+
actions.length > 0 ? h('div', { className: 'mcpmp-row-actions' }, actions) : null,
|
|
760
864
|
h(Switch, {
|
|
761
865
|
checked: server.enabled,
|
|
762
866
|
disabled: busy || server.id === '',
|
|
@@ -768,6 +872,23 @@ window.__ModuleLoader__.load({
|
|
|
768
872
|
? h(
|
|
769
873
|
'div',
|
|
770
874
|
{ className: 'mcpmp-tools' },
|
|
875
|
+
h(
|
|
876
|
+
'div',
|
|
877
|
+
{
|
|
878
|
+
className:
|
|
879
|
+
'mcpmp-binding' + (boundPaths.length > 0 ? ' mcpmp-binding-bound' : ''),
|
|
880
|
+
},
|
|
881
|
+
h('span', { className: 'mcpmp-binding-label' }, t('bindTitle')),
|
|
882
|
+
boundPaths.length > 0
|
|
883
|
+
? h(
|
|
884
|
+
'span',
|
|
885
|
+
{ className: 'mcpmp-binding-paths' },
|
|
886
|
+
boundPaths.map(function (path) {
|
|
887
|
+
return h('code', { key: path, title: path }, path);
|
|
888
|
+
}),
|
|
889
|
+
)
|
|
890
|
+
: h('span', { className: 'mcpmp-binding-all' }, t('bindScopeAll')),
|
|
891
|
+
),
|
|
771
892
|
tools.length === 0
|
|
772
893
|
? h('div', { className: 'mcpmp-tools-empty' }, t('noTools'))
|
|
773
894
|
: tools.map(function (tool) {
|
|
@@ -1052,6 +1173,101 @@ window.__ModuleLoader__.load({
|
|
|
1052
1173
|
);
|
|
1053
1174
|
}
|
|
1054
1175
|
|
|
1176
|
+
/**
|
|
1177
|
+
* The project-binding editor for one server.
|
|
1178
|
+
*
|
|
1179
|
+
* Paths are typed one per line rather than chosen from a directory picker:
|
|
1180
|
+
* a browser file picker cannot hand back an absolute path, and the directory
|
|
1181
|
+
* a user wants to bind is usually not one they can reach from a picker
|
|
1182
|
+
* anyway. The host validates every line and refuses the whole write when one
|
|
1183
|
+
* is relative, so a typo cannot half-apply.
|
|
1184
|
+
*/
|
|
1185
|
+
function BindingDialog(props) {
|
|
1186
|
+
var t = props.t;
|
|
1187
|
+
var server = props.server;
|
|
1188
|
+
var existing =
|
|
1189
|
+
server.binding && Array.isArray(server.binding.paths) ? server.binding.paths : [];
|
|
1190
|
+
var [text, setText] = useState(function () {
|
|
1191
|
+
return existing.join('\n');
|
|
1192
|
+
});
|
|
1193
|
+
var [error, setError] = useState(null);
|
|
1194
|
+
var [busy, setBusy] = useState(false);
|
|
1195
|
+
|
|
1196
|
+
function submit() {
|
|
1197
|
+
if (busy) return;
|
|
1198
|
+
var paths = text
|
|
1199
|
+
.split('\n')
|
|
1200
|
+
.map(function (line) {
|
|
1201
|
+
return line.trim();
|
|
1202
|
+
})
|
|
1203
|
+
.filter(function (line) {
|
|
1204
|
+
return line !== '';
|
|
1205
|
+
});
|
|
1206
|
+
setBusy(true);
|
|
1207
|
+
setError(null);
|
|
1208
|
+
api('bind', { serverName: server.serverName, paths: paths })
|
|
1209
|
+
.then(function (result) {
|
|
1210
|
+
setBusy(false);
|
|
1211
|
+
props.onDone(result);
|
|
1212
|
+
})
|
|
1213
|
+
.catch(function (failure) {
|
|
1214
|
+
setBusy(false);
|
|
1215
|
+
setError(String((failure && failure.message) || failure));
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
return h(
|
|
1220
|
+
Modal,
|
|
1221
|
+
{
|
|
1222
|
+
title: t('bindTitle') + ' · ' + server.serverName,
|
|
1223
|
+
closeLabel: t('close'),
|
|
1224
|
+
onClose: props.onClose,
|
|
1225
|
+
footer: h(
|
|
1226
|
+
'div',
|
|
1227
|
+
{
|
|
1228
|
+
style: {
|
|
1229
|
+
display: 'flex',
|
|
1230
|
+
alignItems: 'center',
|
|
1231
|
+
justifyContent: 'space-between',
|
|
1232
|
+
width: '100%',
|
|
1233
|
+
gap: 12,
|
|
1234
|
+
},
|
|
1235
|
+
},
|
|
1236
|
+
h('span', { className: 'mcpmp-note', style: { fontSize: 11, padding: '5px 8px' } }, t('bindNote')),
|
|
1237
|
+
h(
|
|
1238
|
+
'div',
|
|
1239
|
+
{ style: { display: 'flex', gap: 8 } },
|
|
1240
|
+
h('button', { type: 'button', className: 'mcpmp-btn', onClick: props.onClose }, t('cancel')),
|
|
1241
|
+
h(
|
|
1242
|
+
'button',
|
|
1243
|
+
{ type: 'button', className: 'mcpmp-btn mcpmp-btn-primary', disabled: busy, onClick: submit },
|
|
1244
|
+
busy ? t('saving') : t('confirm'),
|
|
1245
|
+
),
|
|
1246
|
+
),
|
|
1247
|
+
),
|
|
1248
|
+
},
|
|
1249
|
+
h('p', null, t('bindHint')),
|
|
1250
|
+
h(
|
|
1251
|
+
'div',
|
|
1252
|
+
{ className: 'mcpmp-field' },
|
|
1253
|
+
h('label', { htmlFor: 'mcpmp-bind-paths' }, t('bindPathsLabel')),
|
|
1254
|
+
h('textarea', {
|
|
1255
|
+
id: 'mcpmp-bind-paths',
|
|
1256
|
+
className: 'mcpmp-textarea',
|
|
1257
|
+
rows: 6,
|
|
1258
|
+
spellCheck: false,
|
|
1259
|
+
value: text,
|
|
1260
|
+
placeholder: 'D:\\work\\my-project\n~/work/another-project',
|
|
1261
|
+
onChange: function (event) {
|
|
1262
|
+
setText(event.target.value);
|
|
1263
|
+
},
|
|
1264
|
+
}),
|
|
1265
|
+
h('small', null, t('bindPathsHint') + ' ' + t('bindLoadHint')),
|
|
1266
|
+
),
|
|
1267
|
+
error !== null ? h('div', { className: 'mcpmp-note mcpmp-note-error' }, error) : null,
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1055
1271
|
/** The add/edit form for one server. */
|
|
1056
1272
|
function ServerFormDialog(props) {
|
|
1057
1273
|
var t = props.t;
|
|
@@ -1455,6 +1671,9 @@ window.__ModuleLoader__.load({
|
|
|
1455
1671
|
onEdit: function () {
|
|
1456
1672
|
setDialog({ kind: 'form', server: server });
|
|
1457
1673
|
},
|
|
1674
|
+
onBind: function () {
|
|
1675
|
+
setDialog({ kind: 'bind', server: server });
|
|
1676
|
+
},
|
|
1458
1677
|
});
|
|
1459
1678
|
}),
|
|
1460
1679
|
);
|
|
@@ -1604,6 +1823,27 @@ window.__ModuleLoader__.load({
|
|
|
1604
1823
|
: undefined,
|
|
1605
1824
|
})
|
|
1606
1825
|
: null,
|
|
1826
|
+
|
|
1827
|
+
// Binding never touches the loader tree, so the state the host returns
|
|
1828
|
+
// is already final — no `settle()` poll is needed here.
|
|
1829
|
+
dialog !== null && dialog.kind === 'bind'
|
|
1830
|
+
? h(BindingDialog, {
|
|
1831
|
+
t: t,
|
|
1832
|
+
server: dialog.server,
|
|
1833
|
+
onClose: function () {
|
|
1834
|
+
setDialog(null);
|
|
1835
|
+
},
|
|
1836
|
+
onDone: function (result) {
|
|
1837
|
+
setDialog(null);
|
|
1838
|
+
if (result && result.state) setState({ status: 'ready', data: result.state, error: null });
|
|
1839
|
+
setNotice(
|
|
1840
|
+
(result && result.action === 'cleared' ? t('bindUnbound') : t('bindSaved')) +
|
|
1841
|
+
':' +
|
|
1842
|
+
((result && result.serverName) || ''),
|
|
1843
|
+
);
|
|
1844
|
+
},
|
|
1845
|
+
})
|
|
1846
|
+
: null,
|
|
1607
1847
|
);
|
|
1608
1848
|
}
|
|
1609
1849
|
|