iguazio.dashboard-controls 0.37.9 → 0.37.12-patch1

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": "0.37.9",
3
+ "version": "0.37.12-patch1",
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": {
@@ -182,7 +182,8 @@
182
182
  "NO_LOGS_HAVE_BEEN_FOUND": "No logs have been found...",
183
183
  "NODE_SELECTORS": "Node selector",
184
184
  "NORMAL": "Normal",
185
- "NOT_START_WITH_FORBIDDEN_WORDS": "Must not start with 'kubernetes.io', 'k8s.io' or 'nuclio.io'",
185
+ "NOT_START_WITH_FORBIDDEN_WORDS_ANNOTATION": "Must not start with 'kubernetes.io', 'k8s.io'",
186
+ "NOT_START_WITH_FORBIDDEN_WORDS_LABEL": "Must not start with 'kubernetes.io', 'k8s.io' or 'nuclio.io'",
186
187
  "NOT_YET_DEPLOYED": "Not yet deployed",
187
188
  "OAUTH2": "OAuth2",
188
189
  "ONBUILD_IMAGE": "Onbuild image",
@@ -17,15 +17,20 @@
17
17
  transclude: true
18
18
  });
19
19
 
20
- function IgzElementLoadingStatusController($element, $scope, $state, $timeout, $i18next, i18next, lodash) {
20
+ function IgzElementLoadingStatusController($element, $scope, $state, $i18next, i18next, lodash) {
21
21
  var ctrl = this;
22
- var defaultHeight = 0;
23
22
  var lng = i18next.language;
24
23
 
25
- ctrl.isShowSpinner = true;
26
24
  ctrl.isShowContent = false;
27
25
  ctrl.isShowError = false;
26
+ ctrl.isShowSpinner = true;
28
27
 
28
+ ctrl.deregisterHideError = null;
29
+ ctrl.deregisterHideSpinner = null;
30
+ ctrl.deregisterShowError = null;
31
+ ctrl.deregisterShowSpinner = null;
32
+
33
+ ctrl.$onDestroy = onDestroy;
29
34
  ctrl.$onInit = onInit;
30
35
  ctrl.$onChanges = onChanges;
31
36
 
@@ -36,21 +41,25 @@
36
41
  // Hook methods
37
42
  //
38
43
 
44
+ /**
45
+ * Destructor method
46
+ */
47
+ function onDestroy() {
48
+ deregisterBroadcasts();
49
+ }
50
+
39
51
  /**
40
52
  * Initialization method
41
53
  */
42
54
  function onInit() {
43
- $scope.$on('element-loading-status_show-spinner_' + ctrl.name, showSpinner);
44
- $scope.$on('element-loading-status_hide-spinner_' + ctrl.name, hideSpinner);
45
-
46
- $scope.$on('element-loading-status_show-error_' + ctrl.name, showError);
47
- $scope.$on('element-loading-status_hide-error_' + ctrl.name, hideError);
55
+ registerBroadcasts();
48
56
  }
49
57
 
50
58
  /**
51
59
  * Changes method
60
+ * @param {Object} changes
52
61
  */
53
- function onChanges() {
62
+ function onChanges(changes) {
54
63
  lodash.defaults(ctrl, {
55
64
  loadingStatusSize: 'default',
56
65
  refresh: false,
@@ -66,7 +75,10 @@
66
75
  });
67
76
  }
68
77
 
69
- defaultHeight = ctrl.loadingStatusSize === 'small' ? 20 : 40;
78
+ if (changes && changes.name && changes.name.currentValue !== changes.name.previousValue) {
79
+ deregisterBroadcasts();
80
+ registerBroadcasts();
81
+ }
70
82
  }
71
83
 
72
84
  //
@@ -98,12 +110,20 @@
98
110
  //
99
111
 
100
112
  /**
101
- * Show given loading spinner
113
+ * Deregister broadcasts
102
114
  */
103
- function showSpinner() {
115
+ function deregisterBroadcasts() {
116
+ ctrl.deregisterHideError();
117
+ ctrl.deregisterHideSpinner();
118
+ ctrl.deregisterShowError();
119
+ ctrl.deregisterShowSpinner();
120
+ }
121
+
122
+ /**
123
+ * Hide given loading error
124
+ */
125
+ function hideError() {
104
126
  ctrl.isShowError = false;
105
- ctrl.isShowContent = false;
106
- ctrl.isShowSpinner = true;
107
127
  }
108
128
 
109
129
  /**
@@ -114,6 +134,16 @@
114
134
  ctrl.isShowContent = true;
115
135
  }
116
136
 
137
+ /**
138
+ * Register broadcasts
139
+ */
140
+ function registerBroadcasts() {
141
+ ctrl.deregisterHideError = $scope.$on('element-loading-status_hide-error_' + ctrl.name, hideError);
142
+ ctrl.deregisterHideSpinner = $scope.$on('element-loading-status_hide-spinner_' + ctrl.name, hideSpinner);
143
+ ctrl.deregisterShowError = $scope.$on('element-loading-status_show-error_' + ctrl.name, showError);
144
+ ctrl.deregisterShowSpinner = $scope.$on('element-loading-status_show-spinner_' + ctrl.name, showSpinner);
145
+ }
146
+
117
147
  /**
118
148
  * Show given loading error
119
149
  */
@@ -123,10 +153,12 @@
123
153
  }
124
154
 
125
155
  /**
126
- * Hide given loading error
156
+ * Show given loading spinner
127
157
  */
128
- function hideError() {
158
+ function showSpinner() {
129
159
  ctrl.isShowError = false;
160
+ ctrl.isShowContent = false;
161
+ ctrl.isShowSpinner = true;
130
162
  }
131
163
  }
132
164
  }());
