@datagrok/compute 1.0.0 → 1.1.1

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.0.0",
4
+ "version": "1.1.1",
5
5
  "author": {
6
6
  "name": "Aufar Zakiev",
7
7
  "email": "aufar.zakiev@softwarecountry.com"
@@ -13,7 +13,7 @@
13
13
  "directory": "packages/Compute"
14
14
  },
15
15
  "dependencies": {
16
- "@datagrok-libraries/utils": "3.0.0",
16
+ "@datagrok-libraries/utils": "3.1.2",
17
17
  "cash-dom": "latest",
18
18
  "datagrok-api": "latest",
19
19
  "dayjs": "latest",
@@ -66,9 +66,7 @@ export class ModelHandler extends DG.ObjectHandler {
66
66
 
67
67
  renderMarkup(x: DG.Func): HTMLElement {
68
68
  let markup = ui.span([this.renderIcon(x), ui.label(x.friendlyName)]);
69
- let c = grok.functions.getCurrentCall();
70
- markup.ondblclick = (e) => {
71
- ModelHandler.openModel(x, c); }
69
+ markup.ondblclick = (e) => { ModelHandler.openModel(x); }
72
70
  return markup;
73
71
  }
74
72
 
@@ -121,8 +119,7 @@ export class ModelHandler extends DG.ObjectHandler {
121
119
  ui.h2(h),
122
120
  ui.divV([ui.divText(x.description, 'ui-description')], {style: {lineHeight: '150%'}})
123
121
  ]));
124
- let c = grok.functions.getCurrentCall();
125
- card.ondblclick = (e) => { ModelHandler.openModel(x, c); }
122
+ card.ondblclick = (e) => { ModelHandler.openModel(x); }
126
123
  return card;
127
124
  }
128
125
 
@@ -130,8 +127,7 @@ export class ModelHandler extends DG.ObjectHandler {
130
127
  let h = this.renderMarkup(x);
131
128
  h.classList.add('d4-link-label');
132
129
  let card = ui.bind(x, ui.h2(h));
133
- let c = grok.functions.getCurrentCall();
134
- card.ondblclick = (e) => { ModelHandler.openModel(x, c); }
130
+ card.ondblclick = (e) => { ModelHandler.openModel(x); }
135
131
  return card;
136
132
  }
137
133
 
@@ -153,11 +149,15 @@ export class ModelHandler extends DG.ObjectHandler {
153
149
  return wu(grok.shell.views).find((v) => v.parentCall?.func.name == 'modelCatalog') as ModelCatalogView;
154
150
  }
155
151
 
156
- static openModel(x: DG.Func, parentCall?: DG.FuncCall) {
152
+ static openModel(x: DG.Func) {
157
153
  let fc = x.prepare();
158
154
  fc.edit();
159
155
  }
160
156
 
157
+ static openModelFromFunccall(funcCall: DG.FuncCall) {
158
+ funcCall.edit();
159
+ }
160
+
161
161
  static bindModel(fc: DG.FuncCall) {
162
162
  let modelsView = ModelHandler.getModelCatalogView();
163
163
  fc.aux['showOnTaskBar'] = false;
package/src/package.ts CHANGED
@@ -5,9 +5,7 @@ import * as DG from 'datagrok-api/dg';
5
5
  import {ModelHandler} from './model-handler';
6
6
  import {_functionParametersGrid} from './function-parameters-grid';
7
7
  import {ModelCatalogView} from './model-catalog-view';
8
- import wu from 'wu';
9
8
  import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
10
- //import {ModelsWidget} from './models-widget'
11
9
  import {delay} from "@datagrok-libraries/utils/src/test";
12
10
  import {RichFunctionView} from "@datagrok-libraries/utils/src/rich-function-view";
13
11
  import './css/model-card.css';
@@ -16,6 +14,12 @@ import { ImportScriptGeneratorApp } from './import-script-generator/view';
16
14
  let initCompleted: boolean = false;
17
15
  export const _package = new DG.Package();
18
16
 
17
+ //name: openModelFromFuncall
18
+ //input: funccall funccall
19
+ export function openModelFromFuncall(funccall: DG.FuncCall) {
20
+ ModelHandler.openModelFromFunccall(funccall);
21
+ }
22
+
19
23
  //name: Import Script Generator
20
24
  //description: Creates and registers a new script based on the input config
21
25
  //tags: higher-order function, app
@@ -217,10 +221,9 @@ export function modelCatalog() {
217
221
  grok.shell.addView(view);
218
222
  // console.log(parser.href);
219
223
  if (pathSegments.length > 3) {
220
- let c = grok.functions.getCurrentCall();
221
224
  grok.dapi.functions.filter(`shortName = "${pathSegments[3]}" and #model`).list().then((lst) => {
222
225
  if (lst.length == 1)
223
- ModelHandler.openModel(lst[0], c);
226
+ ModelHandler.openModel(lst[0]);
224
227
  });
225
228
  }
226
229
  } else grok.shell.v = modelsView;