@datagrok/compute 1.40.3 → 1.41.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "1.40.3",
4
+ "version": "1.41.0",
5
5
  "author": {
6
6
  "name": "Andrey Sharapov",
7
7
  "email": "andrey.sharapov@softwarecountry.com"
@@ -13,10 +13,10 @@
13
13
  "directory": "packages/Compute"
14
14
  },
15
15
  "dependencies": {
16
- "@datagrok-libraries/compute-utils": "^1.40.3",
17
- "@datagrok-libraries/utils": "^4.3.12",
16
+ "@datagrok-libraries/compute-utils": "^1.41.0",
17
+ "@datagrok-libraries/utils": "^4.4.1",
18
18
  "cash-dom": "^8.1.5",
19
- "datagrok-api": "^1.23.0",
19
+ "datagrok-api": "^1.24.0",
20
20
  "dayjs": "=1.11.10",
21
21
  "exceljs": "^4.3.0",
22
22
  "rxjs": "^6.6.7",
@@ -62,7 +62,7 @@
62
62
  "canView": [
63
63
  "All users"
64
64
  ],
65
- "category": "Machine Learning",
65
+ "category": "Compute",
66
66
  "meta": {
67
67
  "dartium": false
68
68
  }
package/src/package.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  ComputationView as ComputationViewInst,
9
9
  RichFunctionView as RichFunctionViewInst,
10
10
  PipelineView as PipelineViewInst,
11
+ CustomFunctionView as CustomFunctionViewInst,
11
12
  UiUtils,
12
13
  } from '@datagrok-libraries/compute-utils';
