@datagrok/compute 1.41.1 → 1.42.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 +8 -0
- package/dist/148.js +1 -1
- package/dist/148.js.map +1 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +6 -5
- package/src/package.ts +64 -100
- package/webpack.config.js +2 -2
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.42.1",
|
|
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.
|
|
17
|
-
"@datagrok-libraries/utils": "^4.
|
|
16
|
+
"@datagrok-libraries/compute-utils": "^1.42.0",
|
|
17
|
+
"@datagrok-libraries/utils": "^4.5.0",
|
|
18
18
|
"cash-dom": "^8.1.5",
|
|
19
|
-
"datagrok-api": "^1.
|
|
19
|
+
"datagrok-api": "^1.25.0",
|
|
20
20
|
"dayjs": "=1.11.10",
|
|
21
21
|
"exceljs": "^4.3.0",
|
|
22
22
|
"rxjs": "^6.6.7",
|
|
@@ -57,13 +57,14 @@
|
|
|
57
57
|
"build-all": "npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/compute-utils run build && npm run build"
|
|
58
58
|
},
|
|
59
59
|
"canEdit": [
|
|
60
|
-
"
|
|
60
|
+
"Administrators"
|
|
61
61
|
],
|
|
62
62
|
"canView": [
|
|
63
63
|
"All users"
|
|
64
64
|
],
|
|
65
65
|
"category": "Compute",
|
|
66
66
|
"meta": {
|
|
67
|
+
"url": "/Modelhub",
|
|
67
68
|
"dartium": false
|
|
68
69
|
}
|
|
69
70
|
}
|
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
|
|
5
|
+
import {filter} from 'rxjs/operators';
|
|
6
6
|
import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
|
|
7
7
|
import {
|
|
8
8
|
ComputationView as ComputationViewInst,
|
|
@@ -23,12 +23,11 @@ export {
|
|
|
23
23
|
makeAdvice as makeAdvice2,
|
|
24
24
|
mergeValidationResults as mergeValidationResults2,
|
|
25
25
|
} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/utils';
|
|
26
|
-
import {ModelCatalogView, ModelHandler,
|
|
26
|
+
import {ModelCatalogView, ModelHandler, startModelCatalog, makeModelTreeBrowser, renderRestPanel, setModelCatalogEventHandlers, setModelCatalogHandler} from '@datagrok-libraries/compute-utils/model-catalog';
|
|
27
27
|
import {
|
|
28
28
|
testPipeline as testPipelineInst,
|
|
29
29
|
} from '@datagrok-libraries/compute-utils/shared-utils/function-views-testing';
|
|
30
30
|
|
|
31
|
-
let initCompleted: boolean = false;
|
|
32
31
|
export const _package = new DG.Package();
|
|
33
32
|
|
|
34
33
|
//name: openModelFromFuncall
|
|
@@ -64,43 +63,72 @@ export function PipelineStepEditor(call: DG.FuncCall) {
|
|
|
64
63
|
//name: renderRestPanel
|
|
65
64
|
//input: func func
|
|
66
65
|
//output: widget panel
|
|
67
|
-
export async function
|
|
68
|
-
|
|
69
|
-
func.inputs.forEach((i) => (<any>params)[i.name] = null);
|
|
70
|
-
const curl = `
|
|
71
|
-
curl --location --request POST '${(<any>grok.settings).apiUrl}/v1/func/${func.nqName}/run' \\
|
|
72
|
-
--header 'Authorization: ${getCookie('auth')}' \\
|
|
73
|
-
--header 'Content-Type: application/json' \\
|
|
74
|
-
--data-raw '${JSON.stringify(params)}'`;
|
|
75
|
-
const js = `
|
|
76
|
-
var myHeaders = new Headers();
|
|
77
|
-
myHeaders.append("Authorization", "${getCookie('auth')}");
|
|
78
|
-
myHeaders.append("Content-Type", "application/json");
|
|
79
|
-
|
|
80
|
-
var raw = JSON.stringify(${JSON.stringify(params)});
|
|
81
|
-
|
|
82
|
-
var requestOptions = {
|
|
83
|
-
method: 'POST',
|
|
84
|
-
headers: myHeaders,
|
|
85
|
-
body: raw,
|
|
86
|
-
redirect: 'follow'
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
fetch("${(<any>grok.settings).apiUrl}/v1/func/${func.nqName}/run", requestOptions)
|
|
90
|
-
.then(response => response.text())
|
|
91
|
-
.then(result => console.log(result))
|
|
92
|
-
.catch(error => console.log('error', error));`;
|
|
93
|
-
const tabs = ui.tabControl({'CURL': ui.div([ui.divText(curl)]), 'JS': ui.div([ui.divText(js)])});
|
|
94
|
-
return DG.Widget.fromRoot(tabs.root);
|
|
66
|
+
export async function renderPanel(func: DG.Func): Promise<DG.Widget> {
|
|
67
|
+
return renderRestPanel(func);
|
|
95
68
|
}
|
|
96
69
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
70
|
+
let startUriLoaded = false;
|
|
71
|
+
let initCompleted = false;
|
|
72
|
+
|
|
73
|
+
const options = {
|
|
74
|
+
_package,
|
|
75
|
+
ViewClass: ModelCatalogView,
|
|
76
|
+
segment: 'Modelhub',
|
|
77
|
+
viewName: 'Model Hub',
|
|
78
|
+
funcName: 'modelCatalog',
|
|
79
|
+
setStartUriLoaded: () => startUriLoaded = true,
|
|
80
|
+
getStartUriLoaded: () => startUriLoaded,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//tags: init
|
|
84
|
+
export function init() {
|
|
85
|
+
if (initCompleted)
|
|
86
|
+
return;
|
|
87
|
+
|
|
88
|
+
setModelCatalogHandler();
|
|
89
|
+
setModelCatalogEventHandlers(options);
|
|
90
|
+
|
|
91
|
+
initCompleted = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//name: Model Hub
|
|
95
|
+
//tags: app
|
|
96
|
+
//output: view v
|
|
97
|
+
//meta.browsePath: Compute
|
|
98
|
+
export function modelCatalog() {
|
|
99
|
+
return startModelCatalog(options);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//input: dynamic treeNode
|
|
103
|
+
//input: view browseView
|
|
104
|
+
export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup) {
|
|
105
|
+
await makeModelTreeBrowser(treeNode);
|
|
102
106
|
}
|
|
103
107
|
|
|
108
|
+
////
|
|
109
|
+
// Compute-utils API section
|
|
110
|
+
///
|
|
111
|
+
|
|
112
|
+
export const testPipeline = testPipelineInst;
|
|
113
|
+
export const CompView = ComputationViewInst;
|
|
114
|
+
export const RFV = RichFunctionViewInst;
|
|
115
|
+
export const CFV = CustomFunctionViewInst;
|
|
116
|
+
export const Pipeline = PipelineViewInst;
|
|
117
|
+
export const makeValidationResult = makeValidationResultInst;
|
|
118
|
+
export const makeAdvice = makeAdviceInst;
|
|
119
|
+
export const makeRevalidation = makeRevalidationInst;
|
|
120
|
+
export const mergeValidationResults = mergeValidationResultsInst;
|
|
121
|
+
export const fileInput = UiUtils.fileInput;
|
|
122
|
+
export const historyInput = UiUtils.historyInput;
|
|
123
|
+
export const historyInputJSON = UiUtils.historyInputJSON;
|
|
124
|
+
export const historyPanel = UiUtils.historyPanel;
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
////
|
|
128
|
+
// For testing only
|
|
129
|
+
///
|
|
130
|
+
|
|
131
|
+
|
|
104
132
|
//name: CustomDataUploader
|
|
105
133
|
//input: func func
|
|
106
134
|
//output: object uploadedCalls
|
|
@@ -161,48 +189,6 @@ export function CustomCustomizer(params: {defaultView: DG.TableView}) {
|
|
|
161
189
|
});
|
|
162
190
|
}
|
|
163
191
|
|
|
164
|
-
//tags: init
|
|
165
|
-
export function init() {
|
|
166
|
-
if (initCompleted)
|
|
167
|
-
return;
|
|
168
|
-
|
|
169
|
-
if (!(DG.ObjectHandler.list().find((handler) => handler.type === 'Model')))
|
|
170
|
-
DG.ObjectHandler.register(new ModelHandler());
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
grok.events.onAccordionConstructed.subscribe((acc: DG.Accordion) => {
|
|
174
|
-
const ent = acc.context;
|
|
175
|
-
if (ent == null)
|
|
176
|
-
return;
|
|
177
|
-
if (ent.type != 'script')
|
|
178
|
-
return;
|
|
179
|
-
const restPane = acc.getPane('REST');
|
|
180
|
-
if (!restPane)
|
|
181
|
-
acc.addPane('REST', () => ui.wait(async () => (await renderRestPanel(ent)).root));
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
initCompleted = true;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
let startUriLoaded = false;
|
|
188
|
-
|
|
189
|
-
//name: Model Catalog
|
|
190
|
-
//tags: app
|
|
191
|
-
//output: view v
|
|
192
|
-
//meta.browsePath: Compute
|
|
193
|
-
export function modelCatalog() {
|
|
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);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
192
|
//name: SimTimeValidator
|
|
207
193
|
//input: object params
|
|
208
194
|
//output: object validator
|
|
@@ -299,25 +285,3 @@ export function ObjectCoolingSelector(params: any) {
|
|
|
299
285
|
'ObjectCooling',
|
|
300
286
|
);
|
|
301
287
|
}
|
|
302
|
-
|
|
303
|
-
//input: dynamic treeNode
|
|
304
|
-
//input: view browseView
|
|
305
|
-
export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browseView: DG.BrowseView) {
|
|
306
|
-
await makeModelTreeBrowser(treeNode, browseView);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
//// Compute-utils API section
|
|
310
|
-
|
|
311
|
-
export const testPipeline = testPipelineInst;
|
|
312
|
-
export const CompView = ComputationViewInst;
|
|
313
|
-
export const RFV = RichFunctionViewInst;
|
|
314
|
-
export const CFV = CustomFunctionViewInst;
|
|
315
|
-
export const Pipeline = PipelineViewInst;
|
|
316
|
-
export const makeValidationResult = makeValidationResultInst;
|
|
317
|
-
export const makeAdvice = makeAdviceInst;
|
|
318
|
-
export const makeRevalidation = makeRevalidationInst;
|
|
319
|
-
export const mergeValidationResults = mergeValidationResultsInst;
|
|
320
|
-
export const fileInput = UiUtils.fileInput;
|
|
321
|
-
export const historyInput = UiUtils.historyInput;
|
|
322
|
-
export const historyInputJSON = UiUtils.historyInputJSON;
|
|
323
|
-
export const historyPanel = UiUtils.historyPanel;
|
package/webpack.config.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = {
|
|
|
12
12
|
package: './src/package.ts',
|
|
13
13
|
},
|
|
14
14
|
resolve: {
|
|
15
|
-
extensions: ['.wasm', '.
|
|
15
|
+
extensions: ['.wasm', '.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],
|
|
16
16
|
},
|
|
17
17
|
module: {
|
|
18
18
|
rules: [
|
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
|
22
22
|
use: ['style-loader', 'css-loader'],
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
test: /\.(mjs|js|jsx
|
|
25
|
+
test: /\.(ts|tsx|mjs|js|jsx)$/,
|
|
26
26
|
enforce: 'pre',
|
|
27
27
|
use: ['source-map-loader'],
|
|
28
28
|
},
|