iguazio.dashboard-controls 1.0.13 → 1.1.1

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.
Files changed (24) hide show
  1. package/dist/i18n/en/common.json +95 -83
  2. package/dist/i18n/en/functions.json +110 -109
  3. package/dist/js/iguazio.dashboard-controls.js +6660 -5230
  4. package/dist/less/iguazio.dashboard-controls.less +1430 -881
  5. package/package.json +1 -1
  6. package/src/i18n/en/common.json +95 -83
  7. package/src/i18n/en/functions.json +110 -109
  8. package/src/igz_controls/components/date-time-picker/date-time-picker.component.js +689 -0
  9. package/src/igz_controls/components/date-time-picker/date-time-picker.component.spec.js +356 -0
  10. package/src/igz_controls/components/date-time-picker/date-time-picker.less +418 -0
  11. package/src/igz_controls/components/date-time-picker/date-time-picker.tpl.html +90 -0
  12. package/src/igz_controls/components/date-time-picker/prevent-parent-scroll.directive.js +27 -0
  13. package/src/igz_controls/components/log-table-row/log-table-row.component.js +57 -0
  14. package/src/igz_controls/components/log-table-row/log-table-row.component.spec.js +49 -0
  15. package/src/igz_controls/components/log-table-row/log-table-row.less +29 -0
  16. package/src/igz_controls/components/log-table-row/log-table-row.tpl.html +16 -0
  17. package/src/igz_controls/components/multiple-checkboxes/multiple-checkboxes.component.js +39 -5
  18. package/src/igz_controls/services/control-panel-logs-data.service.js +203 -0
  19. package/src/nuclio/common/components/deploy-log/deploy-log.component.js +1 -1
  20. package/src/nuclio/common/services/export.service.js +28 -5
  21. package/src/nuclio/functions/version/version-execution-log/version-execution-log.component.js +463 -0
  22. package/src/nuclio/functions/version/version-execution-log/version-execution-log.less +99 -0
  23. package/src/nuclio/functions/version/version-execution-log/version-execution-log.tpl.html +177 -0
  24. package/src/nuclio/functions/version/version.component.js +29 -2
@@ -171,7 +171,7 @@ such restriction.
171
171
  controller: IgzMultipleCheckboxes
172
172
  });
173
173
 
174
- function IgzMultipleCheckboxes(lodash) {
174
+ function IgzMultipleCheckboxes($document, $element, $scope, lodash) {
175
175
  var ctrl = this;
176
176
 
177
177
  var LABEL_PATH_DEFAULT = 'label';
@@ -192,6 +192,8 @@ such restriction.
192
192
 
193
193
  ctrl.$onInit = onInit;
194
194
  ctrl.$onChanges = onChanges;
195
+ ctrl.$postLink = postLink;
196
+ ctrl.$onDestroy = onDestroy;
195
197
 
196
198
  ctrl.addItem = addItem;
197
199
  ctrl.onApply = onApply;
@@ -364,6 +366,19 @@ such restriction.
364
366
  }
365
367
  }
366
368
 
369
+ /**
370
+ * Post linking method
371
+ */
372
+ function postLink() {
373
+ $document.on('click', unselectDropdown);
374
+ }
375
+
376
+ /**
377
+ * Destructor method
378
+ */
379
+ function onDestroy() {
380
+ $document.off('click', unselectDropdown);
381
+ }
367
382
  //
368
383
  // Public methods
369
384
  //
@@ -447,10 +462,14 @@ such restriction.
447
462
  */
