@datagrok/hit-triage 1.4.2 → 1.4.3

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.
@@ -0,0 +1,27 @@
1
+ [
2
+ {
3
+ "path": "/Hit Design",
4
+ "invalidateOn": "0 * * * *",
5
+ "preflight": true
6
+ },
7
+ {
8
+ "path": "/Hit Triage",
9
+ "invalidateOn": "0 * * * *",
10
+ "preflight": true
11
+ },
12
+ {
13
+ "path": "/Hit Design/campaigns",
14
+ "invalidateOn": "0 * * * *",
15
+ "preflight": true
16
+ },
17
+ {
18
+ "path": "/Hit Triage/campaigns",
19
+ "invalidateOn": "0 * * * *",
20
+ "preflight": true
21
+ },
22
+ {
23
+ "path": "/",
24
+ "invalidateOn": "0 * * * *",
25
+ "preflight": true
26
+ }
27
+ ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/hit-triage",
3
3
  "friendlyName": "HitTriage",
4
- "version": "1.4.2",
4
+ "version": "1.4.3",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
@@ -78,10 +78,13 @@ export abstract class HitAppBase<T> {
78
78
  public async getNewCampaignName(folderName: string, templateKey: string) {
79
79
  const templateCampaigns = (await _package.files.list(folderName))
80
80
  .map((file) => file.name)
81
- .filter((name) => name.startsWith(templateKey));
81
+ .filter((name) => name.startsWith(`${templateKey}-`) && !!parseInt(name.substring(templateKey.length + 1)));
82
82
  if (templateCampaigns.length === 0)
83
83
  return templateKey + '-1';
84
- const postFixes = templateCampaigns.map((c) => c.split('-')[1]).filter(Boolean).map((c) => parseInt(c, 10)).sort();
84
+ const postFixes = templateCampaigns
85
+ .map((c) => c.substring(templateKey.length + 1))
86
+ .filter(Boolean).map((c) => parseInt(c, 10))
87
+ .sort((a, b) => a - b);// sort in ascending order
85
88
  return templateKey + '-' + ((postFixes[postFixes.length - 1] + 1).toString());
86
89
  }
87
90
 
@@ -10,7 +10,7 @@ import {CampaignIdKey, CampaignJsonName, CampaignTableName,
10
10
  import {calculateColumns, calculateCellValues, getNewVid} from './utils/calculate-single-cell';
11
11
  import '../../css/hit-triage.css';
12
12
  import {_package} from '../package';
13
- import {addBreadCrumbsToRibbons, checkRibbonsHaveSubmit, editableTableField, modifyUrl, toFormatedDateString} from './utils';
13
+ import {addBreadCrumbsToRibbons, checkFileExists, checkRibbonsHaveSubmit, editableTableField, modifyUrl, toFormatedDateString} from './utils';
14
14
  import {HitDesignSubmitView} from './hit-design-views/submit-view';
15
15
  import {getTilesViewDialog} from './hit-design-views/tiles-view';
16
16
  import {HitAppBase} from './hit-app-base';
@@ -842,22 +842,8 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
842
842
  labelElement.remove();
843
843
  newPathInput.root.style.width = '100%';
844
844
 
845
- async function checkFolder() {
846
- const newPath = newPathInput.value;
847
- if (!newPath || newPath.trim() === '') {
848
- grok.shell.error('Path can not be empty');
849
- return false;
850
- }
851
- const exists = await grok.dapi.files.exists(newPath);
852
- if (!exists) {
853
- grok.shell.error('Given folder does not exist');
854
- return false;
855
- }
856
- return true;
857
- }
858
-
859
845
  const saveButton = ui.button('Save', async () => {
860
- const exists = await checkFolder();
846
+ const exists = await checkFileExists(newPathInput.value);
861
847
  if (!exists)
862
848
  return;
863
849
  const newPath = newPathInput.value;
package/src/app/utils.ts CHANGED
@@ -323,6 +323,19 @@ export function editableTableField(field: HTMLElement, options?: EditableFieldOp
323
323
  return container;
324
324
  }
325
325
 
326
+ export async function checkFileExists(path: string) {
327
+ if (!path || path.trim() === '') {
328
+ grok.shell.error('Path can not be empty');
329
+ return false;
330
+ }
331
+ const exists = await grok.dapi.files.exists(path);
332
+ if (!exists) {
333
+ grok.shell.error('Given folder does not exist');
334
+ return false;
335
+ }
336
+ return true;
337
+ }
338
+
326
339
 
327
340
  // //name: Demo Design with reinvent
328
341
  // //input: int numberOfMolecules