@sparkelf/dsh-dataops-managed 0.3.10 → 0.3.12

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 CHANGED
@@ -64,6 +64,17 @@ window.__ModuleLoader__.load({
64
64
  id: model.id,
65
65
  shared: model.shared === true
66
66
  }] : [];
67
+ }) : [],
68
+ sections: Array.isArray(record.sections) ? record.sections.flatMap((entry) => {
69
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return [];
70
+ const section = entry;
71
+ if (typeof section.ns !== "string" || section.ns === "") return [];
72
+ return [{
73
+ ns: section.ns,
74
+ followState: section.followState === "detached" ? "detached" : "following",
75
+ applied: section.applied === true,
76
+ mounted: section.mounted === true
77
+ }];
67
78
  }) : []
68
79
  };
69
80
  }
@@ -107,24 +118,24 @@ window.__ModuleLoader__.load({
107
118
  document.head.appendChild(tag);
108
119
  }
109
120
  var ManagedDataOpsSection_module_css_default = {
110
- "modelId": "_2dqzjG_modelId",
121
+ "statusRow": "_2dqzjG_statusRow",
111
122
  "section": "_2dqzjG_section",
112
- "modelPanel": "_2dqzjG_modelPanel",
113
- "modelAction": "_2dqzjG_modelAction",
114
- "brandingCopy": "_2dqzjG_brandingCopy",
115
- "modelList": "_2dqzjG_modelList",
123
+ "description": "_2dqzjG_description",
116
124
  "switch": "_2dqzjG_switch",
125
+ "modelId": "_2dqzjG_modelId",
117
126
  "modelTitle": "_2dqzjG_modelTitle",
127
+ "detailRow": "_2dqzjG_detailRow",
128
+ "modelPanel": "_2dqzjG_modelPanel",
129
+ "modelListTitle": "_2dqzjG_modelListTitle",
118
130
  "title": "_2dqzjG_title",
131
+ "brandingCopy": "_2dqzjG_brandingCopy",
132
+ "modelAction": "_2dqzjG_modelAction",
133
+ "modelList": "_2dqzjG_modelList",
119
134
  "details": "_2dqzjG_details",
120
- "modelDescription": "_2dqzjG_modelDescription",
121
- "modelListTitle": "_2dqzjG_modelListTitle",
122
- "modelRow": "_2dqzjG_modelRow",
123
- "statusRow": "_2dqzjG_statusRow",
124
- "detailRow": "_2dqzjG_detailRow",
125
- "description": "_2dqzjG_description",
126
135
  "brandingRow": "_2dqzjG_brandingRow",
127
- "modelListDescription": "_2dqzjG_modelListDescription"
136
+ "modelListDescription": "_2dqzjG_modelListDescription",
137
+ "modelRow": "_2dqzjG_modelRow",
138
+ "modelDescription": "_2dqzjG_modelDescription"
128
139
  };
129
140
  //#endregion
130
141
  //#region src/client/ManagedDataOpsSection.tsx
@@ -170,7 +181,7 @@ window.__ModuleLoader__.load({
170
181
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
171
182
  })]
172
183
  }),
173
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelSharing, { t }),
184
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PublishDefaults, { t }),
174
185
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
175
186
  className: ManagedDataOpsSection_module_css_default.details,
176
187
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -185,15 +196,16 @@ window.__ModuleLoader__.load({
185
196
  });
186
197
  }
187
198
  /**
188
- * Share this workspace's models, and choose which of them other users may use.
199
+ * Publish this workspace's configuration as the default other users start from.
189
200
  *
190
- * The panel shows the sharing control to an administrator alone, and tells every other user
191
- * which configuration their workspace is using, including how to stop following it. Nothing
192
- * here decides permissions: DataOps reports who may publish.
201
+ * One action rather than a set of controls: the configuration is whatever this workspace already
202
+ * holds -- the models, the permission default, the general settings -- and the button copies it to
203
+ * DataOps. Every other user's workspace takes that copy as its starting values and may then change
204
+ * anything, at which point their own version wins and this button never reaches it again.
193
205
  * @param props - Translate function from the section.
194
- * @returns The sharing panel.
206
+ * @returns The publish row.
195
207
  */
