@datagrok/compute 1.39.6 → 1.40.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/.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 +15 -12
- package/scripts/object-cooling.js +1 -1
- package/src/outliers-selection/outliers-selection-viewer.ts +18 -21
- package/src/package-test.ts +1 -1
- package/src/package.ts +79 -76
- package/tsconfig.json +1 -1
- package/src/global.d.ts +0 -13
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.40.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aufar Zakiev",
|
|
7
7
|
"email": "aufar.zakiev@softwarecountry.com"
|
|
@@ -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.0",
|
|
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: {'
|
|
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: {'
|
|
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(
|
|
@@ -117,7 +117,7 @@ export class OutliersSelectionViewer extends DG.JsViewer {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
inputData.fireValuesChanged();
|
|
120
|
-
}, 'Remove the outliers group'), {style: {
|
|
120
|
+
}, 'Remove the outliers group'), {style: {textAlign: 'center', margin: '6px'}},
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
if (gc.gridColumn.name === 'Actions') {
|
|
@@ -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: {
|
|
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
|
});
|
|
@@ -184,6 +188,7 @@ let startUriLoaded = false;
|
|
|
184
188
|
//name: Model Catalog
|
|
185
189
|
//tags: app
|
|
186
190
|
//output: view v
|
|
191
|
+
//meta.browsePath: Compute
|
|
187
192
|
export function modelCatalog() {
|
|
188
193
|
// Separately process direct link access
|
|
189
194
|
const startOptionalPart = grok.shell.startUri.indexOf('?');
|
|
@@ -199,9 +204,8 @@ export function modelCatalog() {
|
|
|
199
204
|
|
|
200
205
|
if (startPathSegments.length > 3) {
|
|
201
206
|
grok.dapi.functions.filter(`shortName = "${startPathSegments[3]}" and #model`).list().then((lst) => {
|
|
202
|
-
if (lst.length == 1)
|
|
207
|
+
if (lst.length == 1)
|
|
203
208
|
ModelHandler.openModel(lst[0]);
|
|
204
|
-
}
|
|
205
209
|
});
|
|
206
210
|
}
|
|
207
211
|
|
|
@@ -217,23 +221,23 @@ export function modelCatalog() {
|
|
|
217
221
|
const view = ModelCatalogView.findModelCatalogView('modelCatalog');
|
|
218
222
|
|
|
219
223
|
// If there is existing view, then switch on it
|
|
220
|
-
if (view)
|
|
224
|
+
if (view)
|
|
221
225
|
grok.shell.v = view;
|
|
222
|
-
|
|
226
|
+
|
|
223
227
|
|
|
224
228
|
// Always return new with no subscribtions to show in Browse tree
|
|
225
229
|
const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
|
|
226
230
|
return newView;
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
|
|
233
|
+
// Separately process double-clicking on Model Catalog card
|
|
230
234
|
if (pathSegments.includes('apps')) {
|
|
231
235
|
const view = ModelCatalogView.findModelCatalogView('modelCatalog');
|
|
232
236
|
|
|
233
237
|
// If there is existing view, then switch on it
|
|
234
|
-
if (view)
|
|
238
|
+
if (view)
|
|
235
239
|
grok.shell.v = view;
|
|
236
|
-
|
|
240
|
+
else {
|
|
237
241
|
const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
|
|
238
242
|
grok.shell.addView(newView);
|
|
239
243
|
}
|
|
@@ -264,10 +268,10 @@ export function DesiredTempValidator(params: any) {
|
|
|
264
268
|
return makeValidationResultInst({
|
|
265
269
|
errors: [
|
|
266
270
|
...(val < ambTemp) ? [makeAdviceInst(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
|
|
267
|
-
{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},
|
|
268
272
|
])]: [],
|
|
269
273
|
...(val > initTemp) ? [`Desired temperature cannot be higher than initial temperature (${initTemp})`]: [],
|
|
270
|
-
]
|
|
274
|
+
],
|
|
271
275
|
});
|
|
272
276
|
};
|
|
273
277
|
}
|
|
@@ -281,7 +285,7 @@ export function InitialTempValidator(params: any) {
|
|
|
281
285
|
return makeValidationResultInst({
|
|
282
286
|
errors: [
|
|
283
287
|
...(val < ambTemp) ? [`Initial temperature cannot be less than ambient temperature (${ambTemp}).`]: [],
|
|
284
|
-
]
|
|
288
|
+
],
|
|
285
289
|
});
|
|
286
290
|
};
|
|
287
291
|
}
|
|
@@ -295,7 +299,7 @@ export function AmbTempValidator(params: any) {
|
|
|
295
299
|
return makeValidationResultInst({
|
|
296
300
|
errors: [
|
|
297
301
|
...(val > initTemp) ? [`Ambient temperature cannot be higher than initial temperature (${initTemp})`]: [],
|
|
298
|
-
]
|
|
302
|
+
],
|
|
299
303
|
});
|
|
300
304
|
};
|
|
301
305
|
}
|
|
@@ -307,13 +311,13 @@ export function HeatCapValidator(params: any) {
|
|
|
307
311
|
return (val: number, info: ValidationInfo) => {
|
|
308
312
|
return makeValidationResultInst({
|
|
309
313
|
errors: [
|
|
310
|
-
...val <= 0 ? ['Heat capacity must be greater than zero.']: []
|
|
314
|
+
...val <= 0 ? ['Heat capacity must be greater than zero.']: [],
|
|
311
315
|
],
|
|
312
316
|
notifications: [
|
|
313
317
|
makeAdviceInst(`Heat capacity is only dependent on the object material.`, [
|
|
314
|
-
{actionName: 'Google it', action: () => {
|
|
318
|
+
{actionName: 'Google it', action: () => {window.open(`http://google.com`);}},
|
|
315
319
|
]),
|
|
316
|
-
]
|
|
320
|
+
],
|
|
317
321
|
});
|
|
318
322
|
};
|
|
319
323
|
}
|
|
@@ -322,7 +326,7 @@ export function HeatCapValidator(params: any) {
|
|
|
322
326
|
//input: object params
|
|
323
327
|
//output: object input
|
|
324
328
|
export function CustomStringInput(params: any) {
|
|
325
|
-
const defaultInput = ui.input.string('Custom input', {value:''});
|
|
329
|
+
const defaultInput = ui.input.string('Custom input', {value: ''});
|
|
326
330
|
defaultInput.root.style.backgroundColor = 'aqua';
|
|
327
331
|
defaultInput.input.style.backgroundColor = 'aqua';
|
|
328
332
|
return defaultInput;
|
|
@@ -346,55 +350,55 @@ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browse
|
|
|
346
350
|
const modelSource = grok.dapi.functions.filter('(#model)');
|
|
347
351
|
const modelList = await modelSource.list();
|
|
348
352
|
const departments = modelList.reduce((acc, model) => {
|
|
349
|
-
if (model.options.department)
|
|
350
|
-
acc.add(model.options.department)
|
|
351
|
-
else
|
|
352
|
-
acc.add(NO_CATEGORY)
|
|
353
|
+
if (model.options.department)
|
|
354
|
+
acc.add(model.options.department);
|
|
355
|
+
else
|
|
356
|
+
acc.add(NO_CATEGORY);
|
|
353
357
|
return acc;
|
|
354
358
|
}, new Set([] as string[]));
|
|
355
|
-
|
|
359
|
+
|
|
356
360
|
const hlProcesses = modelList.reduce((acc, model) => {
|
|
357
|
-
if (model.options.HL_process)
|
|
358
|
-
acc.add(model.options.HL_process)
|
|
359
|
-
else
|
|
360
|
-
acc.add(NO_CATEGORY)
|
|
361
|
+
if (model.options.HL_process)
|
|
362
|
+
acc.add(model.options.HL_process);
|
|
363
|
+
else
|
|
364
|
+
acc.add(NO_CATEGORY);
|
|
361
365
|
return acc;
|
|
362
366
|
}, new Set([] as string[]));
|
|
363
367
|
|
|
364
368
|
const processes = modelList.reduce((acc, model) => {
|
|
365
|
-
if (model.options.process)
|
|
366
|
-
acc.add(model.options.process)
|
|
367
|
-
else
|
|
368
|
-
acc.add(NO_CATEGORY)
|
|
369
|
+
if (model.options.process)
|
|
370
|
+
acc.add(model.options.process);
|
|
371
|
+
else
|
|
372
|
+
acc.add(NO_CATEGORY);
|
|
369
373
|
return acc;
|
|
370
374
|
}, new Set([] as string[]));
|
|
371
375
|
|
|
372
376
|
for (const department of departments) {
|
|
373
377
|
const serverDep = (department !== NO_CATEGORY ? department: undefined);
|
|
374
|
-
const hasModelsDep = modelList.find((model) =>
|
|
375
|
-
model.options.department === serverDep
|
|
376
|
-
)
|
|
378
|
+
const hasModelsDep = modelList.find((model) =>
|
|
379
|
+
model.options.department === serverDep,
|
|
380
|
+
);
|
|
377
381
|
|
|
378
382
|
if (!hasModelsDep) continue;
|
|
379
383
|
|
|
380
|
-
const depNode = treeNode.getOrCreateGroup(department, null, false)
|
|
384
|
+
const depNode = treeNode.getOrCreateGroup(department, null, false);
|
|
381
385
|
for (const hlProcess of hlProcesses) {
|
|
382
386
|
const serverHlProcess = (hlProcess !== NO_CATEGORY ? hlProcess: undefined);
|
|
383
|
-
const hasModelsHl = modelList.find((model) =>
|
|
387
|
+
const hasModelsHl = modelList.find((model) =>
|
|
384
388
|
model.options.department === serverDep &&
|
|
385
|
-
model.options.HL_process === serverHlProcess
|
|
386
|
-
)
|
|
389
|
+
model.options.HL_process === serverHlProcess,
|
|
390
|
+
);
|
|
387
391
|
|
|
388
392
|
if (!hasModelsHl) continue;
|
|
389
393
|
|
|
390
394
|
const hlNode = hlProcess !== NO_CATEGORY ? depNode.getOrCreateGroup(hlProcess, null, false): depNode;
|
|
391
395
|
for (const process of processes) {
|
|
392
396
|
const serverProcess = (process !== NO_CATEGORY ? process: undefined);
|
|
393
|
-
const hasModels = modelList.find((model) =>
|
|
397
|
+
const hasModels = modelList.find((model) =>
|
|
394
398
|
model.options.department === serverDep &&
|
|
395
399
|
model.options.HL_process === serverHlProcess &&
|
|
396
|
-
model.options.process === serverProcess
|
|
397
|
-
)
|
|
400
|
+
model.options.process === serverProcess,
|
|
401
|
+
);
|
|
398
402
|
|
|
399
403
|
if (!hasModels) continue;
|
|
400
404
|
|
|
@@ -404,9 +408,9 @@ export async function modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browse
|
|
|
404
408
|
const depRules = department === NO_CATEGORY ? `(options.department = null)`: `(options.department in ("${department}"))`;
|
|
405
409
|
const hlProcessRules = hlProcess === NO_CATEGORY ? `(options.HL_process = null)`: `(options.HL_process in ("${hlProcess}"))`;
|
|
406
410
|
const processRules = process === NO_CATEGORY ? `(options.process = null)`: `(options.process in ("${process}"))`;
|
|
407
|
-
const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})
|
|
411
|
+
const filteringRules = `(${[modelRule, depRules, hlProcessRules, processRules].join(' and ')})`;
|
|
408
412
|
processNode.loadSources(grok.dapi.functions.filter(filteringRules));
|
|
409
|
-
})
|
|
413
|
+
});
|
|
410
414
|
}
|
|
411
415
|
}
|
|
412
416
|
}
|
|
@@ -418,7 +422,6 @@ export const testPipeline = testPipelineInst;
|
|
|
418
422
|
export const CompView = ComputationViewInst;
|
|
419
423
|
export const RFV = RichFunctionViewInst;
|
|
420
424
|
export const Pipeline = PipelineViewInst;
|
|
421
|
-
export const CompositionPipeline = CompositionPipelineViewInst;
|
|
422
425
|
export const makeValidationResult = makeValidationResultInst;
|
|
423
426
|
export const makeAdvice = makeAdviceInst;
|
|
424
427
|
export const makeRevalidation = makeRevalidationInst;
|
|
@@ -426,4 +429,4 @@ export const mergeValidationResults = mergeValidationResultsInst;
|
|
|
426
429
|
export const fileInput = UiUtils.fileInput;
|
|
427
430
|
export const historyInput = UiUtils.historyInput;
|
|
428
431
|
export const historyInputJSON = UiUtils.historyInputJSON;
|
|
429
|
-
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
|
-
}
|