@datagrok/compute 1.30.0 → 1.31.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "1.30.0",
4
+ "version": "1.31.0",
5
5
  "author": {
6
6
  "name": "Aufar Zakiev",
7
7
  "email": "aufar.zakiev@softwarecountry.com"
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "rxjs": "^6.6.7",
17
- "@datagrok-libraries/compute-utils": "^1.30.0",
17
+ "@datagrok-libraries/compute-utils": "^1.31.0",
18
18
  "cash-dom": "latest",
19
19
  "datagrok-api": "^1.17.0",
20
20
  "source-map-loader": "^4.0.1",
package/src/package.ts CHANGED
@@ -174,23 +174,61 @@ let startUriLoaded = false;
174
174
 
175
175
  //name: Model Catalog
176
176
  //tags: app
177
- //sidebar: @compute
177
+ //output: view v
178
178
  export function modelCatalog() {
179
- const view = ModelCatalogView.findOrCreateCatalogView('Model Catalog', 'modelCatalog', _package);
180
-
181
- const optionalPart = grok.shell.startUri.indexOf('?');
182
- const pathSegments = grok.shell.startUri
179
+ // Separately process direct link access
180
+ const startOptionalPart = grok.shell.startUri.indexOf('?');
181
+ const startPathSegments = grok.shell.startUri
182
+ .substring('https://'.length, startOptionalPart > 0 ? startOptionalPart: undefined)
183
+ .split('/');
184
+
185
+ if (!startUriLoaded && startPathSegments.includes('Compute')) {
186
+ const view = ModelCatalogView.findOrCreateCatalogView('Model Catalog', 'modelCatalog', _package);
187
+
188
+ grok.shell.addView(view);
189
+ startUriLoaded = true;
190
+
191
+ if (startPathSegments.length > 3) {
192
+ grok.dapi.functions.filter(`shortName = "${startPathSegments[3]}" and #model`).list().then((lst) => {
193
+ if (lst.length == 1) {
194
+ ModelHandler.openModel(lst[0]);
195
+ }
196
+ });
197
+ }
198
+
199
+ return;
200
+ }
201
+
202
+ const optionalPart = window.location.href.indexOf('?');
203
+ const pathSegments = window.location.href
183
204
  .substring('https://'.length, optionalPart > 0 ? optionalPart: undefined)
184
205
  .split('/');
185
- if (!startUriLoaded && pathSegments.length > 3) {
186
- grok.dapi.functions.filter(`shortName = "${pathSegments[3]}" and #model`).list().then((lst) => {
187
- if (lst.length == 1)
188
- ModelHandler.openModel(lst[0]);
189
- startUriLoaded = true;
190
- });
206
+
207
+ if (pathSegments.includes('browse')) {
208
+ const view = ModelCatalogView.findModelCatalogView('modelCatalog');
209
+
210
+ // If there is existing view, then switch on it
211
+ if (view) {
212
+ grok.shell.v = view;
213
+ }
214
+
215
+ // Always return new with no subscribtions to show in Browse tree
216
+ const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
217
+ return newView;
191
218
  }
192
219
 
193
- return view;
220
+ // Separately process double-clicking on Model Catalog card
221
+ if (pathSegments.includes('apps')) {
222
+ const view = ModelCatalogView.findModelCatalogView('modelCatalog');
223
+
224
+ // If there is existing view, then switch on it
225
+ if (view) {
226
+ grok.shell.v = view;
227
+ } else {
228
+ const newView = ModelCatalogView.createModelCatalogView('Model Catalog', 'modelCatalog', _package);
229
+ grok.shell.addView(newView);
230
+ }
231
+ }
194
232
  }
195
233
 
196
234