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.
- package/dist/i18n/en/common.json +95 -83
- package/dist/i18n/en/functions.json +110 -109
- package/dist/js/iguazio.dashboard-controls.js +6660 -5230
- package/dist/less/iguazio.dashboard-controls.less +1430 -881
- package/package.json +1 -1
- package/src/i18n/en/common.json +95 -83
- package/src/i18n/en/functions.json +110 -109
- package/src/igz_controls/components/date-time-picker/date-time-picker.component.js +689 -0
- package/src/igz_controls/components/date-time-picker/date-time-picker.component.spec.js +356 -0
- package/src/igz_controls/components/date-time-picker/date-time-picker.less +418 -0
- package/src/igz_controls/components/date-time-picker/date-time-picker.tpl.html +90 -0
- package/src/igz_controls/components/date-time-picker/prevent-parent-scroll.directive.js +27 -0
- package/src/igz_controls/components/log-table-row/log-table-row.component.js +57 -0
- package/src/igz_controls/components/log-table-row/log-table-row.component.spec.js +49 -0
- package/src/igz_controls/components/log-table-row/log-table-row.less +29 -0
- package/src/igz_controls/components/log-table-row/log-table-row.tpl.html +16 -0
- package/src/igz_controls/components/multiple-checkboxes/multiple-checkboxes.component.js +39 -5
- package/src/igz_controls/services/control-panel-logs-data.service.js +203 -0
- package/src/nuclio/common/components/deploy-log/deploy-log.component.js +1 -1
- package/src/nuclio/common/services/export.service.js +28 -5
- package/src/nuclio/functions/version/version-execution-log/version-execution-log.component.js +463 -0
- package/src/nuclio/functions/version/version-execution-log/version-execution-log.less +99 -0
- package/src/nuclio/functions/version/version-execution-log/version-execution-log.tpl.html +177 -0
- package/src/nuclio/functions/version/version.component.js +29 -2
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
describe('igzDateTimePicker component:', function () {
|
|
2
|
+
var $componentController;
|
|
3
|
+
var $rootScope;
|
|
4
|
+
var $timeout;
|
|
5
|
+
var moment;
|
|
6
|
+
var ctrl;
|
|
7
|
+
|
|
8
|
+
beforeEach(function () {
|
|
9
|
+
module('iguazio.dashboard-controls');
|
|
10
|
+
|
|
11
|
+
inject(function (_$componentController_, _$rootScope_, _$timeout_, _moment_) {
|
|
12
|
+
$componentController = _$componentController_;
|
|
13
|
+
$rootScope = _$rootScope_;
|
|
14
|
+
$timeout = _$timeout_;
|
|
15
|
+
moment = _moment_;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
var dateValue = {
|
|
19
|
+
from: new Date('2016-02-26T14:47:35.738Z'),
|
|
20
|
+
to: new Date('2016-02-28T14:47:35.738Z')
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var bindings = {
|
|
24
|
+
inputDateFrom: dateValue.from,
|
|
25
|
+
inputDateTo: dateValue.to,
|
|
26
|
+
pickFutureDates: true,
|
|
27
|
+
onChangeModel: angular.noop,
|
|
28
|
+
selectedPreset: 'hour'
|
|
29
|
+
};
|
|
30
|
+
var element = angular.element('<igz-date-time-picker></igz-date-time-picker>');
|
|
31
|
+
|
|
32
|
+
ctrl = $componentController('igzDateTimePicker', {$element: element}, bindings);
|
|
33
|
+
ctrl.$onInit();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(function () {
|
|
37
|
+
$componentController = null;
|
|
38
|
+
$rootScope = null;
|
|
39
|
+
$timeout = null;
|
|
40
|
+
moment = null;
|
|
41
|
+
ctrl = null;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('showDatePickerPopup(): ', function () {
|
|
45
|
+
it('should show date picker popup and allow to set future dates', function () {
|
|
46
|
+
ctrl.isShowDatePicker = false;
|
|
47
|
+
ctrl.pickFutureDates = true;
|
|
48
|
+
ctrl.selectedPreset = '';
|
|
49
|
+
|
|
50
|
+
ctrl.showDatepickerPopup({});
|
|
51
|
+
|
|
52
|
+
expect(ctrl.isShowDatePicker).toBeTruthy();
|
|
53
|
+
expect(ctrl.date.from).toEqual(ctrl.inputDateFrom);
|
|
54
|
+
expect(ctrl.date.to).toEqual(ctrl.inputDateTo);
|
|
55
|
+
expect(ctrl.datepickerOptions.from.maxDate).toBeNull();
|
|
56
|
+
expect(ctrl.datepickerOptions.to.maxDate).toBeNull();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should show date picker popup and set current date when selectedPreset is chosen', function () {
|
|
60
|
+
var defaultTimePart = {
|
|
61
|
+
second: 0,
|
|
62
|
+
millisecond: 0
|
|
63
|
+
};
|
|
64
|
+
var currentDate = moment().utcOffset(0).set(defaultTimePart).toDate();
|
|
65
|
+
|
|
66
|
+
ctrl.date.from = new Date('2016-01-01T14:47:35.738Z');
|
|
67
|
+
ctrl.selectedPreset = 'week';
|
|
68
|
+
|
|
69
|
+
ctrl.showDatepickerPopup({});
|
|
70
|
+
|
|
71
|
+
expect(ctrl.date.from).toEqual(currentDate);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should show date picker popup and set previous selected range when it is chosen', function () {
|
|
75
|
+
var date = new Date('2016-01-01T14:47:00.000Z');
|
|
76
|
+
|
|
77
|
+
ctrl.inputDateFrom = date;
|
|
78
|
+
ctrl.selectedPreset = '';
|
|
79
|
+
|
|
80
|
+
ctrl.showDatepickerPopup({});
|
|
81
|
+
|
|
82
|
+
expect(ctrl.date.from).toEqual(date);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should show date picker popup and set max date (not allow to set future dates)', function () {
|
|
86
|
+
ctrl.isShowDatePicker = true;
|
|
87
|
+
ctrl.pickFutureDates = false;
|
|
88
|
+
ctrl.selectedPreset = '';
|
|
89
|
+
|
|
90
|
+
var defaultTimePart = {
|
|
91
|
+
second: 0,
|
|
92
|
+
millisecond: 0
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
ctrl.showDatepickerPopup({});
|
|
96
|
+
|
|
97
|
+
expect(ctrl.isShowDatePicker).toBeFalsy();
|
|
98
|
+
expect(ctrl.date.from).toEqual(ctrl.inputDateFrom);
|
|
99
|
+
expect(ctrl.date.to).toEqual(ctrl.inputDateTo);
|
|
100
|
+
expect(ctrl.datepickerOptions.from.maxDate).toEqual(moment().utcOffset(0).set(defaultTimePart).toDate());
|
|
101
|
+
expect(ctrl.datepickerOptions.to.maxDate).toEqual(moment().utcOffset(0).set(defaultTimePart).toDate());
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('showOptionsList(): ', function () {
|
|
106
|
+
it('should change ctrl.isShowOptionsList', function () {
|
|
107
|
+
ctrl.isShowOptionsList = false;
|
|
108
|
+
|
|
109
|
+
ctrl.showOptionsList({});
|
|
110
|
+
|
|
111
|
+
expect(ctrl.isShowOptionsList).toBeTruthy();
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('isOptionSelected(): ', function () {
|
|
116
|
+
it('should return true if provided with the currently selected preset', function () {
|
|
117
|
+
expect(ctrl.isOptionSelected('hour')).toBeTruthy();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should return flase if provided with a preset other than the currently selected preset', function () {
|
|
121
|
+
expect(ctrl.isOptionSelected('day')).toBeFalsy();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('onChangeDateTime(): ', function () {
|
|
126
|
+
it('should set value to input field and call ctrl.onChangeModel if time picker is available and date range', function () {
|
|
127
|
+
spyOn(ctrl, 'onChangeModel');
|
|
128
|
+
|
|
129
|
+
ctrl.pickTime = true;
|
|
130
|
+
ctrl.isDateRange = true;
|
|
131
|
+
ctrl.date = {
|
|
132
|
+
from: new Date('2016-01-01T14:47:35.738Z'),
|
|
133
|
+
to: new Date('2016-01-05T14:47:35.738Z')
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var expectedDate = {
|
|
137
|
+
from: new Date('2016-01-01T14:47:00.000Z'),
|
|
138
|
+
to: new Date('2016-01-05T14:47:00.000Z')
|
|
139
|
+
};
|
|
140
|
+
var convertedDate = moment(ctrl.date.from).format('MMM D, YYYY') + moment(ctrl.date.from).format(' h:mmA') + ' - ' +
|
|
141
|
+
moment(ctrl.date.to).format('MMM D, YYYY') + moment(ctrl.date.to).format(' h:mmA');
|
|
142
|
+
|
|
143
|
+
ctrl.isShowDatePicker = true;
|
|
144
|
+
ctrl.isShowOptionsList = true;
|
|
145
|
+
ctrl.selectedPreset = '';
|
|
146
|
+
ctrl.showOptionsList({});
|
|
147
|
+
ctrl.applyChanges();
|
|
148
|
+
|
|
149
|
+
$timeout.flush();
|
|
150
|
+
|
|
151
|
+
expect(ctrl.displayText).toEqual(convertedDate);
|
|
152
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith({newValue: expectedDate, selectedPreset: ''});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should set value to input field and call ctrl.onChangeModel if time picker is not available and date range', function () {
|
|
156
|
+
spyOn(ctrl, 'onChangeModel');
|
|
157
|
+
|
|
158
|
+
ctrl.pickTime = false;
|
|
159
|
+
ctrl.isDateRange = true;
|
|
160
|
+
ctrl.date = {
|
|
161
|
+
from: new Date('2016-01-01T14:47:35.738Z'),
|
|
162
|
+
to: new Date('2016-01-05T14:47:35.738Z')
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
var convertedDate = moment(ctrl.date.from).format('MMM D, YYYY') + ' - ' + moment(ctrl.date.to).format('MMM D, YYYY');
|
|
166
|
+
var newValue = {
|
|
167
|
+
from: new Date('2016-01-01T00:00:00.000Z'),
|
|
168
|
+
to: new Date('2016-01-05T00:00:00.000Z')
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
ctrl.isShowDatePicker = true;
|
|
172
|
+
ctrl.isShowOptionsList = true;
|
|
173
|
+
ctrl.selectedPreset = '';
|
|
174
|
+
ctrl.showOptionsList({});
|
|
175
|
+
ctrl.applyChanges();
|
|
176
|
+
|
|
177
|
+
$timeout.flush();
|
|
178
|
+
|
|
179
|
+
expect(ctrl.displayText).toEqual(convertedDate);
|
|
180
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith({newValue: newValue, selectedPreset: ''});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('should set value to input field and call ctrl.onChangeModel if time picker is not available and not date range', function () {
|
|
184
|
+
spyOn(ctrl, 'onChangeModel');
|
|
185
|
+
|
|
186
|
+
ctrl.pickTime = false;
|
|
187
|
+
ctrl.isDateRange = false;
|
|
188
|
+
ctrl.date = {
|
|
189
|
+
from: new Date('2016-01-01T14:47:35.738Z')
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var convertedDate = moment(ctrl.date.from).format('MMM D, YYYY');
|
|
193
|
+
var newValue = {
|
|
194
|
+
from: new Date('2016-01-01T00:00:00.000Z')
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
ctrl.isShowDatePicker = true;
|
|
198
|
+
ctrl.isShowOptionsList = true;
|
|
199
|
+
ctrl.selectedPreset = '';
|
|
200
|
+
ctrl.showOptionsList({});
|
|
201
|
+
ctrl.applyChanges();
|
|
202
|
+
|
|
203
|
+
$timeout.flush();
|
|
204
|
+
|
|
205
|
+
expect(ctrl.displayText).toEqual(convertedDate);
|
|
206
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith({newValue: newValue.from, selectedPreset: ''});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('should set value to input field and call ctrl.onChangeModel if time picker is available and not date range', function () {
|
|
210
|
+
spyOn(ctrl, 'onChangeModel');
|
|
211
|
+
|
|
212
|
+
ctrl.pickTime = true;
|
|
213
|
+
ctrl.isDateRange = false;
|
|
214
|
+
ctrl.date = {
|
|
215
|
+
from: new Date('2016-01-01T14:47:35.738Z')
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
var expectedDate = {
|
|
219
|
+
from: new Date('2016-01-01T14:47:00.000Z')
|
|
220
|
+
};
|
|
221
|
+
var convertedDate = moment(ctrl.date.from).format('MMM D, YYYY') + moment(ctrl.date.from).format(' h:mmA');
|
|
222
|
+
|
|
223
|
+
ctrl.isShowDatePicker = true;
|
|
224
|
+
ctrl.isShowOptionsList = true;
|
|
225
|
+
ctrl.selectedPreset = '';
|
|
226
|
+
ctrl.showOptionsList({});
|
|
227
|
+
ctrl.applyChanges();
|
|
228
|
+
|
|
229
|
+
$timeout.flush();
|
|
230
|
+
|
|
231
|
+
expect(ctrl.displayText).toEqual(convertedDate);
|
|
232
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith({newValue: expectedDate.from, selectedPreset: ''});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('should change ctrl.isShowOptionsList depends on range type', function () {
|
|
236
|
+
ctrl.presets = {
|
|
237
|
+
day: {
|
|
238
|
+
label: 'Last day',
|
|
239
|
+
getRange: function () {
|
|
240
|
+
return {
|
|
241
|
+
from: moment().subtract(1, 'days')
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
ctrl.pickTime = true;
|
|
247
|
+
ctrl.isDateRange = true;
|
|
248
|
+
ctrl.isShowOptionsList = true;
|
|
249
|
+
|
|
250
|
+
ctrl.onChangeDateTime('day');
|
|
251
|
+
|
|
252
|
+
expect(ctrl.isShowOptionsList).toBeFalsy();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
describe('ctrl.applyChanges(): ', function () {
|
|
257
|
+
it('should set date/time by calling ctrl.onChangeModel and close date picker', function () {
|
|
258
|
+
spyOn(ctrl, 'onChangeModel');
|
|
259
|
+
|
|
260
|
+
ctrl.pickTime = true;
|
|
261
|
+
ctrl.isDateRange = true;
|
|
262
|
+
ctrl.date = {
|
|
263
|
+
from: new Date('2016-01-01T14:47:35.738Z'),
|
|
264
|
+
to: new Date('2016-01-05T14:47:35.738Z')
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var expectedDate = {
|
|
268
|
+
from: new Date('2016-01-01T14:47:00.000Z'),
|
|
269
|
+
to: new Date('2016-01-05T14:47:00.000Z')
|
|
270
|
+
};
|
|
271
|
+
var convertedDate = moment(ctrl.date.from).format('MMM D, YYYY') + moment(ctrl.date.from).format(' h:mmA') + ' - ' +
|
|
272
|
+
moment(ctrl.date.to).format('MMM D, YYYY') + moment(ctrl.date.to).format(' h:mmA');
|
|
273
|
+
|
|
274
|
+
ctrl.isShowDatePicker = true;
|
|
275
|
+
ctrl.isShowOptionsList = true;
|
|
276
|
+
ctrl.selectedPreset = '';
|
|
277
|
+
|
|
278
|
+
ctrl.applyChanges();
|
|
279
|
+
|
|
280
|
+
expect(ctrl.displayText).toEqual(convertedDate);
|
|
281
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith({newValue: expectedDate, selectedPreset: '' });
|
|
282
|
+
expect(ctrl.isShowDatePicker).toBeFalsy();
|
|
283
|
+
expect(ctrl.isShowOptionsList).toBeFalsy();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('ctrl.cancelChanges(): ', function () {
|
|
288
|
+
it('should cancel changes and close date picker', function () {
|
|
289
|
+
ctrl.isShowDatePicker = true;
|
|
290
|
+
ctrl.isShowOptionsList = true;
|
|
291
|
+
|
|
292
|
+
ctrl.cancelChanges();
|
|
293
|
+
|
|
294
|
+
expect(ctrl.isShowDatePicker).toBeFalsy();
|
|
295
|
+
expect(ctrl.isShowOptionsList).toBeFalsy();
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
describe('ctrl.clearSelectedDateTime(): ', function () {
|
|
300
|
+
it('should clear selected date fields', function () {
|
|
301
|
+
spyOn(ctrl, 'onChangeModel');
|
|
302
|
+
spyOn(ctrl, 'cancelChanges');
|
|
303
|
+
|
|
304
|
+
var defaultDatepickerOptions = {
|
|
305
|
+
from: {},
|
|
306
|
+
to: {}
|
|
307
|
+
};
|
|
308
|
+
var defaultModel = {
|
|
309
|
+
newValue: {
|
|
310
|
+
to: null,
|
|
311
|
+
from: null
|
|
312
|
+
},
|
|
313
|
+
selectedPreset: ''
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
ctrl.clearSelectedDateTime();
|
|
317
|
+
|
|
318
|
+
expect(ctrl.selectedPreset).toEqual('');
|
|
319
|
+
expect(ctrl.datepickerOptions).toEqual(defaultDatepickerOptions);
|
|
320
|
+
expect(ctrl.onChangeModel).toHaveBeenCalledWith(defaultModel);
|
|
321
|
+
expect(ctrl.cancelChanges).toHaveBeenCalled();
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
describe('ctrl.getErrorMessage(): ', function () {
|
|
326
|
+
it('should returns \'\' if a range is correct', function () {
|
|
327
|
+
ctrl.isDateRange = true;
|
|
328
|
+
ctrl.date = {
|
|
329
|
+
from: new Date('2016-01-01T14:47:35.738Z'),
|
|
330
|
+
to: new Date('2016-01-05T14:47:35.738Z')
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
expect(ctrl.getErrorMessage()).toEqual('');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('should returns \'\' if it is not date range', function () {
|
|
337
|
+
ctrl.isDateRange = false;
|
|
338
|
+
ctrl.date = {
|
|
339
|
+
from: new Date('2016-01-01T14:47:35.738Z'),
|
|
340
|
+
to: new Date('2016-01-05T14:47:35.738Z')
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
expect(ctrl.getErrorMessage()).toEqual('');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('should returns error message if a range is not correct', function () {
|
|
347
|
+
ctrl.isDateRange = true;
|
|
348
|
+
ctrl.date = {
|
|
349
|
+
from: new Date('2016-01-05T14:47:35.738Z'),
|
|
350
|
+
to: new Date('2016-01-01T14:47:35.738Z')
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
expect(ctrl.getErrorMessage()).toEqual('ERROR_MSG.DATE_TIME_PICKER.TO_LATER_THAN_FROM');
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
});
|