iguazio.dashboard-controls 1.2.19-vistra-logs → 1.3.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,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-controls",
3
- "version": "1.2.19-vistra-logs",
3
+ "version": "1.3.0",
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": {
@@ -153,6 +153,7 @@
153
153
  "HUGE": "Huge",
154
154
  "HTTP_TRIGGER_MSG": "A Nuclio function must have a single HTTP trigger. You can define such a trigger&nbsp;<a class=\"link\" data-ng-click=\"$ctrl.addDefaultHttpTrigger($event)\">here</a>. Otherwise, when deploying the function a default HTTP trigger named \"default-http\" is defined and deployed automatically unless there is a custom HTTP trigger configuration in the <a class=\"link\" data-ui-sref=\"app.project.function.edit.code\">external source code</a>.",
155
155
  "HTTP_TRIGGER_NAME_DESCRIPTION": "If the name of the HTTP trigger is <b>default-http</b> it might get overridden by a remote function specification configured in <b>Code Entry Type.</b>",
156
+ "IGUAZIO":"Iguazio",
156
157
  "IMAGE_NAME": "Image name",
157
158
  "IMAGE_NAME_DESCRIPTION": "The name of the built container image (default for this function: <b>{{defaultImageName}}</b>)",
158
159
  "IMPORT": "Import",
@@ -37,13 +37,36 @@ describe('igzElasticLogTableRow component: ', function () {
37
37
  });
38
38
 