13
14
  import {
@@ -22,7 +23,7 @@ export {
22
23
  makeAdvice as makeAdvice2,
23
24
  mergeValidationResults as mergeValidationResults2,
24
25
  } from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/utils';
25
- import {ModelCatalogView, ModelHandler} from '@datagrok-libraries/compute-utils/model-catalog';
26
+ import {ModelCatalogView, ModelHandler, makeModelCatalog, makeModelTreeBrowser} from '@datagrok-libraries/compute-utils/model-catalog';
26
27
  import {
27
28
  testPipeline as testPipelineInst,
28
29
  } from '@datagrok-libraries/compute-utils/shared-utils/function-views-testing';
@@ -190,58 +191,15 @@ let startUriLoaded = false;
190
191
  //output: view v
191
192
  //meta.browsePath: Compute
192
193
  export function modelCatalog() {
193
- // Separately process direct link access
194
- const startOptionalPart = grok.shell.startUri.indexOf('?');
195
- const startPathSegments = grok.shell.startUri
196
- .substring('https://'.length, startOptionalPart > 0 ? startOptionalPart: undefined)
197
- .split('/');
198
-
199
- if (!startUriLoaded && startPathSegments.includes('Compute')) {
200
- const view = ModelCatalogView.findOrCreateCatalogView('Model Catalog', 'modelCatalog', _package);
201
-
202
- grok.shell.addView(view);
203
- startUriLoaded = true;
204
-
205
- if (startPathSegments.length > 3) {
206
- grok.dapi.functions.filter(`shortName = "${startPathSegments[3]}" and #model`).list().then((lst) => {
207
- if (lst.length == 1)
208
- ModelHandler.openModel(lst[0]);
209
- });
210
- }
211
-
212
- return;
213
- }
214
-
215
- const optionalPart = window.location.href.indexOf('?');
216
- const pathSegments = window.location.href
217
- .substring('https://'.length, optionalPart > 0 ? optionalPart: undefined)
218
- .split('/');
219
-
220
- if (pathSegments.includes('browse')) {
221
- const view = ModelCatalogView.findModelCatalogView('modelCatalog');
222
-
223
- // If there is existing view, then switch on it
224
- if (view)
225
- grok.shell.v = view;
226
-
227
-
228
- // Always return new with no subscribtions to show in Browse tree
229
- const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
230
- return newView;
231
- }
232
-
233
- // Separately process double-clicking on Model Catalog card
234
- if (pathSegments.includes('apps')) {
235
- const view = ModelCatalogView.findModelCatalogView('modelCatalog');
236
-
237
- // If there is existing view, then switch on it
238
- if (view)
239
- grok.shell.v = view;
240
- else {
241
- const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
242
- grok.shell.addView(newView);
243
- }
244
- }
194
+ return makeModelCatalog({
195
+ _package,
196
+ ViewClass: ModelCatalogView,
197
+ HandlerCass: ModelHandler,
198
+ segment: 'Compute',
199
+ viewName: 'Model Catalog',
200
+ funcName: 'modelCatalog',
201
+ startUriLoaded,
202
+ }, () => startUriLoaded = true);
245
203
  }
246
204
 
247
205
 
@@ -345,75 +303,7 @@ export function ObjectCoolingSelector(params: any) {
345
303
  //input: dynamic treeNode
346
304
  //input: view browseView
347
305
  export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browseView: DG.BrowseView) {
348
- const NO_CATEGORY = 'Uncategorized' as const;
349
-
350
- const modelSource = grok.dapi.functions.filter('(#model)');
351
- const modelList = await modelSource.list();
352
- const departments = modelList.reduce((acc, model) => {
353
- if (model.options.department)
354
- acc.add(model.options.department);
355
- else
356
- acc.add(NO_CATEGORY);
357
- return acc;
358
- }, new Set([] as string[]));
359
-
360
- const hlProcesses = modelList.reduce((acc, model) => {
361
- if (model.options.HL_process)
362
- acc.add(model.options.HL_process);
363
- else
364
- acc.add(NO_CATEGORY);
365
- return acc;
366
- }, new Set([] as string[]));
367
-
368
- const processes = modelList.reduce((acc, model) => {
369
- if (model.options.process)
370
- acc.add(model.options.process);
371
- else
372
- acc.add(NO_CATEGORY);
373
- return acc;
374
- }, new Set([] as string[]));
375
-
376
- for (const department of departments) {
377
- const serverDep = (department !== NO_CATEGORY ? department: undefined);
378
- const hasModelsDep = modelList.find((model) =>
379
- model.options.department === serverDep,
380
- );
381
-
382
- if (!hasModelsDep) continue;
383
-
384
- const depNode = treeNode.getOrCreateGroup(department, null, false);
385
- for (const hlProcess of hlProcesses) {
386
- const serverHlProcess = (hlProcess !== NO_CATEGORY ? hlProcess: undefined);
387
- const hasModelsHl = modelList.find((model) =>
388
- model.options.department === serverDep &&
389
- model.options.HL_process === serverHlProcess,
390
- );
391
-
392
- if (!hasModelsHl) continue;
393
-
394
- const hlNode = hlProcess !== NO_CATEGORY ? depNode.getOrCreateGroup(hlProcess, null, false): depNode;
395
- for (const process of processes) {
396
- const serverProcess = (process !== NO_CATEGORY ? process: undefined);
397
- const hasModels = modelList.find((model) =>
398
- model.options.department === serverDep &&
399
- model.options.HL_process === serverHlProcess &&
400
- model.options.process === serverProcess,
401
- );
402
-
403
- if (!hasModels) continue;
404
-
405
- const processNode = process !== NO_CATEGORY ? hlNode.getOrCreateGroup(process, null, false): hlNode;
406
- processNode.onNodeExpanding.pipe(take(1)).subscribe(() => {
407
- const modelRule = `(#model)`;
408
- const depRules = department === NO_CATEGORY ? `(options.department = null)`: `(options.department in ("${department}"))`;
409
- const hlProcessRules = hlProcess === NO_CATEGORY ? `(options.HL_process = null)`: `(options.HL_process in ("${hlProcess}"))`;
410
- const processRules = process === NO_CATEGORY ? `(options.process = null)`: `(options.process in ("${process}"))`;
411
- const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})`;
412
- processNode.loadSources(grok.dapi.functions.filter(filteringRules));
413
- });
414
- }
415
- }
416
- }
306
+ await makeModelTreeBrowser(treeNode, browseView);
417
307
  }
418
308
 
419
309
  //// Compute-utils API section
@@ -421,6 +311,7 @@ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browse
421
311
  export const testPipeline = testPipelineInst;
422
312
  export const CompView = ComputationViewInst;
423
313
  export const RFV = RichFunctionViewInst;
314
+ export const CFV = CustomFunctionViewInst;
424
315
  export const Pipeline = PipelineViewInst;
425
316
  export const makeValidationResult = makeValidationResultInst;
426
317
  export const makeAdvice = makeAdviceInst;
package/webpack.config.js CHANGED
@@ -2,7 +2,7 @@ const path = require('path');
2
2
  const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
3
3
 
4
4
  module.exports = {
5
- mode: 'development',
5
+ mode: 'production',
6
6
  entry: {
7
7
  test: {
8
8
  filename: 'package-test.js',
@@ -12,7 +12,7 @@ module.exports = {
12
12
  package: './src/package.ts',
13
13
  },
14
14
  resolve: {
15
- extensions: ['.wasm', '.mjs', '.ts', '.js', '.json', '.tsx'],
15
+ extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
16
16
  },
17
17
  module: {
18
18
  rules: [
@@ -22,10 +22,9 @@ module.exports = {
22
22
  use: ['style-loader', 'css-loader'],
23
23
  },
24
24
  {
25
- test: /\.js$/,
25
+ test: /\.(mjs|js|jsx|ts|tsx)$/,
26
26
  enforce: 'pre',
27
27
  use: ['source-map-loader'],
28
- exclude: /node_modules/
29
28
  },
30
29
  ],
31
30
  },
@@ -48,4 +47,8 @@ module.exports = {
48
47
  libraryTarget: 'var',
49
48
  path: path.resolve(__dirname, 'dist'),
50
49
  },
50
+ optimization: {
51
+ usedExports: true,
52
+ concatenateModules: false,
53
+ }
51
54
  };