@datagrok/hit-triage 1.10.8 → 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 +24 -6
- package/.vscode/settings.json +16 -0
- package/CHANGELOG.md +80 -1
- 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 -0
- package/bdd/bindings/campaign.ts +626 -0
- package/bdd/bindings/hit-design.ts +93 -0
- 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/hit-design/campaign-column-metadata.feature +61 -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 +76 -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/bdd/package.json +1 -0
- package/bdd/tsconfig.json +13 -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 +15 -8
- 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 +492 -882
- 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/types.ts +2 -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/tsconfig.json +3 -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,93 @@
|
|
|
1
|
+
/* Hit Design's campaigns, as the features use them. A campaign is two files on the AppData share
|
|
2
|
+
(campaign.json and its table, enriched_table.csv), and every save also writes its row in the
|
|
3
|
+
hitdesign database's update log (a molecule edit would register V-iDs as well, which these features
|
|
4
|
+
never do). The campaign a feature uses is made for it through the JS API, the template embedded the
|
|
5
|
+
way a saved campaign carries it, and removed at feature end: its folder, and its rows in the
|
|
6
|
+
package's database, read back until they are gone. A run killed before its end is swept up when the
|
|
7
|
+
next one starts. */
|
|
8
|
+
import {Page} from '@playwright/test';
|
|
9
|
+
import {Given, When} from '@datagrok-libraries/bdd';
|
|
10
|
+
import {type ElementRef, atFeatureEnd, expect, gestures, locate, pollMs} from '@datagrok-libraries/bdd/runtime';
|
|
11
|
+
import {keyOf, removedAndReadBack} from './campaign.js';
|
|
12
|
+
|
|
13
|
+
declare const grok: any;
|
|
14
|
+
declare const DG: any;
|
|
15
|
+
|
|
16
|
+
const CAMPAIGNS = 'System:AppData/HitTriage/Hit Design/campaigns';
|
|
17
|
+
|
|
18
|
+
export const campaignOnServer = Given('the Hit Design campaign {string} with a table of:',
|
|
19
|
+
async (page: Page, name: string, table: string[][]) => {
|
|
20
|
+
const key = keyOf(name);
|
|
21
|
+
await removedAndReadBack(page, 'Hit Design', name, key);
|
|
22
|
+
atFeatureEnd(page, () => removedAndReadBack(page, 'Hit Design', name, key));
|
|
23
|
+
await page.evaluate(async ([root, n, k, rows]) => {
|
|
24
|
+
const id = `${k}-1`;
|
|
25
|
+
const csv = rows.map((r) => r.join(',')).join('\n') + '\n';
|
|
26
|
+
const types: {[_: string]: string} = {};
|
|
27
|
+
const semTypes: {[_: string]: string | null} = {};
|
|
28
|
+
for (const c of DG.DataFrame.fromCsv(csv).columns.toList()) {
|
|
29
|
+
types[c.name] = c.type;
|
|
30
|
+
semTypes[c.name] = c.name === 'Molecule' ? 'Molecule' : null;
|
|
31
|
+
}
|
|
32
|
+
await grok.dapi.files.writeAsText(`${root}/${id}/enriched_table.csv`, csv);
|
|
33
|
+
await grok.dapi.files.writeAsText(`${root}/${id}/campaign.json`, JSON.stringify({
|
|
34
|
+
name: id, friendlyName: n, templateName: n, status: 'In Progress', createDate: '2999/12/31', campaignFields: {},
|
|
35
|
+
columnSemTypes: semTypes, columnTypes: types, rowCount: rows.length - 1, filteredRowCount: rows.length - 1,
|
|
36
|
+
savePath: `System.AppData/HitTriage/Hit Design/campaigns/${id}/enriched_table.csv`, version: 1,
|
|
37
|
+
template: {name: n, key: k, campaignFields: [], stages: ['Design'],
|
|
38
|
+
compute: {descriptors: {enabled: false, args: []}, functions: [], scripts: [], queries: []}}}));
|
|
39
|
+
}, [CAMPAIGNS, name, key, table] as [string, string, string, string[][]]);
|
|
40
|
+
await showFirstOnLanding(page);
|
|
41
|
+
}, {tier: 'api', description: 'a campaign of that friendly name made through the JS API, its id "BDD" and the name\'s letters ("BDDBDDCOLUMNS-1"): its table the rows given (the first one the header), its template embedded (no compute, one "Design" stage), created 2999/12/31 so the landing sorted newest first lists it at the top; removed at feature end with its rows in the hitdesign database, read back, and swept the same way before it is made'});
|
|
42
|
+
|
|
43
|
+
/* The landing lists the campaigns the page read once (the package caches the list for the page) and keeps its
|
|
44
|
+
columns, grouping and sorting in the browser: a campaign made for a feature is listed only once the page drops its
|
|
45
|
+
copy, and is in view at the top of a table sorted by Created, newest first, with no grouping. The landing's
|
|
46
|
+
settings are put back at feature end. */
|
|
47
|
+
const LANDING_SETTINGS = /^HDCampaign|^Accordion:Hit-Design-campaigns-group-/;
|
|
48
|
+
|
|
49
|
+
async function showFirstOnLanding(page: Page): Promise<void> {
|
|
50
|
+
const saved: [string, string][] = await page.evaluate((re) => {
|
|
51
|
+
const keys = Object.keys(localStorage).filter((k) => new RegExp(re).test(k));
|
|
52
|
+
const out = keys.map((k) => [k, localStorage.getItem(k) ?? ''] as [string, string]);
|
|
53
|
+
for (const k of keys)
|
|
54
|
+
localStorage.removeItem(k);
|
|
55
|
+
localStorage.setItem('HDCampaignsTableSorting', JSON.stringify({columnName: 'Created', ascending: false}));
|
|
56
|
+
const cache = (window as any).hittriage?._package?.campaignsCache;
|
|
57
|
+
if (cache)
|
|
58
|
+
delete cache['Hit Design'];
|
|
59
|
+
return out;
|
|
60
|
+
}, LANDING_SETTINGS.source);
|
|
61
|
+
atFeatureEnd(page, () => page.evaluate(([re, back]) => {
|
|
62
|
+
for (const k of Object.keys(localStorage).filter((k) => new RegExp(re).test(k)))
|
|
63
|
+
localStorage.removeItem(k);
|
|
64
|
+
for (const [k, v] of back)
|
|
65
|
+
localStorage.setItem(k, v);
|
|
66
|
+
const cache = (window as any).hittriage?._package?.campaignsCache;
|
|
67
|
+
if (cache)
|
|
68
|
+
delete cache['Hit Design'];
|
|
69
|
+
}, [LANDING_SETTINGS.source, saved] as [string, [string, string][]]));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The Tags input of the Column Properties dialog is a key and value per row, with an empty row only
|
|
73
|
+
* when the column has no tags: a new tag goes into that row, else into the one the first row's "+"
|
|
74
|
+
* inserts. */
|
|
75
|
+
export const addTag = When('user adds the {string} tag with value {string} to {element}',
|
|
76
|
+
async (page: Page, tag: string, value: string, target: ElementRef) => {
|
|
77
|
+
const root = (await locate(page, target)).first()
|
|
78
|
+
.locator('xpath=ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " ui-input-root ")][1]');
|
|
79
|
+
const rows = root.locator('tr');
|
|
80
|
+
const emptyRow = () => rows.evaluateAll((trs) => trs.findIndex((tr) => {
|
|
81
|
+
const inputs = Array.from(tr.querySelectorAll('input'));
|
|
82
|
+
return inputs.length === 2 && inputs.every((i) => i.value === '');
|
|
83
|
+
}));
|
|
84
|
+
if (await emptyRow() < 0)
|
|
85
|
+
await rows.first().locator('button').first().click();
|
|
86
|
+
let row = -1;
|
|
87
|
+
await expect.poll(async () => row = await emptyRow(), {message: `an empty row in ${target.phrase}`}).toBeGreaterThanOrEqual(0);
|
|
88
|
+
const [keyInput, valueInput] = [rows.nth(row).locator('input').nth(0), rows.nth(row).locator('input').nth(1)];
|
|
89
|
+
await keyInput.click();
|
|
90
|
+
await gestures.typeVerified(keyInput, tag, `the key of a new row in ${target.phrase}`);
|
|
91
|
+
await valueInput.click();
|
|
92
|
+
await gestures.typeVerified(valueInput, value, `the value of the "${tag}" row in ${target.phrase}`);
|
|
93
|
+
}, {tier: 'ui', description: 'types the tag and its value into an empty row of a Tags input (the Column Properties dialog\'s), a new one made with the first row\'s "+" when every row holds a tag'});
|