39
39
  describe('getLogName():', function () {
40
- it('should return the log name display value with free space in the end', function () {
41
- expect(ctrl.getLogName()).toBe('cron ');
40
+ it('should return the full log name display value', function () {
41
+ ctrl.entryItem.name = '012345678901234567890123456789';
42
+ expect(ctrl.getLogName()).toBe('012345678901234567890123456789');
42
43
  });
43
44
 
44
- it('should return the cropped log name display value', function () {
45
- ctrl.entryItem.name = '012345678901234567890123456789';
46
- expect(ctrl.getLogName()).toBe('012345678901234');
45
+ it('should return the kubernetes pod name', function () {
46
+ ctrl.entryItem.kubernetes = { pod: { name: 'kubName' } }
47
+ expect(ctrl.getLogName()).toBe('kubName');
48
+ });
49
+
50
+ it('should return the empty string', function () {
51
+ ctrl.entryItem.name = undefined
52
+ expect(ctrl.getLogName()).toBe('');
53
+ });
54
+
55
+ it('should return the empty sting', function () {
56
+ ctrl.entryItem.kubernetes = { pod: {} }
57
+ ctrl.entryItem.name = undefined
58
+ expect(ctrl.getLogName()).toBe('');
59
+ });
60
+ });
61
+
62
+ describe('getLogTrimmedName():', function () {
63
+ it('should return the log name display value with free space in the end, 25 symbols in total', function () {
64
+ expect(ctrl.getLogTrimmedName()).toBe('cron ');
65
+ });
66
+
67
+ it('should return the cropped log name display value to 25 symbols', function () {
68
+ ctrl.entryItem.name = '012345678901234567890123456789123456789';
69
+ expect(ctrl.getLogTrimmedName()).toBe('0123456789012345678901234');
47
70
  });
48
71
  });
49
72
  });
@@ -39,7 +39,7 @@ describe('igzToastStatusPanel component:', function () {
39
39
  panelStatus: null
40
40
  };
41
41
 
42
- ctrl = $componentController('igzToastStatusPanel', {$element: element}, bindings);
42
+ ctrl = $componentController('igzToastStatusPanel', {$element: element, $transclude: angular.noop}, bindings);
43
43
  });
44
44
 
45
45
  afterEach(function () {
@@ -40,6 +40,11 @@ such restriction.
40
40
  id: 'oauth2',
41
41
  name: $i18next.t('functions:OAUTH2', { lng: lng }),
42
42
  tooltip: $i18next.t('functions:OAUTH2', { lng: lng })
43
+ },
44
+ {
45
+ id: 'iguazio',
46
+ name: $i18next.t('functions:IGUAZIO', { lng: lng }),
47
+ tooltip: $i18next.t('functions:IGUAZIO', { lng: lng })
43
48
  }
44
49
  ];
45
50
 
@@ -46,20 +46,6 @@ describe('nclFunctionFromScratch Component:', function () {
46
46
  '0sIGVycm9yKSB7DQogICAgcmV0dXJuIG5pbCwgbmlsDQp9', // source code in base64
47
47
  visible: true
48
48
  },
49
- {
50
- id: 'python:3.7',
51
- name: 'Python 3.7 ' + $i18next.t('functions:DEPRECATED_SOON_LABEL', {lng: lng}),
52
- sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
53
- nameTemplate: 'Python 3.7 ' + '<b>' + $i18next.t('functions:DEPRECATED_SOON_LABEL', {lng: lng}) + '</b>',
54
- visible: true
55
- },
56
- {
57
- id: 'python:3.8',
58
- name: 'Python 3.8 ' + $i18next.t('functions:DEPRECATED_SOON_LABEL', {lng: lng}),
59
- sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
60
- nameTemplate: 'Python 3.8 ' + '<b>' + $i18next.t('functions:DEPRECATED_SOON_LABEL', {lng: lng}) + '</b>',
61
- visible: true
62
- },
63
49
  {
64
50
  id: 'python:3.9',
65
51
  name: 'Python 3.9',
@@ -78,6 +64,12 @@ describe('nclFunctionFromScratch Component:', function () {
78
64
  sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
79
65
  visible: true
80
66
  },
67
+ {
68
+ id: 'python:3.12',
69
+ name: 'Python 3.12',
70
+ sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
71
+ visible: true
72
+ },
81
73
  {
82
74
  id: 'dotnetcore',
83
75
  name: '.NET Core ' + $i18next.t('functions:TECH_PREVIEW_LABEL', { lng: lng }),
@@ -718,8 +718,9 @@ such restriction.
718
718
  var projectName = '{project_name="' + ctrl.project.metadata.name + '"}';
719
719
  var gpuUtilizationMetric = ' * on (pod) group_left(function_name)(nuclio_function_pod_labels{project_name="' +
720
720
  ctrl.project.metadata.name + '"})';
721
+ var invocationMetricQuery = 'increase(' + ctrl.functionEventsMetric + functionEventsProjectName + '[24h])';
721
722
  var args = {
722
- metric: ctrl.functionEventsMetric + functionEventsProjectName,
723
+ metric: invocationMetricQuery,
723
724
  from: from,
724
725
  until: until,
725
726
  interval: '5m'
@@ -53,9 +53,10 @@ such restriction.
53
53
  * Returns classes list by type.
54
54
  * @param {string} type - Determines which class list to return (e.g. `'volume'`, `'trigger'`).
55
55
  * @param {Object} [additionalData] - May include additional data for populating the list.
56
+ * @param {boolean} isEnterpriseVersion - Determines if Nuclio is part of dashboard
56
57
  * @returns {Object[]} - array of classes
57
58
  */
58
- function getClassesList(type, additionalData) {
59
+ function getClassesList(type, additionalData, isEnterpriseVersion) {
59
60
  var lng = i18next.language;
60
61
  var defaultFunctionConfig = lodash.get(ConfigService, 'nuclio.defaultFunctionConfig.attributes', {});
61
62
  var classesList = {
@@ -527,6 +528,7 @@ such restriction.
527
528
  },
528
529
  {
529
530
  id: 'v3ioStream',
531
+ visible: lodash.defaultTo(isEnterpriseVersion, false),
530
532
  name: 'V3IO stream',
531
533
  tooltip: 'V3IO stream',
532
534
  tooltipOriginal: 'V3IO stream',
@@ -44,6 +44,7 @@ such restriction.
44
44
  autoScrollOnFocus: false
45
45
  }
46
46
  };
47
+ ctrl.isEnterpriseVersion = false;
47
48
  ctrl.scrollConfigHorizontal = {
48
49
  axis: 'x',
49
50
  advanced: {
@@ -209,6 +210,8 @@ such restriction.
209
210
  $scope.$on('ui.layout.loaded', resizeScrollBar);
210
211
 
211
212
  angular.element($window).bind('resize', resizeScrollBar);
213
+
214
+ ctrl.isEnterpriseVersion = ConfigService.nuclio.isEnterpriseVersion;
212
215
  }
213
216
 
214
217
  /**
@@ -501,19 +504,25 @@ such restriction.
501
504
  },
502
505
  {
503
506
  id: 'python:3.10',
507
+ ext: 'py',
504
508
  name: 'Python 3.10',
509
+ language: 'python',
505
510
  sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
506
511
  visible: true
507
512
  },
508
513
  {
509
514
  id: 'python:3.11',
515
+ ext: 'py',
510
516
  name: 'Python 3.11',
517
+ language: 'python',
511
518
  sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
512
519
  visible: true
513
520
  },
514
521
  {
515
522
  id: 'python:3.12',
523
+ ext: 'py',
516
524
  name: 'Python 3.12',
525
+ language: 'python',
517
526
  sourceCode: 'ZGVmIGhhbmRsZXIoY29udGV4dCwgZXZlbnQpOg0KICAgIHJldHVybiAiIg==', // source code in base64
518
527
  visible: true
519
528
  },
@@ -148,22 +148,23 @@
148
148
 
149
149
  <div data-ng-if="$ctrl.selectedEntryType.id === 'archive'"
150
150
  class="ncl-code-entry-url">
151
- <div class="field-label">
152
- <span>{{ 'functions:ACCESS_KEY_V3IO_ONLY' | i18next }}</span>
153
- <igz-more-info data-description="{{ 'functions:TOOLTIP.V3IO_ACCESS_KEY' | i18next }}"></igz-more-info>
151
+ <div data-ng-if="$ctrl.isEnterpriseVersion">
152
+ <div class="field-label">
153
+ <span>{{ 'functions:ACCESS_KEY_V3IO_ONLY' | i18next }}</span>
154
+ <igz-more-info data-description="{{ 'functions:TOOLTIP.V3IO_ACCESS_KEY' | i18next }}"></igz-more-info>
155
+ </div>
156
+ <igz-validating-input-field data-field-type="password"
157
+ data-input-name="sessionKey"
158
+ data-input-value="$ctrl.version.spec.build.codeEntryAttributes.headers['X-V3io-Session-Key']"
159
+ data-is-focused="false"
160
+ data-form-object="$ctrl.versionCodeForm"
161
+ data-validation-is-required="false"
162
+ data-read-only="$ctrl.isFunctionDeploying()"
163
+ data-placeholder-text="{{ 'functions:PLACEHOLDER.ENTER_ACCESS_KEY' | i18next }}"
164
+ data-update-data-callback="$ctrl.inputValueCallback(newData, field)"
165
+ data-update-data-field="spec.build.codeEntryAttributes.headers['X-V3io-Session-Key']">
166
+ </igz-validating-input-field>
154
167
  </div>
155
- <igz-validating-input-field data-field-type="password"
156
- data-input-name="sessionKey"
157
- data-input-value="$ctrl.version.spec.build.codeEntryAttributes.headers['X-V3io-Session-Key']"
158
- data-is-focused="false"
159
- data-form-object="$ctrl.versionCodeForm"
160
- data-validation-is-required="false"
161
- data-read-only="$ctrl.isFunctionDeploying()"
162
- data-placeholder-text="{{ 'functions:PLACEHOLDER.ENTER_ACCESS_KEY' | i18next }}"
163
- data-update-data-callback="$ctrl.inputValueCallback(newData, field)"
164
- data-update-data-field="spec.build.codeEntryAttributes.headers['X-V3io-Session-Key']">
165
- </igz-validating-input-field>
166
-
167
168
  <div class="field-label">
168
169
  <span>{{ 'functions:WORK_DIRECTORY' | i18next }}</span>
169
170
  <igz-more-info data-description="{{ 'functions:TOOLTIP.WORK_DIR' | i18next }}"></igz-more-info>
@@ -95,6 +95,7 @@ such restriction.
95
95
  */
96
96
  function onInit() {
97
97
  var additionalData = {};
98
+ var isEnterpriseVersion = ConfigService.nuclio.isEnterpriseVersion;
98
99
  if (lodash.isArray(ctrl.containers) && !lodash.isEmpty(ctrl.containers)) {
99
100
  additionalData.containers = lodash.chain(ctrl.containers)
100
101
  .cloneDeep()
@@ -102,7 +103,7 @@ such restriction.
102
103
  .value();
103
104
  }
104
105
 
105
- ctrl.classList = FunctionsService.getClassesList('trigger', additionalData);
106
+ ctrl.classList = FunctionsService.getClassesList('trigger', additionalData, isEnterpriseVersion);
106
107
 
107
108
  $scope.$on('edit-item-has-been-changed', updateTriggersChangesState);
108
109
 
@@ -35,13 +35,12 @@ such restriction.
35
35
  controller: NclVersionController
36
36
  });
37
37
 
38
- function NclVersionController($i18next, $interval, $injector, $rootScope, $scope, $state, $stateParams, $transitions, $timeout,
38
+ function NclVersionController($i18next, $interval, $rootScope, $scope, $state, $stateParams, $transitions, $timeout,
39
39
  i18next, lodash, ngDialog, ConfigService, DialogsService, ExportService,
40
40
  FunctionsService, GeneralDataService, NuclioHeaderService,
41
41
  VersionHelperService) {
42
42
  var ctrl = this;
43
43
  var deregisterFunction = null;
44
- var servicesService = null;
45
44
  var interval = null;
46
45
  var lng = i18next.language;
47
46
 
@@ -228,10 +227,6 @@ such restriction.
228
227
  }
229
228
  });
230
229
 
231
- if ($injector.has('ServicesService')) {
232
- servicesService = $injector.get('ServicesService')
233
- }
234
-
235
230
  setImageNamePrefixTemplate();
236
231
  setIngressHost();
237
232
  initLogTabs();
@@ -687,18 +682,11 @@ such restriction.
687
682
  * Checks if the "Execution log" tab should be shown
688
683
  */
689
684
  function initLogTabs() {
690
- if (lodash.get(ConfigService, 'url.elasticsearch.path', '') && servicesService) {
691
- servicesService.getServices().then(function (result) {
692
- var services = result.services;
693
- var logForwarderService = lodash.find(services, ['spec.name', 'log-forwarder']);
694
-
695
- if (servicesService.isEnabled(logForwarderService)) {
696
- ctrl.navigationTabsConfig.push({
697
- tabName: $i18next.t('functions:EXECUTION_LOG', { lng: lng }),
698
- id: 'execution-log',
699
- uiRoute: 'app.project.function.edit.execution-log'
700
- });
701
- }
685
+ if (lodash.get(ConfigService, 'nuclio.defaultProxyLogsSource', '') === 'elasticsearch') {
686
+ ctrl.navigationTabsConfig.push({
687
+ tabName: $i18next.t('functions:EXECUTION_LOG', { lng: lng }),
688
+ id: 'execution-log',
689
+ uiRoute: 'app.project.function.edit.execution-log'
702
690
  });
703
691
  }
704
692
  }