iguazio.dashboard-controls 0.37.12-patch1 → 0.37.12-patch2
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/js/iguazio.dashboard-controls.js +4987 -4874
- package/dist/less/iguazio.dashboard-controls.less +2211 -2211
- package/package.json +1 -1
- package/src/igz_controls/components/pagination/pagination.controller.js +21 -13
- package/src/igz_controls/services/general-data.service.js +10 -0
- package/src/igz_controls/services/server-status.service.js +91 -0
- package/src/nuclio/functions/functions.component.js +6 -4
- package/src/nuclio/functions/version/version.component.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-controls",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v0.37.12-patch2",
|
|
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": {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
.controller('PaginationController', PaginationController);
|
|
5
5
|
|
|
6
6
|
/*eslint no-shadow: 0*/
|
|
7
|
-
function PaginationController($i18next, $injector , $location, $rootScope, $stateParams, $timeout,
|
|
8
|
-
i18next, lodash, ActionCheckboxAllService, PaginationService,
|
|
7
|
+
function PaginationController($i18next, $injector , $location, $q, $rootScope, $stateParams, $timeout,
|
|
8
|
+
i18next, lodash, ActionCheckboxAllService, GeneralDataService, PaginationService,
|
|
9
9
|
entitiesType, onChangePageCallback, dataServiceName, vm, emptyOnPageChange) {
|
|
10
10
|
|
|
11
11
|
// entityId - id of nested entity
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
* (e.g. filter, include, sort, etc.).
|
|
35
35
|
*/
|
|
36
36
|
function changePage(pageNumber, perPage, additionalParams) {
|
|
37
|
+
var previousData = angular.copy(vm[entitiesType]);
|
|
37
38
|
var pageAdditionalParams = lodash.cloneDeep(additionalParams);
|
|
38
39
|
selectedItemId = lodash.defaultTo($stateParams.selectedItemId, $location.search().id);
|
|
39
40
|
selectedItemId = isNumeric(selectedItemId) ? lodash.toInteger(selectedItemId) : selectedItemId;
|
|
@@ -122,17 +123,24 @@
|
|
|
122
123
|
vm.isSplashShowed.value = false;
|
|
123
124
|
})
|
|
124
125
|
.catch(function (error) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
if (GeneralDataService.isDisconnectionError(error.status)) {
|
|
127
|
+
vm[entitiesType] = previousData;
|
|
128
|
+
vm.isSplashShowed.value = false;
|
|
129
|
+
|
|
130
|
+
return $q.reject(error)
|
|
131
|
+
} else {
|
|
132
|
+
var errorMessages = {
|
|
133
|
+
'400': $i18next.t('common:ERROR_MSG.PAGINATION.400', { lng: lng }),
|
|
134
|
+
'403': $i18next.t('common:ERROR_MSG.PAGINATION.403', { lng: lng }),
|
|
135
|
+
'500': $i18next.t('common:ERROR_MSG.ERROR_ON_SERVER_SIDE', { lng: lng }),
|
|
136
|
+
'default': $i18next.t('common:ERROR_MSG.UNKNOWN_ERROR', { lng: lng })
|
|
137
|
+
};
|
|
138
|
+
var message = lodash.get(errorMessages, String(error.status), errorMessages.default);
|
|
139
|
+
|
|
140
|
+
$rootScope.$broadcast('splash-screen_show-error', {
|
|
141
|
+
alertText: message + ' ' + $i18next.t('common:ERROR_MSG.YOU_CAN_TRY_TO_REFRESH_PAGE', { lng: lng })
|
|
142
|
+
});
|
|
143
|
+
}
|
|
136
144
|
});
|
|
137
145
|
}
|
|
138
146
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
return {
|
|
11
11
|
fetchAllPages: fetchAllPages,
|
|
12
12
|
getErrorMessage: getErrorMessage,
|
|
13
|
+
isDisconnectionError: isDisconnectionError,
|
|
13
14
|
poll: poll,
|
|
14
15
|
pruneObject: pruneObject,
|
|
15
16
|
trackDeletion: trackDeletion
|
|
@@ -144,6 +145,15 @@
|
|
|
144
145
|
return lodash.defaultTo(result, messages.default);
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Checks if the error status is equal '-1'. It means, that server is unreachable.
|
|
150
|
+
* @param {number} errorStatus - Error status code.
|
|
151
|
+
* @returns {Boolean} if true - server is unreachable
|
|
152
|
+
*/
|
|
153
|
+
function isDisconnectionError(errorStatus) {
|
|
154
|
+
return errorStatus === -1;
|
|
155
|
+
}
|
|
156
|
+
|
|
147
157
|
/**
|
|
148
158
|
* Polls by calling `pollMethod` and then invoking `isDone` method with `pollMethod`'s result. Stops polling
|
|
149
159
|
* when `isDone` returned `true`. Keeps on polling as long as `isDone` returns `false`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
angular.module('iguazio.dashboard-controls')
|
|
5
|
+
.factory('ServerStatusService', ServerStatusService);
|
|
6
|
+
|
|
7
|
+
function ServerStatusService($http, $q, $i18next, i18next, lodash, ConfigService, DialogsService) {
|
|
8
|
+
var dialogPromise = null;
|
|
9
|
+
var errors = [];
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
resolveInterceptor: resolveInterceptor,
|
|
13
|
+
rejectInterceptor: rejectInterceptor
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//
|
|
17
|
+
// Public methods
|
|
18
|
+
//
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Removes error from errors list if server becomes reachable
|
|
22
|
+
* @param {Object} response - backend response object
|
|
23
|
+
* @returns {Promise} returns promise
|
|
24
|
+
*/
|
|
25
|
+
function resolveInterceptor(response) {
|
|
26
|
+
if (response && response.status && response.status !== -1) {
|
|
27
|
+
if (errors.length > 0) {
|
|
28
|
+
errors = errors.filter(function (err) {
|
|
29
|
+
return err.method !== response.config.method && err.url !== response.config.url;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return $q.resolve(response);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Adds request to errors list if it`s failed and pops a modal if server isn`t reachable more than 60sec
|
|
39
|
+
* @param {Object} rejectionResponse - backend response object
|
|
40
|
+
* @returns {Promise} returns promise
|
|
41
|
+
*/
|
|
42
|
+
function rejectInterceptor(rejectionResponse) {
|
|
43
|
+
const currentError = {
|
|
44
|
+
method: rejectionResponse.config.method,
|
|
45
|
+
url: rejectionResponse.config.url
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (rejectionResponse.status === -1 && rejectionResponse.xhrStatus === 'error') {
|
|
49
|
+
const existingFailedResponse = errors.find(function (err) {
|
|
50
|
+
return err.method === rejectionResponse.config.method && err.url === rejectionResponse.config.url;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (existingFailedResponse) {
|
|
54
|
+
const dateNow = new Date();
|
|
55
|
+
const timeFromFirstFailure = (dateNow.getTime() - existingFailedResponse.date.getTime());
|
|
56
|
+
|
|
57
|
+
if (timeFromFirstFailure >= 3000) {
|
|
58
|
+
return showAlert()
|
|
59
|
+
.then(function () {
|
|
60
|
+
location.reload();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
currentError.date = new Date();
|
|
65
|
+
errors.push(currentError);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return $q.reject(rejectionResponse);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Pops a modal with an error message and makes sure there's only one open.
|
|
74
|
+
* When the modal is resolved, all pending flows that awaited it will continue.
|
|
75
|
+
* @returns {Promise} resolved when modal is closed ("Refresh" button is clicked)
|
|
76
|
+
*/
|
|
77
|
+
function showAlert() {
|
|
78
|
+
var lng = i18next.language;
|
|
79
|
+
|
|
80
|
+
if (lodash.isNull(dialogPromise)) {
|
|
81
|
+
dialogPromise = DialogsService.oopsAlert($i18next.t('common:SERVER_UNREACHABLE_ALERT', {lng: lng}),
|
|
82
|
+
$i18next.t('common:REFRESH', {lng: lng}))
|
|
83
|
+
.then(function () {
|
|
84
|
+
dialogPromise = null;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return dialogPromise;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}());
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
function FunctionsController($filter, $interval, $q, $rootScope, $scope, $state, $stateParams, $timeout,
|
|
24
24
|
$transitions, $i18next, i18next, lodash, CommonTableService, ConfigService,
|
|
25
|
-
DialogsService, ElementLoadingStatusService, FunctionsService,
|
|
26
|
-
TableSizeService) {
|
|
25
|
+
DialogsService, ElementLoadingStatusService, FunctionsService, GeneralDataService,
|
|
26
|
+
NuclioHeaderService, TableSizeService) {
|
|
27
27
|
var ctrl = this;
|
|
28
28
|
var lng = i18next.language;
|
|
29
29
|
var updatingFunctionsInterval = null;
|
|
@@ -344,9 +344,11 @@
|
|
|
344
344
|
sortTable(true);
|
|
345
345
|
})
|
|
346
346
|
.catch(function (error) {
|
|
347
|
-
|
|
347
|
+
if (!GeneralDataService.isDisconnectionError(error.status)) {
|
|
348
|
+
var defaultMsg = $i18next.t('functions:ERROR_MSG.GET_FUNCTIONS', {lng: lng});
|
|
348
349
|
|
|
349
|
-
|
|
350
|
+
return DialogsService.alert(lodash.get(error, 'data.error', defaultMsg));
|
|
351
|
+
}
|
|
350
352
|
})
|
|
351
353
|
.finally(function () {
|
|
352
354
|
ctrl.isSplashShowed.value = false;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
function NclVersionController($i18next, $interval, $rootScope, $scope, $state, $stateParams, $transitions, $timeout,
|
|
22
22
|
i18next, lodash, ngDialog, ConfigService, DialogsService, ExportService,
|
|
23
|
-
FunctionsService, NuclioHeaderService, VersionHelperService) {
|
|
23
|
+
FunctionsService, GeneralDataService, NuclioHeaderService, VersionHelperService) {
|
|
24
24
|
var ctrl = this;
|
|
25
25
|
var deregisterFunction = null;
|
|
26
26
|
var interval = null;
|
|
@@ -369,9 +369,12 @@
|
|
|
369
369
|
setIngressHost();
|
|
370
370
|
})
|
|
371
371
|
.catch(function (error) {
|
|
372
|
-
|
|
372
|
+
if (!GeneralDataService.isDisconnectionError(error.status)) {
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
var defaultMsg = $i18next.t('functions:ERROR_MSG.GET_FUNCTION', {lng: lng});
|
|
375
|
+
|
|
376
|
+
DialogsService.alert(lodash.get(error, 'data.error', defaultMsg));
|
|
377
|
+
}
|
|
375
378
|
})
|
|
376
379
|
.finally(function () {
|
|
377
380
|
ctrl.isSplashShowed.value = false;
|