448
463
  function onSearchInputChange(searchData) {
449
464
  if (lodash.isEmpty(searchData) || lodash.isNil(searchData)) {
450
- lodash.forEach(ctrl.optionList, function (group) {
451
- lodash.forEach(group.options, function (option) {
452
- lodash.set(option, 'filtered', false);
453
- });
465
+ lodash.forEach(ctrl.optionList, function (item) {
466
+ if (ctrl.groups) {
467
+ lodash.forEach(item.options, function (option) {
468
+ lodash.set(option, 'filtered', false)
469
+ });
470
+ } else {
471
+ lodash.set(item, 'filtered', false);
472
+ }
454
473
  });
455
474
  } else {
456
475
  lodash.forEach(ctrl.optionList, function (item) {
@@ -559,6 +578,21 @@ such restriction.
559
578
  lodash.forEach(ctrl.optionList, function (option) {
560
579
  option.checked = lodash.includes(ctrl.ngModelCtrl.$viewValue, option.value);
561
580
  });
581
+ ctrl.isAllItemsChecked = ctrl.optionList.every(function (option) {
582
+ return option.checked;
583
+ });
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Handle click on the document and not on the dropdown field and close the dropdown
589
+ * @param {Object} e - event
590
+ */
591
+ function unselectDropdown(e) {
592
+ if ($element.find(e.target).length === 0) {
593
+ $scope.$evalAsync(function () {
594
+ ctrl.isDropdownOpened = false;
595
+ });
562
596
  }
563
597
  }
564
598
  }
@@ -0,0 +1,203 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ angular.module('iguazio.dashboard-controls')
5
+ .factory('ControlPanelLogsDataService', ControlPanelLogsDataService);
6
+
7
+ function ControlPanelLogsDataService($q, lodash, ElasticsearchService) {
8
+ return {
9
+ entriesPaginated: search,
10
+ logsPaginated: logsWidthReplicas
11
+ };
12
+
13
+ //
14
+ // Public methods
15
+ //
16
+
17
+ /**
18
+ * Get latest log entries with replicas
19
+ * @param {number} page - current page
20
+ * @param {number} perPage - max items count on a page
21
+ * @param {Object} queryParams - additional parameters
22
+ * @param {string} queryParams.query - search query text
23
+ * @param {string} queryParams.timeFrame - selected time period to show results for
24
+ * @param {string} [queryParams.lastEntryTimestamp] - time stamp of the last item in a list, used with auto
25
+ * update
26
+ * @returns {Promise} array of log entries
27
+ */
28
+ function logsWidthReplicas(page, perPage, queryParams) {
29
+ return search(page, perPage, queryParams, true)
30
+ }
31
+
32
+ /**
33
+ * Get latest log entries
34
+ * @param {number} page - current page
35
+ * @param {number} perPage - max items count on a page
36
+ * @param {Object} queryParams - additional parameters
37
+ * @param {string} queryParams.query - search query text
38
+ * @param {string} queryParams.timeFrame - selected time period to show results for
39
+ * @param {string} [queryParams.lastEntryTimestamp] - time stamp of the last item in a list, used with auto
40
+ * @param {boolean} withReplicas - determines if replicas should be requested
41
+ * update
42
+ * @returns {Promise} array of log entries
43
+ */
44
+ function search(page, perPage, queryParams, withReplicas) {
45
+ // if Search is called in scope of autoupdate, only new entries should be shown
46
+ // so `lastEntryTimestamp` variable is used
47
+ var searchFrom = queryParams.lastEntryTimestamp;
48
+ var searchTo = 'now';
49
+ // but if there was no items in the list, use timeFrameParam
50
+
51
+ if (!searchFrom) {
52
+ if (queryParams.timeFrame) {
53
+ searchFrom = 'now-' + queryParams.timeFrame;
54
+ } else {
55
+ searchFrom = queryParams.customTimeFrame.from
56
+ searchTo = lodash.get(queryParams, 'customTimeFrame.to', 'now')
57
+ }
58
+ }
59
+
60
+ var config = {
61
+ index: 'filebeat*',
62
+ body: {
63
+ query: {
64
+ bool: {
65
+ must: [
66
+ {
67
+ range: {
68
+ '@timestamp': {
69
+ gte: searchFrom,
70
+ lte: searchTo
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ sort: [
78
+ {
79
+ '@timestamp': 'desc'
80
+ }
81
+ ]
82
+ }
83
+ };
84
+
85
+ if (withReplicas) {
86
+ config.body.aggs = {
87
+ 'distinct_pod_names': {
88
+ terms: {
89
+ field: 'kubernetes.pod.name',
90
+ size: 100000
91
+ }
92
+ }
93
+ };
94
+ }
95
+
96
+ // If query text was set, add proper items to config
97
+ if (!lodash.isEmpty(queryParams.query)) {
98
+ config.body.query.bool.must.push({
99
+ query_string: {
100
+ query: queryParams.query,
101
+ analyze_wildcard: true,
102
+ default_field: '*'
103
+ }
104
+ });
105
+ }
106
+
107
+ // Add perPage only if user navigates from page to page
108
+ // Pagination should not be used in auto update
109
+ if (!lodash.isNull(perPage)) {
110
+ lodash.defaults(config, {
111
+ size: perPage,
112
+ from: page * perPage
113
+ });
114
+ }
115
+
116
+ return ElasticsearchService.search(config)
117
+ .then(function (response) {
118
+ // Saved log entry can be found in `_source` property
119
+ // For now all additional data from Elasticsearch is not used, so only entries are returned
120
+ var logs = lodash.map(response.hits.hits, '_source');
121
+ var replicas = lodash.get(response, 'aggregations.distinct_pod_names.buckets', []).map(function (replica) {
122
+ return replica.key;
123
+ });
124
+
125
+ // Total records count is received from Elasticsearch,
126
+ // but Paginator expects pages count, so we need to calculate it
127
+ logs.total_logs_count = lodash.get(response, 'hits.total.value', 0);
128
+ logs.total_pages = Math.ceil(lodash.get(response, 'hits.total.value', 0) / perPage);
129
+
130
+ if (withReplicas) {
131
+ logs.replicas = replicas;
132
+ }
133
+
134
+ return logs;
135
+ })
136
+ .catch(function (err) {
137
+ console.log(err);
138
+
139
+ return $q.reject(err);
140
+ });
141
+ }
142
+
143
+ /**
144
+ * Mocks the real search function without the need for a running Elasticsearch service, for development
145
+ * purposes.
146
+ * @returns {Promise.<Array.<Object>>} a promise resolving to an array of mocked log entries.
147
+ */
148
+ function searchMocked(page, perPage, queryParams, withReplicas) {
149
+ var mock = {
150
+ levels: [
151
+ 'debug',
152
+ 'INFO',
153
+ 'warn',
154
+ 'WARNING',
155
+ 'ERROR'
156
+ ],
157
+ names: [
158
+ 'docker-registry-s1b0j6wn6s-gl3bp',
159
+ 'framesd-jgx8uftz60',
160
+ 'grafana-tffz8965jk-vw08z',
161
+ 'jupyter-3ie700eg7l-ukz5g',
162
+ 'nuclio-1k5fvxzp32',
163
+ 'webapi-nq74spt3zw'
164
+ ]
165
+ };
166
+
167
+ var logs = Array.from({ length: perPage }, function () {
168
+ return lodash.omit({
169
+ '@timestamp': new Date(),
170
+ name: lodash.sample(mock.names),
171
+ level: lodash.sample(mock.levels),
172
+ message: 'message message message message message message message message',
173
+ more: 'more more more more more more more more more more more more'
174
+ }, lodash.sample([false, true]) ? 'more' : '');
175
+ });
176
+ const replicas = ['nuclio-dashboard-f9f78c6dd-8scqs',
177
+ 'nuclio-controller-54fc6d9cbf-lfhln',
178
+ 'nuclio-mm-app-project-n-v1-serving-3-544ccc46b-qjlpk',
179
+ 'nuclio-mm-non-v3io-project2-serving-func0-cccf69fb9-rfvs5',
180
+ 'nuclio-fraud-demo-2-normal-user-transaction-fraud-6fc949f956zrf',
181
+ 'nuclio-llm-monitoring-intro-llm-monit-7dcd4cfcb5-tc4dq',
182
+ 'nuclio-mm-ilan-project-agg-app-cfc597969-6xkw5',
183
+ 'nuclio-mm-app-project-n-v222-model-monitoring-controller-5gbfqf',
184
+ 'nuclio-mm-ilan-project-const-app-65f7749cdf-gzfvl',
185
+ 'nuclio-mm-app-project-model-monitoring-controller-845b685cx2gvf',
186
+ 'nuclio-mm-app-project-n-v1-model-monitoring-controller-b7bv9wwq',
187
+ 'nuclio-mm-app-project-v1-model-monitoring-controller-bf8b6vgm8s',
188
+ 'nuclio-tutorial-normal-user-model-monitoring-controller-6c4gfcv'
189
+ ];
190
+
191
+ logs.total_pages = 30000 / perPage;
192
+ logs.total_logs_count = 30000;
193
+
194
+ if (withReplicas) {
195
+ logs.replicas = replicas;
196
+ }
197
+
198
+ console.info(queryParams);
199
+
200
+ return $q.when(logs);
201
+ }
202
+ }
203
+ }());
@@ -29,7 +29,7 @@ such restriction.
29
29
  function NclDeployLogController(lodash) {
30
30
  var ctrl = this;
31
31
 
32
- ctrl.scrollCofig = {
32
+ ctrl.scrollConfig = {
33
33
  advanced: {
34
34
  updateOnContentResize: true
35
35
  },
@@ -23,6 +23,7 @@ such restriction.
23
23
  function ExportService($i18next, $q, $timeout, $window, i18next, lodash, DialogsService, YamlService) {
24
24
  return {
25
25
  exportFunction: exportFunction,
26
+ exportLogs: exportLogs,
26
27
  getFunctionConfig: getFunctionConfig,
27
28
  exportProject: exportProject,
28
29
  exportProjects: exportProjects
@@ -43,6 +44,18 @@ such restriction.
43
44
  downloadExportedFunction(blob, version.metadata.name);
44
45
  }
45
46
 
47
+ /**
48
+ * Creates artificial link and starts downloading of exported file.
49
+ * Downloaded file will be saved in user's default folder for downloads.
50
+ * @param {Object} logs
51
+ * @param {string} name
52
+ */
53
+ function exportLogs(logs, name) {
54
+ var blob = prepareBlobObject(logs);
55
+
56
+ downloadExportedFile(blob, name, 'log');
57
+ }
58
+
46
59
  /**
47
60
  * Returns function config
48
61
  * @param {Object} version
@@ -141,17 +154,18 @@ such restriction.
141
154
  //
142
155
 
143
156
  /**
144
- * Creates artificial link and starts downloading of exported function.
145
- * Downloaded .yaml file will be saved in user's default folder for downloads.
146
- * @param {Blob} data - exported function config parsed to YAML
157
+ * Creates artificial link and starts downloading of exported file.
158
+ * Downloaded file will be saved in user's default folder for downloads.
159
+ * @param {Blob} data - exported file config parsed to YAML
147
160
  * @param {string} fileName - name of the file
161
+ * @param {string} extension - extension of the file
148
162
  */
149
- function downloadExportedFunction(data, fileName) {
163
+ function downloadExportedFile(data, fileName, extension) {
150
164
  var url = $window.URL.createObjectURL(data);
151
165
  var link = document.createElement('a');
152
166
 
153
167
  link.href = url;
154
- link.download = fileName + '.yaml';
168
+ link.download = fileName + '.' + extension;
155
169
  document.body.appendChild(link);
156
170
 
157
171
  $timeout(function () {
@@ -161,6 +175,15 @@ such restriction.
161
175
  });
162
176
  }
163
177
 
178
+ /**
179
+ * Downloads function yaml
180
+ * @param {Blob} data - exported function config parsed to YAML
181
+ * @param {string} fileName - name of the file
182
+ */
183
+ function downloadExportedFunction(data, fileName) {
184
+ downloadExportedFile(data, fileName, 'yaml');
185
+ }
186
+
164
187
  /**
165
188
  * Prepare function data
166
189
  * @param {Object} version