commit
6ad273b9fa
6 changed files with 680 additions and 468 deletions
3
webui/.babelrc
Normal file
3
webui/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["es2015"]
|
||||
}
|
|
@ -32,6 +32,7 @@ module.exports = {
|
|||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: [
|
||||
'babel-loader',
|
||||
'ng-annotate'
|
||||
]
|
||||
},
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
"dependencies": {
|
||||
"angular": "^1.4.2",
|
||||
"angular-animate": "^1.5.8",
|
||||
"animate.css": "^3.4.0",
|
||||
"angular-aria": "^1.5.8",
|
||||
"angular-cookies": "^1.5.8",
|
||||
"angular-messages": "^1.5.8",
|
||||
|
@ -20,6 +19,7 @@
|
|||
"angular-sanitize": "^1.5.8",
|
||||
"angular-ui-bootstrap": "^2.0.0",
|
||||
"angular-ui-router": "^0.3.1",
|
||||
"animate.css": "^3.4.0",
|
||||
"bootstrap": "^3.3.6",
|
||||
"moment": "^2.14.1",
|
||||
"nvd3": "^1.8.4"
|
||||
|
@ -27,7 +27,9 @@
|
|||
"devDependencies": {
|
||||
"angular-mocks": "^1.4.2",
|
||||
"autoprefixer": "^6.2.2",
|
||||
"babel-loader": "^6.2.0",
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-loader": "^7.0.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"browser-sync": "^2.9.11",
|
||||
"browser-sync-spa": "^1.0.3",
|
||||
"css-loader": "^0.23.1",
|
||||
|
|
|
@ -9,39 +9,38 @@ angular
|
|||
.factory('Providers', Providers);
|
||||
|
||||
/** @ngInject */
|
||||
function Providers($resource) {
|
||||
function Providers($resource, $q) {
|
||||
const resourceProvider = $resource('../api/providers');
|
||||
return {
|
||||
get: function () {
|
||||
const rawProviders = resourceProvider.get();
|
||||
get: function() {
|
||||
return $q((resolve, reject) => {
|
||||
resourceProvider.get().$promise.then((rawProviders) => {
|
||||
for (let providerName in rawProviders) {
|
||||
if (rawProviders.hasOwnProperty(providerName)) {
|
||||
if (!providerName.startsWith('$')) {
|
||||
// BackEnds mapping
|
||||
let bckends = rawProviders[providerName].backends;
|
||||
|
||||
for (let providerName in rawProviders) {
|
||||
if (rawProviders.hasOwnProperty(providerName)) {
|
||||
rawProviders[providerName].backends = Object.keys(bckends).map(key => {
|
||||
const goodBackend = bckends[key];
|
||||
goodBackend.backendId = key;
|
||||
return goodBackend;
|
||||
});
|
||||
|
||||
// BackEnds mapping
|
||||
let bckends = rawProviders[providerName].backends;
|
||||
// FrontEnds mapping
|
||||
let frtends = rawProviders[providerName].frontends;
|
||||
|
||||
rawProviders[providerName].backends = Object.keys(bckends)
|
||||
.map(key => {
|
||||
const goodBackend = bckends[key];
|
||||
goodBackend.backendId = key;
|
||||
return goodBackend;
|
||||
});
|
||||
|
||||
// FrontEnds mapping
|
||||
let frtends = rawProviders[providerName].frontends;
|
||||
|
||||
rawProviders[providerName].frontends = Object.keys(frtends)
|
||||
.map(key => {
|
||||
const goodFrontend = frtends[key];
|
||||
goodFrontend.frontendId = key;
|
||||
return goodFrontend;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return rawProviders;
|
||||
rawProviders[providerName].frontends = Object.keys(frtends).map(key => {
|
||||
const goodFrontend = frtends[key];
|
||||
goodFrontend.frontendId = key;
|
||||
return goodFrontend;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve(rawProviders);
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,17 +4,19 @@
|
|||
function ProvidersController($scope, $interval, $log, Providers) {
|
||||
const vm = this;
|
||||
|
||||
vm.providers = Providers.get();
|
||||
function loadProviders() {
|
||||
Providers
|
||||
.get()
|
||||
.then(providers => vm.providers = providers)
|
||||
.catch(error => {
|
||||
vm.providers = {};
|
||||
$log.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
const intervalId = $interval(function () {
|
||||
Providers.get(function (providers) {
|
||||
vm.providers = providers;
|
||||
}, function (error) {
|
||||
vm.providers = {};
|
||||
$log.error(error);
|
||||
});
|
||||
loadProviders();
|
||||
|
||||
}, 2000);
|
||||
const intervalId = $interval(loadProviders, 2000);
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$interval.cancel(intervalId);
|
||||
|
|
1063
webui/yarn.lock
1063
webui/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue