forked from iguazio/dashboard-controls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiguazio.dashboard-controls.config.js
147 lines (132 loc) · 6.58 KB
/
iguazio.dashboard-controls.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
Copyright 2018 Iguazio Systems Ltd.
Licensed under the Apache License, Version 2.0 (the "License") with
an addition restriction as set forth herein. You may not use this
file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
In addition, you may not use the software for any purposes that are
illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
(function () {
'use strict';
var defaultConfig = {
url: {
api: {
baseUrl: location.protocol + '//' + location.hostname + ':8001/api'
},
push: {
baseUrl: location.protocol + '//' + location.hostname + ':8002/push'
},
nginx: {
baseUrl: location.protocol + '//' + location.hostname + ':8081'
},
elasticsearch: {
baseUrl: location.protocol + '//' + location.hostname + ':8004'
}
},
path: {
hostArtifactDir: '/'
},
mode: 'production',
isDemoMode: function () {
return defaultConfig.mode === 'demo';
},
isStagingMode: function (strict) {
return defaultConfig.mode === 'staging' || !strict && defaultConfig.mode === 'demo';
},
requestsChunkSize: 1,
cacheStoragePoolId: '0',
defaultIntervalSec: 10, // the default interval in units of seconds that back-end uses for statistics
externalIPAddress: ''
};
angular.module('iguazio.dashboard-controls')
.constant('ConfigService', window._.merge(defaultConfig, {}));
angular.module('iguazio.dashboard-controls')
.config(config)
.config(ngDialogConfig)
.config(lodashConfig);
angular.module('iguazio.dashboard-controls')
.constant('moment', window.moment)
.constant('d3', window.d3)
.constant('Highcharts', window.Highcharts)
.constant('lodash', window._)
.constant('Base64', window.Base64);
function config($locationProvider, $httpProvider, uibDatepickerConfig, $qProvider) {
$locationProvider.html5Mode(true);
$httpProvider.defaults.withCredentials = true;
uibDatepickerConfig.showWeeks = false;
// prevents 'Possibly unhandled rejection' error
$qProvider.errorOnUnhandledRejections(false);
}
function ngDialogConfig(ngDialogProvider) {
ngDialogProvider.setDefaults({
className: 'ngdialog-theme-nuclio',
showClose: false,
closeByEscape: false,
closeByDocument: false
});
}
function lodashConfig() {
var lodash = window._;
lodash.mixin({
/**
* Checks if value is a non-empty object, collection, map, or set.
*
* Objects are considered non-empty if they have any own enumerable string keyed properties.
*
* Array-like values such as arguments objects, arrays, buffers, strings, or jQuery-like collections are
* considered non-empty if they have a length greater than 0. Similarly, maps and sets are considered
* non-empty if they have a size greater than 0.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if value is non-empty, else `false`.
*/
isNonEmpty: lodash.negate(lodash.isEmpty),
/**
* Checks if `predicate` returns falsey for *any* element of `collection`. Iteration is stopped once
* `predicate` returns falsey. The predicate is invoked with three arguments:
* _(value, index|key, collection)_.
* @param {Array|Object} collection - The collection to iterate over.
* @param {function|string|Array|Object} [predicate=lodash.identity] - The function invoked per iteration.
* @returns {boolean} Returns `true` if any element fails the predicate check, else `false`.
*/
notEvery: lodash.negate(lodash.every),
/**
* Checks if `predicate` returns falsey for *all* element of `collection`. Iteration is stopped once
* `predicate` returns truthy. The predicate is invoked with three arguments:
* _(value, index|key, collection)_.
* @param {Array|Object} collection - The collection to iterate over.
* @param {function|string|Array|Object} [predicate=lodash.identity] - The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements fail the predicate check, else `false`.
*/
none: lodash.negate(lodash.some),
/**
* Iterates over elements of collection, finding the first element for which predicate returns truthy. The
* predicate is invoked with three arguments: _(value, index|key, collection)_. Then gets the value at
* `path` of matched element (if found). If the resolved value is `undefined`, or if no match was found, the
* `defaultValue` is returned instead (if it is provided, otherwise `undefined` is returned).
* @param {Array|Object} collection - The collection to inspect
* @param {function|string|Array|Object} [predicate=lodash.identity] - The function invoked per iteration.
* @param {Array|string} path - The path of the property to get
* @param {*} defaultValue - The value returned for `undefined` resolved values of matched element, or in
* case no match found.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the resolved value of the matched element, or `defaultValue` for `undefined`
* resolved values, or in case no match was found. If `defaultValue` is not provided then `undefined` is
* returned in these cases.
*/
findGet: function (collection, predicate, path, defaultValue, fromIndex) {
return lodash.chain(collection)
.find(predicate, fromIndex)
.get(path, defaultValue)
.value();
}
});
}
}());