@datagrok/hit-triage 1.3.4 → 1.3.6

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.
@@ -32,7 +32,6 @@
32
32
  "~Molecule.canonicalSmiles": "string"
33
33
  },
34
34
  "version": 1,
35
- "authorUserId": "7a6a9f30-25d0-11ef-c943-0b65a97fa481",
36
35
  "permissions": {
37
36
  "view": ["a4b45840-9a50-11e6-9cc9-8546b8bf62e6"],
38
37
  "edit": ["a4b45840-9a50-11e6-9cc9-8546b8bf62e6"]
@@ -44,7 +44,6 @@
44
44
  "fr_NH2": "int"
45
45
  },
46
46
  "version": 1,
47
- "authorUserId": "7a6a9f30-25d0-11ef-c943-0b65a97fa481",
48
47
  "permissions": {
49
48
  "view": ["a4b45840-9a50-11e6-9cc9-8546b8bf62e6"],
50
49
  "edit": ["a4b45840-9a50-11e6-9cc9-8546b8bf62e6"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/hit-triage",
3
3
  "friendlyName": "HitTriage",
4
- "version": "1.3.4",
4
+ "version": "1.3.6",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
package/src/app/consts.ts CHANGED
@@ -29,6 +29,7 @@ export const i18n = {
29
29
  continueCampaigns: 'Continue Campaign',
30
30
  createNewCampaignHeader: 'New Campaign',
31
31
  selectTemplate: 'Template',
32
+ noInformation: 'No Information',
32
33
  } as const;
33
34
 
34
35
  export const funcTypeNames = {
@@ -43,4 +44,6 @@ export enum CampaignGroupingType {
43
44
  None = 'None',
44
45
  Template = 'Template',
45
46
  Status = 'Status',
47
+ Author = 'Author',
48
+ LastModifiedUser = 'Last Modified User',
46
49
  }
@@ -645,10 +645,13 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
645
645
 
646
646
  return {
647
647
  'Template': this.template?.name ?? 'Molecules',
648
- 'File path': getPathEditor(),
648
+ 'File Path': getPathEditor(),
649
+ ...(this.campaign?.authorUserFriendlyName ? {'Author': this.campaign.authorUserFriendlyName} : {}),
650
+ ...(this.campaign?.lastModifiedUserName ? {'Last Modified By': this.campaign.lastModifiedUserName} : {}),
651
+ ...(this.campaign?.createDate ? {'Create Date': this.campaign.createDate} : {}),
649
652
  ...campaignProps,
650
- 'Number of molecules': (this.dataFrame!.rowCount).toString(),
651
- 'Enrichment methods': [this.template!.compute.descriptors.enabled ? 'descriptors' : '',
653
+ 'Number of Molecules': (this.dataFrame!.rowCount).toString(),
654
+ 'Enrichment Methods': [this.template!.compute.descriptors.enabled ? 'descriptors' : '',
652
655
  ...this.template!.compute.functions.map((func) => func.name)].filter((f) => f && f.trim() !== '').join(', '),
653
656
  };
654
657
  }
@@ -667,7 +670,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
667
670
  // if its first time save author as current user, else keep the same
668
671
  const authorUserId = this.campaign?.authorUserId ?? grok.shell.user.id;
669
672
  const permissions = this.campaign?.permissions ?? defaultPermissions;
670
-
673
+ const authorName = authorUserId ? this.campaign?.authorUserFriendlyName ?? (await grok.dapi.users.find(authorUserId))?.friendlyName : undefined;
671
674
  const campaign: HitDesignCampaign = {
672
675
  name: campaignName,
673
676
  templateName,
@@ -682,6 +685,8 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
682
685
  tilesViewerFormSketch: sketchStateString,
683
686
  version: this.version + 1,
684
687
  authorUserId,
688
+ authorUserFriendlyName: authorName,
689
+ lastModifiedUserName: grok.shell.user.friendlyName,
685
690
  permissions,
686
691
  };
687
692
  if (!this.hasEditPermission) {
@@ -253,14 +253,17 @@ export class HitDesignInfoView
253
253
  });
254
254
  return [shareIcon, deleteIcon];
255
255
  };
256
- const table = ui.table(Object.values(campaignNamesMap), (info) =>
257
- ([ui.link(info.name, () => this.setCampaign(info.name), '', ''),
256
+
257
+ const table = ui.table(Object.values(grouppedCampaigns).flat(), (info) =>
258
+ ([ui.link(info.name, () => this.setCampaign(info.name), 'Continue Campaign', ''),
258
259
  info.createDate,
260
+ info.authorUserFriendlyName ?? '',
261
+ info.lastModifiedUserName ?? '',
259
262
  info.rowCount,
260
263
  info.status,
261
264
  ...(deleteAndShareCampaignIcons(info)),
262
265
  ]),
263
- ['Name', 'Created', 'Molecules', 'Status', '']);
266
+ ['Name', 'Created', 'Author', 'Last Modified by', 'Molecules', 'Status', '', '']);
264
267
  table.style.color = 'var(--grey-5)';
265
268
  table.style.marginLeft = '24px';
266
269
  processGroupingTable(table, grouppedCampaigns);
package/src/app/types.ts CHANGED
@@ -119,7 +119,9 @@ export type HitTriageCampaign = {
119
119
  columnTypes?: {[key: string]: string},
120
120
  version?: number,
121
121
  permissions?: TriagePermissions,
122
- authorUserId?: string
122
+ authorUserId?: string,
123
+ authorUserFriendlyName?: string,
124
+ lastModifiedUserName?: string,
123
125
  };
124
126
 
125
127
  export type TriagePermissions = {
package/src/app/utils.ts CHANGED
@@ -3,7 +3,7 @@ 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
5
  import {Subscription} from 'rxjs';
6
- import {CampaignGroupingType, CampaignJsonName, ComputeQueryMolColName, HDCampaignsGroupingLSKey} from './consts';
6
+ import {CampaignGroupingType, CampaignJsonName, ComputeQueryMolColName, HDCampaignsGroupingLSKey, i18n} from './consts';
7
7
  import {AppName, CampaignsType, HitDesignCampaign, HitTriageCampaign, TriagePermissions} from './types';
8
8
  import {_package} from '../package';
9
9
 
@@ -128,6 +128,11 @@ export async function loadCampaigns<T extends AppName>(
128
128
  !await checkViewPermissions(campaignJson.authorUserId, campaignJson.permissions)
129
129
  )
130
130
  continue;
131
+ if (campaignJson.authorUserId && !campaignJson.authorUserFriendlyName) {
132
+ const user = await grok.dapi.users.find(campaignJson.authorUserId);
133
+ if (user)
134
+ campaignJson.authorUserFriendlyName = user.friendlyName;
135
+ }
131
136
  campaignNamesMap[campaignJson.name] = campaignJson;
132
137
  } catch (e) {
133
138
  continue;
@@ -141,13 +146,12 @@ async function checkPermissions(authorId: string, groupIdList: string[]): Promis
141
146
  const userGroupId = DG.User.current().group?.id;
142
147
  if (authorId === userId)
143
148
  return true;
144
- const dapiGroups = grok.dapi.groups;
145
149
  for (const groupId of groupIdList) {
146
- const group = await dapiGroups.find(groupId);
150
+ const group = await grok.dapi.groups.find(groupId);
147
151
  if (!group)
148
152
  continue;
149
153
  if (group.personal) {
150
- const user = await dapiGroups.getUser(group);
154
+ const user = await grok.dapi.groups.getUser(group);
151
155
  if (user?.id === userId)
152
156
  return true;
153
157
  } else if (userGroupId && group.members.length > 0) {
@@ -188,6 +192,10 @@ export const getGroupingKey = <T extends HitDesignCampaign | HitTriageCampaign =
188
192
  return campaign.template?.key ?? campaign.templateName;
189
193
  case CampaignGroupingType.Status:
190
194
  return campaign.status;
195
+ case CampaignGroupingType.Author:
196
+ return campaign.authorUserFriendlyName ?? i18n.noInformation;
197
+ case CampaignGroupingType.LastModifiedUser:
198
+ return campaign.lastModifiedUserName ?? i18n.noInformation;
191
199
  default:
192
200
  return '';
193
201
  }
@@ -207,7 +215,7 @@ export function getGroupedCampaigns<T extends HitDesignCampaign | HitTriageCampa
207
215
  return groupedCampaigns;
208
216
  }
209
217
 
210
- export function processGroupingTable<T extends HitDesignCampaign | HitTriageCampaign = HitDesignCampaign>(table: HTMLTableElement, groupedCampaigns: {[key: string]: T[]}, numCols = 6) {
218
+ export function processGroupingTable<T extends HitDesignCampaign | HitTriageCampaign = HitDesignCampaign>(table: HTMLTableElement, groupedCampaigns: {[key: string]: T[]}, numCols = 8) {
211
219
  table.classList.add('hit-design-groupped-campaigns-table');
212
220
  const keys = Object.keys(groupedCampaigns);
213
221
  if (keys.length < 2)