@datagrok/compute 1.16.1 → 1.17.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/CHANGELOG.md +14 -0
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
- package/src/css/model-card.css +1 -1
- package/src/package.ts +19 -118
- package/files/default_data.csv +0 -2425
- package/scripts/trig.js +0 -15
- package/scripts/vmax.js +0 -179
- package/scripts/wrapper.js +0 -8
- package/src/function-parameters-grid.ts +0 -63
- package/src/import-script-generator/store.ts +0 -12
- package/src/import-script-generator/view.ts +0 -185
- package/src/model-catalog-view.ts +0 -84
- package/src/model-handler.ts +0 -165
- package/src/models-widget.ts +0 -118
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/compute",
|
|
3
3
|
"friendlyName": "Compute",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.17.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/compute-utils": "^1.
|
|
16
|
+
"@datagrok-libraries/compute-utils": "^1.17.1",
|
|
17
17
|
"cash-dom": "latest",
|
|
18
18
|
"datagrok-api": "^1.17.0",
|
|
19
19
|
"dayjs": "^1.11.10",
|
package/src/css/model-card.css
CHANGED
package/src/package.ts
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
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 {ModelHandler} from './model-handler';
|
|
6
|
-
import {_functionParametersGrid} from './function-parameters-grid';
|
|
7
|
-
import {ModelCatalogView} from './model-catalog-view';
|
|
8
5
|
import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
|
|
9
6
|
import {RichFunctionView} from "@datagrok-libraries/compute-utils";
|
|
10
|
-
import './css/model-card.css';
|
|
11
|
-
import { ImportScriptGeneratorApp } from './import-script-generator/view';
|
|
12
7
|
import { ValidationInfo, makeAdvice, makeValidationResult } from '@datagrok-libraries/compute-utils/shared-utils/validation';
|
|
8
|
+
import {ModelCatalogView, ModelHandler} from '@datagrok-libraries/compute-utils/model-catalog';
|
|
9
|
+
import './css/model-card.css';
|
|
13
10
|
|
|
14
11
|
let initCompleted: boolean = false;
|
|
15
12
|
export const _package = new DG.Package();
|
|
@@ -20,17 +17,6 @@ export function openModelFromFuncall(funccall: DG.FuncCall) {
|
|
|
20
17
|
ModelHandler.openModelFromFunccall(funccall);
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
//name: Import Script Generator
|
|
24
|
-
//description: Creates and registers a new script based on the input config
|
|
25
|
-
//tags: higher-order function, app
|
|
26
|
-
//meta.icon: icons/flux.png
|
|
27
|
-
export function importScriptGenerator(){
|
|
28
|
-
const app = new ImportScriptGeneratorApp();
|
|
29
|
-
app.name = 'Import Script Gen'
|
|
30
|
-
grok.shell.addView(app);
|
|
31
|
-
app.root.classList.remove('ui-panel');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
20
|
//name: OutliersSelectionViewer
|
|
35
21
|
//description: Creates an outliers selection viewer
|
|
36
22
|
//tags: viewer
|
|
@@ -55,67 +41,6 @@ export function PipelineStepEditor(call: DG.FuncCall) {
|
|
|
55
41
|
return RichFunctionView.fromFuncCall(call, {historyEnabled: false, isTabbed: true});
|
|
56
42
|
}
|
|
57
43
|
|
|
58
|
-
/*//output: widget result
|
|
59
|
-
//tags: dashboard
|
|
60
|
-
export function modelsWidget(): DG.Widget {
|
|
61
|
-
return new ModelsWidget();
|
|
62
|
-
}*/
|
|
63
|
-
|
|
64
|
-
/* eslint-disable */
|
|
65
|
-
|
|
66
|
-
//description: A spreadsheet that lets you interactively edit parameters and evaluate functions
|
|
67
|
-
//tags: functionAnalysis
|
|
68
|
-
//input: func f
|
|
69
|
-
//output: view result
|
|
70
|
-
export function functionParametersGrid(f: DG.Func): DG.View {
|
|
71
|
-
return _functionParametersGrid(f);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//name: hof
|
|
75
|
-
//description: some description
|
|
76
|
-
//sidebar: @compute
|
|
77
|
-
export function hof() {
|
|
78
|
-
console.log('hof');
|
|
79
|
-
let f: DG.Func = DG.Func.byName('Sin');
|
|
80
|
-
let v: DG.View = functionParametersGrid(f);
|
|
81
|
-
v.parentCall = grok.functions.getCurrentCall();
|
|
82
|
-
//v.parentView = v.parentCall?.aux['view'];
|
|
83
|
-
grok.shell.addView(v);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//name: hof2
|
|
88
|
-
//tags:
|
|
89
|
-
//description: some description 2 2 2
|
|
90
|
-
//sidebar: @compute
|
|
91
|
-
//meta.icon: package1.png
|
|
92
|
-
export function hof2() {
|
|
93
|
-
console.log('hof2');
|
|
94
|
-
|
|
95
|
-
let f: DG.Func = DG.Func.byName('Sin');
|
|
96
|
-
let v: DG.View = functionParametersGrid(f);
|
|
97
|
-
|
|
98
|
-
v.root.appendChild(ui.narrowForm([
|
|
99
|
-
ui.switchInput('test', true),
|
|
100
|
-
ui.boolInput('test', true)]));
|
|
101
|
-
v.root.appendChild(ui.form([
|
|
102
|
-
ui.switchInput('test', true),
|
|
103
|
-
ui.boolInput('test', true)]));
|
|
104
|
-
v.parentCall = grok.functions.getCurrentCall(); // hof2 call itself
|
|
105
|
-
v.parentView = v.parentCall.parentCall?.aux['view']; // modelCatalog view
|
|
106
|
-
let path = v.parentCall.parentCall?.aux['url']; // uri if called from model catalog
|
|
107
|
-
// grok.shell.info(path);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let path2 = v.parentCall?.aux['url']; // uri if called directly (if app)
|
|
111
|
-
// grok.shell.info(path2);
|
|
112
|
-
|
|
113
|
-
v.basePath = '/' + v.parentCall.func.name;
|
|
114
|
-
v.path = '/';
|
|
115
|
-
|
|
116
|
-
grok.shell.addView(v);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
44
|
//name: renderRestPanel
|
|
120
45
|
//input: func func
|
|
121
46
|
//output: widget panel
|
|
@@ -167,8 +92,9 @@ export function autostart() {
|
|
|
167
92
|
export function init() {
|
|
168
93
|
if (initCompleted)
|
|
169
94
|
return;
|
|
170
|
-
DG.ObjectHandler.register(new ModelHandler());
|
|
171
95
|
|
|
96
|
+
DG.ObjectHandler.register(new ModelHandler('Model Catalog', 'modelCatalog', _package));
|
|
97
|
+
|
|
172
98
|
grok.events.onAccordionConstructed.subscribe((acc: DG.Accordion) => {
|
|
173
99
|
const ent = acc.context;
|
|
174
100
|
if (ent == null)
|
|
@@ -179,54 +105,29 @@ export function init() {
|
|
|
179
105
|
if (!restPane)
|
|
180
106
|
acc.addPane('REST', () => ui.wait(async () => (await renderRestPanel(ent)).root));
|
|
181
107
|
});
|
|
182
|
-
/*
|
|
183
|
-
let modelsList = ui.waitBox(async () => {
|
|
184
|
-
let models = await grok.dapi.scripts
|
|
185
|
-
.filter('#model')
|
|
186
|
-
.list();
|
|
187
|
-
let list = ui.divV(models.map((model) => ui.render(model, {onClick: (_) => ModelHandler.openModel(model)})), {style: {lineHeight: '165%'}});
|
|
188
|
-
|
|
189
|
-
let props = ['domain', 'modality'];
|
|
190
|
-
let mtree: { model: DG.Func}[] = models.map((m) => { return {model: m}});
|
|
191
|
-
mtree.forEach((m: {model: DG.Func}) => {
|
|
192
|
-
props.forEach((k) => {
|
|
193
|
-
(<any>m)[k] = m.model.options[k];
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
let tree = DG.TreeViewNode.fromItemCategories(mtree,
|
|
198
|
-
props,
|
|
199
|
-
{ itemToElement: (x) => ui.render(x.model, {onClick: (_) => ModelHandler.openModel(x.model)}), itemToValue: (x) => x.model, removeEmpty: true }).root
|
|
200
|
-
|
|
201
|
-
return ui.tabControl({
|
|
202
|
-
'LIST': list,
|
|
203
|
-
'TREE': tree
|
|
204
|
-
}).root;
|
|
205
|
-
});*/
|
|
206
108
|
|
|
207
109
|
initCompleted = true;
|
|
208
110
|
}
|
|
209
111
|
|
|
112
|
+
let startUriLoaded = false;
|
|
113
|
+
|
|
210
114
|
//name: Model Catalog
|
|
211
115
|
//tags: app
|
|
212
116
|
//sidebar: @compute
|
|
213
117
|
export function modelCatalog() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
grok.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
} else grok.shell.v = modelsView;
|
|
118
|
+
ModelCatalogView.findOrCreateCatalogView('Model Catalog', 'modelCatalog', _package)
|
|
119
|
+
|
|
120
|
+
const optionalPart = grok.shell.startUri.indexOf('?');
|
|
121
|
+
const pathSegments = grok.shell.startUri
|
|
122
|
+
.substring('https://'.length, optionalPart > 0 ? optionalPart: undefined)
|
|
123
|
+
.split('/');
|
|
124
|
+
if (!startUriLoaded && pathSegments.length > 3) {
|
|
125
|
+
grok.dapi.functions.filter(`shortName = "${pathSegments[3]}" and #model`).list().then((lst) => {
|
|
126
|
+
if (lst.length == 1)
|
|
127
|
+
ModelHandler.openModel(lst[0]);
|
|
128
|
+
startUriLoaded = true;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
230
131
|
}
|
|
231
132
|
|
|
232
133
|
|