@datagrok/api-samples 1.0.12 → 1.2.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 +5 -1
- package/README.md +2 -2
- package/dist/package-test.js +1848 -2
- package/dist/package.js +30 -2
- package/package.json +18 -17
- package/scripts/dapi/admin.js +5 -5
- package/scripts/dapi/applicable-layouts.js +3 -1
- package/scripts/dapi/fetch.js +8 -6
- package/scripts/dapi/files.js +7 -2
- package/scripts/dapi/projects-list.js +3 -3
- package/scripts/dapi/projects-open.js +4 -4
- package/scripts/dapi/who-am-i.js +10 -10
- package/scripts/data-access/db/ad-hoc-query.js +16 -0
- package/scripts/data-access/db/db-edit.js +6 -9
- package/scripts/data-access/{parameterized-query.js → db/parameterized-query.js} +3 -2
- package/scripts/data-access/db/query_builder_join.js +15 -0
- package/scripts/data-access/db/query_builder_simple.js +15 -0
- package/scripts/data-access/db-master-details-manual.js +9 -12
- package/scripts/data-access/external/stock-prices.js +2 -2
- package/scripts/data-access/files/file-exists.js +10 -0
- package/scripts/data-access/files/read-file.js +19 -0
- package/scripts/data-access/load-csv.js +2 -2
- package/scripts/data-access/save-and-load-df.js +6 -5
- package/scripts/data-frame/column-access.js +5 -1
- package/scripts/data-frame/columns-ordering.js +4 -0
- package/scripts/data-frame/construction/add-new-column.js +13 -0
- package/scripts/data-frame/construction/create-from-columns.js +4 -4
- package/scripts/data-frame/construction/date-time.js +24 -0
- package/scripts/data-frame/join-link/link-tables-dynamic.js +10 -9
- package/scripts/data-frame/join-link/link-tables.js +12 -8
- package/scripts/demo/med-chem.js +103 -0
- package/scripts/demo/stock-broker.js +1 -1
- package/scripts/domains/chem/chem-benchmark.js +0 -5
- package/scripts/domains/chem/descriptors.js +2 -4
- package/scripts/domains/chem/diversity-search.js +2 -4
- package/scripts/domains/chem/mcs.js +3 -3
- package/scripts/domains/chem/r-group.js +3 -3
- package/scripts/domains/chem/similarity-scoring-scores.js +3 -5
- package/scripts/domains/chem/similarity-scoring-sorted.js +3 -5
- package/scripts/domains/chem/substructure-search-smarts-molfile-als.js +11 -12
- package/scripts/domains/chem/substructure-search-smarts.js +4 -7
- package/scripts/domains/chem/substructure-search.js +5 -6
- package/scripts/domains/data-science/cluster.js +8 -10
- package/scripts/domains/data-science/missing-values-imputation.js +3 -3
- package/scripts/domains/data-science/pca.js +3 -3
- package/scripts/domains/data-science/predictive-model.js +4 -4
- package/scripts/domains/data-science/random-data.js +5 -6
- package/scripts/events/function-events.js +1 -1
- package/scripts/functions/caching-results.js +8 -9
- package/scripts/functions/calling.js +7 -10
- package/scripts/functions/func-call.js +4 -2
- package/scripts/functions/param-editor.js +1 -1
- package/scripts/functions/progress.js +2 -5
- package/scripts/functions/register-function.js +1 -1
- package/scripts/grid/advanced/column-groups.js +8 -0
- package/scripts/grid/advanced/dynamic-value-retrieval.js +12 -0
- package/scripts/grid/cell-types/tags-multi-cell.js +18 -0
- package/scripts/grid/color-coding/color-coding-conditional.js +1 -1
- package/scripts/grid/color-coding/color-coding.js +7 -4
- package/scripts/misc/audit/errors-summary.js +2 -2
- package/scripts/misc/audit/test-tracking.js +2 -2
- package/scripts/misc/audit/users-today.js +3 -5
- package/scripts/misc/package-credentials.js +2 -1
- package/scripts/performance/all-chembl-structures.js +2 -1
- package/scripts/scripting/grok-scripting.js +2 -3
- package/scripts/scripting/package-scripting.js +4 -2
- package/scripts/shell/windows/browse/customize-tree.js +1 -1
- package/scripts/ui/components/drop-down.js +8 -5
- package/scripts/ui/components/icons.js +7 -7
- package/scripts/ui/components/menu-advanced.js +85 -0
- package/scripts/ui/components/popup-menu.js +6 -5
- package/scripts/ui/components/summary-card.js +4 -3
- package/scripts/ui/containers/splitters.js +9 -17
- package/scripts/ui/handlers/markup-handlers.js +2 -3
- package/scripts/ui/inputs/advanced/all-input-types.js +21 -16
- package/scripts/ui/inputs/advanced/for-properties.js +1 -1
- package/scripts/ui/inputs/advanced/input-api.js +4 -5
- package/scripts/ui/inputs/advanced/input-form.js +5 -5
- package/scripts/ui/inputs/forms.js +5 -6
- package/scripts/ui/inputs/inputs.js +2 -2
- package/scripts/ui/inputs/validation/{visible-enabled.js → parameter-expressions.js} +1 -1
- package/scripts/ui/inputs/validation/{script-param-validation.js → parameter-validation.js} +2 -2
- package/scripts/ui/rendering/render-items.js +9 -9
- package/scripts/ui/tooltips/tooltip-events.js +2 -1
- package/scripts/ui/tooltips/tooltips.js +5 -0
- package/scripts/ui/viewers/advanced/descriptors.js +14 -0
- package/scripts/ui/viewers/filters/custom-filters.js +6 -5
- package/scripts/ui/viewers/js viewers/globe-viewer.js +7 -7
- package/scripts/ui/viewers/js viewers/surface-plot.js +19 -1
- package/scripts/ui/viewers/types/globe.js +2 -3
- package/scripts/ui/viewers/types/markup-advanced.js +1 -1
- package/scripts/ui/viewers/types/markup-eeg.js +5 -5
- package/scripts/ui/viewers/types/shape-map.js +4 -4
- package/scripts/ui/viewers/viewer-tooltips.js +1 -1
- package/scripts/ui/views/default-views.js +8 -7
- package/scripts/ui/widgets/widgets-tree.js +32 -0
- package/src/package-api.ts +8 -0
- package/src/package-test.ts +44 -31
- package/src/tests/owners.ts +8 -0
- package/test-console-output-1.log +6957 -0
- package/test-console-output-2.log +371 -0
- package/test-console-output-3.log +887 -0
- package/test-console-output-4.log +1085 -0
- package/test-console-output-5.log +944 -0
- package/test-console-output-6.log +2 -0
- package/test-record-1.mp4 +0 -0
- package/test-record-2.mp4 +0 -0
- package/test-record-3.mp4 +0 -0
- package/test-record-4.mp4 +0 -0
- package/test-record-5.mp4 +0 -0
- package/test-record-6.mp4 +0 -0
- package/to fix/dynamic-loading.js +6 -6
- package/tsconfig.json +1 -1
- package/scripts/misc/audit/activity-today.js +0 -4
- package/src/global.d.ts +0 -13
- /package/scripts/data-access/{dynamic-query.js → db/dynamic-query.js} +0 -0
- /package/scripts/grid/{cell-bounds.js → advanced/cell-bounds.js} +0 -0
- /package/scripts/grid/{hit-test.js → advanced/hit-test.js} +0 -0
- /package/scripts/grid/{category-colors.js → color-coding/category-colors.js} +0 -0
- /package/scripts/grid/{custom-cell-prepare.js → events/custom-cell-prepare.js} +0 -0
- /package/scripts/grid/{custom-cell-rendering-indexes.js → events/custom-cell-rendering-indexes.js} +0 -0
- /package/scripts/grid/{custom-cell-rendering.js → events/custom-cell-rendering.js} +0 -0
- /package/scripts/grid/{custom-cell-tooltip.js → events/custom-cell-tooltip.js} +0 -0
- /package/scripts/grid/{scroll-bars.js → navigate/scroll-bars.js} +0 -0
- /package/scripts/grid/{scroll-to-cell.js → navigate/scroll-to-cell.js} +0 -0
- /package/scripts/grid/{scroll-to-pixels.js → navigate/scroll-to-pixels.js} +0 -0
- /package/scripts/grid/{order-columns.js → order/order-columns.js} +0 -0
- /package/scripts/grid/{order-rows-by-comparer.js → order/order-rows-by-comparer.js} +0 -0
- /package/scripts/grid/{order-rows.js → order/order-rows.js} +0 -0
- /package/scripts/grid/{hide-columns.js → resize/hide-columns.js} +0 -0
- /package/scripts/grid/{resize-columns.js → resize/resize-columns.js} +0 -0
- /package/scripts/grid/{resize-events.js → resize/resize-events.js} +0 -0
- /package/scripts/grid/{column-cell-styles.js → styles/column-cell-styles.js} +0 -0
- /package/scripts/grid/{column-controlled-values.js → styles/column-controlled-values.js} +0 -0
- /package/scripts/grid/{data-format.js → styles/data-format.js} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Builds a visual tree of currently active widgets,
|
|
2
|
+
// along with the functions and properties that these widgets expose
|
|
3
|
+
|
|
4
|
+
function addWidgetToTree(widget, parentGroup) {
|
|
5
|
+
const label = widget.type + (widget.children.length === 0 ? '' : '(' + widget.children.length + ')');
|
|
6
|
+
const group = parentGroup.group(label, widget, false);
|
|
7
|
+
|
|
8
|
+
const functions = widget.getFunctions();
|
|
9
|
+
if (functions && functions.length > 0) {
|
|
10
|
+
const funcNode = group.group('Functions (' + functions.length + ')', null, false);
|
|
11
|
+
for (const f of functions)
|
|
12
|
+
funcNode.item(f.name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const properties = widget.getProperties();
|
|
16
|
+
if (properties && properties.length > 0) {
|
|
17
|
+
const propNode = group.group('Properties(' + properties.length + ')', null, false);
|
|
18
|
+
for (const p of properties)
|
|
19
|
+
propNode.item(p.name);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (widget.children)
|
|
23
|
+
for (const child of widget.children)
|
|
24
|
+
addWidgetToTree(child, group);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tree = DG.TreeViewGroup.tree();
|
|
28
|
+
for (const widget of DG.Widget.getAll())
|
|
29
|
+
if (widget.parent == null)
|
|
30
|
+
addWidgetToTree(widget, tree);
|
|
31
|
+
|
|
32
|
+
tree.root
|
package/src/package-test.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DataFrame, Script } from 'datagrok-api/dg';
|
|
2
|
+
import * as DG from 'datagrok-api/dg';
|
|
3
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
4
|
import { runTests, tests, TestContext, category, test as _test, delay, initAutoTests as initCoreTests, expect, awaitCheck, before } from '@datagrok-libraries/utils/src/test';
|
|
5
|
+
import { categoryOwners } from './tests/owners';
|
|
3
6
|
export const _package = new DG.Package();
|
|
4
7
|
export { tests };
|
|
5
8
|
|
|
@@ -9,6 +12,7 @@ const skip = [
|
|
|
9
12
|
// Skipped
|
|
10
13
|
'function-events', 'demo', 'ui-events', 'last-error', 'chem-benchmark',
|
|
11
14
|
'menu-customization', '10k-columns-updates', '100-million-rows',
|
|
15
|
+
'sticky-meta-1-tags', 'sticky-meta-2-semtype', /* skipped as they spawn persisting data */
|
|
12
16
|
'files' /* do not test manually */,
|
|
13
17
|
|
|
14
18
|
// To fix
|
|
@@ -35,10 +39,9 @@ const skip = [
|
|
|
35
39
|
];
|
|
36
40
|
|
|
37
41
|
const scriptViewer = [
|
|
38
|
-
'
|
|
39
|
-
'parameter
|
|
40
|
-
'
|
|
41
|
-
'docking',
|
|
42
|
+
'parameter-validation',
|
|
43
|
+
'parameter-expressions',
|
|
44
|
+
'docking',
|
|
42
45
|
'input-api',
|
|
43
46
|
'helm-input-ui',
|
|
44
47
|
'output-layouts'
|
|
@@ -58,41 +61,50 @@ interface ScriptObject {
|
|
|
58
61
|
[key: string]: () => Promise<void>;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
let beforeArr
|
|
62
|
-
['Scripts:ui:inputs']
|
|
63
|
-
await grok.functions.call("Helm:getHelmHelper");
|
|
64
|
+
let beforeArr: ScriptObject = {
|
|
65
|
+
['Scripts:ui:inputs']: async () => {
|
|
66
|
+
await grok.functions.call("Helm:getHelmHelper");
|
|
67
|
+
}
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
let beforeArrAdded
|
|
70
|
+
let beforeArrAdded: string[] = [];
|
|
67
71
|
|
|
72
|
+
let initStarted: boolean = false;
|
|
68
73
|
//tags: init
|
|
69
74
|
export async function initTests() {
|
|
70
75
|
|
|
76
|
+
if (initStarted)
|
|
77
|
+
return;
|
|
78
|
+
initStarted = true;
|
|
71
79
|
const scripts = await grok.dapi.scripts.filter('package.shortName = "ApiSamples"').list();
|
|
72
80
|
for (const script of scripts) {
|
|
73
81
|
let catName = ('Scripts:' + script.options.path as string).replaceAll('/', ':');
|
|
82
|
+
let owner: string | undefined;
|
|
83
|
+
let fullCatName = catName + ':' + script.friendlyName;
|
|
84
|
+
for (let category of Object.keys(categoryOwners))
|
|
85
|
+
if (fullCatName.startsWith(category))
|
|
86
|
+
owner = categoryOwners[category];
|
|
74
87
|
category(catName, () => {
|
|
75
|
-
if(!beforeArrAdded.includes(catName) && beforeArr[catName.replaceAll(' ', '')]){
|
|
76
|
-
before(async ()=>{
|
|
88
|
+
if (!beforeArrAdded.includes(catName) && beforeArr[catName.replaceAll(' ', '')]) {
|
|
89
|
+
before(async () => {
|
|
77
90
|
await beforeArr[catName.replaceAll(' ', '')]();
|
|
78
91
|
})
|
|
79
92
|
beforeArrAdded.push(catName);
|
|
80
93
|
}
|
|
81
|
-
|
|
94
|
+
|
|
82
95
|
_test(script.friendlyName, async () => {
|
|
83
96
|
|
|
84
97
|
const annotation = `//name: ${script.friendlyName}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
debugger
|
|
98
|
+
//language: javascript`;
|
|
99
|
+
// debugger
|
|
88
100
|
if (scriptViewer.includes(script.friendlyName))
|
|
89
101
|
await runScriptViewer(script);
|
|
90
102
|
else
|
|
91
103
|
await evaluateScript(script);
|
|
92
104
|
grok.shell.closeAll();
|
|
93
105
|
|
|
94
|
-
async function runScriptViewer(script: Script) {
|
|
95
|
-
const scriptResult = new Promise<boolean>(async (resolve) => {
|
|
106
|
+
async function runScriptViewer(script: Script) {
|
|
107
|
+
const scriptResult = new Promise<boolean>(async (resolve) => {
|
|
96
108
|
script.script = `${annotation}\n${script.script}`;
|
|
97
109
|
const scriptView = DG.ScriptView.create(script);
|
|
98
110
|
grok.shell.addView(scriptView);
|
|
@@ -101,19 +113,31 @@ export async function initTests() {
|
|
|
101
113
|
if ((funcCall.func as any).script === script.script.replaceAll('\r', '')) {
|
|
102
114
|
if (timeout)
|
|
103
115
|
clearTimeout(timeout);
|
|
116
|
+
if (formInterval)
|
|
117
|
+
clearInterval(formInterval);
|
|
104
118
|
subscription.unsubscribe();
|
|
105
119
|
scriptView.close();
|
|
106
120
|
resolve(true);
|
|
107
121
|
}
|
|
108
122
|
});
|
|
109
123
|
await delay(1000);
|
|
110
|
-
(
|
|
111
|
-
|
|
124
|
+
let formInterval = setInterval(() => {
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
let buttonOk : HTMLElement= Array.from(document.querySelectorAll('.ui-btn.ui-btn-ok'))
|
|
127
|
+
.find((el) => el.textContent === 'OK') as HTMLElement;
|
|
128
|
+
if (buttonOk)
|
|
129
|
+
buttonOk.click();
|
|
130
|
+
}, 1000);
|
|
112
131
|
timeout = setTimeout(() => {
|
|
113
132
|
subscription.unsubscribe();
|
|
114
133
|
scriptView.close();
|
|
134
|
+
if (formInterval)
|
|
135
|
+
clearInterval(formInterval);
|
|
115
136
|
resolve(false);
|
|
116
137
|
}, 10000);
|
|
138
|
+
(document.getElementsByClassName("fa-play")[0] as any).click();
|
|
139
|
+
await delay(1000);
|
|
140
|
+
|
|
117
141
|
})
|
|
118
142
|
|
|
119
143
|
if (!(await scriptResult))
|
|
@@ -121,21 +145,10 @@ export async function initTests() {
|
|
|
121
145
|
}
|
|
122
146
|
|
|
123
147
|
async function evaluateScript(script: Script) {
|
|
124
|
-
let timeout: any;
|
|
125
|
-
const subscription = grok.functions.onAfterRunAction.subscribe((funcCall) => {
|
|
126
|
-
if ((funcCall.func as any).script === script.script.replaceAll('\r', '')) {
|
|
127
|
-
if (timeout)
|
|
128
|
-
clearTimeout(timeout);
|
|
129
|
-
subscription.unsubscribe();
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
148
|
await script.apply();
|
|
133
|
-
|
|
134
|
-
subscription.unsubscribe();
|
|
135
|
-
throw new Error('Script didnt pass');
|
|
136
|
-
}, 10000);
|
|
149
|
+
await delay(300);
|
|
137
150
|
}
|
|
138
|
-
}, skip.includes(script.friendlyName) ? { skipReason: 'skip' } : { timeout: 60000 });
|
|
151
|
+
}, skip.includes(script.friendlyName) ? { skipReason: 'skip', owner: owner } : { timeout: 60000, owner: owner });
|
|
139
152
|
});
|
|
140
153
|
}
|
|
141
154
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const categoryOwners: {[k: string]: string} = {
|
|
2
|
+
'Scripts:grid': 'dkovalyov@datagrok.ai',
|
|
3
|
+
'Scripts:performance:1-million-columns': 'dkovalyov@datagrok.ai',
|
|
4
|
+
'Scripts:performance:100-million-rows': 'dkovalyov@datagrok.ai',
|
|
5
|
+
'Scripts:ui:components:breadcrumbs': 'dkovalyov@datagrok.ai',
|
|
6
|
+
'Scripts:ui:inputs': 'dkovalyov@datagrok.ai',
|
|
7
|
+
'Scripts:ui:viewers': 'dkovalyov@datagrok.ai',
|
|
8
|
+
};
|