@datagrok/hit-triage 1.10.9 → 1.11.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/.grokignore +2 -0
- package/.turbo/turbo-build.log +25 -3
- package/CHANGELOG.md +78 -0
- package/CLAUDE.md +87 -10
- package/README_HD.md +14 -14
- package/README_HT.md +6 -6
- package/README_PH.md +110 -0
- package/bdd/bdd.config.json +3 -1
- package/bdd/bindings/campaign.ts +626 -0
- package/bdd/bindings/hit-design.ts +36 -42
- package/bdd/bindings/landing.ts +839 -0
- package/bdd/bindings/pepti-hit.ts +35 -0
- package/bdd/features/campaign/crumbs.feature +22 -0
- package/bdd/features/campaign/grid.feature +56 -0
- package/bdd/features/campaign/merge.feature +105 -0
- package/bdd/features/campaign/molecule-vid.feature +40 -0
- package/bdd/features/campaign/permissions.feature +46 -0
- package/bdd/features/campaign/progress-tracker.feature +89 -0
- package/bdd/features/campaign/refresh-hint.feature +33 -0
- package/bdd/features/campaign/ribbon.feature +49 -0
- package/bdd/features/campaign/stage-choices.feature +39 -0
- package/bdd/features/campaign/submit.feature +135 -0
- package/bdd/features/campaign/tracker-cards.feature +46 -0
- package/bdd/features/campaign/view-only.feature +37 -0
- package/bdd/features/landing/campaign-deep-links.feature +61 -0
- package/bdd/features/landing/hit-design-campaigns-fixes.feature +116 -0
- package/bdd/features/landing/hit-design-campaigns.feature +153 -0
- package/bdd/features/landing/hit-triage-campaigns.feature +99 -0
- package/bdd/features/landing/new-campaign.feature +69 -0
- package/bdd/features/landing/pep-triage-campaigns.feature +41 -0
- package/bdd/features/landing/pepti-hit-landing.feature +132 -0
- package/bdd/features/pepti-hit/helm-edit.feature +47 -0
- package/bdd/features/templates/template-editor.feature +130 -0
- package/bdd/features/templates/template-picker.feature +112 -0
- package/bdd/features/templates/triage-forms.feature +59 -0
- package/bdd/fixtures/bar-chart.layout +1 -0
- package/bdd/fixtures/merge-local.csv +2 -0
- package/bdd/generated/campaign/crumbs.test.ts +33 -0
- package/bdd/generated/campaign/grid.test.ts +79 -0
- package/bdd/generated/campaign/merge.test.ts +134 -0
- package/bdd/generated/campaign/molecule-vid.test.ts +52 -0
- package/bdd/generated/campaign/permissions.test.ts +58 -0
- package/bdd/generated/campaign/progress-tracker.test.ts +129 -0
- package/bdd/generated/campaign/refresh-hint.test.ts +44 -0
- package/bdd/generated/campaign/ribbon.test.ts +65 -0
- package/bdd/generated/campaign/stage-choices.test.ts +55 -0
- package/bdd/generated/campaign/submit.test.ts +167 -0
- package/bdd/generated/campaign/tracker-cards.test.ts +49 -0
- package/bdd/generated/campaign/view-only.test.ts +51 -0
- package/bdd/generated/hit-design/campaign-column-metadata.test.ts +1 -0
- package/bdd/generated/landing/campaign-deep-links.test.ts +68 -0
- package/bdd/generated/landing/hit-design-campaigns-fixes.test.ts +99 -0
- package/bdd/generated/landing/hit-design-campaigns.test.ts +160 -0
- package/bdd/generated/landing/hit-triage-campaigns.test.ts +107 -0
- package/bdd/generated/landing/new-campaign.test.ts +78 -0
- package/bdd/generated/landing/pep-triage-campaigns.test.ts +52 -0
- package/bdd/generated/landing/pepti-hit-landing.test.ts +130 -0
- package/bdd/generated/pepti-hit/helm-edit.test.ts +64 -0
- package/bdd/generated/templates/template-editor.test.ts +137 -0
- package/bdd/generated/templates/template-picker.test.ts +119 -0
- package/bdd/generated/templates/triage-forms.test.ts +68 -0
- package/css/hit-triage.css +27 -23
- package/dist/package-test.js +690 -4
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +318 -73
- package/dist/package.js.map +1 -1
- package/package.json +11 -7
- package/queries/locks.sql +37 -0
- package/src/app/accordeons/layout-input.ts +52 -44
- package/src/app/accordeons/new-campaign-accordeon.ts +91 -54
- package/src/app/accordeons/new-hit-design-campaign-accordeon.ts +3 -67
- package/src/app/accordeons/new-pep-triage-template-accordeon.ts +39 -41
- package/src/app/accordeons/new-template-accordeon.ts +41 -24
- package/src/app/ai/view-functions.ts +22 -19
- package/src/app/base-view.ts +99 -8
- package/src/app/consts.ts +8 -5
- package/src/app/dialogs/functions-dialog.ts +14 -9
- package/src/app/dialogs/merge-table-dialog.ts +181 -325
- package/src/app/hit-app-base.ts +61 -90
- package/src/app/hit-design-app.ts +481 -886
- package/src/app/hit-design-views/info-view.ts +57 -407
- package/src/app/hit-design-views/submit-view.ts +216 -111
- package/src/app/hit-design-views/tiles-view.ts +168 -123
- package/src/app/hit-design-views/utils.css +0 -8
- package/src/app/hit-triage-app.ts +69 -38
- package/src/app/hit-triage-views/info-view.ts +70 -371
- package/src/app/pep-triage-app.ts +2 -2
- package/src/app/pep-triage-views/info-view.ts +42 -83
- package/src/app/pepti-hit-app.ts +32 -183
- package/src/app/pepti-hits-views/info-view.ts +15 -37
- package/src/app/shared/campaign-catalog.ts +408 -0
- package/src/app/shared/campaign-session.ts +557 -0
- package/src/app/shared/compute-editor.ts +274 -0
- package/src/app/shared/hit-home.ts +45 -0
- package/src/app/shared/new-campaign-form.ts +90 -0
- package/src/app/shared/permissions-editor.ts +93 -0
- package/src/app/shared/template-editor.ts +331 -0
- package/src/app/shared/template-picker.ts +154 -0
- package/src/app/utils/merge-table.ts +183 -78
- package/src/app/utils.ts +34 -325
- package/src/package-api.ts +29 -8
- package/src/package-test.ts +17 -2
- package/src/package.g.ts +12 -8
- package/src/package.ts +19 -7
- package/src/tests/ai.ts +244 -0
- package/src/tests/campaign-layout.ts +82 -0
- package/src/tests/campaign-session.ts +168 -0
- package/src/tests/campaigns.ts +23 -0
- package/src/tests/catalog.ts +156 -0
- package/src/tests/compat.ts +482 -0
- package/src/tests/compute.ts +165 -0
- package/src/tests/fixtures.ts +359 -0
- package/src/tests/merge.ts +149 -0
- package/src/tests/owners.ts +11 -0
- package/src/tests/save-lock.ts +932 -0
- package/src/tests/storage.ts +106 -0
- package/src/tests/template-editor.ts +538 -0
- package/src/tests/templates.ts +143 -0
- package/src/tests/triage-start.ts +81 -0
- package/src/tests/u2-guards.ts +384 -0
- package/src/tests/vid.ts +77 -0
- package/src/app/accordeons/new-hit-design-template-accordeon.ts +0 -238
- package/src/app/dialogs/permissions-dialog.ts +0 -66
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as DG from 'datagrok-api/dg';
|
|
3
|
+
import {category, expect, test, waitUntil} from '@datagrok-libraries/test/src/test';
|
|
4
|
+
import {byKind, byName, expectOperable, state, u2test, user} from '@datagrok-libraries/u2/testing';
|
|
5
|
+
import {openMergeTableDialog} from '../app/dialogs/merge-table-dialog';
|
|
6
|
+
import {HitDesignApp} from '../app/hit-design-app';
|
|
7
|
+
import {designCampaign, designCsv, expectSame, noComputeTemplate, Sandbox} from './fixtures';
|
|
8
|
+
|
|
9
|
+
type Host = Parameters<typeof openMergeTableDialog>[1];
|
|
10
|
+
|
|
11
|
+
const host = (app: HitDesignApp) => (app as unknown as {_session: {host: Host}})._session.host;
|
|
12
|
+
|
|
13
|
+
// a table saved after a filter or a search read its molecules carries Chem's twin
|
|
14
|
+
const TWIN_HEADER = '~Molecule.canonicalSmiles,Molecule,V-iD,Note';
|
|
15
|
+
|
|
16
|
+
const OPTIONS = ['merge-by', 'molecule-column', 'vid-column', 'add-rows', 'run-compute', 'on-clash', 'auto-merge'];
|
|
17
|
+
|
|
18
|
+
async function mergeDialog(sb: Sandbox, mergeConfig?: object): Promise<{app: HitDesignApp, dialog: HTMLElement,
|
|
19
|
+
filePath: string}> {
|
|
20
|
+
const t = noComputeTemplate('ZZB3 Merge', 'ZZB3');
|
|
21
|
+
await sb.writeTemplate(t);
|
|
22
|
+
const filePath = `System:AppData/HitTriage/${sb.appName}/merge-source.csv`;
|
|
23
|
+
await grok.dapi.files.writeAsText(filePath, 'Molecule,V-iD,Note\nOCC,,merged\n');
|
|
24
|
+
await sb.writeCampaign(designCampaign(sb, 'ZZB3-1', t, mergeConfig ? {mergeConfig} : {}), designCsv);
|
|
25
|
+
const app = await sb.hitDesign();
|
|
26
|
+
await sb.openDesign(app, 'ZZB3-1');
|
|
27
|
+
await openMergeTableDialog(app, host(app));
|
|
28
|
+
return {app, dialog: byKind(document, 'dialog').find((d) => state(d).name === 'merge-table')!, filePath};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const checkbox = (dialog: HTMLElement, name: string) => byName(dialog, name).querySelector('input')!;
|
|
32
|
+
|
|
33
|
+
async function typePath(dialog: HTMLElement, filePath: string): Promise<void> {
|
|
34
|
+
user.type(byName(dialog, 'source-file'), filePath);
|
|
35
|
+
await waitUntil(() => state(byName(dialog, 'molecule-column')).value === 'Molecule',
|
|
36
|
+
'the typed share file was never read', 15000);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
category('Campaign view: merge', () => {
|
|
40
|
+
test('Merge with table neither offers nor picks a hidden column of the incoming table', u2test(async () => {
|
|
41
|
+
const sb = await Sandbox.create('merge');
|
|
42
|
+
try {
|
|
43
|
+
const t = noComputeTemplate('ZZB3 Merge', 'ZZB3');
|
|
44
|
+
await sb.writeTemplate(t);
|
|
45
|
+
const filePath = `System:AppData/HitTriage/${sb.appName}/merge-source.csv`;
|
|
46
|
+
await grok.dapi.files.writeAsText(filePath, `${TWIN_HEADER}\nOCC,OCC,,merged\n`);
|
|
47
|
+
await sb.writeCampaign(designCampaign(sb, 'ZZB3-1', t, {mergeConfig: {mode: 'smiles', filePath,
|
|
48
|
+
addNewRows: false, runComputeOnNewRows: false, clashStrategy: 'skip'}}), designCsv);
|
|
49
|
+
const app = await sb.hitDesign();
|
|
50
|
+
await sb.openDesign(app, 'ZZB3-1');
|
|
51
|
+
await openMergeTableDialog(app, host(app));
|
|
52
|
+
const dialog = byKind(document, 'dialog').find((d) => state(d).name === 'merge-table')!;
|
|
53
|
+
const offered = (name: string) => state(byName(dialog, name)).items?.list.map((i) => i.label) ?? [];
|
|
54
|
+
await waitUntil(() => offered('molecule-column').length > 1, 'the dialog never listed the file\'s columns',
|
|
55
|
+
15000);
|
|
56
|
+
const columns = ['(none)', 'Molecule', 'V-iD', 'Note'];
|
|
57
|
+
expectSame(offered('molecule-column'), columns, 'Molecule column (incoming) choices');
|
|
58
|
+
expectSame(offered('vid-column'), columns, 'V-iD column (incoming) choices');
|
|
59
|
+
expectSame([state(byName(dialog, 'molecule-column')).value, state(byName(dialog, 'vid-column')).value],
|
|
60
|
+
['Molecule', 'V-iD'], 'the columns picked by default');
|
|
61
|
+
user.click(byName(dialog, 'Cancel'));
|
|
62
|
+
await waitUntil(() => !dialog.isConnected, 'CANCEL left the dialog open');
|
|
63
|
+
} finally {
|
|
64
|
+
await sb.dispose();
|
|
65
|
+
}
|
|
66
|
+
}), {timeout: 120000});
|
|
67
|
+
|
|
68
|
+
test('a merge carries no hidden column of the incoming table into the campaign: Auto-merge on open, a dropped table',
|
|
69
|
+
async () => {
|
|
70
|
+
const sb = await Sandbox.create('merge');
|
|
71
|
+
try {
|
|
72
|
+
const t = noComputeTemplate('ZZB3 Merge', 'ZZB3');
|
|
73
|
+
await sb.writeTemplate(t);
|
|
74
|
+
const filePath = `System:AppData/HitTriage/${sb.appName}/merge-source.csv`;
|
|
75
|
+
await grok.dapi.files.writeAsText(filePath, `${TWIN_HEADER}\nOCC,OCC,,merged\n`);
|
|
76
|
+
await sb.writeCampaign(designCampaign(sb, 'ZZB3-1', t, {mergeConfig: {mode: 'smiles', filePath,
|
|
77
|
+
molColName: 'Molecule', addNewRows: false, runComputeOnNewRows: false, clashStrategy: 'overwrite',
|
|
78
|
+
autoMergeOnOpen: true}}), designCsv);
|
|
79
|
+
const app = await sb.hitDesign();
|
|
80
|
+
await sb.openDesign(app, 'ZZB3-1');
|
|
81
|
+
const hidden = () => app.dataFrame!.columns.names().filter((n) => n.startsWith('~'));
|
|
82
|
+
expect(app.dataFrame!.get('Note', 0), 'merged', 'the file\'s value in the matched row (OCC is CCO)');
|
|
83
|
+
expectSame(hidden(), [], 'hidden columns of the campaign\'s table after Auto-merge on open');
|
|
84
|
+
const dropped = DG.DataFrame.fromCsv(`${TWIN_HEADER}\nCCN,CCN,,dropped\n`);
|
|
85
|
+
await grok.data.detectSemanticTypes(dropped);
|
|
86
|
+
await app.handleJoiningDataframe(dropped);
|
|
87
|
+
expect(app.dataFrame!.get('Note', app.dataFrame!.rowCount - 1), 'dropped', 'the dropped table\'s row added');
|
|
88
|
+
expectSame(hidden(), [], 'hidden columns of the campaign\'s table after a dropped table');
|
|
89
|
+
} finally {
|
|
90
|
+
await sb.dispose();
|
|
91
|
+
}
|
|
92
|
+
}, {timeout: 120000});
|
|
93
|
+
|
|
94
|
+
test('Merge with table: an option that is off says why, as the file, the key and Add unmatched rows decide',
|
|
95
|
+
u2test(async () => {
|
|
96
|
+
const sb = await Sandbox.create('merge');
|
|
97
|
+
try {
|
|
98
|
+
const {dialog, filePath} = await mergeDialog(sb);
|
|
99
|
+
const why = () => Object.fromEntries(OPTIONS.map((n) => [n, state(byName(dialog, n)).disabledReason ?? null]));
|
|
100
|
+
const ok = () => byName(dialog, 'OK').getAttribute('aria-description');
|
|
101
|
+
const first = 'Pick a source file first';
|
|
102
|
+
expectOperable(dialog);
|
|
103
|
+
expectSame(why(), Object.fromEntries(OPTIONS.map((n) => [n, first])), 'why each option is off before a file');
|
|
104
|
+
expect(ok(), 'Pick a source file to merge from.', 'why OK is off before a file');
|
|
105
|
+
await typePath(dialog, filePath);
|
|
106
|
+
expectSame(why(), Object.fromEntries(OPTIONS.map((n) => [n, null])), 'what is off with a share file, by V-iD');
|
|
107
|
+
user.pick(byName(dialog, 'merge-by'), 'By canonical SMILES');
|
|
108
|
+
user.click(checkbox(dialog, 'add-rows'));
|
|
109
|
+
expectSame(why(), {...Object.fromEntries(OPTIONS.map((n) => [n, null])),
|
|
110
|
+
'vid-column': 'Used only when merging by V-iD', 'run-compute': 'Turn on Add unmatched rows first'},
|
|
111
|
+
'what is off by canonical SMILES, with no unmatched rows added');
|
|
112
|
+
user.pick(byName(dialog, 'molecule-column'), '(none)');
|
|
113
|
+
expectSame(why(), {...Object.fromEntries(OPTIONS.map((n) => [n, null])),
|
|
114
|
+
'vid-column': 'Used only when merging by V-iD', 'add-rows': 'Pick the molecule column (incoming) first',
|
|
115
|
+
'run-compute': 'Pick the molecule column (incoming) first'}, 'what is off with no molecule column');
|
|
116
|
+
expect(ok(), 'Pick the molecule column from the incoming table.', 'why OK is off with no molecule column');
|
|
117
|
+
expectOperable(dialog);
|
|
118
|
+
user.click(byName(dialog, 'Cancel'));
|
|
119
|
+
await waitUntil(() => !dialog.isConnected, 'CANCEL left the dialog open');
|
|
120
|
+
} finally {
|
|
121
|
+
await sb.dispose();
|
|
122
|
+
}
|
|
123
|
+
}), {timeout: 120000});
|
|
124
|
+
|
|
125
|
+
test('Merge with table: Source file offers the platform\'s Files; a share file is kept to merge again on open',
|
|
126
|
+
u2test(async () => {
|
|
127
|
+
const sb = await Sandbox.create('merge');
|
|
128
|
+
try {
|
|
129
|
+
const {app, dialog, filePath} = await mergeDialog(sb);
|
|
130
|
+
const filesDialog = () => DG.Dialog.getOpenDialogs().find((d) => d.title === 'Select a file');
|
|
131
|
+
user.click(byName(dialog, 'Add file from Files'));
|
|
132
|
+
await waitUntil(() => filesDialog() !== undefined, 'Add file from Files opened no "Select a file"', 15000);
|
|
133
|
+
filesDialog()!.close();
|
|
134
|
+
await waitUntil(() => filesDialog() === undefined, '"Select a file" stayed open', 10000);
|
|
135
|
+
expect(state(byName(dialog, 'source-file')).value ?? null, null, 'nothing picked: the box stays empty');
|
|
136
|
+
await typePath(dialog, filePath);
|
|
137
|
+
user.pick(byName(dialog, 'merge-by'), 'By canonical SMILES');
|
|
138
|
+
user.click(checkbox(dialog, 'auto-merge'));
|
|
139
|
+
user.click(byName(dialog, 'OK'));
|
|
140
|
+
await waitUntil(() => !dialog.isConnected, 'OK left the dialog open', 30000);
|
|
141
|
+
await sb.savesDone();
|
|
142
|
+
expect(app.dataFrame!.get('Note', 0), 'merged', 'the file\'s value in the matched row (OCC is CCO)');
|
|
143
|
+
const kept = (await sb.readCampaign('ZZB3-1')).mergeConfig;
|
|
144
|
+
expectSame([kept?.filePath, kept?.autoMergeOnOpen], [filePath, true], 'the file the campaign merges on open');
|
|
145
|
+
} finally {
|
|
146
|
+
await sb.dispose();
|
|
147
|
+
}
|
|
148
|
+
}), {timeout: 120000});
|
|
149
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {Scope} from '@datagrok-libraries/u2';
|
|
2
|
+
import type {Component} from '@datagrok-libraries/u2';
|
|
3
|
+
|
|
4
|
+
/** What a test builds outside any view: [build]'s component on a root of its own (`Scope.root(label)`), ended with
|
|
5
|
+
* it. */
|
|
6
|
+
export function onRoot<C extends Component>(label: string, build: () => C): C {
|
|
7
|
+
const owner = Scope.root(label);
|
|
8
|
+
const built = owner.build(build);
|
|
9
|
+
built.own(() => owner.dispose());
|
|
10
|
+
return built;
|
|
11
|
+
}
|