@datagrok/compute 1.39.5 → 1.39.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "1.39.5",
4
+ "version": "1.39.7",
5
5
  "author": {
6
6
  "name": "Aufar Zakiev",
7
7
  "email": "aufar.zakiev@softwarecountry.com"
@@ -101,11 +101,11 @@ export class OutliersSelectionViewer extends DG.JsViewer {
101
101
  }
102
102
 
103
103
  const confirmBtn = () => ui.div(
104
- ui.iconFA('check', confirmOutliers, 'Confirm the outliers'), {style: {'text-align': 'center', 'margin': '6px'}},
104
+ ui.iconFA('check', confirmOutliers, 'Confirm the outliers'), {style: {textAlign: 'center', 'margin': '6px'}},
105
105
  );
106
106
 
107
107
  const cancelBtn = () => ui.div(
108
- ui.iconFA('times', cancelOutliers, 'Cancel the outliers'), {style: {'text-align': 'center', 'margin': '6px'}},
108
+ ui.iconFA('times', cancelOutliers, 'Cancel the outliers'), {style: {textAlign: 'center', 'margin': '6px'}},
109
109
  );
110
110
 
111
111
  const deleteBtn = (rationale: string) => ui.div(
@@ -117,7 +117,7 @@ export class OutliersSelectionViewer extends DG.JsViewer {
117
117
  }
118
118
  }
119
119
  inputData.fireValuesChanged();
120
- }, 'Remove the outliers group'), {style: {'text-align': 'center', 'margin': '6px'}},
120
+ }, 'Remove the outliers group'), {style: {textAlign: 'center', margin: '6px'}},
121
121
  );
122
122
 
123
123
  if (gc.gridColumn.name === 'Actions') {
package/src/package.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as grok from 'datagrok-api/grok';
3
3
  import * as ui from 'datagrok-api/ui';
4
4
  import * as DG from 'datagrok-api/dg';
5
- import {filter} from 'rxjs/operators';
5
+ import {filter, take} from 'rxjs/operators';
6
6
  import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
7
7
  import {
8
8
  ComputationView as ComputationViewInst,
@@ -126,7 +126,7 @@ export async function CustomUploader(params: {func: DG.Func}) {
126
126
 
127
127
  const dummyWidget = DG.Widget.fromRoot(ui.panel([ui.divV([
128
128
  ui.label('This part of dialog comes from my custom data uploader'),
129
- ui.divH([uploadBtn], {style: {'justify-content': 'center'}})
129
+ ui.divH([uploadBtn], {style: {justifyContent: 'center'}})
130
130
  ])]));
131
131
 
132
132
  const setLoadingSub = grok.functions.onBeforeRunAction.pipe(
@@ -184,6 +184,7 @@ let startUriLoaded = false;
184
184
  //name: Model Catalog
185
185
  //tags: app
186
186
  //output: view v
187
+ //meta.browsePath: Compute
187
188
  export function modelCatalog() {
188
189
  // Separately process direct link access
189
190
  const startOptionalPart = grok.shell.startUri.indexOf('?');
@@ -338,6 +339,80 @@ export function ObjectCoolingSelector(params: any) {
338
339
  );
339
340
  }
340
341
 
342
+ //input: dynamic treeNode
343
+ //input: view browseView
344
+ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browseView: DG.BrowseView) {
345
+ const NO_CATEGORY = 'Uncategorized' as const;
346
+
347
+ const modelSource = grok.dapi.functions.filter('(#model)');
348
+ const modelList = await modelSource.list();
349
+ const departments = modelList.reduce((acc, model) => {
350
+ if (model.options.department)
351
+ acc.add(model.options.department)
352
+ else
353
+ acc.add(NO_CATEGORY)
354
+ return acc;
355
+ }, new Set([] as string[]));
356
+
357
+ const hlProcesses = modelList.reduce((acc, model) => {
358
+ if (model.options.HL_process)
359
+ acc.add(model.options.HL_process)
360
+ else
361
+ acc.add(NO_CATEGORY)
362
+ return acc;
363
+ }, new Set([] as string[]));
364
+
365
+ const processes = modelList.reduce((acc, model) => {
366
+ if (model.options.process)
367
+ acc.add(model.options.process)
368
+ else
369
+ acc.add(NO_CATEGORY)
370
+ return acc;
371
+ }, new Set([] as string[]));
372
+
373
+ for (const department of departments) {
374
+ const serverDep = (department !== NO_CATEGORY ? department: undefined);
375
+ const hasModelsDep = modelList.find((model) =>
376
+ model.options.department === serverDep
377
+ )
378
+
379
+ if (!hasModelsDep) continue;
380
+
381
+ const depNode = treeNode.getOrCreateGroup(department, null, false)
382
+ for (const hlProcess of hlProcesses) {
383
+ const serverHlProcess = (hlProcess !== NO_CATEGORY ? hlProcess: undefined);
384
+ const hasModelsHl = modelList.find((model) =>
385
+ model.options.department === serverDep &&
386
+ model.options.HL_process === serverHlProcess
387
+ )
388
+
389
+ if (!hasModelsHl) continue;
390
+
391
+ const hlNode = hlProcess !== NO_CATEGORY ? depNode.getOrCreateGroup(hlProcess, null, false): depNode;
392
+ for (const process of processes) {
393
+ const serverProcess = (process !== NO_CATEGORY ? process: undefined);
394
+ const hasModels = modelList.find((model) =>
395
+ model.options.department === serverDep &&
396
+ model.options.HL_process === serverHlProcess &&
397
+ model.options.process === serverProcess
398
+ )
399
+
400
+ if (!hasModels) continue;
401
+
402
+ const processNode = process !== NO_CATEGORY ? hlNode.getOrCreateGroup(process, null, false): hlNode;
403
+ processNode.onNodeExpanding.pipe(take(1)).subscribe(() => {
404
+ const modelRule = `(#model)`;
405
+ const depRules = department === NO_CATEGORY ? `(options.department = null)`: `(options.department in ("${department}"))`;
406
+ const hlProcessRules = hlProcess === NO_CATEGORY ? `(options.HL_process = null)`: `(options.HL_process in ("${hlProcess}"))`;
407
+ const processRules = process === NO_CATEGORY ? `(options.process = null)`: `(options.process in ("${process}"))`;
408
+ const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})`
409
+ processNode.loadSources(grok.dapi.functions.filter(filteringRules));
410
+ })
411
+ }
412
+ }
413
+ }
414
+ }
415
+
341
416
  //// Compute-utils API section
342
417
 
343
418
  export const testPipeline = testPipelineInst;