@datagrok/compute 1.22.0 → 1.24.0

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.22.0",
4
+ "version": "1.24.0",
5
5
  "author": {
6
6
  "name": "Aufar Zakiev",
7
7
  "email": "aufar.zakiev@softwarecountry.com"
@@ -13,7 +13,8 @@
13
13
  "directory": "packages/Compute"
14
14
  },
15
15
  "dependencies": {
16
- "@datagrok-libraries/compute-utils": "^1.22.0",
16
+ "rxjs": "^6.6.7",
17
+ "@datagrok-libraries/compute-utils": "^1.24.0",
17
18
  "cash-dom": "latest",
18
19
  "datagrok-api": "^1.17.0",
19
20
  "source-map-loader": "^4.0.1",
@@ -19,6 +19,7 @@
19
19
  //meta.runOnInput: true
20
20
  //meta.foldedCategories: ["Object properties"]
21
21
  //meta.compareCustomizer: Compute:CustomCustomizer
22
+ //meta.uploadFunc: Compute:CustomUploader
22
23
 
23
24
  timeToCool = undefined;
24
25
 
package/src/package.ts CHANGED
@@ -2,6 +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} from 'rxjs/operators';
5
6
  import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
6
7
  import {RichFunctionView} from "@datagrok-libraries/compute-utils";
7
8
  import { ValidationInfo, makeAdvice, makeValidationResult } from '@datagrok-libraries/compute-utils/shared-utils/validation';
@@ -88,6 +89,56 @@ export function autostart() {
88
89
 
89
90
  }
90
91
 
92
+ //name: CustomDataUploader
93
+ //input: func func
94
+ //output: object uploadedCalls
95
+ export async function CustomDataUploader(func: DG.Func) {
96
+ await new Promise((r) => setTimeout(r, 1000));
97
+
98
+ const dummyFunccall = await func.prepare({
99
+ 'ambTemp': 22,
100
+ 'initTemp': 100,
101
+ 'desiredTemp': 30,
102
+ 'area': 0.06,
103
+ 'heatCap': 4200,
104
+ 'heatTransferCoeff': 8.3,
105
+ 'simTime': 21600,
106
+ }).call();
107
+
108
+ return [dummyFunccall]
109
+ }
110
+
111
+ //name: CustomUploader
112
+ //input: object params
113
+ //output: widget uploadWidget
114
+ //output: funccall uploadFuncCall
115
+ export async function CustomUploader(params: {func: DG.Func}) {
116
+ const uploadFunc = await grok.functions.eval('Compute:CustomDataUploader') as DG.Func;
117
+ const uploadFuncCall = uploadFunc.prepare({func: params.func})
118
+ const uploadBtn = ui.bigButton('Click me to get mock calls', () => uploadFuncCall.call());
119
+
120
+ const dummyWidget = DG.Widget.fromRoot(ui.panel([ui.divV([
121
+ ui.label('This part of dialog comes from my custom data uploader'),
122
+ ui.divH([uploadBtn], {style: {'justify-content': 'center'}})
123
+ ])]));
124
+
125
+ const setLoadingSub = grok.functions.onBeforeRunAction.pipe(
126
+ filter((call) => call.id === uploadFuncCall.id)
127
+ ).subscribe(() => {
128
+ ui.setUpdateIndicator(uploadBtn, true);
129
+ })
130
+
131
+ const unsetLoadingSub = grok.functions.onAfterRunAction.pipe(
132
+ filter((call) => call.id === uploadFuncCall.id)
133
+ ).subscribe(() => {
134
+ ui.setUpdateIndicator(uploadBtn, false);
135
+ })
136
+
137
+ dummyWidget.subs.push(setLoadingSub, unsetLoadingSub)
138
+
139
+ return {uploadWidget: dummyWidget, uploadFuncCall};
140
+ }
141
+
91
142
  //name: CustomCustomizer
92
143
  //input: object params
93
144
  export function CustomCustomizer(params: {defaultView: DG.TableView}) {