iguazio.dashboard-controls 1.2.6 → 1.2.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-controls",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "main": "dist/js/iguazio.dashboard-controls.js",
5
5
  "description": "Collection of resources (such as CSS styles, fonts and images) and AngularJs 1.x components and services to share among different Iguazio repos.",
6
6
  "repository": {
@@ -37,6 +37,7 @@
37
37
  * @param {Object} queryParams - additional parameters
38
38
  * @param {string} queryParams.query - search query text
39
39
  * @param {string} queryParams.timeFrame - selected time period to show results for
40
+ * @param {string} queryParams.filterName - selected function name
40
41
  * @param {string} [queryParams.lastEntryTimestamp] - time stamp of the last item in a list, used with auto
41
42
  * @param {boolean} withReplicas - determines if replicas should be requested
42
43
  * update
@@ -94,6 +95,14 @@
94
95
  };
95
96
  }
96
97
 
98
+ if (queryParams.filterName) {
99
+ config.body.query.bool.should = [
100
+ { term: { name: queryParams.filterName } },
101
+ { term: { 'name.keyword': queryParams.filterName } }
102
+ ];
103
+ config.body.query.bool.minimum_should_match = 1;
104
+ }
105
+
97
106
  // If query text was set, add proper items to config
98
107
  if (!lodash.isEmpty(queryParams.query)) {
99
108
  config.body.query.bool.must.push({
@@ -306,6 +315,14 @@
306
315
  }
307
316
  };
308
317
 
318
+ if (queryParams.filterName) {
319
+ config.body.query.bool.should = [
320
+ { term: { name: queryParams.filterName } },
321
+ { term: { 'name.keyword': queryParams.filterName } }
322
+ ];
323
+ config.body.query.bool.minimum_should_match = 1;
324
+ }
325
+
309
326
  return ElasticsearchService.search(config);
310
327
  }
311
328
 
@@ -391,13 +391,9 @@ such restriction.
391
391
  function generateFilterQuery() {
392
392
  var levels = lodash.chain(ctrl.filter.level).pickBy().keys().join(' OR ').value();
393
393
  var projectName = lodash.get(ctrl.version, ['metadata', 'labels', 'nuclio.io/project-name']);
394
- var projectFilter = '(nuclio.project_name.keyword:' + projectName + ' OR nuclio.project_name:' + projectName + ')'
394
+ var projectFilter = '(nuclio.project_name.keyword:' + projectName + ' OR nuclio.project_name:' + projectName + ')';
395
395
  var queries = ['system-id:"' + ConfigService.systemId + '"', '_exists_:nuclio', projectFilter];
396
396
 
397
- if (!lodash.isEmpty(ctrl.version.metadata.name)) {
398
- queries.push('(name.keyword:' + ctrl.version.metadata.name + ' OR name:' + ctrl.version.metadata.name + ')');
399
- }
400
-
401
397
  if (ctrl.selectedReplicas.length && ctrl.selectedReplicas.length !== initialReplicas.length) {
402
398
  var replicas = ctrl.selectedReplicas.join(' OR ');
403
399
 
@@ -416,6 +412,7 @@ such restriction.
416
412
  }
417
413
 
418
414
  ctrl.filterQuery = lodash.join(queries, ' AND ');
415
+ ctrl.filterName = ctrl.version.metadata.name;
419
416
  }
420
417
 
421
418
  /**
@@ -425,6 +422,7 @@ such restriction.
425
422
  function queryParams() {
426
423
  return {
427
424
  query: ctrl.filterQuery,
425
+ filterName: ctrl.filterName,
428
426
  timeFrame: ctrl.datePreset,
429
427
  customTimeFrame: ctrl.timeRange
430
428
  };
@@ -47,6 +47,7 @@ such restriction.
47
47
  };
48
48
 
49
49
  ctrl.$onInit = onInit;
50
+ ctrl.$onChanges = onChanges;
50
51
 
51
52
  ctrl.checkIsErrorState = checkIsErrorState;
52
53
  ctrl.onRowCollapse = onRowCollapse;
@@ -64,6 +65,16 @@ such restriction.
64
65
  initEnrichedNodeSelectors();
65
66
  }
66
67
 
68
+ /**
69
+ * On changes hook method
70
+ * @param {Object} changes
71
+ */
72
+ function onChanges(changes) {
73
+ if (lodash.has(changes, 'version')) {
74
+ initEnrichedNodeSelectors();
75
+ }
76
+ }
77
+
67
78
  //
68
79
  // Public methods
69
80
  //