iguazio.dashboard-controls 1.2.2 → 1.2.4

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.2",
3
+ "version": "1.2.4",
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": {
@@ -169,7 +169,7 @@
169
169
  "LOGGER_DESTINATION": "Logger destination",
170
170
  "LOGGER_LEVEL": "Logger level",
171
171
  "LOGGING": "Logging",
172
- "LOGS_LINES_LIMITATION": "Only the latest 10000 lines are displayed. <br> To access the full log history, download the complete log file.",
172
+ "LOGS_LINES_LIMITATION": "Note: Only the last 10,000 rows are displayed. <br> To download up to 100,000 rows, click on the 'Download' button.",
173
173
  "MAX": "Max",
174
174
  "MAX_REPLICAS": "Maximum number of replicas (default: {{default}})",
175
175
  "MAX_WORKERS": "Max Workers",
@@ -49,9 +49,9 @@ such restriction.
49
49
  * @returns {string} the log name display value
50
50
  */
51
51
  function getLogName() {
52
- var name = lodash.get(ctrl.entryItem, 'name', '');
52
+ var name = lodash.get(ctrl.entryItem, 'kubernetes.pod.name', lodash.get(ctrl.entryItem, 'name', ''));
53
53
 
54
- return lodash.padEnd(name.substring(0, 15), 15);
54
+ return lodash.padEnd(name.substring(0, 25), 25);
55
55
  }
56
56
  }
57
57
  }());
@@ -4,7 +4,7 @@
4
4
  angular.module('iguazio.dashboard-controls')
5
5
  .factory('ControlPanelLogsDataService', ControlPanelLogsDataService);
6
6
 
7
- function ControlPanelLogsDataService($q, lodash, ElasticsearchService, ElasticSearchDataService) {
7
+ function ControlPanelLogsDataService($q, lodash, ElasticsearchService) {
8
8
  return {
9
9
  collectLogs: collectLogs,
10
10
  entriesPaginated: search,
@@ -146,7 +146,6 @@
146
146
  * @param {Object} queryParams - additional parameters
147
147
  * @param {string} queryParams.query - search query text
148
148
  * @param {string} queryParams.timeFrame - selected time period to show results for
149
- * @param {string} [queryParams.lastEntryTimestamp] - time stamp of the last item in a list, used with auto
150
149
  * @returns {Promise.<Array>} a promise resolving to an array of logs.
151
150
  */
152
151
  function collectLogs(queryParams) {
@@ -155,21 +154,25 @@
155
154
  var downloadLogsData = [];
156
155
  var MAX_DOWNLOAD_LOGS = 100000;
157
156
 
158
- return ElasticSearchDataService.createPit(keepAlive).then(function (pitId) {
159
- return getNextChunk(pitId, null);
157
+ return createSearch(size, keepAlive, queryParams).then(function (response) {
158
+ var hits = response.hits.hits;
159
+
160
+ if (hits.length > 0) {
161
+ downloadLogsData = downloadLogsData.concat(prepareLogs(hits));
162
+
163
+ return getNextChunk(response._scroll_id);
164
+ }
160
165
  });
161
166
 
162
- function getNextChunk(pit, searchAfter) {
163
- return getNextPitLogs(size, queryParams, keepAlive, pit, searchAfter)
167
+ function getNextChunk(scroll) {
168
+ return getNextScrollLogs(keepAlive, scroll)
164
169
  .then(function (response) {
165
170
  var hits = response.hits.hits;
166
171
 
167
172
  if (hits.length > 0 && downloadLogsData.length < MAX_DOWNLOAD_LOGS - size) {
168
- var lastHit = lodash.last(hits);
169
-
170
173
  downloadLogsData = downloadLogsData.concat(prepareLogs(hits));
171
174
 
172
- return getNextChunk(response.pit_id, lastHit.sort);
175
+ return getNextChunk(response._scroll_id);
173
176
  } else {
174
177
  return downloadLogsData;
175
178
  }
@@ -181,8 +184,10 @@
181
184
  function prepareLogs(logs) {
182
185
  return logs.map(function (logData) {
183
186
  var log = lodash.get(logData, '_source', {});
187
+ var level = log.level ? ' (' + log.level + ') ' : '';
188
+ var name = lodash.get(log, 'kubernetes.pod.name', lodash.get(log, 'name', ''));
184
189
 
185
- return log['@timestamp'] + ' ' + log.name + ' (' + log.level + ') ' +
190
+ return log['@timestamp'] + ' ' + name + level +
186
191
  lodash.get(log, 'message', '') + ' ' + JSON.stringify(lodash.get(log, 'more', {}));
187
192
  });
188
193
  }
@@ -249,18 +254,15 @@
249
254
  }
250
255
 
251
256
  /**
252
- * Gets next part of the logs using Pit Id and search after parameters
253
- * @param {number} size - size of the logs to be requested
257
+ * Makes a request to elasticsearch to create search id
258
+ * @param {boolean} size - logs size
259
+ * @param {string} keepAlive - sets lifetime for scroll id
254
260
  * @param {Object} queryParams - additional parameters
255
261
  * @param {string} queryParams.query - search query text
256
- * @param {string} queryParams.timeFrame - selected time period to show results for
257
262
  * @param {string} [queryParams.lastEntryTimestamp] - time stamp of the last item in a list, used with auto
258
- * @param {boolean} keepAlive - determines how long the PIT ID should be alive
259
- * @param {string} pitId - PIT ID that is needed to get next chunk of logs
260
- * @param {Array} searchAfter - An array of identifiers that points to the last provided log
261
- * @returns {Promise.<Object>} Elasticsearch logs data.
263
+ * @returns {Object}
262
264
  */
263
- function getNextPitLogs(size, queryParams, keepAlive, pitId, searchAfter) {
265
+ function createSearch(size, keepAlive, queryParams) {
264
266
  var searchFrom = '';
265
267
  var searchTo = 'now';
266
268
 
@@ -273,11 +275,8 @@
273
275
 
274
276
  var config = {
275
277
  size: size,
278
+ scroll: keepAlive,
276
279
  body: {
277
- pit: {
278
- id: pitId,
279
- keep_alive: keepAlive
280
- },
281
280
  query: {
282
281
  bool: {
283
282
  must: [
@@ -307,11 +306,22 @@
307
306
  }
308
307
  };
309
308
 
310
- if (searchAfter) {
311
- config.body.search_after = searchAfter;
312
- }
313
-
314
309
  return ElasticsearchService.search(config);
315
310
  }
311
+
312
+ /**
313
+ * Gets next part of the logs using scroll id parameter
314
+ * @param {boolean} keepAlive - determines how long the scroll id should be alive
315
+ * @param {string} scrollId - scroll id that is needed to get next chunk of logs
316
+ * @returns {Promise.<Object>} Elasticsearch logs data.
317
+ */
318
+ function getNextScrollLogs(keepAlive, scrollId) {
319
+ return ElasticsearchService.scroll({
320
+ body: {
321
+ scroll: keepAlive,
322
+ scroll_id: scrollId
323
+ }
324
+ });
325
+ }
316
326
  }
317
327
  }());
@@ -8,7 +8,7 @@
8
8
  height: 95%;
9
9
 
10
10
  .info-page-filters {
11
- z-index: 990;
11
+ z-index: 1000;
12
12
 
13
13
  .multiple-checkboxes-option {
14
14
  margin: 10px 0;