@datagrok/compute 1.39.7 → 1.40.3
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/.eslintrc.json +47 -0
- package/CHANGELOG.md +8 -0
- 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 +17 -14
- package/scripts/object-cooling.js +1 -1
- package/src/outliers-selection/outliers-selection-viewer.ts +17 -20
- package/src/package-test.ts +1 -1
- package/src/package.ts +78 -76
- package/tsconfig.json +1 -1
- package/src/global.d.ts +0 -13
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/compute",
|
|
3
3
|
"friendlyName": "Compute",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.40.3",
|
|
5
5
|
"author": {
|
|
6
|
-
"name": "
|
|
7
|
-
"email": "
|
|
6
|
+
"name": "Andrey Sharapov",
|
|
7
|
+
"email": "andrey.sharapov@softwarecountry.com"
|
|
8
8
|
},
|
|
9
9
|
"description": "Provides additional analytical and UI blocks for [Datagrok scientific computing](https://datagrok.ai/help/compute/).",
|
|
10
10
|
"repository": {
|
|
@@ -13,24 +13,25 @@
|
|
|
13
13
|
"directory": "packages/Compute"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@datagrok-libraries/utils": "^
|
|
17
|
-
"@datagrok-libraries/
|
|
16
|
+
"@datagrok-libraries/compute-utils": "^1.40.3",
|
|
17
|
+
"@datagrok-libraries/utils": "^4.3.12",
|
|
18
18
|
"cash-dom": "^8.1.5",
|
|
19
|
-
"datagrok-api": "^1.
|
|
19
|
+
"datagrok-api": "^1.23.0",
|
|
20
|
+
"dayjs": "=1.11.10",
|
|
21
|
+
"exceljs": "^4.3.0",
|
|
20
22
|
"rxjs": "^6.6.7",
|
|
21
|
-
"source-map-loader": "^
|
|
23
|
+
"source-map-loader": "^5.0.0",
|
|
22
24
|
"ts-loader": "^9.5.1",
|
|
23
|
-
"typescript": "^5.6.3"
|
|
24
|
-
"exceljs": "^4.3.0"
|
|
25
|
+
"typescript": "^5.6.3"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/lodash.clonedeepwith": "^4.5.9",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
29
|
-
"@typescript-eslint/parser": "^
|
|
30
|
-
"css-loader": "^
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
30
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
31
|
+
"css-loader": "^7.1.2",
|
|
31
32
|
"eslint": "^8.0.1",
|
|
32
33
|
"eslint-config-google": "^0.14.0",
|
|
33
|
-
"style-loader": "^
|
|
34
|
+
"style-loader": "^4.0.0",
|
|
34
35
|
"webpack": "^5.95.0",
|
|
35
36
|
"webpack-cli": "^5.1.4"
|
|
36
37
|
},
|
|
@@ -42,6 +43,8 @@
|
|
|
42
43
|
"release-compute": "webpack && grok publish localhost --release",
|
|
43
44
|
"build-compute": "webpack",
|
|
44
45
|
"build": "webpack",
|
|
46
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
47
|
+
"lint-fix": "eslint . --ext .ts,.tsx --fix",
|
|
45
48
|
"build-compute-local": "npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/utils run build && npm run build",
|
|
46
49
|
"debug-compute-dev": "webpack && grok publish dev",
|
|
47
50
|
"release-compute-dev": "grok publish dev --release",
|
|
@@ -63,4 +66,4 @@
|
|
|
63
66
|
"meta": {
|
|
64
67
|
"dartium": false
|
|
65
68
|
}
|
|
66
|
-
}
|
|
69
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//input: int simTime = 21600 {caption: Simulation time; units: sec; category: Simulation; validatorFunc: Compute:SimTimeValidator; validatorFuncOptions: { "reasonableMin": 10800, "reasonableMax": 100000} }
|
|
13
13
|
//output: dataframe simulation {caption: Temp. vs time; category: Output; viewer: Line chart(block: 75) | Grid(block: 25)}
|
|
14
14
|
//output: double timeToCool {caption: Time to cool; units: sec.; category: Output}
|
|
15
|
-
//output: double coolingFactor {caption: Cooling factor; units: 1 / sec.; category: Calculations}
|
|
15
|
+
//output: double coolingFactor {caption: Cooling factor; units: 1 / sec.; category: Calculations; precision: 5}
|
|
16
16
|
//output: double tempDiff {caption: Temperature difference; units: C; category: Calculations}
|
|
17
17
|
//editor: Compute:RichFunctionViewEditor
|
|
18
18
|
//meta.features: {"sens-analysis": true, "upload": true}
|
|
@@ -4,8 +4,8 @@ import * as DG from 'datagrok-api/dg';
|
|
|
4
4
|
import $ from 'cash-dom';
|
|
5
5
|
|
|
6
6
|
const getBalloonContainer = () => {
|
|
7
|
-
return document.querySelector('.d4-balloon-container')
|
|
8
|
-
}
|
|
7
|
+
return document.querySelector('.d4-balloon-container');
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
export class OutliersSelectionViewer extends DG.JsViewer {
|
|
11
11
|
constructor() {
|
|
@@ -61,10 +61,10 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
61
61
|
ui.divV([
|
|
62
62
|
groupsListGrid.root,
|
|
63
63
|
], {style: {'height': '75%'}}),
|
|
64
|
-
], {style: {'height': '100%'}})
|
|
64
|
+
], {style: {'height': '100%'}}),
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
const confirmOutliers =
|
|
67
|
+
const confirmOutliers = () => {
|
|
68
68
|
if (!groupsListGrid.dataFrame) return;
|
|
69
69
|
|
|
70
70
|
inputData.col(IS_OUTLIER_COL_LABEL)?.meta.markers.assign('true', DG.MARKER_TYPE.OUTLIER);
|
|
@@ -93,19 +93,19 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
93
93
|
inputData.selection.setAll(false);
|
|
94
94
|
|
|
95
95
|
$(getBalloonContainer()).empty();
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
|
|
98
98
|
groupsListGrid.onCellPrepare((gc) => {
|
|
99
|
-
if (!gc.isTableCell)
|
|
99
|
+
if (!gc.isTableCell)
|
|
100
100
|
return;
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
|
|
103
103
|
const confirmBtn = () => ui.div(
|
|
104
|
-
ui.iconFA('check', confirmOutliers, 'Confirm the outliers'), {style: {textAlign: '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: {textAlign: '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(
|
|
@@ -145,9 +145,8 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
145
145
|
|
|
146
146
|
for (let i = 0; i < inputData.rowCount; i++) {
|
|
147
147
|
const currentCellValue = inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).get(i);
|
|
148
|
-
if (currentCellValue != '' && !uniqueValues.has(currentCellValue))
|
|
148
|
+
if (currentCellValue != '' && !uniqueValues.has(currentCellValue))
|
|
149
149
|
inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).set(i, editedCell.cell.value);
|
|
150
|
-
}
|
|
151
150
|
}
|
|
152
151
|
});
|
|
153
152
|
|
|
@@ -155,13 +154,11 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
155
154
|
if ((inputData.columns as DG.ColumnList).byName(OUTLIER_RATIONALE_COL_LABEL)) {
|
|
156
155
|
for (let i = 0; i < inputData.rowCount; i++) {
|
|
157
156
|
if (inputData.columns.byName(IS_OUTLIER_COL_LABEL).get(i)) {
|
|
158
|
-
if (inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).get(i) === '')
|
|
159
|
-
(inputData.columns as DG.ColumnList).byName(OUTLIER_RATIONALE_COL_LABEL).set(i,
|
|
160
|
-
}
|
|
157
|
+
if (inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).get(i) === '')
|
|
158
|
+
(inputData.columns as DG.ColumnList).byName(OUTLIER_RATIONALE_COL_LABEL).set(i, 'Manual', false);
|
|
161
159
|
} else {
|
|
162
|
-
if (inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).get(i) !== '')
|
|
163
|
-
(inputData.columns as DG.ColumnList).byName(OUTLIER_RATIONALE_COL_LABEL).set(i, '', false)
|
|
164
|
-
}
|
|
160
|
+
if (inputData.columns.byName(OUTLIER_RATIONALE_COL_LABEL).get(i) !== '')
|
|
161
|
+
(inputData.columns as DG.ColumnList).byName(OUTLIER_RATIONALE_COL_LABEL).set(i, '', false);
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
164
|
}
|
|
@@ -197,9 +194,9 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
197
194
|
ui.divText('Confirm selected points as outliers?'),
|
|
198
195
|
ui.divH([
|
|
199
196
|
ui.bigButton('Confirm', confirmOutliers),
|
|
200
|
-
ui.button('Cancel', cancelOutliers)
|
|
201
|
-
])
|
|
202
|
-
]))
|
|
197
|
+
ui.button('Cancel', cancelOutliers),
|
|
198
|
+
]),
|
|
199
|
+
]));
|
|
203
200
|
}
|
|
204
201
|
|
|
205
202
|
const isConfirmedColumn = (groupsListGrid.dataFrame.columns as DG.ColumnList)
|
package/src/package-test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
|
-
import {runTests, tests, TestContext, initAutoTests as initTests
|
|
3
|
+
import {runTests, tests, TestContext, initAutoTests as initTests} from '@datagrok-libraries/utils/src/test';
|
|
4
4
|
|
|
5
5
|
export const _package = new DG.Package();
|
|
6
6
|
export {tests};
|
package/src/package.ts
CHANGED
|
@@ -6,21 +6,25 @@ import {filter, take} from 'rxjs/operators';
|
|
|
6
6
|
import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
|
|
7
7
|
import {
|
|
8
8
|
ComputationView as ComputationViewInst,
|
|
9
|
-
RichFunctionView as RichFunctionViewInst,
|
|
9
|
+
RichFunctionView as RichFunctionViewInst,
|
|
10
10
|
PipelineView as PipelineViewInst,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
makeAdvice as makeAdviceInst,
|
|
11
|
+
UiUtils,
|
|
12
|
+
} from '@datagrok-libraries/compute-utils';
|
|
13
|
+
import {
|
|
14
|
+
ValidationInfo,
|
|
15
|
+
makeAdvice as makeAdviceInst,
|
|
17
16
|
makeValidationResult as makeValidationResultInst,
|
|
18
17
|
makeRevalidation as makeRevalidationInst,
|
|
19
18
|
mergeValidationResults as mergeValidationResultsInst,
|
|
20
19
|
} from '@datagrok-libraries/compute-utils/shared-utils/validation';
|
|
20
|
+
export {
|
|
21
|
+
makeValidationResult as makeValidationResult2,
|
|
22
|
+
makeAdvice as makeAdvice2,
|
|
23
|
+
mergeValidationResults as mergeValidationResults2,
|
|
24
|
+
} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/utils';
|
|
21
25
|
import {ModelCatalogView, ModelHandler} from '@datagrok-libraries/compute-utils/model-catalog';
|
|
22
26
|
import {
|
|
23
|
-
testPipeline as testPipelineInst
|
|
27
|
+
testPipeline as testPipelineInst,
|
|
24
28
|
} from '@datagrok-libraries/compute-utils/shared-utils/function-views-testing';
|
|
25
29
|
|
|
26
30
|
let initCompleted: boolean = false;
|
|
@@ -60,14 +64,14 @@ export function PipelineStepEditor(call: DG.FuncCall) {
|
|
|
60
64
|
//input: func func
|
|
61
65
|
//output: widget panel
|
|
62
66
|
export async function renderRestPanel(func: DG.Func): Promise<DG.Widget> {
|
|
63
|
-
|
|
67
|
+
const params: object = {};
|
|
64
68
|
func.inputs.forEach((i) => (<any>params)[i.name] = null);
|
|
65
|
-
|
|
69
|
+
const curl = `
|
|
66
70
|
curl --location --request POST '${(<any>grok.settings).apiUrl}/v1/func/${func.nqName}/run' \\
|
|
67
71
|
--header 'Authorization: ${getCookie('auth')}' \\
|
|
68
72
|
--header 'Content-Type: application/json' \\
|
|
69
|
-
--data-raw '${JSON.stringify(params)}'
|
|
70
|
-
|
|
73
|
+
--data-raw '${JSON.stringify(params)}'`;
|
|
74
|
+
const js = `
|
|
71
75
|
var myHeaders = new Headers();
|
|
72
76
|
myHeaders.append("Authorization", "${getCookie('auth')}");
|
|
73
77
|
myHeaders.append("Content-Type", "application/json");
|
|
@@ -84,14 +88,14 @@ var requestOptions = {
|
|
|
84
88
|
fetch("${(<any>grok.settings).apiUrl}/v1/func/${func.nqName}/run", requestOptions)
|
|
85
89
|
.then(response => response.text())
|
|
86
90
|
.then(result => console.log(result))
|
|
87
|
-
.catch(error => console.log('error', error))
|
|
88
|
-
|
|
91
|
+
.catch(error => console.log('error', error));`;
|
|
92
|
+
const tabs = ui.tabControl({'CURL': ui.div([ui.divText(curl)]), 'JS': ui.div([ui.divText(js)])});
|
|
89
93
|
return DG.Widget.fromRoot(tabs.root);
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
function getCookie(name: string): string | undefined{
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
function getCookie(name: string): string | undefined {
|
|
97
|
+
const matches = document.cookie.match(new RegExp(
|
|
98
|
+
'(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)',
|
|
95
99
|
));
|
|
96
100
|
return matches ? decodeURIComponent(matches[1]) : undefined;
|
|
97
101
|
}
|
|
@@ -110,9 +114,9 @@ export async function CustomDataUploader(func: DG.Func) {
|
|
|
110
114
|
'heatCap': 4200,
|
|
111
115
|
'heatTransferCoeff': 8.3,
|
|
112
116
|
'simTime': 21600,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return [dummyFunccall]
|
|
117
|
+
}).call();
|
|
118
|
+
|
|
119
|
+
return [dummyFunccall];
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
//name: CustomUploader
|
|
@@ -121,27 +125,27 @@ export async function CustomDataUploader(func: DG.Func) {
|
|
|
121
125
|
//output: funccall uploadFuncCall
|
|
122
126
|
export async function CustomUploader(params: {func: DG.Func}) {
|
|
123
127
|
const uploadFunc = await grok.functions.eval('Compute:CustomDataUploader') as DG.Func;
|
|
124
|
-
const uploadFuncCall = uploadFunc.prepare({func: params.func})
|
|
128
|
+
const uploadFuncCall = uploadFunc.prepare({func: params.func});
|
|
125
129
|
const uploadBtn = ui.bigButton('Click me to get mock calls', () => uploadFuncCall.call());
|
|
126
130
|
|
|
127
131
|
const dummyWidget = DG.Widget.fromRoot(ui.panel([ui.divV([
|
|
128
132
|
ui.label('This part of dialog comes from my custom data uploader'),
|
|
129
|
-
ui.divH([uploadBtn], {style: {justifyContent: 'center'}})
|
|
130
|
-
])]));
|
|
133
|
+
ui.divH([uploadBtn], {style: {justifyContent: 'center'}}),
|
|
134
|
+
])]));
|
|
131
135
|
|
|
132
136
|
const setLoadingSub = grok.functions.onBeforeRunAction.pipe(
|
|
133
|
-
filter((call) => call.id === uploadFuncCall.id)
|
|
137
|
+
filter((call) => call.id === uploadFuncCall.id),
|
|
134
138
|
).subscribe(() => {
|
|
135
139
|
ui.setUpdateIndicator(uploadBtn, true);
|
|
136
|
-
})
|
|
140
|
+
});
|
|
137
141
|
|
|
138
142
|
const unsetLoadingSub = grok.functions.onAfterRunAction.pipe(
|
|
139
|
-
filter((call) => call.id === uploadFuncCall.id)
|
|
143
|
+
filter((call) => call.id === uploadFuncCall.id),
|
|
140
144
|
).subscribe(() => {
|
|
141
145
|
ui.setUpdateIndicator(uploadBtn, false);
|
|
142
|
-
})
|
|
146
|
+
});
|
|
143
147
|
|
|
144
|
-
dummyWidget.subs.push(setLoadingSub, unsetLoadingSub)
|
|
148
|
+
dummyWidget.subs.push(setLoadingSub, unsetLoadingSub);
|
|
145
149
|
|
|
146
150
|
return {uploadWidget: dummyWidget, uploadFuncCall};
|
|
147
151
|
}
|
|
@@ -151,8 +155,8 @@ export async function CustomUploader(params: {func: DG.Func}) {
|
|
|
151
155
|
export function CustomCustomizer(params: {defaultView: DG.TableView}) {
|
|
152
156
|
const comparisonView = params.defaultView;
|
|
153
157
|
comparisonView.scatterPlot({
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
'xColumnName': 'Initial temperature',
|
|
159
|
+
'yColumnName': 'Time to cool',
|
|
156
160
|
});
|
|
157
161
|
}
|
|
158
162
|
|
|
@@ -161,17 +165,17 @@ export function init() {
|
|
|
161
165
|
if (initCompleted)
|
|
162
166
|
return;
|
|
163
167
|
|
|
164
|
-
if (!(DG.ObjectHandler.list().find((handler) => handler.type ===
|
|
168
|
+
if (!(DG.ObjectHandler.list().find((handler) => handler.type === 'Model')))
|
|
165
169
|
DG.ObjectHandler.register(new ModelHandler());
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
|
|
171
|
+
|
|
168
172
|
grok.events.onAccordionConstructed.subscribe((acc: DG.Accordion) => {
|
|
169
173
|
const ent = acc.context;
|
|
170
174
|
if (ent == null)
|
|
171
175
|
return;
|
|
172
176
|
if (ent.type != 'script')
|
|
173
177
|
return;
|
|
174
|
-
|
|
178
|
+
const restPane = acc.getPane('REST');
|
|
175
179
|
if (!restPane)
|
|
176
180
|
acc.addPane('REST', () => ui.wait(async () => (await renderRestPanel(ent)).root));
|
|
177
181
|
});
|
|
@@ -200,9 +204,8 @@ export function modelCatalog() {
|
|
|
200
204
|
|
|
201
205
|
if (startPathSegments.length > 3) {
|
|
202
206
|
grok.dapi.functions.filter(`shortName = "${startPathSegments[3]}" and #model`).list().then((lst) => {
|
|
203
|
-
if (lst.length == 1)
|
|
207
|
+
if (lst.length == 1)
|
|
204
208
|
ModelHandler.openModel(lst[0]);
|
|
205
|
-
}
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
211
|
|
|
@@ -218,23 +221,23 @@ export function modelCatalog() {
|
|
|
218
221
|
const view = ModelCatalogView.findModelCatalogView('modelCatalog');
|
|
219
222
|
|
|
220
223
|
// If there is existing view, then switch on it
|
|
221
|
-
if (view)
|
|
224
|
+
if (view)
|
|
222
225
|
grok.shell.v = view;
|
|
223
|
-
|
|
226
|
+
|
|
224
227
|
|
|
225
228
|
// Always return new with no subscribtions to show in Browse tree
|
|
226
229
|
const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
|
|
227
230
|
return newView;
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
|
|
233
|
+
// Separately process double-clicking on Model Catalog card
|
|
231
234
|
if (pathSegments.includes('apps')) {
|
|
232
235
|
const view = ModelCatalogView.findModelCatalogView('modelCatalog');
|
|
233
236
|
|
|
234
237
|
// If there is existing view, then switch on it
|
|
235
|
-
if (view)
|
|
238
|
+
if (view)
|
|
236
239
|
grok.shell.v = view;
|
|
237
|
-
|
|
240
|
+
else {
|
|
238
241
|
const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
|
|
239
242
|
grok.shell.addView(newView);
|
|
240
243
|
}
|
|
@@ -265,10 +268,10 @@ export function DesiredTempValidator(params: any) {
|
|
|
265
268
|
return makeValidationResultInst({
|
|
266
269
|
errors: [
|
|
267
270
|
...(val < ambTemp) ? [makeAdviceInst(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
|
|
268
|
-
{actionName: 'Set desired equal to ambient', action: () => info.funcCall.inputs['desiredTemp'] = ambTemp
|
|
271
|
+
{actionName: 'Set desired equal to ambient', action: () => info.funcCall.inputs['desiredTemp'] = ambTemp},
|
|
269
272
|
])]: [],
|
|
270
273
|
...(val > initTemp) ? [`Desired temperature cannot be higher than initial temperature (${initTemp})`]: [],
|
|
271
|
-
]
|
|
274
|
+
],
|
|
272
275
|
});
|
|
273
276
|
};
|
|
274
277
|
}
|
|
@@ -282,7 +285,7 @@ export function InitialTempValidator(params: any) {
|
|
|
282
285
|
return makeValidationResultInst({
|
|
283
286
|
errors: [
|
|
284
287
|
...(val < ambTemp) ? [`Initial temperature cannot be less than ambient temperature (${ambTemp}).`]: [],
|
|
285
|
-
]
|
|
288
|
+
],
|
|
286
289
|
});
|
|
287
290
|
};
|
|
288
291
|
}
|
|
@@ -296,7 +299,7 @@ export function AmbTempValidator(params: any) {
|
|
|
296
299
|
return makeValidationResultInst({
|
|
297
300
|
errors: [
|
|
298
301
|
...(val > initTemp) ? [`Ambient temperature cannot be higher than initial temperature (${initTemp})`]: [],
|
|
299
|
-
]
|
|
302
|
+
],
|
|
300
303
|
});
|
|
301
304
|
};
|
|
302
305
|
}
|
|
@@ -308,13 +311,13 @@ export function HeatCapValidator(params: any) {
|
|
|
308
311
|
return (val: number, info: ValidationInfo) => {
|
|
309
312
|
return makeValidationResultInst({
|
|
310
313
|
errors: [
|
|
311
|
-
...val <= 0 ? ['Heat capacity must be greater than zero.']: []
|
|
314
|
+
...val <= 0 ? ['Heat capacity must be greater than zero.']: [],
|
|
312
315
|
],
|
|
313
316
|
notifications: [
|
|
314
317
|
makeAdviceInst(`Heat capacity is only dependent on the object material.`, [
|
|
315
|
-
{actionName: 'Google it', action: () => {
|
|
318
|
+
{actionName: 'Google it', action: () => {window.open(`http://google.com`);}},
|
|
316
319
|
]),
|
|
317
|
-
]
|
|
320
|
+
],
|
|
318
321
|
});
|
|
319
322
|
};
|
|
320
323
|
}
|
|
@@ -323,7 +326,7 @@ export function HeatCapValidator(params: any) {
|
|
|
323
326
|
//input: object params
|
|
324
327
|
//output: object input
|
|
325
328
|
export function CustomStringInput(params: any) {
|
|
326
|
-
const defaultInput = ui.input.string('Custom input', {value:''});
|
|
329
|
+
const defaultInput = ui.input.string('Custom input', {value: ''});
|
|
327
330
|
defaultInput.root.style.backgroundColor = 'aqua';
|
|
328
331
|
defaultInput.input.style.backgroundColor = 'aqua';
|
|
329
332
|
return defaultInput;
|
|
@@ -347,55 +350,55 @@ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browse
|
|
|
347
350
|
const modelSource = grok.dapi.functions.filter('(#model)');
|
|
348
351
|
const modelList = await modelSource.list();
|
|
349
352
|
const departments = modelList.reduce((acc, model) => {
|
|
350
|
-
if (model.options.department)
|
|
351
|
-
acc.add(model.options.department)
|
|
352
|
-
else
|
|
353
|
-
acc.add(NO_CATEGORY)
|
|
353
|
+
if (model.options.department)
|
|
354
|
+
acc.add(model.options.department);
|
|
355
|
+
else
|
|
356
|
+
acc.add(NO_CATEGORY);
|
|
354
357
|
return acc;
|
|
355
358
|
}, new Set([] as string[]));
|
|
356
|
-
|
|
359
|
+
|
|
357
360
|
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)
|
|
361
|
+
if (model.options.HL_process)
|
|
362
|
+
acc.add(model.options.HL_process);
|
|
363
|
+
else
|
|
364
|
+
acc.add(NO_CATEGORY);
|
|
362
365
|
return acc;
|
|
363
366
|
}, new Set([] as string[]));
|
|
364
367
|
|
|
365
368
|
const processes = modelList.reduce((acc, model) => {
|
|
366
|
-
if (model.options.process)
|
|
367
|
-
acc.add(model.options.process)
|
|
368
|
-
else
|
|
369
|
-
acc.add(NO_CATEGORY)
|
|
369
|
+
if (model.options.process)
|
|
370
|
+
acc.add(model.options.process);
|
|
371
|
+
else
|
|
372
|
+
acc.add(NO_CATEGORY);
|
|
370
373
|
return acc;
|
|
371
374
|
}, new Set([] as string[]));
|
|
372
375
|
|
|
373
376
|
for (const department of departments) {
|
|
374
377
|
const serverDep = (department !== NO_CATEGORY ? department: undefined);
|
|
375
|
-
const hasModelsDep = modelList.find((model) =>
|
|
376
|
-
model.options.department === serverDep
|
|
377
|
-
)
|
|
378
|
+
const hasModelsDep = modelList.find((model) =>
|
|
379
|
+
model.options.department === serverDep,
|
|
380
|
+
);
|
|
378
381
|
|
|
379
382
|
if (!hasModelsDep) continue;
|
|
380
383
|
|
|
381
|
-
const depNode = treeNode.getOrCreateGroup(department, null, false)
|
|
384
|
+
const depNode = treeNode.getOrCreateGroup(department, null, false);
|
|
382
385
|
for (const hlProcess of hlProcesses) {
|
|
383
386
|
const serverHlProcess = (hlProcess !== NO_CATEGORY ? hlProcess: undefined);
|
|
384
|
-
const hasModelsHl = modelList.find((model) =>
|
|
387
|
+
const hasModelsHl = modelList.find((model) =>
|
|
385
388
|
model.options.department === serverDep &&
|
|
386
|
-
model.options.HL_process === serverHlProcess
|
|
387
|
-
)
|
|
389
|
+
model.options.HL_process === serverHlProcess,
|
|
390
|
+
);
|
|
388
391
|
|
|
389
392
|
if (!hasModelsHl) continue;
|
|
390
393
|
|
|
391
394
|
const hlNode = hlProcess !== NO_CATEGORY ? depNode.getOrCreateGroup(hlProcess, null, false): depNode;
|
|
392
395
|
for (const process of processes) {
|
|
393
396
|
const serverProcess = (process !== NO_CATEGORY ? process: undefined);
|
|
394
|
-
const hasModels = modelList.find((model) =>
|
|
397
|
+
const hasModels = modelList.find((model) =>
|
|
395
398
|
model.options.department === serverDep &&
|
|
396
399
|
model.options.HL_process === serverHlProcess &&
|
|
397
|
-
model.options.process === serverProcess
|
|
398
|
-
)
|
|
400
|
+
model.options.process === serverProcess,
|
|
401
|
+
);
|
|
399
402
|
|
|
400
403
|
if (!hasModels) continue;
|
|
401
404
|
|
|
@@ -405,9 +408,9 @@ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browse
|
|
|
405
408
|
const depRules = department === NO_CATEGORY ? `(options.department = null)`: `(options.department in ("${department}"))`;
|
|
406
409
|
const hlProcessRules = hlProcess === NO_CATEGORY ? `(options.HL_process = null)`: `(options.HL_process in ("${hlProcess}"))`;
|
|
407
410
|
const processRules = process === NO_CATEGORY ? `(options.process = null)`: `(options.process in ("${process}"))`;
|
|
408
|
-
const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})
|
|
411
|
+
const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})`;
|
|
409
412
|
processNode.loadSources(grok.dapi.functions.filter(filteringRules));
|
|
410
|
-
})
|
|
413
|
+
});
|
|
411
414
|
}
|
|
412
415
|
}
|
|
413
416
|
}
|
|
@@ -419,7 +422,6 @@ export const testPipeline = testPipelineInst;
|
|
|
419
422
|
export const CompView = ComputationViewInst;
|
|
420
423
|
export const RFV = RichFunctionViewInst;
|
|
421
424
|
export const Pipeline = PipelineViewInst;
|
|
422
|
-
export const CompositionPipeline = CompositionPipelineViewInst;
|
|
423
425
|
export const makeValidationResult = makeValidationResultInst;
|
|
424
426
|
export const makeAdvice = makeAdviceInst;
|
|
425
427
|
export const makeRevalidation = makeRevalidationInst;
|
|
@@ -427,4 +429,4 @@ export const mergeValidationResults = mergeValidationResultsInst;
|
|
|
427
429
|
export const fileInput = UiUtils.fileInput;
|
|
428
430
|
export const historyInput = UiUtils.historyInput;
|
|
429
431
|
export const historyInputJSON = UiUtils.historyInputJSON;
|
|
430
|
-
export const historyPanel = UiUtils.historyPanel;
|
|
432
|
+
export const historyPanel = UiUtils.historyPanel;
|
package/tsconfig.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// "incremental": true, /* Enable incremental compilation */
|
|
7
7
|
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
8
|
"module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
"lib": ["
|
|
9
|
+
"lib": ["es2023", "dom"], /* Specify library files to be included in the compilation. */
|
|
10
10
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
11
|
// "checkJs": true, /* Report errors in .js files. */
|
|
12
12
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
package/src/global.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as grokNamespace from 'datagrok-api/grok';
|
|
2
|
-
import * as uiNamespace from 'datagrok-api/ui';
|
|
3
|
-
import * as DGNamespace from 'datagrok-api/dg';
|
|
4
|
-
import * as rxjsNamespace from 'rxjs';
|
|
5
|
-
import $Namespace from 'cash-dom';
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
const grok: typeof grokNamespace;
|
|
9
|
-
const ui: typeof uiNamespace;
|
|
10
|
-
const DG: typeof DGNamespace;
|
|
11
|
-
const rjxs: typeof rxjsNamespace;
|
|
12
|
-
const $: typeof $Namespace;
|
|
13
|
-
}
|