@@ -341,7 +341,7 @@
341
341
  $scope.$on('info-page-pane_toggled', updateChart);
342
342
  $scope.$on('resize-size-cells', updateChart);
343
343
 
344
- timeout = $timeout(updateChart);
344
+ updateChart();
345
345
  }
346
346
 
347
347
  /**
@@ -43,7 +43,11 @@
43
43
  $timeout(initColumnsWidths);
44
44
  $timeout(initElements);
45
45
 
46
- angular.element($window).on('resize', reloadColumns);
46
+ angular.element($window).on('resize', function () {
47
+ $timeout(function () {
48
+ reloadColumns()
49
+ }, 200)
50
+ });
47
51
  $scope.$on('reload-columns', reloadColumns);
48
52
  $scope.$on('resizable-table-column_reset-data', resetData);
49
53
  $scope.$on('$destroy', onDestroy);
@@ -243,7 +247,7 @@
243
247
  columnWidth: ctrl.columnHeadWidth + 'px',
244
248
  nextColumnWidth: ctrl.nextBlockWidth + 'px'
245
249
  });
246
- }, 200);
250
+ });
247
251
  }
248
252
  }
249
253
 
@@ -294,12 +294,6 @@
294
294
  $i18next.t('common:BEGIN_END_WITH', { lng: lng }) + ': a–z, 0–9',
295
295
  pattern: /^([a-z0-9]([^/]*[a-z0-9])?\/)?[^/]+$/
296
296
  },
297
- {
298
- name: 'prefixNotStart',
299
- label: '[' + $i18next.t('functions:PREFIX', { lng: lng }) + '] ' +
300
- $i18next.t('functions:NOT_START_WITH_FORBIDDEN_WORDS', { lng: lng }),
301
- pattern: /^(?!kubernetes\.io\/)(?!k8s\.io\/)(?!nuclio\.io\/)/
302
- },
303
297
  {
304
298
  name: 'prefixMaxLength',
305
299
  label: '[' + $i18next.t('functions:PREFIX', { lng: lng }) + '] ' +
@@ -330,7 +324,6 @@
330
324
  generateRule.validCharacters('a-z A-Z 0-9 - _ .'),
331
325
  generateRule.beginNotWith('0-9 .')
332
326
  ],
333
- prefixedQualifiedName: commonRules.prefixedQualifiedName,
334
327
  qualifiedName: [
335
328
  generateRule.validCharacters('a-z A-Z 0-9 - _ .'),
336
329
  generateRule.beginEndWith('a-z A-Z 0-9'),
@@ -358,9 +351,25 @@
358
351
  generateRule.length({ max: lengths.function.name })
359
352
  ),
360
353
  label: {
361
- key: commonRules.prefixedQualifiedName.concat(generateRule.length({
362
- max: lengths.function.label.key
363
- }))
354
+ key: commonRules.prefixedQualifiedName.concat(
355
+ {
356
+ name: 'prefixNotStart',
357
+ label: '[' + $i18next.t('functions:PREFIX', {lng: lng}) + '] ' +
358
+ $i18next.t('functions:NOT_START_WITH_FORBIDDEN_WORDS_LABEL', {lng: lng}),
359
+ pattern: /^(?!kubernetes\.io\/)(?!k8s\.io\/)(?!nuclio\.io\/)/
360
+ },
361
+ generateRule.length({
362
+ max: lengths.function.label.key
363
+ }))
364
+ },
365
+ annotation: {
366
+ key: commonRules.prefixedQualifiedName.concat(
367
+ {
368
+ name: 'prefixNotStart',
369
+ label: '[' + $i18next.t('functions:PREFIX', {lng: lng}) + '] ' +
370
+ $i18next.t('functions:NOT_START_WITH_FORBIDDEN_WORDS_ANNOTATION', {lng: lng}),
371
+ pattern: /^(?!kubernetes\.io\/)(?!k8s\.io\/)/
372
+ })
364
373
  },
365
374
  itemPath: [generateRule.length({ max: lengths.function.itemPath })],
366
375
  subscriptionQoS: [
@@ -38,7 +38,7 @@
38
38
  name: $i18next.t('functions:TOOLTIP.ANNOTATION', { lng: lng })
39
39
  });
40
40
  ctrl.validationRules = {
41
- key: ValidationService.getValidationRules('k8s.prefixedQualifiedName', [
41
+ key: ValidationService.getValidationRules('function.annotation.key', [
42
42
  {
43
43
  name: 'uniqueness',
44
44
  label: $i18next.t('functions:UNIQUENESS', { lng: lng }),
@@ -75,9 +75,6 @@
75
75
  if (lodash.has(changes, 'version')) {
76
76
  ctrl.annotations = lodash.chain(ctrl.version)
77
77
  .get('metadata.annotations', {})
78
- .omitBy(function (value, key) {
79
- return lodash.startsWith(key, 'nuclio.io/');
80
- })
81
78
  .map(function (value, key) {
82
79
  return {
83
80
  name: key,
@@ -165,10 +162,6 @@
165
162
  */
166
163
  function updateAnnotations() {
167
164
  var isFormValid = true;
168
- var annotations = lodash.get(ctrl.version, 'metadata.annotations', {});
169
- var nuclioAnnotations = lodash.pickBy(annotations, function (value, key) {
170
- return lodash.startsWith(key, 'nuclio.io/');
171
- });
172
165
  var newAnnotations = {};
173
166
 
174
167
  lodash.forEach(ctrl.annotations, function (annotation) {
@@ -188,8 +181,6 @@
188
181
  isDisabled: !isFormValid
189
182
  });
190
183
 
191
- lodash.merge(newAnnotations, nuclioAnnotations);
192
-
193
184
  lodash.set(ctrl.version, 'metadata.annotations', newAnnotations);
194
185
  ctrl.onChangeCallback();
195
186
  }