196
- function ModelSharing({ t }) {
208
+ function PublishDefaults({ t }) {
197
209
  const [state, setState] = (0, react.useState)({ kind: "loading" });
198
210
  const [busy, setBusy] = (0, react.useState)(false);
199
211
  const refresh = (0, react.useCallback)(async () => {
@@ -210,10 +222,10 @@ window.__ModuleLoader__.load({
210
222
  (0, react.useEffect)(() => {
211
223
  refresh();
212
224
  }, [refresh]);
213
- const act = (0, react.useCallback)(async (body) => {
225
+ const publish = (0, react.useCallback)(async () => {
214
226
  setBusy(true);
215
227
  try {
216
- const status = await postModelSyncAction(body);
228
+ const status = await postModelSyncAction({ action: "publish-defaults" });
217
229
  if (status !== null) setState({
218
230
  kind: "ready",
219
231
  status
@@ -225,117 +237,52 @@ window.__ModuleLoader__.load({
225
237
  }
226
238
  }, []);
227
239
  if (state.kind === "loading") return null;
228
- if (state.kind === "unavailable") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
240
+ if (state.kind === "unavailable" || state.kind === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
229
241
  className: ManagedDataOpsSection_module_css_default.modelPanel,
230
242
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
231
243
  className: ManagedDataOpsSection_module_css_default.modelTitle,
232
- children: t("modelsTitle")
244
+ children: t("defaultsTitle")
233
245
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
234
246
  className: ManagedDataOpsSection_module_css_default.modelDescription,
235
- children: t("modelsUnavailable")
247
+ role: state.kind === "failed" ? "alert" : void 0,
248
+ children: state.kind === "failed" ? t("loadFailed") : t("modelsUnavailable")
236
249
  })]
237
250
  });
238
- if (state.kind === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
251
+ const { status } = state;
252
+ if (!status.canPublish) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
239
253
  className: ManagedDataOpsSection_module_css_default.modelPanel,
240
254
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
241
255
  className: ManagedDataOpsSection_module_css_default.modelTitle,
242
- children: t("modelsTitle")
256
+ children: t("defaultsTitle")
243
257
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
244
258
  className: ManagedDataOpsSection_module_css_default.modelDescription,
245
- role: "alert",
246
- children: t("loadFailed")
259
+ children: t("defaultsNotAdmin")
247
260
  })]
248
261
  });
249
- const { status } = state;
250
- const following = status.followState === "following";
251
262
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
252
263
  className: ManagedDataOpsSection_module_css_default.modelPanel,
253
264
  children: [
254
265
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
255
266
  className: ManagedDataOpsSection_module_css_default.modelTitle,
256
- children: t("modelsTitle")
267
+ children: t("defaultsTitle")
257
268
  }),
258
269
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
259
270
  className: ManagedDataOpsSection_module_css_default.modelDescription,
260
- children: t("modelsDescription")
271
+ children: t("defaultsDescription")
261
272
  }),
262
- status.canPublish ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
263
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
264
- className: ManagedDataOpsSection_module_css_default.brandingRow,
265
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
266
- className: ManagedDataOpsSection_module_css_default.brandingCopy,
267
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("syncTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("syncDescription") })]
268
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
269
- type: "button",
270
- className: ManagedDataOpsSection_module_css_default.switch,
271
- role: "switch",
272
- "aria-label": t("syncToggle"),
273
- "aria-checked": status.publisherSharing,
274
- "data-checked": status.publisherSharing,
275
- disabled: busy,
276
- onClick: () => {
277
- act({
278
- action: "publish",
279
- sharingEnabled: !status.publisherSharing
280
- });
281
- },
282
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
283
- })]
284
- }),
285
- status.publisherSharing && status.models.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
286
- className: ManagedDataOpsSection_module_css_default.modelList,
287
- children: [
288
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
289
- className: ManagedDataOpsSection_module_css_default.modelListTitle,
290
- children: t("modelsListTitle")
291
- }),
292
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
293
- className: ManagedDataOpsSection_module_css_default.modelListDescription,
294
- children: t("modelsListDescription")
295
- }),
296
- status.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
297
- className: ManagedDataOpsSection_module_css_default.modelRow,
298
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
299
- className: ManagedDataOpsSection_module_css_default.modelId,
300
- children: model.id
301
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
302
- type: "button",
303
- className: ManagedDataOpsSection_module_css_default.switch,
304
- role: "switch",
305
- "aria-label": t("modelShareLabel") + ": " + model.id,
306
- "aria-checked": model.shared,
307
- "data-checked": model.shared,
308
- disabled: busy,
309
- onClick: () => {
310
- const next = model.shared ? [...status.privateModelIds, model.id] : status.privateModelIds.filter((id) => id !== model.id);
311
- act({
312
- action: "private-models",
313
- privateModelIds: next,
314
- sharingEnabled: true
315
- });
316
- },
317
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
318
- })]
319
- }, model.id))
320
- ]
321
- }) : null,
322
- status.publisherSharing && status.models.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
323
- className: ManagedDataOpsSection_module_css_default.modelDescription,
324
- children: t("modelsEmpty")
325
- }) : null
326
- ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
273
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
327
274
  className: ManagedDataOpsSection_module_css_default.brandingRow,
