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$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loaders: [
|
loaders: [
|
||||||
|
'babel-loader',
|
||||||
'ng-annotate'
|
'ng-annotate'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular": "^1.4.2",
|
"angular": "^1.4.2",
|
||||||
"angular-animate": "^1.5.8",
|
"angular-animate": "^1.5.8",
|
||||||
"animate.css": "^3.4.0",
|
|
||||||
"angular-aria": "^1.5.8",
|
"angular-aria": "^1.5.8",
|
||||||
"angular-cookies": "^1.5.8",
|
"angular-cookies": "^1.5.8",
|
||||||
"angular-messages": "^1.5.8",
|
"angular-messages": "^1.5.8",
|
||||||
|
@ -20,6 +19,7 @@
|
||||||
"angular-sanitize": "^1.5.8",
|
"angular-sanitize": "^1.5.8",
|
||||||
"angular-ui-bootstrap": "^2.0.0",
|
"angular-ui-bootstrap": "^2.0.0",
|
||||||
"angular-ui-router": "^0.3.1",
|
"angular-ui-router": "^0.3.1",
|
||||||
|
"animate.css": "^3.4.0",
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.6",
|
||||||
"moment": "^2.14.1",
|
"moment": "^2.14.1",
|
||||||
"nvd3": "^1.8.4"
|
"nvd3": "^1.8.4"
|
||||||
|
@ -27,7 +27,9 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"angular-mocks": "^1.4.2",
|
"angular-mocks": "^1.4.2",
|
||||||
"autoprefixer": "^6.2.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": "^2.9.11",
|
||||||
"browser-sync-spa": "^1.0.3",
|
"browser-sync-spa": "^1.0.3",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
|
|
|
@ -9,39 +9,38 @@ angular
|
||||||
.factory('Providers', Providers);
|
.factory('Providers', Providers);
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
function Providers($resource) {
|
function Providers($resource, $q) {
|
||||||
const resourceProvider = $resource('../api/providers');
|
const resourceProvider = $resource('../api/providers');
|
||||||
return {
|
return {
|
||||||
get: function () {
|
get: function() {
|
||||||
const rawProviders = resourceProvider.get();
|
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) {
|
rawProviders[providerName].backends = Object.keys(bckends).map(key => {
|
||||||
if (rawProviders.hasOwnProperty(providerName)) {
|
const goodBackend = bckends[key];
|
||||||
|
goodBackend.backendId = key;
|
||||||
|
return goodBackend;
|
||||||
|
});
|
||||||
|
|
||||||
// BackEnds mapping
|
// FrontEnds mapping
|
||||||
let bckends = rawProviders[providerName].backends;
|
let frtends = rawProviders[providerName].frontends;
|
||||||
|
|
||||||
rawProviders[providerName].backends = Object.keys(bckends)
|
rawProviders[providerName].frontends = Object.keys(frtends).map(key => {
|
||||||
.map(key => {
|
const goodFrontend = frtends[key];
|
||||||
const goodBackend = bckends[key];
|
goodFrontend.frontendId = key;
|
||||||
goodBackend.backendId = key;
|
return goodFrontend;
|
||||||
return goodBackend;
|
});
|
||||||
});
|
}
|
||||||
|
}
|
||||||
// FrontEnds mapping
|
}
|
||||||
let frtends = rawProviders[providerName].frontends;
|
resolve(rawProviders);
|
||||||
|
}).catch(reject);
|
||||||
rawProviders[providerName].frontends = Object.keys(frtends)
|
});
|
||||||
.map(key => {
|
|
||||||
const goodFrontend = frtends[key];
|
|
||||||
goodFrontend.frontendId = key;
|
|
||||||
return goodFrontend;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rawProviders;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
function ProvidersController($scope, $interval, $log, Providers) {
|
function ProvidersController($scope, $interval, $log, Providers) {
|
||||||
const vm = this;
|
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 () {
|
loadProviders();
|
||||||
Providers.get(function (providers) {
|
|
||||||
vm.providers = providers;
|
|
||||||
}, function (error) {
|
|
||||||
vm.providers = {};
|
|
||||||
$log.error(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
}, 2000);
|
const intervalId = $interval(loadProviders, 2000);
|
||||||
|
|
||||||
$scope.$on('$destroy', function () {
|
$scope.$on('$destroy', function () {
|
||||||
$interval.cancel(intervalId);
|
$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