328
275
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
329
276
  className: ManagedDataOpsSection_module_css_default.brandingCopy,
330
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: following ? t("followTitle") : t("detachedTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: following && !status.publisherSharing ? t("noPublisher") : following ? t("followDescription") : t("detachedDescription") })]
331
- }), following ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
277
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("defaultsActionTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: status.publishedAt === null ? t("defaultsNeverPublished") : t("defaultsPublishedAt") + " " + status.publishedAt })]
278
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
332
279
  type: "button",
333
280
  className: ManagedDataOpsSection_module_css_default.modelAction,
334
281
  disabled: busy,
335
282
  onClick: () => {
336
- act({ action: "resume" });
283
+ publish();
337
284
  },
338
- children: busy ? t("resuming") : t("resume")
285
+ children: busy ? t("defaultsPublishing") : t("defaultsPublish")
339
286
  })]
340
287
  })
341
288
  ]
@@ -415,28 +362,28 @@ window.__ModuleLoader__.load({
415
362
  document.head.appendChild(tag);
416
363
  }
417
364
  var SkillPlazaSection_module_css_default = {
418
- "titleIcon": "_9FdZvq_titleIcon",
365
+ "search": "_9FdZvq_search",
366
+ "cards": "_9FdZvq_cards",
367
+ "cardMain": "_9FdZvq_cardMain",
368
+ "cardMarks": "_9FdZvq_cardMarks",
419
369
  "intro": "_9FdZvq_intro",
420
- "cardHead": "_9FdZvq_cardHead",
421
- "cardEnd": "_9FdZvq_cardEnd",
422
- "head": "_9FdZvq_head",
370
+ "toolbar": "_9FdZvq_toolbar",
371
+ "emptyText": "_9FdZvq_emptyText",
372
+ "notice": "_9FdZvq_notice",
373
+ "section": "_9FdZvq_section",
423
374
  "card": "_9FdZvq_card",
424
- "mine": "_9FdZvq_mine",
425
- "empty": "_9FdZvq_empty",
426
- "emptyIcon": "_9FdZvq_emptyIcon",
427
- "cardDesc": "_9FdZvq_cardDesc",
428
375
  "cardIcon": "_9FdZvq_cardIcon",
429
- "emptyText": "_9FdZvq_emptyText",
430
- "cardMain": "_9FdZvq_cardMain",
431
376
  "title": "_9FdZvq_title",
432
- "search": "_9FdZvq_search",
433
- "notice": "_9FdZvq_notice",
434
- "cardMarks": "_9FdZvq_cardMarks",
435
- "toolbar": "_9FdZvq_toolbar",
436
- "cards": "_9FdZvq_cards",
377
+ "cardDesc": "_9FdZvq_cardDesc",
378
+ "tagBar": "_9FdZvq_tagBar",
379
+ "cardEnd": "_9FdZvq_cardEnd",
380
+ "empty": "_9FdZvq_empty",
381
+ "cardHead": "_9FdZvq_cardHead",
437
382
  "cardTitle": "_9FdZvq_cardTitle",
438
- "section": "_9FdZvq_section",
439
- "tagBar": "_9FdZvq_tagBar"
383
+ "mine": "_9FdZvq_mine",
384
+ "emptyIcon": "_9FdZvq_emptyIcon",
385
+ "titleIcon": "_9FdZvq_titleIcon",
386
+ "head": "_9FdZvq_head"
440
387
  };
441
388
  //#endregion
442
389
  //#region src/client/SkillPlazaSection.tsx
@@ -688,18 +635,18 @@ window.__ModuleLoader__.load({
688
635
  document.head.appendChild(tag);
689
636
  }
690
637
  var WanxiangBrand_module_css_default = {
691
- "sidebarName": "s0HPxG_sidebarName",
692
- "animatedMark": "s0HPxG_animatedMark",
693
638
  "unit-core": "s0HPxG_unit-core",
694
- "unitRight": "s0HPxG_unitRight",
695
- "unitCore": "s0HPxG_unitCore",
696
- "unitTop": "s0HPxG_unitTop",
697
- "unit-right": "s0HPxG_unit-right",
639
+ "unit-top": "s0HPxG_unit-top",
698
640
  "mark": "s0HPxG_mark",
641
+ "unit-right": "s0HPxG_unit-right",
699
642
  "unit-left": "s0HPxG_unit-left",
700
643
  "unitLeft": "s0HPxG_unitLeft",
701
- "unit-top": "s0HPxG_unit-top",
702
- "harness": "s0HPxG_harness"
644
+ "unitRight": "s0HPxG_unitRight",
645
+ "sidebarName": "s0HPxG_sidebarName",
646
+ "animatedMark": "s0HPxG_animatedMark",
647
+ "harness": "s0HPxG_harness",
648
+ "unitTop": "s0HPxG_unitTop",
649
+ "unitCore": "s0HPxG_unitCore"
703
650
  };
704
651
  //#endregion
705
652
  //#region src/client/WanxiangBrand.tsx
@@ -987,20 +934,14 @@ window.__ModuleLoader__.load({
987
934
  modelsTitle: "Model configuration",
988
935
  modelsDescription: "Share the models configured here with other users, and choose which of them they may use.",
989
936
  modelsUnavailable: "Model configuration is unavailable until this workspace is connected to DataOps.",
990
- syncTitle: "Share models with other users",
991
- syncDescription: "Other users who have not configured their own models get the models configured here.",
992
- syncToggle: "Share models with other users",
993
- followTitle: "Using the shared model configuration",
994
- followDescription: "The models shared by an administrator are available here. Change them and this workspace keeps your version instead.",
995
- detachedTitle: "Using your own model configuration",
996
- detachedDescription: "This workspace keeps the models configured here and no longer follows the shared configuration.",
997
- resume: "Use the shared configuration again",
998
- resuming: "Switching…",
999
- noPublisher: "No administrator is sharing models right now.",
1000
- modelsListTitle: "Models other users may use",
1001
- modelsListDescription: "A model turned off here stays available in this workspace and is not offered to other users.",
1002
- modelShareLabel: "Available to other users",
1003
- modelsEmpty: "No models are configured in this workspace yet. Add them in Models settings first.",
937
+ defaultsTitle: "Default configuration",
938
+ defaultsDescription: "Publish the configuration this workspace holds — models, permissions, and general settings — as the values other users start from. Their workspace takes that copy once and may then change anything, and a change they make is never overwritten.",
939
+ defaultsActionTitle: "Publish as the default",
940
+ defaultsNotAdmin: "Only an administrator may publish the default configuration.",
941
+ defaultsNeverPublished: "Not published yet.",
942
+ defaultsPublishedAt: "Last published:",
943
+ defaultsPublish: "Publish default configuration",
944
+ defaultsPublishing: "Publishing…",
1004
945
  loadFailed: "The model configuration could not be loaded. Try again.",
1005
946
  plazaTitle: "Skill plaza",
1006
947
  plazaIntro: "Skills other users shared. Install one to use it in this workspace, or share a skill of your own.",
@@ -1035,20 +976,14 @@ window.__ModuleLoader__.load({
1035
976
  modelsTitle: "模型配置共享",
1036
977
  modelsDescription: "把这里配置的模型共享给其他用户,并决定他们可以使用其中哪些。",
1037
978
  modelsUnavailable: "工作区接入 DataOps 后即可使用模型配置共享。",
1038
- syncTitle: "共享模型给其他用户",
1039
- syncDescription: "尚未自己配置过模型的用户,会获得这里配置的模型。",
1040
- syncToggle: "共享模型给其他用户",
1041
- followTitle: "正在使用共享的模型配置",
1042
- followDescription: "管理员共享的模型已可在此使用;你修改后会保留自己的版本。",
1043
- detachedTitle: "正在使用自己的模型配置",
1044
- detachedDescription: "本工作区保留自己配置的模型,不再跟随共享配置。",
1045
- resume: "重新使用共享配置",
1046
- resuming: "切换中…",
1047
- noPublisher: "当前没有管理员共享模型。",
1048
- modelsListTitle: "其他用户可使用的模型",
1049
- modelsListDescription: "在这里关闭的模型,本工作区仍可使用,只是不提供给其他用户。",
1050
- modelShareLabel: "提供给其他用户使用",
1051
- modelsEmpty: "本工作区还没有配置模型,请先在模型设置中添加。",
979
+ defaultsTitle: "默认配置",
980
+ defaultsDescription: "把本工作区当前的配置(模型、权限、通用设置)发布为其他用户的初始值。对方工作区只取用一次,之后可以随意修改,改过的内容不会被覆盖。",
981
+ defaultsActionTitle: "发布为默认值",
982
+ defaultsNotAdmin: "只有管理员可以发布默认配置。",
983
+ defaultsNeverPublished: "尚未发布。",
984
+ defaultsPublishedAt: "上次发布:",
985
+ defaultsPublish: "发布默认配置",
986
+ defaultsPublishing: "发布中…",
1052
987
  loadFailed: "模型配置加载失败,请重试。",
1053
988
  plazaTitle: "技能广场",
1054
989
  plazaIntro: "其他用户共享的技能。装载后即可在本工作区使用,也可以把自己的技能共享出去。",