added requirejs

Change-Id: I590a9b75c6842f0ece16f89ec31a38035360eb84
This commit is contained in:
Chi Zhang 2014-09-30 16:27:48 -07:00
parent 1e7b4d7a77
commit a74e8ab014
21 changed files with 4078 additions and 3898 deletions

View File

@ -19,54 +19,13 @@
<link rel="stylesheet" type="text/css" href="assets/css/shelf.css">
<script type="text/javascript" src="vendor/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- AngularJS v1.2.16 -->
<script type="text/javascript" src="vendor/angular/angular.min.js"></script>
<script type="text/javascript" src="vendor/angular/angular-animate.min.js"></script>
<script type="text/javascript" src="vendor/angular/angular-mocks.js"></script>
<script type="text/javascript" src="vendor/angular/angular-touch.js"></script>
<!--<script type="text/javascript" src="../vendor/angular/angular-resource.min.js"></script>-->
<script type="text/javascript" src="vendor/angular-ui-router/angular-ui-router.min.js"></script>
<script type="text/javascript" src="vendor/angular-bootstrap/ui-bootstrap-tpls-0.11.0.min.js"></script>
<script type="text/javascript" src="vendor/angular-dragdrop/draganddrop.js"></script>
<script type="text/javascript" src="vendor/ng-table/ng-table.min.js"></script>
<script type="text/javascript" src="vendor/d3/d3.min.js"></script>
<script type="text/javascript" src="vendor/nvd3/nv.d3.min.js"></script>
<script type="text/javascript" src="vendor/angular-nvd3/angularjs-nvd3-directives.min.js"></script>
<script type="text/javascript" src="vendor/angular-ui-tree/angular-ui-tree.min.js"></script>
<script type="text/javascript" src="vendor/rickshaw/rickshaw.min.js"></script>
<script type="text/javascript" src="vendor/angular-rickshaw/rickshaw.min.js"></script>
<script type="text/javascript" src="vendor/angular-spinner/spin.min.js"></script>
<script type="text/javascript" src="vendor/angular-spinner/angular-spinner.min.js"></script>
<script type="text/javascript" src="vendor/angular-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="vendor/angular-daterangepicker/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="vendor/angular-daterangepicker/daterangepicker-bs3.css">
<script type="text/javascript" src="vendor/angular-daterangepicker/ng-bs-daterangepicker.js"></script>
<script type="text/javascript" src="src/app/app.js"></script>
<script type="text/javascript" src="src/app/appDev.js"></script>
<script type="text/javascript" src="src/app/login/login.js"></script>
<script type="text/javascript" src="src/app/services.js"></script>
<script type="text/javascript" src="src/app/topnav/topnav.js"></script>
<script type="text/javascript" src="src/app/wizard/wizard.js"></script>
<script type="text/javascript" src="src/app/cluster/cluster.js"></script>
<script type="text/javascript" src="src/app/cluster/clusterlist.js"></script>
<script type="text/javascript" src="src/app/monitoring/monitoring.js"></script>
<script type="text/javascript" src="src/app/server/server.js"></script>
<script type="text/javascript" src="src/common/charts.js"></script>
<script type="text/javascript" src="src/common/findservers/findservers.js"></script>
<script type="text/javascript" src="src/common/gantt-chart-d3v2.js"></script>
<script type="text/javascript" src="src/app/user/usersetting.js"></script>
<script type="text/javascript" src="src/app/user/userprofile.js"></script>
<script data-main="src/main.js" src="vendor/require.js"></script>
</head>
<body ng-app="compass" ng-controller="appController">
<body ng-controller="appController">
<div ng-if="isAuthenticated && !state.includes('login')">
<div ng-controller="topnavCtrl">
<div topnav></div>
@ -75,10 +34,10 @@
<div class="main-container no-skin">
<div ui-view></div>
<div ui-view></div>
</div>
</body>
</html>
</html>

View File

@ -1,55 +1,69 @@
var app = angular.module('compass', [
'compass.login',
'compass.services',
'compass.topnav',
'compass.wizard',
'compass.cluster',
'compass.clusterlist',
'compass.monitoring',
'compass.server',
'compass.userSetting',
'compass.userProfile',
'ui.router',
'ui.bootstrap',
//'compassAppDev',
'ngAnimate'
]);
define([
'angular',
'login',
'services',
'appDev',
'clusterList',
'cluster',
'monitoring',
'wizard',
'topnav',
'server',
'userProfile',
'charts',
'userSetting',
'findservers'
], function(ng) {
'use strict';
var compassModule = ng.module('app', [
'compass.login',
'compass.services',
// 'compassAppDev',
'compass.clusterlist',
'compass.cluster',
'compass.wizard',
'compass.topnav',
'compass.server',
'compass.userProfile',
'compass.userSetting',
'compass.monitoring',
'compass.charts',
'compass.findservers'
]);
compassModule.constant('settings', {
apiUrlBase: '/api',
metadataUrlBase: 'data',
//monitoringUrlBase: 'http://metrics-api/monit/api/v1'
monitoringUrlBase: '/monit/api/v1'
});
compassModule.config(function($stateProvider, $urlRouterProvider) {
compassModule.stateProvider = $stateProvider;
$urlRouterProvider.otherwise('/login');
});
compassModule.run(function($rootScope, $state, authService) {
$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams) {
if (toState.authenticate && !authService.isAuthenticated) {
// User isn't authenticated
$state.transitionTo("login");
event.preventDefault();
}
});
});
compassModule.controller('appController', function($scope, authService, $state) {
$scope.currentUser = null;
$scope.isAuthenticated = authService.isAuthenticated;
$scope.state = $state;
app.constant('settings', {
apiUrlBase: '/api',
metadataUrlBase: 'data',
//monitoringUrlBase: 'http://metrics-api/monit/api/v1'
monitoringUrlBase: '/monit/api/v1'
});
$scope.$watch(function() {
return authService.isAuthenticated
}, function(val) {
$scope.isAuthenticated = authService.isAuthenticated;
})
app.config(function($stateProvider, $urlRouterProvider) {
app.stateProvider = $stateProvider;
$urlRouterProvider.otherwise('/login');
});
app.run(function($rootScope, $state, authService) {
$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams) {
if (toState.authenticate && !authService.isAuthenticated) {
// User isn't authenticated
$scope.logout = function() {
authService.isAuthenticated = false;
$state.transitionTo("login");
event.preventDefault();
}
});
});
app.controller('appController', function($scope, authService, $state) {
$scope.currentUser = null;
$scope.isAuthenticated = authService.isAuthenticated;
$scope.state = $state;
$scope.$watch(function() {
return authService.isAuthenticated
}, function(val) {
$scope.isAuthenticated = authService.isAuthenticated;
})
$scope.logout = function() {
authService.isAuthenticated = false;
$state.transitionTo("login");
}
});
});

View File

@ -1,4 +1,5 @@
var compassAppDev = angular.module('compassAppDev', ['compass', 'ngMockE2E']);
define(['angular','angularMocks'],function(){
var compassAppDev = angular.module('compassAppDev', ['ngMockE2E']);
compassAppDev.run(function($httpBackend, settings, $http) {
var progressPercent = 0;
@ -1738,4 +1739,5 @@ compassAppDev.run(function($httpBackend, settings, $http) {
}];
return [200, metricData, {}];
});
});
});

View File

@ -1,304 +1,307 @@
angular.module('compass.cluster', [
'ui.router',
'ui.bootstrap',
'compass.charts',
'ngAnimate',
'ngTable',
'angular-rickshaw'
])
define(['angular'], function() {
var clusterModule = angular.module('compass.cluster', [
//'ui.router',
//'ui.bootstrap',
//'compass.charts',
//'ngAnimate',
//'ngTable',
//'angular-rickshaw'
]);
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('cluster', {
url: '/cluster/{id}',
controller: 'clusterCtrl',
templateUrl: 'src/app/cluster/cluster.tpl.html',
authenticate: true,
resolve: {
clusterhostsData: function($stateParams, $q, dataService) {
var clusterId = $stateParams.id;
var deferred = $q.defer();
dataService.getClusterHosts(clusterId).success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
}
}
})
.state('cluster.overview', {
url: '/overview',
controller: 'clusterProgressCtrl',
templateUrl: 'src/app/cluster/cluster-overview.tpl.html',
authenticate: true
})
.state('cluster.config', {
url: '/config',
controller: 'configurationCtrl',
templateUrl: 'src/app/cluster/cluster-config.tpl.html',
authenticate: true
})
.state('cluster.config.security', {
url: '/security',
templateUrl: 'src/app/cluster/cluster-security.tpl.html',
authenticate: true
})
.state('cluster.config.network', {
url: '/network',
templateUrl: 'src/app/cluster/cluster-network.tpl.html',
authenticate: true
})
.state('cluster.config.partition', {
url: '/partition',
templateUrl: 'src/app/cluster/cluster-partition.tpl.html',
authenticate: true
})
.state('cluster.config.roles', {
url: '/roles',
templateUrl: 'src/app/cluster/cluster-roles.tpl.html',
authenticate: true
})
.state('cluster.log', {
url: '/log',
controller: "clusterLogCtrl",
templateUrl: 'src/app/cluster/cluster-log.tpl.html',
authenticate: true
});
})
.controller('clusterCtrl', function($scope, $state, dataService, $stateParams) {
$scope.clusterId = $stateParams.id;
$scope.state = $state;
dataService.getClusterById($scope.clusterId).success(function(data) {
$scope.clusterInfo = data;
});
}).directive('clusternav', function($timeout) {
return {
restrict: 'EAC',
templateUrl: 'src/app/cluster/cluster-nav.tpl.html',
link: function($scope, elem, attrs) {
$timeout(function() {
$('.nav-list ul a').on('click touchend', function(e) {
var el = $(this);
var link = el.attr('href');
window.location = link;
});
}, 0);
elem.bind('$destroy', function() {
$('.nav-list ul a').off('click touchend');
});
}
}
})
.controller('clusterLogCtrl', function() {
})
.controller('clusterProgressCtrl', function($scope, dataService, $stateParams, $filter, ngTableParams, $timeout, $modal, clusterhostsData) {
var clusterId = $stateParams.id;
var progressTimer;
var fireTimer = true;
$scope.hosts = clusterhostsData;
var getClusterProgress = function() {
dataService.getClusterProgress(clusterId).success(function(data) {
$scope.clusterProgress = data;
if (fireTimer) {
progressTimer = $timeout(getClusterProgress, 5000);
}
});
};
getClusterProgress();
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.progress;
});
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.hosts.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.hosts.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')($scope.hosts, params.orderBy()) : $scope.hosts;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
$scope.deleteHost = function(index) {
dataService.deleteHost($scope.hosts[index].id)
$scope.hosts.splice(index, 1);
$scope.tableParams.reload();
};
$scope.selectAllServers = function(flag) {
if (flag) {
angular.forEach($scope.hosts, function(sv) {
sv.selected = true;
})
} else {
angular.forEach($scope.hosts, function(sv) {
sv.selected = false;
})
}
};
$scope.openDeleteHostModal = function(index) {
var modalInstance = $modal.open({
templateUrl: 'deleteHostConfirm.html',
controller: deleteHostModalCtrl,
resolve: {
host: function() {
return $scope.hosts[index];
}
}
});
modalInstance.result.then(function() {
// ok
$scope.deleteHost(index);
}, function() {
// cancel
});
};
$scope.$on('$destroy', function() {
fireTimer = false;
$timeout.cancel(progressTimer);
});
})
.controller('createClusterCtrl', ['$scope', '$state', '$modal', '$log', 'dataService', 'wizardFactory','$rootScope',
function($scope, $state, $modal, $log, dataService, wizardFactory,$rootScope) {
dataService.getAdapters().success(function(data) {
$scope.allAdapters = data;
$scope.cluster = {};
$scope.open = function(size) {
var modalInstance = $modal.open({
templateUrl: 'createClusterModal.html',
controller: ClusterModalCtrl,
size: size,
resolve: {
allAdapters: function() {
return $scope.allAdapters;
},
cluster: function() {
return $scope.cluster;
}
}
});
modalInstance.result.then(function(cluster) {
$scope.cluster = cluster;
var postClusterData = {
"name": cluster.name,
"adapter_id": cluster.adapter.id,
"os_id": cluster.os.id
};
if (cluster.flavor) {
postClusterData.flavor_id = cluster.flavor.id;
}
dataService.createCluster(postClusterData).success(function(data, status) {
$scope.clusters.push(data);
$rootScope.$emit('clusters',$scope.clusters);
wizardFactory.setClusterInfo(data);
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
wizardFactory.setAdapter(adapter);
}
})
$state.go('wizard', {
"id": data.id,
"config": "true"
clusterModule.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('cluster', {
url: '/cluster/{id}',
controller: 'clusterCtrl',
templateUrl: 'src/app/cluster/cluster.tpl.html',
authenticate: true,
resolve: {
clusterhostsData: function($stateParams, $q, dataService) {
var clusterId = $stateParams.id;
var deferred = $q.defer();
dataService.getClusterHosts(clusterId).success(function(data) {
deferred.resolve(data);
});
$scope.cluster = {};
});
}, function() {
// modal cancelled
});
};
});
}
])
.controller('configurationCtrl', function($scope, dataService, $stateParams, $filter, ngTableParams, clusterhostsData) {
var clusterId = $stateParams.id;
$scope.partitionarray = [];
dataService.getClusterConfig(clusterId).success(function(data) {
$scope.configuration = data;
angular.forEach($scope.configuration.os_config.partition, function(value, key) {
$scope.partitionarray.push({
"name": key,
"number": value.percentage
return deferred.promise;
}
}
})
.state('cluster.overview', {
url: '/overview',
controller: 'clusterProgressCtrl',
templateUrl: 'src/app/cluster/cluster-overview.tpl.html',
authenticate: true
})
.state('cluster.config', {
url: '/config',
controller: 'configurationCtrl',
templateUrl: 'src/app/cluster/cluster-config.tpl.html',
authenticate: true
})
.state('cluster.config.security', {
url: '/security',
templateUrl: 'src/app/cluster/cluster-security.tpl.html',
authenticate: true
})
.state('cluster.config.network', {
url: '/network',
templateUrl: 'src/app/cluster/cluster-network.tpl.html',
authenticate: true
})
.state('cluster.config.partition', {
url: '/partition',
templateUrl: 'src/app/cluster/cluster-partition.tpl.html',
authenticate: true
})
.state('cluster.config.roles', {
url: '/roles',
templateUrl: 'src/app/cluster/cluster-roles.tpl.html',
authenticate: true
})
.state('cluster.log', {
url: '/log',
controller: "clusterLogCtrl",
templateUrl: 'src/app/cluster/cluster-log.tpl.html',
authenticate: true
});
});
clusterModule.controller('clusterCtrl', function($scope, $state, dataService, $stateParams) {
$scope.clusterId = $stateParams.id;
$scope.state = $state;
dataService.getClusterById($scope.clusterId).success(function(data) {
$scope.clusterInfo = data;
});
});
clusterModule.directive('clusternav', function($timeout) {
return {
restrict: 'EAC',
templateUrl: 'src/app/cluster/cluster-nav.tpl.html',
link: function($scope, elem, attrs) {
$timeout(function() {
$('.nav-list ul a').on('click touchend', function(e) {
var el = $(this);
var link = el.attr('href');
window.location = link;
});
}, 0);
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.roles;
});
$scope.hosts = clusterhostsData;
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.hosts.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.hosts.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')($scope.hosts, params.orderBy()) : $scope.hosts;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
elem.bind('$destroy', function() {
$('.nav-list ul a').off('click touchend');
});
}
}
});
})
var ClusterModalCtrl = function($scope, $modalInstance, allAdapters, cluster) {
$scope.allAdapters = allAdapters;
$scope.cluster = cluster;
clusterModule.controller('clusterLogCtrl', function() {
$scope.updateSelectedAdapter = function() {
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter.id) {
$scope.supported_oses = adapter.supported_oses;
$scope.flavors = adapter.flavors;
});
clusterModule.controller('clusterProgressCtrl', function($scope, dataService, $stateParams, $filter, ngTableParams, $timeout, $modal, clusterhostsData) {
var clusterId = $stateParams.id;
var progressTimer;
var fireTimer = true;
$scope.hosts = clusterhostsData;
var getClusterProgress = function() {
dataService.getClusterProgress(clusterId).success(function(data) {
$scope.clusterProgress = data;
if (fireTimer) {
progressTimer = $timeout(getClusterProgress, 5000);
}
});
};
getClusterProgress();
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.progress;
});
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.hosts.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.hosts.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')($scope.hosts, params.orderBy()) : $scope.hosts;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
})
});
$scope.deleteHost = function(index) {
dataService.deleteHost($scope.hosts[index].id)
$scope.hosts.splice(index, 1);
$scope.tableParams.reload();
};
$scope.selectAllServers = function(flag) {
if (flag) {
angular.forEach($scope.hosts, function(sv) {
sv.selected = true;
})
} else {
angular.forEach($scope.hosts, function(sv) {
sv.selected = false;
})
}
};
$scope.openDeleteHostModal = function(index) {
var modalInstance = $modal.open({
templateUrl: 'deleteHostConfirm.html',
controller: deleteHostModalCtrl,
resolve: {
host: function() {
return $scope.hosts[index];
}
}
});
modalInstance.result.then(function() {
// ok
$scope.deleteHost(index);
}, function() {
// cancel
});
};
$scope.$on('$destroy', function() {
fireTimer = false;
$timeout.cancel(progressTimer);
});
});
clusterModule.controller('createClusterCtrl', ['$scope', '$state', '$modal', '$log', 'dataService', 'wizardFactory', '$rootScope',
function($scope, $state, $modal, $log, dataService, wizardFactory, $rootScope) {
dataService.getAdapters().success(function(data) {
$scope.allAdapters = data;
$scope.cluster = {};
$scope.open = function(size) {
var modalInstance = $modal.open({
templateUrl: 'createClusterModal.html',
controller: ClusterModalCtrl,
size: size,
resolve: {
allAdapters: function() {
return $scope.allAdapters;
},
cluster: function() {
return $scope.cluster;
}
}
});
modalInstance.result.then(function(cluster) {
$scope.cluster = cluster;
var postClusterData = {
"name": cluster.name,
"adapter_id": cluster.adapter.id,
"os_id": cluster.os.id
};
if (cluster.flavor) {
postClusterData.flavor_id = cluster.flavor.id;
}
dataService.createCluster(postClusterData).success(function(data, status) {
$scope.clusters.push(data);
$rootScope.$emit('clusters', $scope.clusters);
wizardFactory.setClusterInfo(data);
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
wizardFactory.setAdapter(adapter);
}
})
$state.go('wizard', {
"id": data.id,
"config": "true"
});
$scope.cluster = {};
});
}, function() {
// modal cancelled
});
};
});
}
]);
clusterModule.controller('configurationCtrl', function($scope, dataService, $stateParams, $filter, ngTableParams, clusterhostsData) {
var clusterId = $stateParams.id;
$scope.partitionarray = [];
dataService.getClusterConfig(clusterId).success(function(data) {
$scope.configuration = data;
angular.forEach($scope.configuration.os_config.partition, function(value, key) {
$scope.partitionarray.push({
"name": key,
"number": value.percentage
});
});
});
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.roles;
});
$scope.hosts = clusterhostsData;
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.hosts.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.hosts.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')($scope.hosts, params.orderBy()) : $scope.hosts;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
});
var ClusterModalCtrl = function($scope, $modalInstance, allAdapters, cluster) {
$scope.allAdapters = allAdapters;
$scope.cluster = cluster;
$scope.updateSelectedAdapter = function() {
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter.id) {
$scope.supported_oses = adapter.supported_oses;
$scope.flavors = adapter.flavors;
}
})
};
$scope.ok = function() {
$scope.result = 'ok';
$modalInstance.close($scope.cluster);
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
$scope.result = 'cancel';
};
};
$scope.ok = function() {
$scope.result = 'ok';
$modalInstance.close($scope.cluster);
var deleteHostModalCtrl = function($scope, $modalInstance, host) {
$scope.host = host;
$scope.ok = function() {
$modalInstance.close();
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
$scope.result = 'cancel';
};
};
var deleteHostModalCtrl = function($scope, $modalInstance, host) {
$scope.host = host;
$scope.ok = function() {
$modalInstance.close();
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
}
});

View File

@ -1,69 +1,74 @@
var app = angular.module('compass.clusterlist', [
'ui.router',
'ui.bootstrap',
'ngTable'
])
define(['angular'], function() {
var clusterlistModule = angular.module('compass.clusterlist', [
//'ui.router',
//'ui.bootstrap',
//'ngTable'
]);
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('clusterList', {
url: '/clusterlist',
controller: 'clustersListCtrl',
templateUrl: 'src/app/cluster/cluster-all.tpl.html',
authenticate: true,
resolve: {
allClusterData: function($q, dataService) {
var deferred = $q.defer();
dataService.getClusters().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
clusterlistModule.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('clusterList', {
url: '/clusterlist',
controller: 'clustersListCtrl',
templateUrl: 'src/app/cluster/cluster-all.tpl.html',
authenticate: true,
resolve: {
allClusterData: function($q, dataService) {
var deferred = $q.defer();
dataService.getClusters().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
}
}
});
});
clusterlistModule.controller('clustersListCtrl', function($scope, $state, ngTableParams, $filter, dataService, allClusterData) {
$scope.clusters = allClusterData;
angular.forEach($scope.clusters, function(cluster) {
dataService.getClusterProgress(cluster.id).success(function(data) {
cluster.progress = data.status;
cluster.state = data.state;
});
});
var data = $scope.clusters;
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 10, // count per page
}, {
total: data.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')(data, params.orderBy()) :
data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
})
.controller('clustersListCtrl', function($scope, $state, ngTableParams, $filter, dataService, allClusterData) {
$scope.clusters = allClusterData
angular.forEach($scope.clusters, function(cluster) {
dataService.getClusterProgress(cluster.id).success(function(data) {
cluster.progress = data.status;
cluster.state = data.state;
});
});
$scope.goToCluster = function(id, state) {
if (state == "UNINITIALIZED") {
$state.go("wizard", {
"id": id,
"config": "true"
});
} else {
$state.go("cluster.overview", {
"id": id
});
}
};
var data = $scope.clusters;
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 10, // count per page
}, {
total: data.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')(data, params.orderBy()) :
data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
//button alerts
$scope.alert = function(text) {
alert('delete?');
}
});
$scope.goToCluster = function(id, state) {
if (state == "UNINITIALIZED") {
$state.go("wizard", {"id": id, "config": "true"});
} else {
$state.go("cluster.overview", {
"id": id
});
$scope.export = function(text) {
alert('export?');
}
};
//button alerts
$scope.alert = function(text) {
alert('delete?');
}
$scope.export = function(text) {
alert('export?');
}
});
});
})

View File

@ -1,59 +1,61 @@
angular.module('compass.login', [
'compass.services',
'ui.router',
'ui.bootstrap'
])
define(['uiRouter'], function() {
'use strict';
var loginModule = angular.module('compass.login', [
'ui.router',
'ui.bootstrap'
]);
loginModule.config(function config($stateProvider) {
$stateProvider
.state('login', {
url: '/login',
controller: 'loginCtrl',
templateUrl: 'src/app/login/login.tpl.html',
authenticate: false
});
});
.config(function config($stateProvider) {
$stateProvider
.state('login', {
url: '/login',
controller: 'loginCtrl',
templateUrl: 'src/app/login/login.tpl.html',
authenticate: false
});
})
.controller('loginCtrl', function($scope, authService, $state) {
$scope.alerts = [];
$scope.login = function() {
loginModule.controller('loginCtrl', function($scope, authService, $state) {
$scope.alerts = [];
var credentials = {
"email": $scope.email,
"password": $scope.password
$scope.login = function() {
$scope.alerts = [];
var credentials = {
"email": $scope.email,
"password": $scope.password
};
authService.login(credentials).success(function(data) {
authService.isAuthenticated = true;
$state.transitionTo("clusterList");
}).error(function(response) {
console.log(response);
$scope.alerts.push(response);
})
};
authService.login(credentials).success(function(data) {
authService.isAuthenticated = true;
$state.transitionTo("clusterList");
}).error(function(response) {
console.log(response);
$scope.alerts.push(response);
})
};
$scope.closeAlert = function() {
$scope.alerts = [];
};
$scope.closeAlert = function() {
$scope.alerts = [];
};
})
});
.directive('setFocus', function() {
return function(scope, element){ element[0].focus();};
})
loginModule.directive('setFocus', function() {
return function(scope, element) {
element[0].focus();
};
});
.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) { // 13 is enter key
loginModule.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if (event.which === 13) { // 13 is enter key
if(scope.email.trim() !="" && scope.password.trim() != "")
{
scope.$eval(attrs.ngEnter);
if (scope.email.trim() != "" && scope.password.trim() != "") {
scope.$eval(attrs.ngEnter);
}
event.preventDefault();
}
event.preventDefault();
}
});
};
});
});
};
});
});

View File

@ -1,176 +1,178 @@
angular.module('compass.monitoring', [
'ui.router',
'ui.bootstrap',
'compass.charts',
'ngAnimate',
'angular-rickshaw',
'nvd3ChartDirectives',
'ui.tree'
])
define(['angularAnimate', 'angularRickshaw', 'angularUiTree', 'nvd3Directive'], function() {
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('cluster.monitoring', {
url: '/monitoring',
templateUrl: 'src/app/monitoring/cluster-monitoring.tpl.html',
authenticate: true
})
.state('cluster.monitoring.overview', {
url: '/overview',
controller: 'moniOverviewCtrl',
templateUrl: 'src/app/monitoring/overview.tpl.html',
authenticate: true
})
.state('cluster.monitoring.topology', {
url: '/topology',
controller: 'topologyCtrl',
templateUrl: 'src/app/monitoring/topology.tpl.html',
authenticate: true
})
.state('cluster.monitoring.alerts', {
url: '/alerts',
controller: 'alertsCtrl',
templateUrl: 'src/app/monitoring/alerts.tpl.html',
authenticate: true
})
.state('cluster.monitoring.metrics', {
url: '/metrics',
controller: 'metricsCtrl',
templateUrl: 'src/app/monitoring/metrics.tpl.html',
authenticate: true
})
.state('cluster.monitoring.charts', {
url: '/charts',
templateUrl: 'src/app/monitoring/charts.tpl.html',
authenticate: true
})
})
var monitoringModule = angular.module('compass.monitoring', [
'ui.router',
'ui.bootstrap',
'compass.charts',
'ngAnimate',
'angular-rickshaw',
'nvd3ChartDirectives',
'ui.tree'
]);
.controller('moniOverviewCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.goDash = function(locs) {
//alert(locs);
setTimeout(function() {
document.getElementById('dashboards').src = "/dash/#/dashboard/file/" + locs;
}, 600);
}
$scope.moniOverviewData = [];
dataService.monitorOverview(clusterId).success(function(data) {
$scope.moniOverviewData = data;
}).error(function(response) {
// TODO: error handle
monitoringModule.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('cluster.monitoring', {
url: '/monitoring',
templateUrl: 'src/app/monitoring/cluster-monitoring.tpl.html',
authenticate: true
})
.state('cluster.monitoring.overview', {
url: '/overview',
controller: 'moniOverviewCtrl',
templateUrl: 'src/app/monitoring/overview.tpl.html',
authenticate: true
})
.state('cluster.monitoring.topology', {
url: '/topology',
controller: 'topologyCtrl',
templateUrl: 'src/app/monitoring/topology.tpl.html',
authenticate: true
})
.state('cluster.monitoring.alerts', {
url: '/alerts',
controller: 'alertsCtrl',
templateUrl: 'src/app/monitoring/alerts.tpl.html',
authenticate: true
})
.state('cluster.monitoring.metrics', {
url: '/metrics',
controller: 'metricsCtrl',
templateUrl: 'src/app/monitoring/metrics.tpl.html',
authenticate: true
})
.state('cluster.monitoring.charts', {
url: '/charts',
templateUrl: 'src/app/monitoring/charts.tpl.html',
authenticate: true
})
});
})
monitoringModule.controller('moniOverviewCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
.controller('topologyCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.goDash = function(locs) {
//alert(locs);
setTimeout(function() {
document.getElementById('dashboards').src = "/dash/#/dashboard/file/" + locs;
}, 600);
}
$scope.physicalTopoData = {};
$scope.physicalTopoDataReady = "false";
$scope.moniOverviewData = [];
dataService.monitorOverview(clusterId).success(function(data) {
$scope.moniOverviewData = data;
}).error(function(response) {
// TODO: error handle
});
dataService.monitorTopology(clusterId).success(function(data) {
$scope.physicalTopoData = data;
$scope.physicalTopoDataReady = "true";
}).error(function(response) {
// TODO: error handling
});
monitoringModule.controller('topologyCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.logicalTopoData = {};
$scope.logicalTopoDataReady = "false";
$scope.physicalTopoData = {};
$scope.physicalTopoDataReady = "false";
dataService.monitorTopology(clusterId).success(function(data) {
$scope.physicalTopoData = data;
$scope.physicalTopoDataReady = "true";
}).error(function(response) {
// TODO: error handling
});
$scope.logicalTopoData = {};
$scope.logicalTopoDataReady = "false";
dataService.monitorServiceTopology(clusterId).success(function(data) {
$scope.logicalTopoData = data;
$scope.logicalTopoDataReady = "true";
}).error(function(response) {
// TODO: error handling
});
dataService.monitorServiceTopology(clusterId).success(function(data) {
$scope.logicalTopoData = data;
$scope.logicalTopoDataReady = "true";
}).error(function(response) {
// TODO: error handling
});
})
monitoringModule.controller('alertsCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
.controller('alertsCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.alerts = [];
$scope.alertDataReady = "false";
$scope.alerts = [];
$scope.alertDataReady = "false";
dataService.monitorAlarms(clusterId).success(function(data) {
$scope.alerts = data;
$scope.alertDataReady = "true";
}).error(function(response) {
//TODO: error handling
});
dataService.monitorAlarms(clusterId).success(function(data) {
$scope.alerts = data;
$scope.alertDataReady = "true";
}).error(function(response) {
//TODO: error handling
});
})
.controller('metricsCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.metricsTree = [];
dataService.monitorMetricsTree().success(function(data) {
$scope.metricsTree = data;
}).error(function(response) {
// TODO
});
$scope.metrics = [];
dataService.monitorMetrics().success(function(data) {
$scope.metrics = data;
}).error(function(response) {
// TODO
});
$scope.metricsData = [];
$scope.generate = function(node) {
console.log(node);
dataService.monitorClusterMetric(clusterId, node.title).success(function(data) {
$scope.metricsData = data;
monitoringModule.controller('metricsCtrl', function($scope, dataService, $stateParams) {
var clusterId = $stateParams.id;
$scope.metricsTree = [];
dataService.monitorMetricsTree().success(function(data) {
$scope.metricsTree = data;
}).error(function(response) {
// TODO
});
};
$scope.metrics = [];
dataService.monitorMetrics().success(function(data) {
$scope.metrics = data;
}).error(function(response) {
// TODO
});
// For Angular UI Tree
$scope.toggle = function(scope) {
scope.toggle();
};
$scope.metricsData = [];
$scope.generate = function(node) {
console.log(node);
var getRootNodesScope = function() {
return angular.element(document.getElementById("tree-root")).scope();
};
dataService.monitorClusterMetric(clusterId, node.title).success(function(data) {
$scope.metricsData = data;
$scope.collapseAll = function() {
var scope = getRootNodesScope();
scope.collapseAll();
};
}).error(function(response) {
// TODO
});
$scope.expandAll = function() {
var scope = getRootNodesScope();
scope.expandAll();
};
};
// For NVD3 Line Chart
$scope.xAxisTickFormatFunction = function() {
return function(d) {
return d3.time.format('%x')(new Date(d));
}
};
// For Angular UI Tree
$scope.toggle = function(scope) {
scope.toggle();
};
$scope.toolTipContentFunction = function() {
return function(key, x, y, e, graph) {
return 'Super New Tooltip' +
'<h1>' + key + '</h1>' +
'<p>' + y + ' at ' + x + '</p>'
}
};
var getRootNodesScope = function() {
return angular.element(document.getElementById("tree-root")).scope();
};
/*
$scope.collapseAll = function() {
var scope = getRootNodesScope();
scope.collapseAll();
};
$scope.expandAll = function() {
var scope = getRootNodesScope();
scope.expandAll();
};
// For NVD3 Line Chart
$scope.xAxisTickFormatFunction = function() {
return function(d) {
return d3.time.format('%x')(new Date(d));
}
};
$scope.toolTipContentFunction = function() {
return function(key, x, y, e, graph) {
return 'Super New Tooltip' +
'<h1>' + key + '</h1>' +
'<p>' + y + ' at ' + x + '</p>'
}
};
/*
// customize stack/line chart colors
$scope.colorFunction = function() {
var colors = ["#68bc31", "#2091cf", "#6fb3e0", "#fee074", "#f89406", "#af4e96"];
@ -180,4 +182,5 @@ angular.module('compass.monitoring', [
}
*/
})
})
});

View File

@ -1,121 +1,123 @@
angular.module('compass.server', [
'ui.router',
'ui.bootstrap',
'compass.charts',
'compass.findservers',
'ngTable'
])
define(['uiRouter', 'uiBootstrap', 'angularTable'], function() {
var serverModule = angular.module('compass.server', [
'ui.router',
'ui.bootstrap',
'compass.charts',
'compass.findservers',
'ngTable'
]);
.config(function config($stateProvider) {
$stateProvider
.state('serverList', {
url: '/serverlist',
controller: 'serverCtrl',
templateUrl: 'src/app/server/server-list.tpl.html',
authenticate: true,
resolve: {
machinesHostsData: function($q, dataService) {
var deferred = $q.defer();
dataService.getAllMachineHosts().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
}
}
});
})
.controller('serverCtrl', function($scope, dataService, $filter, ngTableParams, sortingService, machinesHostsData) {
$scope.hideunselected = '';
$scope.search = {};
$scope.allservers = machinesHostsData;
$scope.foundResults = [];
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.machines_hosts;
});
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.allservers.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.allservers.length, // length of data
getData: function($defer, params) {
var reverse = false;
var orderBy = params.orderBy()[0];
var orderBySort = "";
var orderByColumn = "";
if (orderBy) {
orderByColumn = orderBy.substring(1);
orderBySort = orderBy.substring(0, 1);
if (orderBySort == "+") {
reverse = false;
} else {
reverse = true;
}
}
var orderedData = params.sorting() ?
$filter('orderBy')($scope.allservers, function(item) {
if (orderByColumn == "switch_ip") {
return sortingService.ipAddressPre(item.switch_ip);
} else {
return item[orderByColumn];
serverModule.config(function config($stateProvider) {
$stateProvider
.state('serverList', {
url: '/serverlist',
controller: 'serverCtrl',
templateUrl: 'src/app/server/server-list.tpl.html',
authenticate: true,
resolve: {
machinesHostsData: function($q, dataService) {
var deferred = $q.defer();
dataService.getAllMachineHosts().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
}
}, reverse) : $scope.allservers;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
}
});
});
$scope.selectAllServers = function(flag) {
if (flag) {
angular.forEach($scope.allservers, function(sv) {
sv.selected = true;
})
} else {
angular.forEach($scope.allservers, function(sv) {
sv.selected = false;
})
}
};
serverModule.controller('serverCtrl', function($scope, dataService, $filter, ngTableParams, sortingService, machinesHostsData) {
$scope.hideunselected = '';
$scope.search = {};
$scope.allservers = machinesHostsData;
$scope.foundResults = [];
$scope.hideUnselected = function() {
if ($scope.hideunselected) {
$scope.search.selected = true;
} else {
delete $scope.search.selected;
}
};
$scope.reloadServers = function() {
dataService.getAllMachineHosts().success(function(data) {
$scope.allservers = data;
$scope.tableParams.$params.count = $scope.allservers.length;
$scope.tableParams.reload();
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.machines_hosts;
});
};
// add newly found servers at the top if allservers array
$scope.$watch('foundResults', function(newResults, oldResults) {
if (newResults != oldResults) {
for (var i = 0; i < newResults.length; i++) {
var sv = $filter('filter')($scope.allservers, newResults[i].mac, true);
if (sv.length == 0) {
newResults[i].machine_id = newResults[i].id;
delete newResults[i]['id'];
newResults[i].new = true;
$scope.allservers.unshift(newResults[i]);
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.allservers.length + 1 // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.allservers.length, // length of data
getData: function($defer, params) {
var reverse = false;
var orderBy = params.orderBy()[0];
var orderBySort = "";
var orderByColumn = "";
if (orderBy) {
orderByColumn = orderBy.substring(1);
orderBySort = orderBy.substring(0, 1);
if (orderBySort == "+") {
reverse = false;
} else {
reverse = true;
}
}
}
if ($scope.tableParams) {
var orderedData = params.sorting() ?
$filter('orderBy')($scope.allservers, function(item) {
if (orderByColumn == "switch_ip") {
return sortingService.ipAddressPre(item.switch_ip);
} else {
return item[orderByColumn];
}
}, reverse) : $scope.allservers;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
$scope.selectAllServers = function(flag) {
if (flag) {
angular.forEach($scope.allservers, function(sv) {
sv.selected = true;
})
} else {
angular.forEach($scope.allservers, function(sv) {
sv.selected = false;
})
}
};
$scope.hideUnselected = function() {
if ($scope.hideunselected) {
$scope.search.selected = true;
} else {
delete $scope.search.selected;
}
};
$scope.reloadServers = function() {
dataService.getAllMachineHosts().success(function(data) {
$scope.allservers = data;
$scope.tableParams.$params.count = $scope.allservers.length;
$scope.tableParams.reload();
}
}
}, true);
});
};
})
// add newly found servers at the top if allservers array
$scope.$watch('foundResults', function(newResults, oldResults) {
if (newResults != oldResults) {
for (var i = 0; i < newResults.length; i++) {
var sv = $filter('filter')($scope.allservers, newResults[i].mac, true);
if (sv.length == 0) {
newResults[i].machine_id = newResults[i].id;
delete newResults[i]['id'];
newResults[i].new = true;
$scope.allservers.unshift(newResults[i]);
}
}
if ($scope.tableParams) {
$scope.tableParams.$params.count = $scope.allservers.length;
$scope.tableParams.reload();
}
}
}, true);
});
});

View File

@ -1,167 +1,165 @@
angular.module('compass.services', [])
define(['angular'], function() {
var servicesModule = angular.module('compass.services', []);
// stateService is used for dynamically add/edit state
/* .service('stateService', ['$state',
function($state) {
this.addStates = function(pendingStates) {
var existingStates = $state.get(); // get all the current existing states
var alreadyExist = false; // flag - if the pending state is already in the states
// stateService is used for dynamically add/edit state
/*
.service('stateService', ['$state',
function($state) {
this.addStates = function(pendingStates) {
var existingStates = $state.get(); // get all the current existing states
var alreadyExist = false; // flag - if the pending state is already in the states
angular.forEach(pendingStates, function(pst) {
angular.forEach(existingStates, function(est) {
if (pst.name == est.name) {
alreadyExist = true;
}
});
if (!alreadyExist) {
app.stateProvider.state(pst.name, {
url: pst.url,
//controller: pst.controller,
templateUrl: 'src/app/monitoring/' + pst.url.substring(1) + '.tpl.html'
angular.forEach(pendingStates, function(pst) {
angular.forEach(existingStates, function(est) {
if (pst.name == est.name) {
alreadyExist = true;
}
});
}
alreadyExist = false;
});
}
}
])
*/
// dataService is used for http calls
.service('dataService', ['$http', 'settings',
function($http, settings) {
this.login = function(user) {
return $http.post(settings.apiUrlBase + '/users/login', angular.toJson(user));
};
this.getWizardPreConfig = function() {
return $http.get(settings.metadataUrlBase + '/config.json');
};
this.getWizardSteps = function() {
return $http.get(settings.metadataUrlBase + '/wizard_steps.json');
};
this.getAdapterConfig = function() {
return $http.get(settings.metadataUrlBase + '/adapter_config');
};
this.getAllMachineHosts = function(os) {
if (os) {
return $http.get(settings.apiUrlBase + '/switches-machines-hosts?os_id=' + os);
} else {
return $http.get(settings.apiUrlBase + '/switches-machines-hosts');
if (!alreadyExist) {
app.stateProvider.state(pst.name, {
url: pst.url,
//controller: pst.controller,
templateUrl: 'src/app/monitoring/' + pst.url.substring(1) + '.tpl.html'
});
}
alreadyExist = false;
});
}
};
}
])
*/
// dataService is used for http calls
servicesModule.service('dataService', ['$http', 'settings', //settings is global constant
function($http, settings) {
this.getSwitches = function() {
return $http.get(settings.apiUrlBase + '/switches');
};
this.login = function(user) {
return $http.post(settings.apiUrlBase + '/users/login', angular.toJson(user));
};
this.getSwitchById = function(id) {
return $http.get(settings.apiUrlBase + '/switches/' + id);
};
this.getWizardPreConfig = function() {
return $http.get(settings.metadataUrlBase + '/config.json');
};
this.postSwitches = function(sw) {
return $http.post(settings.apiUrlBase + '/switches', angular.toJson(sw));
};
this.getWizardSteps = function() {
return $http.get(settings.metadataUrlBase + '/wizard_steps.json');
};
this.putSwitches = function(id, sw) {
return $http.put(settings.apiUrlBase + '/switches/' + id, angular.toJson(sw));
};
this.getAdapterConfig = function() {
return $http.get(settings.metadataUrlBase + '/adapter_config');
};
/*
this.getAllMachineHosts = function(os) {
if (os) {
return $http.get(settings.apiUrlBase + '/switches-machines-hosts?os_id=' + os);
} else {
return $http.get(settings.apiUrlBase + '/switches-machines-hosts');
}
};
this.getSwitches = function() {
return $http.get(settings.apiUrlBase + '/switches');
};
this.getSwitchById = function(id) {
return $http.get(settings.apiUrlBase + '/switches/' + id);
};
this.postSwitches = function(sw) {
return $http.post(settings.apiUrlBase + '/switches', angular.toJson(sw));
};
this.putSwitches = function(id, sw) {
return $http.put(settings.apiUrlBase + '/switches/' + id, angular.toJson(sw));
};
/*
this.postSwitchFilters = function(filters) {
return $http.post(settings.apiUrlBase + '/switch-filters', angular.toJson(filters));
};
*/
this.putSwitchFilters = function(id, filters) {
return $http.put(settings.apiUrlBase + '/switch-filters/' + id, angular.toJson(filters));
};
this.putSwitchFilters = function(id, filters) {
return $http.put(settings.apiUrlBase + '/switch-filters/' + id, angular.toJson(filters));
};
this.postSwitchAction = function(id, action) {
return $http.post(settings.apiUrlBase + '/switches/' + id + '/action', angular.toJson(action));
};
this.postSwitchAction = function(id, action) {
return $http.post(settings.apiUrlBase + '/switches/' + id + '/action', angular.toJson(action));
};
this.getSwitchMachines = function(id) {
return $http.get(settings.apiUrlBase + '/switches/' + id + '/machines');
};
this.getSwitchMachines = function(id) {
return $http.get(settings.apiUrlBase + '/switches/' + id + '/machines');
};
this.getServerColumns = function() {
return $http.get(settings.metadataUrlBase + '/machine_host_columns.json');
};
this.getServerColumns = function() {
return $http.get(settings.metadataUrlBase + '/machine_host_columns.json');
};
this.getMonitoringNav = function() {
return $http.get(settings.metadataUrlBase + '/monitoring_nav.json');
};
this.getMonitoringNav = function() {
return $http.get(settings.metadataUrlBase + '/monitoring_nav.json');
};
this.getAdapters = function() {
return $http.get(settings.apiUrlBase + '/adapters');
};
this.getAdapters = function() {
return $http.get(settings.apiUrlBase + '/adapters');
};
this.getAdapter = function(id) {
return $http.get(settings.apiUrlBase + '/adapters/' + id);
};
this.getAdapter = function(id) {
return $http.get(settings.apiUrlBase + '/adapters/' + id);
};
this.createCluster = function(cluster) {
return $http.post(settings.apiUrlBase + '/clusters', angular.toJson(cluster));
};
this.createCluster = function(cluster) {
return $http.post(settings.apiUrlBase + '/clusters', angular.toJson(cluster));
};
this.createUser = function(newUser) {
return $http.post(settings.apiUrlBase + '/users', angular.toJson(newUser));
};
this.createUser = function(newUser) {
return $http.post(settings.apiUrlBase + '/users', angular.toJson(newUser));
};
this.getUserSetting = function() {
return $http.get(settings.apiUrlBase + '/users');
};
this.getUserSetting = function() {
return $http.get(settings.apiUrlBase + '/users');
};
this.getUserLog = function() {
return $http.get(settings.apiUrlBase + '/users/logs');
}
this.getClusters = function() {
return $http.get(settings.apiUrlBase + '/clusters');
};
this.getUserLog = function() {
return $http.get(settings.apiUrlBase + '/users/logs');
}
this.getClusters = function() {
return $http.get(settings.apiUrlBase + '/clusters');
};
this.getClusterById = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id);
};
this.getClusterById = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id);
};
this.getClusterProgress = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/state');
};
this.getClusterProgress = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/state');
};
this.getClusterConfig = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/config');
};
this.getClusterConfig = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/config');
};
this.updateClusterConfig = function(id, config) {
return $http.put(settings.apiUrlBase + '/clusters/' + id + '/config', angular.toJson(config));
};
this.updateClusterConfig = function(id, config) {
return $http.put(settings.apiUrlBase + '/clusters/' + id + '/config', angular.toJson(config));
};
this.getClusterMetadata = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/metadata');
};
this.getClusterMetadata = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/metadata');
};
this.getSubnetConfig = function() {
return $http.get(settings.apiUrlBase + '/subnets');
};
this.getSubnetConfig = function() {
return $http.get(settings.apiUrlBase + '/subnets');
};
this.postSubnetConfig = function(subnet_config) {
return $http.post(settings.apiUrlBase + '/subnets', angular.toJson(subnet_config));
};
this.postSubnetConfig = function(subnet_config) {
return $http.post(settings.apiUrlBase + '/subnets', angular.toJson(subnet_config));
};
this.putSubnetConfig = function(id, subnet_config) {
return $http.put(settings.apiUrlBase + '/subnets/' + id, angular.toJson(subnet_config));
};
this.putSubnetConfig = function(id, subnet_config) {
return $http.put(settings.apiUrlBase + '/subnets/' + id, angular.toJson(subnet_config));
};
this.deleteSubnet = function(id) {
return $http.delete(settings.apiUrlBase + '/subnets/' + id);
};
this.deleteSubnet = function(id) {
return $http.delete(settings.apiUrlBase + '/subnets/' + id);
};
// keep routing table for later use
/*
// keep routing table for later use
/*
this.postRoutingTable = function(id, routing_table) {
return $http.post(settings.apiUrlBase + '/clusters/' + id + '/routing-table', angular.toJson(routing_table));
};
@ -171,233 +169,233 @@ angular.module('compass.services', [])
};
*/
this.getTimezones = function() {
return $http.get(settings.metadataUrlBase + '/timezone.json');
};
this.getTimezones = function() {
return $http.get(settings.metadataUrlBase + '/timezone.json');
};
this.postClusterActions = function(id, actions) {
return $http.post(settings.apiUrlBase + '/clusters/' + id + '/action', angular.toJson(actions));
};
this.postClusterActions = function(id, actions) {
return $http.post(settings.apiUrlBase + '/clusters/' + id + '/action', angular.toJson(actions));
};
this.putHost = function(id, config) {
return $http.put(settings.apiUrlBase + '/hosts/' + id, angular.toJson(config));
};
this.putHost = function(id, config) {
return $http.put(settings.apiUrlBase + '/hosts/' + id, angular.toJson(config));
};
this.postHostNetwork = function(id, network) {
return $http.post(settings.apiUrlBase + '/hosts/' + id + '/networks', angular.toJson(network));
};
this.postHostNetwork = function(id, network) {
return $http.post(settings.apiUrlBase + '/hosts/' + id + '/networks', angular.toJson(network));
};
this.putHostNetwork = function(id, networkId, network) {
return $http.put(settings.apiUrlBase + '/hosts/' + id + '/networks/' + networkId, angular.toJson(network));
};
this.putHostNetwork = function(id, networkId, network) {
return $http.put(settings.apiUrlBase + '/hosts/' + id + '/networks/' + networkId, angular.toJson(network));
};
this.getClusterHosts = function(clusterId, hostId) {
return $http.get(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts');
};
this.getClusterHosts = function(clusterId, hostId) {
return $http.get(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts');
};
this.updateClusterHost = function(clusterId, hostId, data) {
return $http.put(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId, angular.toJson(data));
};
this.updateClusterHost = function(clusterId, hostId, data) {
return $http.put(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId, angular.toJson(data));
};
this.updateClusterHostConfig = function(clusterId, hostId, config) {
return $http.put(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId + '/config', angular.toJson(config));
};
this.updateClusterHostConfig = function(clusterId, hostId, config) {
return $http.put(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId + '/config', angular.toJson(config));
};
this.getClusterHostProgress = function(clusterId, hostId) {
return $http.get(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId + '/state');
};
this.getClusterHostProgress = function(clusterId, hostId) {
return $http.get(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId + '/state');
};
this.deleteHost = function(id) {
return $http.delete(settings.apiUrlBase + '/hosts/' + id);
};
/*
this.deleteHost = function(id) {
return $http.delete(settings.apiUrlBase + '/hosts/' + id);
};
/*
this.deleteHost = function(clusterId, hostId) {
return $http.delete(settings.apiUrlBase + '/clusters/' + clusterId + '/hosts/' + hostId);
};
*/
this.monitorHosts = function(id) {
// This differ from the main hosts API because it has status/alert information
// /monit/api/cluster/<id>/hosts
return $http.get(settings.monitoringUrlBase + '/clusters/' + id + '/hosts');
};
this.monitorHosts = function(id) {
// This differ from the main hosts API because it has status/alert information
// /monit/api/cluster/<id>/hosts
return $http.get(settings.monitoringUrlBase + '/clusters/' + id + '/hosts');
};
/* this.monitorProxy = function(px_url) {
/* this.monitorProxy = function(px_url) {
// Leave for now may delete later
// /monit/api/proxy/<path:url>
return $http.get(settings.monitoringUrlBase + '/proxy/' + px_url);
};
*/
this.monitorMetrics = function() {
// This returns a flat json list of metrics currently or historically have been collected
// /monit/api/metrics
return $http.get(settings.monitoringUrlBase + '/metrics');
};
this.monitorMetrics = function() {
// This returns a flat json list of metrics currently or historically have been collected
// /monit/api/metrics
return $http.get(settings.monitoringUrlBase + '/metrics');
};
this.monitorMetricsTree = function() {
// This will also order the metrics in a tree
// /monit/api/metricstree
return $http.get(settings.monitoringUrlBase + '/metricstree');
};
this.monitorMetricsTree = function() {
// This will also order the metrics in a tree
// /monit/api/metricstree
return $http.get(settings.monitoringUrlBase + '/metricstree');
};
this.monitorHostMetric = function(clusterId, hostName, metricName) {
// Returns a single metric for a cluster host
// /monit/api/cluster/<id>/host/<hostname>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/hosts/' + hostName + '/metric/' + metricName);
};
this.monitorHostMetric = function(clusterId, hostName, metricName) {
// Returns a single metric for a cluster host
// /monit/api/cluster/<id>/host/<hostname>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/hosts/' + hostName + '/metric/' + metricName);
};
this.monitorHostGroupMetric = function(clusterId, groupName, metricName) {
// Returns a single metric for a cluster hostgroup
// /monit/api/cluster/<id>/hostgroup/<hostgroup>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/hostgroups/' + groupName + '/metric/' + metricName);
};
this.monitorHostGroupMetric = function(clusterId, groupName, metricName) {
// Returns a single metric for a cluster hostgroup
// /monit/api/cluster/<id>/hostgroup/<hostgroup>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/hostgroups/' + groupName + '/metric/' + metricName);
};
this.monitorClusterMetric = function(clusterId, metricName) {
// Returns a single metric for a cluster hostgroup
// /monit/api/cluster/<id>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/metrics/' + metricName);
};
this.monitorClusterMetric = function(clusterId, metricName) {
// Returns a single metric for a cluster hostgroup
// /monit/api/cluster/<id>/metric/<metricname>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/metrics/' + metricName);
};
this.monitorAlarms = function(clusterId) {
// Returns all alarm data for a cluster host
// /monit/api/cluster/<id>/alarms
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/alarms');
};
this.monitorAlarms = function(clusterId) {
// Returns all alarm data for a cluster host
// /monit/api/cluster/<id>/alarms
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/alarms');
};
this.monitorEvents = function(id) {
// Reurns all event data for a cluster host
// /monit/api/cluster/<id>/events
return $http.get(settings.monitoringUrlBase + '/clusters/' + id + '/events');
};
this.monitorEvents = function(id) {
// Reurns all event data for a cluster host
// /monit/api/cluster/<id>/events
return $http.get(settings.monitoringUrlBase + '/clusters/' + id + '/events');
};
this.monitorTopology = function(clusterId) {
// Returns a nested json of networks and servers
// /monit/api/cluster/<id>/topology
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/topology');
};
this.monitorTopology = function(clusterId) {
// Returns a nested json of networks and servers
// /monit/api/cluster/<id>/topology
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/topology');
};
this.monitorServiceTopology = function(clusterId) {
// Returns a nested json of servers, roles and metrics
// /monit/api/cluster/<id>/servicetopology
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/servicetopology');
};
this.monitorServiceTopology = function(clusterId) {
// Returns a nested json of servers, roles and metrics
// /monit/api/cluster/<id>/servicetopology
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/servicetopology');
};
this.monitorOverview = function(clusterId) {
// Returns a nested json for constructing the overview page
// /monit/api/cluster/<id>/overview
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/overview');
};
this.monitorOverview = function(clusterId) {
// Returns a nested json for constructing the overview page
// /monit/api/cluster/<id>/overview
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/overview');
};
this.monitorUsers = function(clusterId) {
// Returns a flat json list of all cluster users
// /monit/api/cluster/<id>/users
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/users');
};
this.monitorUsers = function(clusterId) {
// Returns a flat json list of all cluster users
// /monit/api/cluster/<id>/users
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/users');
};
this.monitorUser = function(clusterId, userName) {
// Returns json information on a particliar user
// /monit/api/cluster/<id>/user/<username>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/user' + userName);
};
}
])
.service('sortingService', function() {
this.ipAddressPre = function(a) {
var m = a.split("."),
x = "";
for (var i = 0; i < m.length; i++) {
var item = m[i];
if (item.length == 1) {
x += "00" + item;
} else if (item.length == 2) {
x += "0" + item;
} else {
x += item;
}
this.monitorUser = function(clusterId, userName) {
// Returns json information on a particliar user
// /monit/api/cluster/<id>/user/<username>
return $http.get(settings.monitoringUrlBase + '/clusters/' + clusterId + '/user' + userName);
};
}
return x;
};
})
])
servicesModule.service('sortingService', function() {
this.ipAddressPre = function(a) {
var m = a.split("."),
x = "";
.factory('wizardFactory', [
function() {
var wizard = {};
wizard.init = function() {
wizard.cluster = {};
wizard.steps = [];
wizard.commit = {};
wizard.servers = [];
wizard.allServers = [];
//wizard.adapter = {}; //
wizard.generalConfig = {};
wizard.subnetworks = [];
wizard.routingtable = [];
wizard.generalConfig = {};
wizard.interfaces = {};
wizard.partition = {};
wizard.server_credentials = {};
wizard.service_credentials = {};
wizard.console_credentials = {};
wizard.network_mapping = {};
for (var i = 0; i < m.length; i++) {
var item = m[i];
if (item.length == 1) {
x += "00" + item;
} else if (item.length == 2) {
x += "0" + item;
} else {
x += item;
}
}
return x;
};
})
wizard.init();
wizard.preConfig = function(config) {
//wizard.setClusterInfo(config.cluster);
wizard.setInterfaces(config.interface);
wizard.setGeneralConfig(config.general);
wizard.setPartition(config.partition);
wizard.setServerCredentials(config.server_credentials);
wizard.setServiceCredentials(config.service_credentials);
wizard.setConsoleCredentials(config.console_credentials);
wizard.setNetworkMapping(config.network_mapping);
};
servicesModule.factory('wizardFactory', [
wizard.setClusterInfo = function(cluster) {
wizard.cluster = cluster;
};
function() {
var wizard = {};
wizard.init = function() {
wizard.cluster = {};
wizard.steps = [];
wizard.commit = {};
wizard.servers = [];
wizard.allServers = [];
//wizard.adapter = {}; //
wizard.generalConfig = {};
wizard.subnetworks = [];
wizard.routingtable = [];
wizard.generalConfig = {};
wizard.interfaces = {};
wizard.partition = {};
wizard.server_credentials = {};
wizard.service_credentials = {};
wizard.console_credentials = {};
wizard.network_mapping = {};
};
wizard.getClusterInfo = function() {
return angular.copy(wizard.cluster);
};
wizard.init();
wizard.setSteps = function(steps) {
wizard.steps = steps;
};
wizard.preConfig = function(config) {
//wizard.setClusterInfo(config.cluster);
wizard.setInterfaces(config.interface);
wizard.setGeneralConfig(config.general);
wizard.setPartition(config.partition);
wizard.setServerCredentials(config.server_credentials);
wizard.setServiceCredentials(config.service_credentials);
wizard.setConsoleCredentials(config.console_credentials);
wizard.setNetworkMapping(config.network_mapping);
};
wizard.getSteps = function() {
return angular.copy(wizard.steps);
};
wizard.setClusterInfo = function(cluster) {
wizard.cluster = cluster;
};
wizard.setCommitState = function(commitState) {
wizard.commit = commitState;
};
wizard.getClusterInfo = function() {
return angular.copy(wizard.cluster);
};
wizard.getCommitState = function() {
return wizard.commit;
};
wizard.setSteps = function(steps) {
wizard.steps = steps;
};
wizard.setAllMachinesHost = function(server) {
wizard.allServers = server;
};
wizard.getSteps = function() {
return angular.copy(wizard.steps);
};
wizard.getAllMachinesHost = function() {
return angular.copy(wizard.allServers);
};
wizard.setCommitState = function(commitState) {
wizard.commit = commitState;
};
wizard.setServers = function(servers) {
wizard.servers = servers;
};
wizard.getCommitState = function() {
return wizard.commit;
};
wizard.getServers = function() {
return angular.copy(wizard.servers);
};
/*
wizard.setAllMachinesHost = function(server) {
wizard.allServers = server;
};
wizard.getAllMachinesHost = function() {
return angular.copy(wizard.allServers);
};
wizard.setServers = function(servers) {
wizard.servers = servers;
};
wizard.getServers = function() {
return angular.copy(wizard.servers);
};
/*
wizard.setAdapter = function(adapter) { ////
wizard.adapter = adapter;
};
@ -406,24 +404,24 @@ angular.module('compass.services', [])
return angular.copy(wizard.adapter);
};
*/
wizard.setGeneralConfig = function(config) {
wizard.generalConfig = config;
};
wizard.setGeneralConfig = function(config) {
wizard.generalConfig = config;
};
wizard.getGeneralConfig = function() {
return angular.copy(wizard.generalConfig);
};
wizard.getGeneralConfig = function() {
return angular.copy(wizard.generalConfig);
};
wizard.setSubnetworks = function(subnetworks) {
wizard.subnetworks = subnetworks;
};
wizard.setSubnetworks = function(subnetworks) {
wizard.subnetworks = subnetworks;
};
wizard.getSubnetworks = function() {
return angular.copy(wizard.subnetworks);
};
wizard.getSubnetworks = function() {
return angular.copy(wizard.subnetworks);
};
// keey routing table for later use
/*
// keey routing table for later use
/*
wizard.setRoutingTable = function(routingTb) {
wizard.routingtable = routingTb;
};
@ -433,71 +431,72 @@ angular.module('compass.services', [])
};
*/
wizard.setInterfaces = function(interfaces) {
wizard.interfaces = interfaces;
};
wizard.setInterfaces = function(interfaces) {
wizard.interfaces = interfaces;
};
wizard.getInterfaces = function() {
return angular.copy(wizard.interfaces);
};
wizard.getInterfaces = function() {
return angular.copy(wizard.interfaces);
};
wizard.setPartition = function(partition) {
wizard.partition = partition;
};
wizard.setPartition = function(partition) {
wizard.partition = partition;
};
wizard.getPartition = function() {
return angular.copy(wizard.partition);
};
wizard.getPartition = function() {
return angular.copy(wizard.partition);
};
wizard.setServerCredentials = function(credentials) {
wizard.server_credentials = credentials;
};
wizard.setServerCredentials = function(credentials) {
wizard.server_credentials = credentials;
};
wizard.getServerCredentials = function() {
return angular.copy(wizard.server_credentials);
wizard.getServerCredentials = function() {
return angular.copy(wizard.server_credentials);
}
wizard.setServiceCredentials = function(credentials) {
wizard.service_credentials = credentials;
};
wizard.getServiceCredentials = function() {
return angular.copy(wizard.service_credentials);
};
wizard.setConsoleCredentials = function(credentials) {
wizard.console_credentials = credentials;
};
wizard.getConsoleCredentials = function() {
return angular.copy(wizard.console_credentials);
};
wizard.setNetworkMapping = function(mapping) {
wizard.network_mapping = mapping;
};
wizard.getNetworkMapping = function() {
return angular.copy(wizard.network_mapping);
};
return wizard;
}
wizard.setServiceCredentials = function(credentials) {
wizard.service_credentials = credentials;
};
])
wizard.getServiceCredentials = function() {
return angular.copy(wizard.service_credentials);
};
wizard.setConsoleCredentials = function(credentials) {
wizard.console_credentials = credentials;
};
wizard.getConsoleCredentials = function() {
return angular.copy(wizard.console_credentials);
};
wizard.setNetworkMapping = function(mapping) {
wizard.network_mapping = mapping;
};
wizard.getNetworkMapping = function() {
return angular.copy(wizard.network_mapping);
};
return wizard;
}
])
.service('authService', ['$http', 'dataService',
function($http, dataService) {
this.isAuthenticated = false;
this.setLogin = function(isLogin) {
this.isAuthenticated = isLogin;
}
this.login = function(user) {
return dataService.login(user);
};
this.logout = function() {
servicesModule.service('authService', ['$http', 'dataService',
function($http, dataService) {
this.isAuthenticated = false;
};
}
])
this.setLogin = function(isLogin) {
this.isAuthenticated = isLogin;
}
this.login = function(user) {
return dataService.login(user);
};
this.logout = function() {
this.isAuthenticated = false;
};
}
])
})

View File

@ -1,18 +1,21 @@
angular.module('compass.topnav', [
'ui.router',
'ui.bootstrap'
])
define(['angular'], function() {
var topNavModule = angular.module('compass.topnav', [
'ui.router',
'ui.bootstrap'
]);
.controller('topnavCtrl', function($scope, $http, dataService, $rootScope) {
// get all clusters
dataService.getClusters().success(function(data) {
$scope.clusters = data;
topNavModule.controller('topnavCtrl', function($scope, $http, dataService, $rootScope) {
// get all clusters
dataService.getClusters().success(function(data) {
$scope.clusters = data;
});
$rootScope.$on('clusters', function(event, data) {
$scope.clusters = data;
});
});
$rootScope.$on('clusters', function(event, data) {
$scope.clusters = data;
})
}).directive('topnav', function() {
return {
templateUrl: 'src/app/topnav/topnav.tpl.html'
};
});
topNavModule.directive('topnav', function() {
return {
templateUrl: 'src/app/topnav/topnav.tpl.html'
};
});
});

View File

@ -163,6 +163,7 @@
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="userLog in $data | filter:searchActivity | timeStampFilter:dateRange">
<td sortable="'user_id'">

View File

@ -1,17 +1,18 @@
var app = angular.module('compass.userProfile', [
'ui.router',
'ui.bootstrap'
])
define(['angular'], function() {
var userProfileModule = angular.module('compass.userProfile', [
'ui.router',
'ui.bootstrap'
]);
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('userProfile', {
url: '/userProfile',
//controller: 'userProfileCtrl',
templateUrl: 'src/app/user/user-profile.html',
authenticate: true,
//resolve: {}
});
userProfileModule.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('userProfile', {
url: '/userProfile',
//controller: 'userProfileCtrl',
templateUrl: 'src/app/user/user-profile.html',
authenticate: true,
//resolve: {}
});
});
})
//combine usersetting and userprofile into a single file?

View File

@ -1,86 +1,44 @@
var app = angular.module('compass.userSetting', [
'ui.router',
'ui.bootstrap',
'ngTable',
'ngBootstrap'
])
define(['ngBsDaterangepicker', 'uiRouter', 'uiBootstrap', 'angularTable'], function() {
'use strict';
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('userSetting', {
url: '/userSetting',
controller: 'userSettingCtrl',
templateUrl: 'src/app/user/user-setting.html',
authenticate: true,
resolve: {
userSettingData: function($q, dataService) {
var deferred = $q.defer();
dataService.getUserSetting().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
},
userLogData: function($q, dataService) {
var deferred = $q.defer();
dataService.getUserLog().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
var userSettingModule = angular.module('compass.userSetting', [
'ui.router',
'ui.bootstrap',
'ngTable',
'ngBootstrap'
]);
userSettingModule.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('userSetting', {
url: '/userSetting',
controller: 'userSettingCtrl',
templateUrl: 'src/app/user/user-setting.html',
authenticate: true,
resolve: {
userSettingData: function($q, dataService) {
var deferred = $q.defer();
dataService.getUserSetting().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
},
userLogData: function($q, dataService) {
var deferred = $q.defer();
dataService.getUserLog().success(function(data) {
deferred.resolve(data);
});
return deferred.promise;
}
}
}
});
})
.controller('userSettingCtrl', function($scope, $state, ngTableParams, $filter, dataService, userSettingData, $modal) {
$scope.userSetting = userSettingData;
var data = userSettingData;
$scope.tableParams = new ngTableParams({
page: 1,
count: 10,
}, {
total: data.length,
getData: function($defer, params) {
var orderedData = params.sorting() ?
$filter('orderBy')(data, params.orderBy()) :
data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
$scope.edit = function() {
alert("Edit User?")
};
$scope.delete = function() {
alert("Delete User?")
};
$scope.newUser = {};
$scope.open = function(size) {
var modalInstance = $modal.open({
templateUrl: 'userSettingModal.html',
controller: UserModalCtrl,
resolve: {
newUser: function() {
return $scope.newUser;
}
}
});
modalInstance.result.then(function(newUser) {
$scope.newUser = newUser;
dataService.createUser(newUser).success(function(data, status) {
$scope.userSetting.push(newUser);
$scope.tableParams.reload();
});
$scope.newUser = {};
}, function() {
// modal cancelled
});
};
dataService.getUserLog().success(function(data) {
$scope.userParams = new ngTableParams({
});
userSettingModule.controller('userSettingCtrl', function($scope, $state, ngTableParams, $filter, dataService, userSettingData, $modal) {
$scope.userSetting = userSettingData;
var data = userSettingData;
$scope.tableParams = new ngTableParams({
page: 1,
count: 10,
}, {
@ -92,54 +50,100 @@ var app = angular.module('compass.userSetting', [
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
});
})
.directive('match', function() {
return {
require: 'ngModel',
restrict: 'A',
scope: {
match: '='
},
link: function(scope, elem, attrs, ctrl) {
scope.$watch(function() {
return (ctrl.$pristine && angular.isUndefined(ctrl.$modelValue)) || scope.match === ctrl.$modelValue;
}, function(currentValue) {
ctrl.$setValidity('match', currentValue);
$scope.edit = function() {
alert("Edit User?")
};
$scope.delete = function() {
alert("Delete User?")
};
$scope.newUser = {};
$scope.open = function(size) {
var modalInstance = $modal.open({
templateUrl: 'userSettingModal.html',
controller: UserModalCtrl,
resolve: {
newUser: function() {
return $scope.newUser;
}
}
});
}
};
});
modalInstance.result.then(function(newUser) {
$scope.newUser = newUser;
dataService.createUser(newUser).success(function(data, status) {
$scope.userSetting.push(newUser);
$scope.tableParams.reload();
});
app.filter('timeStampFilter', function () {
return function(items, dateRange) {
if (items !== undefined) {
var filtered = [];
var startDate = dateRange.startDate;
var endDate = dateRange.endDate;
for (var i = 0; i < items.length; i++) {
var item = items[i];
var standardTime = moment(item.timestamp);
if (moment(standardTime).isAfter(startDate) && moment(standardTime).isBefore(endDate)) {
filtered.push(item);
}
}
return filtered;
}
};
})
$scope.newUser = {};
}, function() {
// modal cancelled
});
};
dataService.getUserLog().success(function(data) {
$scope.userParams = new ngTableParams({
page: 1,
count: 10,
}, {
total: data.length,
getData: function($defer, params) {
var orderedData = params.sorting() ?
$filter('orderBy')(data, params.orderBy()) :
data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
});
});
var UserModalCtrl = function($scope, $modalInstance, newUser) {
$scope.newUser = newUser;
userSettingModule.directive('match', function() {
return {
require: 'ngModel',
restrict: 'A',
scope: {
match: '='
},
link: function(scope, elem, attrs, ctrl) {
scope.$watch(function() {
return (ctrl.$pristine && angular.isUndefined(ctrl.$modelValue)) || scope.match === ctrl.$modelValue;
}, function(currentValue) {
ctrl.$setValidity('match', currentValue);
});
}
};
});
$scope.ok = function() {
$scope.result = 'ok';
$modalInstance.close($scope.newUser);
};
userSettingModule.filter('timeStampFilter', function() {
return function(items, dateRange) {
if (items !== undefined) {
var filtered = [];
var startDate = dateRange.startDate;
var endDate = dateRange.endDate;
for (var i = 0; i < items.length; i++) {
var item = items[i];
var standardTime = moment(item.timestamp);
if (moment(standardTime).isAfter(startDate) && moment(standardTime).isBefore(endDate)) {
filtered.push(item);
}
}
return filtered;
}
};
});
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
$scope.result = 'cancel';
var UserModalCtrl = function($scope, $modalInstance, newUser) {
$scope.newUser = newUser;
$scope.ok = function() {
$scope.result = 'ok';
$modalInstance.close($scope.newUser);
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
$scope.result = 'cancel';
};
};
};
});

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<div class="page-content" ng-swipe-disable-mouse ng-swipe-right="stepForward()" ng-swipe-left="stepBackward()" >
<div class="page-header">
<h1>Create Cluster Wizard</h1>
<span us-spinner="{radius:30, length: 20, lines:13, width:10}" spinner-key="spinner-1"></span>
<!-- <span us-spinner="{radius:30, length: 20, lines:13, width:10}" spinner-key="spinner-1"></span> -->
</div>
<div id="create-cluster-wizard">
<ul class="wizard-steps">
@ -26,7 +26,7 @@
<div class="widget-body">
<div class="widget-main padding-32">
<span us-spinner ng-if="loading == true" style="position: relative !important; left: 47%"></span>
<div ng-hide = "loading == true" ng-include="steps[currentStep-1].template"></div>
<div ng-hide="loading == true" ng-include="steps[currentStep-1].template"></div>
</div>
</div>
</div>

6
v2/src/bootstrap.js vendored Normal file
View File

@ -0,0 +1,6 @@
define(['angular', 'app/app'], function(ng) {
'use strict';
ng.element(document).ready(function() {
ng.bootstrap(document, ['app']);
})
});

File diff suppressed because it is too large Load Diff

View File

@ -1,201 +1,203 @@
angular.module('compass.findservers', [])
.directive('switchrow', function(dataService, $timeout) {
return {
restrict: 'A',
scope: {
polling: '=',
switchinfo: '=',
result: '=',
machines: '='
},
link: function(scope, element, attrs) {
var checkSwitchTimer;
var checkSwitchCount = 0;
//var pollingTriggered = scope.polling;
var fireTimer = true;
define(['angular'], function() {
var findserversModule = angular.module('compass.findservers', []);
findserversModule.directive('switchrow', function(dataService, $timeout) {
return {
restrict: 'A',
scope: {
polling: '=',
switchinfo: '=',
result: '=',
machines: '='
},
link: function(scope, element, attrs) {
var checkSwitchTimer;
var checkSwitchCount = 0;
//var pollingTriggered = scope.polling;
var fireTimer = true;
var getMachines = function() {
dataService.getSwitchMachines(scope.switchinfo.id).success(function(data) {
scope.polling = false;
scope.result = "success";
scope.machines = data;
}).error(function(data) {
scope.polling = false;
scope.result = "error";
})
};
// check switch state 15 times with the interval of 2 sec
var checkSwitchState = function() {
checkSwitchCount++;
dataService.getSwitchById(scope.switchinfo.id).success(function(data) {
if (data.state == "under_monitoring") {
getMachines();
} else if (data.state === "initialized" || data.state === "repolling")
if (fireTimer && checkSwitchCount < 15) {
checkSwitchTimer = $timeout(checkSwitchState, 2000);
} else {
scope.polling = false;
scope.result = "error";
} else {
var getMachines = function() {
dataService.getSwitchMachines(scope.switchinfo.id).success(function(data) {
scope.polling = false;
scope.result = "success";
scope.machines = data;
}).error(function(data) {
scope.polling = false;
scope.result = "error";
}
})
};
})
};
scope.$watch('polling', function(newval, oldval) {
if (newval != oldval) {
if (newval == true) {
checkSwitchCount = 0;
fireTimer = true;
// check switch state 15 times with the interval of 2 sec
var checkSwitchState = function() {
checkSwitchCount++;
dataService.getSwitchById(scope.switchinfo.id).success(function(data) {
if (data.state == "under_monitoring") {
getMachines();
} else if (data.state === "initialized" || data.state === "repolling")
if (fireTimer && checkSwitchCount < 15) {
checkSwitchTimer = $timeout(checkSwitchState, 2000);
} else {
scope.polling = false;
scope.result = "error";
} else {
scope.polling = false;
scope.result = "error";
}
})
};
var findingAction = {
"find_machines": null
};
dataService.postSwitchAction(scope.switchinfo.id, findingAction).success(function(data) {
checkSwitchState();
})
}
}
})
scope.$watch('polling', function(newval, oldval) {
if (newval != oldval) {
if (newval == true) {
checkSwitchCount = 0;
fireTimer = true;
element.bind('$destroy', function() {
fireTimer = false;
$timeout.cancel(checkSwitchTimer);
});
}
}
})
.directive('findservers', function(dataService, $modal, $log) {
return {
restrict: 'E',
scope: {
newFoundServers: '=results'
},
templateUrl: "src/common/findservers/find-new-servers.tpl.html",
link: function(scope, element, attrs) {
scope.switches = [];
scope.newFoundServers = [];
scope.isFindingNewServers = false;
dataService.getSwitches().success(function(data) {
scope.switches = data;
});
scope.modifySwitchModal = function(index) {
var modalInstance = $modal.open({
templateUrl: 'modifySwitchModal.html',
controller: modifySwitchModalInstanceCtrl,
resolve: {
targetSwitch: function() {
return scope.switches[index];
var findingAction = {
"find_machines": null
};
dataService.postSwitchAction(scope.switchinfo.id, findingAction).success(function(data) {
checkSwitchState();
})
}
}
})
element.bind('$destroy', function() {
fireTimer = false;
$timeout.cancel(checkSwitchTimer);
});
}
}
});
findserversModule.directive('findservers', function(dataService, $modal, $log) {
return {
restrict: 'E',
scope: {
newFoundServers: '=results'
},
templateUrl: "src/common/findservers/find-new-servers.tpl.html",
link: function(scope, element, attrs) {
scope.switches = [];
scope.newFoundServers = [];
scope.isFindingNewServers = false;
dataService.getSwitches().success(function(data) {
scope.switches = data;
});
modalInstance.result.then(function(targetSwitch) {
scope.alerts = [];
dataService.putSwitches(targetSwitch.id,targetSwitch).success(function() {
scope.modifySwitchModal = function(index) {
var modalInstance = $modal.open({
templateUrl: 'modifySwitchModal.html',
controller: modifySwitchModalInstanceCtrl,
resolve: {
targetSwitch: function() {
return scope.switches[index];
}
}
});
scope.switches[index] = angular.copy(targetSwitch);
modalInstance.result.then(function(targetSwitch) {
scope.alerts = [];
dataService.putSwitches(targetSwitch.id, targetSwitch).success(function() {
scope.switches[index] = angular.copy(targetSwitch);
}).error(function(response) {
scope.alerts[0] = response;
});
}, function() {
$log.info('Modal dismissed at: ' + new Date());
});
};
scope.selectAllSwitches = function(flag) {
if (flag) {
angular.forEach(scope.switches, function(sv) {
sv.selected = true;
})
} else {
angular.forEach(scope.switches, function(sv) {
sv.selected = false;
})
}
};
scope.findServers = function() {
var swSelection = false;
angular.forEach(scope.switches, function(sw) {
if (sw.selected) {
swSelection = true;
}
});
if (!swSelection) {
alert("Please select at least one switch");
} else {
scope.isFindingNewServers = true;
scope.newFoundServers = [];
angular.forEach(scope.switches, function(sw) {
if (sw.selected) {
sw.result = "";
sw.finished = false;
sw.polling = true;
}
});
}
};
scope.$watch('switches', function(val) {
var totalResultReady = true;
if (scope.isFindingNewServers) {
angular.forEach(scope.switches, function(sw) {
if (sw.selected && !sw.finished) {
if (sw.result == "success") {
scope.newFoundServers = scope.newFoundServers.concat(angular.copy(sw.machines));
sw.finished = true;
} else if (sw.result == "error") {
sw.finished = true;
} else {
totalResultReady = false;
}
}
});
if (totalResultReady) {
scope.isFindingNewServers = false;
}
}
}, true);
scope.newswitch = {}
scope.newswitch.credentials = {};
scope.alerts = [];
scope.addSwitch = function() {
scope.alerts = [];
dataService.postSwitches(scope.newswitch).success(function(switchData) {
scope.newswitch = {};
scope.switches.push(switchData);
}).error(function(response) {
scope.alerts[0] = response;
});
}, function() {
$log.info('Modal dismissed at: ' + new Date());
});
};
};
scope.selectAllSwitches = function(flag) {
if (flag) {
angular.forEach(scope.switches, function(sv) {
sv.selected = true;
})
} else {
angular.forEach(scope.switches, function(sv) {
sv.selected = false;
})
}
};
scope.closeAlert = function() {
scope.alerts = [];
};
}
};
});
var modifySwitchModalInstanceCtrl = function($scope, $modalInstance, targetSwitch) {
$scope.targetSwitch = angular.copy(targetSwitch);
$scope.ok = function() {
$modalInstance.close($scope.targetSwitch);
};
scope.findServers = function() {
var swSelection = false;
angular.forEach(scope.switches, function(sw) {
if (sw.selected) {
swSelection = true;
}
});
if (!swSelection) {
alert("Please select at least one switch");
} else {
scope.isFindingNewServers = true;
scope.newFoundServers = [];
angular.forEach(scope.switches, function(sw) {
if (sw.selected) {
sw.result = "";
sw.finished = false;
sw.polling = true;
}
});
}
};
scope.$watch('switches', function(val) {
var totalResultReady = true;
if (scope.isFindingNewServers) {
angular.forEach(scope.switches, function(sw) {
if (sw.selected && !sw.finished) {
if (sw.result == "success") {
scope.newFoundServers = scope.newFoundServers.concat(angular.copy(sw.machines));
sw.finished = true;
} else if (sw.result == "error") {
sw.finished = true;
} else {
totalResultReady = false;
}
}
});
if (totalResultReady) {
scope.isFindingNewServers = false;
}
}
}, true);
scope.newswitch = {}
scope.newswitch.credentials = {};
scope.alerts = [];
scope.addSwitch = function() {
scope.alerts = [];
dataService.postSwitches(scope.newswitch).success(function(switchData) {
scope.newswitch = {};
scope.switches.push(switchData);
}).error(function(response) {
scope.alerts[0] = response;
});
};
scope.closeAlert = function() {
scope.alerts = [];
};
}
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
})
var modifySwitchModalInstanceCtrl = function ($scope, $modalInstance,targetSwitch) {
$scope.targetSwitch = angular.copy(targetSwitch);
$scope.ok = function () {
$modalInstance.close($scope.targetSwitch);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
});

View File

@ -2,220 +2,232 @@
* @author Dimitry Kudrayvtsev
* @version 2.0
*/
define(['d3'], function() {
d3.gantt = function() {
var FIT_TIME_DOMAIN_MODE = "fit";
var FIXED_TIME_DOMAIN_MODE = "fixed";
d3.gantt = function() {
var FIT_TIME_DOMAIN_MODE = "fit";
var FIXED_TIME_DOMAIN_MODE = "fixed";
var margin = {
top : 20,
right : 40,
bottom : 20,
left : 150
};
var timeDomainStart = d3.time.day.offset(new Date(),-3);
var timeDomainEnd = d3.time.hour.offset(new Date(),+3);
var timeDomainMode = FIT_TIME_DOMAIN_MODE;// fixed or fit
var taskTypes = [];
var taskStatus = [];
var height = document.body.clientHeight - margin.top - margin.bottom-5;
var width = document.body.clientWidth - margin.right - margin.left-5;
var margin = {
top: 20,
right: 40,
bottom: 20,
left: 150
};
var timeDomainStart = d3.time.day.offset(new Date(), -3);
var timeDomainEnd = d3.time.hour.offset(new Date(), +3);
var timeDomainMode = FIT_TIME_DOMAIN_MODE; // fixed or fit
var taskTypes = [];
var taskStatus = [];
var height = document.body.clientHeight - margin.top - margin.bottom - 5;
var width = document.body.clientWidth - margin.right - margin.left - 5;
var tickFormat = "%H:%M";
var tickFormat = "%H:%M";
var keyFunction = function(d) {
return d.startDate + d.name + d.endDate;
};
var keyFunction = function(d) {
return d.startDate + d.name + d.endDate;
};
var rectTransform = function(d) {
return "translate(" + x(d.startDate) + "," + y(d.name) + ")";
};
var rectTransform = function(d) {
return "translate(" + x(d.startDate) + "," + y(d.name) + ")";
};
var x = d3.time.scale().domain([ timeDomainStart, timeDomainEnd ]).range([ 0, width ]).clamp(true);
var x = d3.time.scale().domain([timeDomainStart, timeDomainEnd]).range([0, width]).clamp(true);
var y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);
var xAxis = d3.svg.axis().scale(x).orient("bottom").tickFormat(d3.time.format(tickFormat)).tickSubdivide(true)
.tickSize(8).tickPadding(8);
var y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([0, height - margin.top - margin.bottom], .1);
var yAxis = d3.svg.axis().scale(y).orient("left").tickSize(0);
var xAxis = d3.svg.axis().scale(x).orient("bottom").tickFormat(d3.time.format(tickFormat)).tickSubdivide(true)
.tickSize(8).tickPadding(8);
var initTimeDomain = function() {
if (timeDomainMode === FIT_TIME_DOMAIN_MODE) {
if (tasks === undefined || tasks.length < 1) {
timeDomainStart = d3.time.day.offset(new Date(), -3);
timeDomainEnd = d3.time.hour.offset(new Date(), +3);
return;
}
tasks.sort(function(a, b) {
return a.endDate - b.endDate;
});
timeDomainEnd = tasks[tasks.length - 1].endDate;
tasks.sort(function(a, b) {
return a.startDate - b.startDate;
});
timeDomainStart = tasks[0].startDate;
}
};
var yAxis = d3.svg.axis().scale(y).orient("left").tickSize(0);
var initAxis = function() {
x = d3.time.scale().domain([ timeDomainStart, timeDomainEnd ]).range([ 0, width ]).clamp(true);
y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);
xAxis = d3.svg.axis().scale(x).orient("bottom").tickFormat(d3.time.format(tickFormat)).tickSubdivide(true)
.tickSize(8).tickPadding(8);
var initTimeDomain = function() {
if (timeDomainMode === FIT_TIME_DOMAIN_MODE) {
if (tasks === undefined || tasks.length < 1) {
timeDomainStart = d3.time.day.offset(new Date(), -3);
timeDomainEnd = d3.time.hour.offset(new Date(), +3);
return;
}
tasks.sort(function(a, b) {
return a.endDate - b.endDate;
});
timeDomainEnd = tasks[tasks.length - 1].endDate;
tasks.sort(function(a, b) {
return a.startDate - b.startDate;
});
timeDomainStart = tasks[0].startDate;
}
};
yAxis = d3.svg.axis().scale(y).orient("left").tickSize(0);
};
function gantt(tasks) {
initTimeDomain();
initAxis();
var svg = d3.select("ganttchart")
.append("svg")
.attr("class", "chart")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("class", "gantt-chart")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.attr("transform", "translate(" + margin.left + ", " + margin.top + ")");
svg.selectAll(".chart")
.data(tasks, keyFunction).enter()
.append("rect")
.attr("rx", 5)
.attr("ry", 5)
.attr("class", function(d){
if(taskStatus[d.status] == null){ return "bar";}
return taskStatus[d.status];
})
.attr("y", 0)
.attr("transform", rectTransform)
.attr("height", function(d) { return y.rangeBand(); })
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0, " + (height - margin.top - margin.bottom) + ")")
.transition()
.call(xAxis);
svg.append("g").attr("class", "y axis").transition().call(yAxis);
return gantt;
var initAxis = function() {
x = d3.time.scale().domain([timeDomainStart, timeDomainEnd]).range([0, width]).clamp(true);
y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([0, height - margin.top - margin.bottom], .1);
xAxis = d3.svg.axis().scale(x).orient("bottom").tickFormat(d3.time.format(tickFormat)).tickSubdivide(true)
.tickSize(8).tickPadding(8);
};
gantt.redraw = function(tasks) {
yAxis = d3.svg.axis().scale(y).orient("left").tickSize(0);
};
initTimeDomain();
initAxis();
var svg = d3.select("svg");
function gantt(tasks) {
var ganttChartGroup = svg.select(".gantt-chart");
var rect = ganttChartGroup.selectAll("rect").data(tasks, keyFunction);
rect.enter()
.insert("rect",":first-child")
.attr("rx", 5)
.attr("ry", 5)
.attr("class", function(d){
if(taskStatus[d.status] == null){ return "bar";}
return taskStatus[d.status];
})
.transition()
.attr("y", 0)
.attr("transform", rectTransform)
.attr("height", function(d) { return y.rangeBand(); })
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
initTimeDomain();
initAxis();
rect.transition()
.attr("transform", rectTransform)
.attr("height", function(d) { return y.rangeBand(); })
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
rect.exit().remove();
var svg = d3.select("ganttchart")
.append("svg")
.attr("class", "chart")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("class", "gantt-chart")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.attr("transform", "translate(" + margin.left + ", " + margin.top + ")");
svg.select(".x").transition().call(xAxis);
svg.select(".y").transition().call(yAxis);
return gantt;
};
svg.selectAll(".chart")
.data(tasks, keyFunction).enter()
.append("rect")
.attr("rx", 5)
.attr("ry", 5)
.attr("class", function(d) {
if (taskStatus[d.status] == null) {
return "bar";
}
return taskStatus[d.status];
})
.attr("y", 0)
.attr("transform", rectTransform)
.attr("height", function(d) {
return y.rangeBand();
})
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0, " + (height - margin.top - margin.bottom) + ")")
.transition()
.call(xAxis);
svg.append("g").attr("class", "y axis").transition().call(yAxis);
return gantt;
};
gantt.redraw = function(tasks) {
initTimeDomain();
initAxis();
var svg = d3.select("svg");
var ganttChartGroup = svg.select(".gantt-chart");
var rect = ganttChartGroup.selectAll("rect").data(tasks, keyFunction);
rect.enter()
.insert("rect", ":first-child")
.attr("rx", 5)
.attr("ry", 5)
.attr("class", function(d) {
if (taskStatus[d.status] == null) {
return "bar";
}
return taskStatus[d.status];
})
.transition()
.attr("y", 0)
.attr("transform", rectTransform)
.attr("height", function(d) {
return y.rangeBand();
})
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
rect.transition()
.attr("transform", rectTransform)
.attr("height", function(d) {
return y.rangeBand();
})
.attr("width", function(d) {
return (x(d.endDate) - x(d.startDate));
});
rect.exit().remove();
svg.select(".x").transition().call(xAxis);
svg.select(".y").transition().call(yAxis);
return gantt;
};
gantt.margin = function(value) {
if (!arguments.length)
return margin;
margin = value;
return gantt;
};
gantt.timeDomain = function(value) {
if (!arguments.length)
return [timeDomainStart, timeDomainEnd];
timeDomainStart = +value[0], timeDomainEnd = +value[1];
return gantt;
};
/**
* @param {string}
* vale The value can be "fit" - the domain fits the data or
* "fixed" - fixed domain.
*/
gantt.timeDomainMode = function(value) {
if (!arguments.length)
return timeDomainMode;
timeDomainMode = value;
return gantt;
};
gantt.taskTypes = function(value) {
if (!arguments.length)
return taskTypes;
taskTypes = value;
return gantt;
};
gantt.taskStatus = function(value) {
if (!arguments.length)
return taskStatus;
taskStatus = value;
return gantt;
};
gantt.width = function(value) {
if (!arguments.length)
return width;
width = +value;
return gantt;
};
gantt.height = function(value) {
if (!arguments.length)
return height;
height = +value;
return gantt;
};
gantt.tickFormat = function(value) {
if (!arguments.length)
return tickFormat;
tickFormat = value;
return gantt;
};
gantt.margin = function(value) {
if (!arguments.length)
return margin;
margin = value;
return gantt;
};
gantt.timeDomain = function(value) {
if (!arguments.length)
return [ timeDomainStart, timeDomainEnd ];
timeDomainStart = +value[0], timeDomainEnd = +value[1];
return gantt;
};
/**
* @param {string}
* vale The value can be "fit" - the domain fits the data or
* "fixed" - fixed domain.
*/
gantt.timeDomainMode = function(value) {
if (!arguments.length)
return timeDomainMode;
timeDomainMode = value;
return gantt;
};
gantt.taskTypes = function(value) {
if (!arguments.length)
return taskTypes;
taskTypes = value;
return gantt;
};
gantt.taskStatus = function(value) {
if (!arguments.length)
return taskStatus;
taskStatus = value;
return gantt;
};
gantt.width = function(value) {
if (!arguments.length)
return width;
width = +value;
return gantt;
};
gantt.height = function(value) {
if (!arguments.length)
return height;
height = +value;
return gantt;
};
gantt.tickFormat = function(value) {
if (!arguments.length)
return tickFormat;
tickFormat = value;
return gantt;
};
return gantt;
};
return d3.gantt;
})

127
v2/src/main.js Normal file
View File

@ -0,0 +1,127 @@
require.config({
baseUrl: "src",
paths: {
'jquery': '../vendor/jquery/jquery-1.11.1.min',
'twitterBootstrap': '../vendor/bootstrap/js/bootstrap.min',
'angular': '../vendor/angular/angular.min',
'uiRouter': '../vendor/angular-ui-router/angular-ui-router.min',
'angularMocks': '../vendor/angular/angular-mocks',
'angularTouch': '../vendor/angular/angular-touch',
'uiBootstrap': '../vendor/angular-bootstrap/ui-bootstrap-tpls-0.11.0.min',
'angularTable': '../vendor/ng-table/ng-table.min',
'angularDragDrop': '../vendor/angular-dragdrop/draganddrop',
'spin': '../vendor/angular-spinner/spin.min',
'ngSpinner': '../vendor/angular-spinner/angular-spinner.min',
'angularAnimate': '../vendor/angular/angular-animate.min',
'd3': '../vendor/d3/d3.min',
'nvD3': '../vendor/nvd3/nv.d3.min',
'ganttChart':'common/gantt-chart-d3v2',
'rickshaw': '../vendor/rickshaw/rickshaw.min',
'angularRickshaw': '../vendor/angular-rickshaw/rickshaw.min',
'moment': '../vendor/angular-daterangepicker/moment.min',
'daterangepicker': '../vendor/angular-daterangepicker/daterangepicker',
'ngBsDaterangepicker': '../vendor/angular-daterangepicker/ng-bs-daterangepicker',
'angularUiTree': '../vendor/angular-ui-tree/angular-ui-tree.min',
'nvd3Directive': '../vendor/angular-nvd3/angularjs-nvd3-directives.min',
'login': 'app/login/login',
'services': 'app/services',
'appDev': 'app/appDev',
'clusterList': 'app/cluster/clusterList',
'cluster': 'app/cluster/cluster',
'wizard': 'app/wizard/wizard',
'topnav': 'app/topnav/topnav',
'server': 'app/server/server',
'userProfile': 'app/user/userprofile',
'userSetting': 'app/user/usersetting',
'monitoring': 'app/monitoring/monitoring',
'charts': 'common/charts',
'findservers': 'common/findservers/findservers'
},
shim: {
"jquery": {
exports: "jquery"
},
"twitterBootstrap": {
deps: ["jquery"],
exports: "twitterBootstrap"
},
"angular": {
deps: ['jquery'],
exports: "angular"
},
"angularTable": {
deps: ["angular"],
exports: "angularTable"
},
"angularMocks": {
deps: ["angular"],
exports: "angularMocks"
},
"angularTouch": {
deps: ["angular"],
exports: "angularTouch"
},
"uiBootstrap": {
deps: ["angular"],
exports: "uiBootstrap"
},
"angularDragDrop": {
deps: ["angular"],
exports: "angularDragDrop"
},
"uiRouter": {
deps: ["angular"],
exports: "uiRouter"
},
"spin": {
//deps:["angular"],
exports: "spin"
},
"ngSpinner": {
deps: ["angular", "spin"], // may depends on angularspin
exports: "ngSpinner"
},
"angularAnimate": {
deps: ["angular"],
exports: "angularAnimate"
},
"d3": {
exports: "d3"
},
"nvD3": {
deps: ["d3"],
exports: "nvD3"
},
"nvd3Directive": {
deps: ["nvD3"],
exports: "nvd3Directive"
},
"rickshaw": {
exports: "rickshaw"
},
"angularUiTree": {
deps: ["angular"],
exports: "angularUiTree"
},
"angularRickshaw": {
deps: ["angular", "rickshaw", "d3"],
exports: "angularRickshaw"
},
"moment": {
exports: "moment"
},
"daterangepicker": {
deps: ["twitterBootstrap", "angular", "moment"],
exports: "daterangepicker"
},
"ngBsDaterangepicker": {
deps: ["daterangepicker"],
exports: "ngBsDaterangepicker"
}
},
deps: ['./bootstrap']
});

36
v2/vendor/require.js vendored Executable file
View File

@ -0,0 +1,36 @@
/*
RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
Available via the MIT or new BSD license.
see: http://github.com/jrburke/requirejs for details
*/
var requirejs,require,define;
(function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function T(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function t(b,c){return fa.call(b,c)}function m(b,c){return t(b,c)&&b[c]}function B(b,c){for(var d in b)if(t(b,d)&&c(b[d],d))break}function U(b,c,d,e){c&&B(c,function(c,g){if(d||!t(b,g))e&&"object"===typeof c&&c&&!H(c)&&!G(c)&&!(c instanceof
RegExp)?(b[g]||(b[g]={}),U(b[g],c,d,e)):b[g]=c});return b}function u(b,c){return function(){return c.apply(b,arguments)}}function ca(b){throw b;}function da(b){if(!b)return b;var c=ba;v(b.split("."),function(b){c=c[b]});return c}function C(b,c,d,e){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=e;d&&(c.originalError=d);return c}function ga(b){function c(a,k,b){var f,l,c,d,e,g,i,p,k=k&&k.split("/"),h=j.map,n=h&&h["*"];if(a){a=a.split("/");l=a.length-1;j.nodeIdCompat&&
Q.test(a[l])&&(a[l]=a[l].replace(Q,""));"."===a[0].charAt(0)&&k&&(l=k.slice(0,k.length-1),a=l.concat(a));l=a;for(c=0;c<l.length;c++)if(d=l[c],"."===d)l.splice(c,1),c-=1;else if(".."===d&&!(0===c||1==c&&".."===l[2]||".."===l[c-1])&&0<c)l.splice(c-1,2),c-=2;a=a.join("/")}if(b&&h&&(k||n)){l=a.split("/");c=l.length;a:for(;0<c;c-=1){e=l.slice(0,c).join("/");if(k)for(d=k.length;0<d;d-=1)if(b=m(h,k.slice(0,d).join("/")))if(b=m(b,e)){f=b;g=c;break a}!i&&(n&&m(n,e))&&(i=m(n,e),p=c)}!f&&i&&(f=i,g=p);f&&(l.splice(0,
g,f),a=l.join("/"))}return(f=m(j.pkgs,a))?f:a}function d(a){z&&v(document.getElementsByTagName("script"),function(k){if(k.getAttribute("data-requiremodule")===a&&k.getAttribute("data-requirecontext")===i.contextName)return k.parentNode.removeChild(k),!0})}function e(a){var k=m(j.paths,a);if(k&&H(k)&&1<k.length)return k.shift(),i.require.undef(a),i.makeRequire(null,{skipMap:!0})([a]),!0}function n(a){var k,c=a?a.indexOf("!"):-1;-1<c&&(k=a.substring(0,c),a=a.substring(c+1,a.length));return[k,a]}function p(a,
k,b,f){var l,d,e=null,g=k?k.name:null,j=a,p=!0,h="";a||(p=!1,a="_@r"+(K+=1));a=n(a);e=a[0];a=a[1];e&&(e=c(e,g,f),d=m(r,e));a&&(e?h=d&&d.normalize?d.normalize(a,function(a){return c(a,g,f)}):-1===a.indexOf("!")?c(a,g,f):a:(h=c(a,g,f),a=n(h),e=a[0],h=a[1],b=!0,l=i.nameToUrl(h)));b=e&&!d&&!b?"_unnormalized"+(O+=1):"";return{prefix:e,name:h,parentMap:k,unnormalized:!!b,url:l,originalName:j,isDefine:p,id:(e?e+"!"+h:h)+b}}function s(a){var k=a.id,b=m(h,k);b||(b=h[k]=new i.Module(a));return b}function q(a,
k,b){var f=a.id,c=m(h,f);if(t(r,f)&&(!c||c.defineEmitComplete))"defined"===k&&b(r[f]);else if(c=s(a),c.error&&"error"===k)b(c.error);else c.on(k,b)}function w(a,b){var c=a.requireModules,f=!1;if(b)b(a);else if(v(c,function(b){if(b=m(h,b))b.error=a,b.events.error&&(f=!0,b.emit("error",a))}),!f)g.onError(a)}function x(){R.length&&(ha.apply(A,[A.length,0].concat(R)),R=[])}function y(a){delete h[a];delete V[a]}function F(a,b,c){var f=a.map.id;a.error?a.emit("error",a.error):(b[f]=!0,v(a.depMaps,function(f,
d){var e=f.id,g=m(h,e);g&&(!a.depMatched[d]&&!c[e])&&(m(b,e)?(a.defineDep(d,r[e]),a.check()):F(g,b,c))}),c[f]=!0)}function D(){var a,b,c=(a=1E3*j.waitSeconds)&&i.startTime+a<(new Date).getTime(),f=[],l=[],g=!1,h=!0;if(!W){W=!0;B(V,function(a){var i=a.map,j=i.id;if(a.enabled&&(i.isDefine||l.push(a),!a.error))if(!a.inited&&c)e(j)?g=b=!0:(f.push(j),d(j));else if(!a.inited&&(a.fetched&&i.isDefine)&&(g=!0,!i.prefix))return h=!1});if(c&&f.length)return a=C("timeout","Load timeout for modules: "+f,null,
f),a.contextName=i.contextName,w(a);h&&v(l,function(a){F(a,{},{})});if((!c||b)&&g)if((z||ea)&&!X)X=setTimeout(function(){X=0;D()},50);W=!1}}function E(a){t(r,a[0])||s(p(a[0],null,!0)).init(a[1],a[2])}function I(a){var a=a.currentTarget||a.srcElement,b=i.onScriptLoad;a.detachEvent&&!Y?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=i.onScriptError;(!a.detachEvent||Y)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function J(){var a;
for(x();A.length;){a=A.shift();if(null===a[0])return w(C("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));E(a)}}var W,Z,i,L,X,j={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},h={},V={},$={},A=[],r={},S={},aa={},K=1,O=1;L={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?r[a.map.id]=a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?
a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return m(j.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};Z=function(a){this.events=m($,a.id)||{};this.map=a;this.shim=m(j.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Z.prototype={init:function(a,b,c,f){f=f||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=u(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=
c;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
this.map.url;S[a]||(S[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var f=this.exports,l=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&&
(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f);
if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval",
"fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b,
a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p,
nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b,
a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild=
!0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!==
e&&(!("."===k||".."===k)||1<e))d=b.substring(e,b.length),b=b.substring(0,e);return i.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return t(r,p(b,a,!1,!0).id)},specified:function(b){b=p(b,a,!1,!0).id;return t(r,b)||t(h,b)}});a||(j.undef=function(b){x();var c=p(b,a,!0),e=m(h,b);d(b);delete r[b];delete S[c.url];delete $[b];T(A,function(a,c){a[0]===b&&A.splice(c,1)});e&&(e.events.defined&&($[b]=e.events),y(b))});return j},enable:function(a){m(h,a.id)&&s(a).enable()},completeLoad:function(a){var b,
c,d=m(j.shim,a)||{},g=d.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);E(c)}c=m(h,a);if(!b&&!t(r,a)&&c&&!c.inited){if(j.enforceDefine&&(!g||!da(g)))return e(a)?void 0:w(C("nodefine","No define call for "+a,null,[a]));E([a,d.deps||[],d.exportsFn])}D()},nameToUrl:function(a,b,c){var d,e,h;(d=m(j.pkgs,a))&&(a=d);if(d=m(aa,a))return i.nameToUrl(d,b,c);if(g.jsExtRegExp.test(a))d=a+(b||"");else{d=j.paths;a=a.split("/");for(e=a.length;0<e;e-=1)if(h=a.slice(0,
e).join("/"),h=m(d,h)){H(h)&&(h=h[0]);a.splice(0,e,h);break}d=a.join("/");d+=b||(/^data\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+d}return j.urlArgs?d+((-1===d.indexOf("?")?"?":"&")+j.urlArgs):d},load:function(a,b){g.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ja.test((a.currentTarget||a.srcElement).readyState))N=null,a=I(a),i.completeLoad(a.id)},onScriptError:function(a){var b=I(a);if(!e(b.id))return w(C("scripterror",
"Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var g,x,y,D,I,E,N,J,s,O,ka=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,la=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,Q=/\.js$/,ia=/^\.\//;x=Object.prototype;var K=x.toString,fa=x.hasOwnProperty,ha=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),ea=!z&&"undefined"!==typeof importScripts,ja=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,
Y="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},q={},R=[],M=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(q=require,require=void 0);g=requirejs=function(b,c,d,e){var n,p="_";!H(b)&&"string"!==typeof b&&(n=b,H(c)?(b=c,c=d,d=e):b=[]);n&&n.context&&(p=n.context);(e=m(F,p))||(e=F[p]=g.s.newContext(p));n&&e.configure(n);return e.require(b,c,d)};g.config=function(b){return g(b)};
g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.15";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c=
b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var e=b&&b.config||{};if(z)return e=g.createNode(e,c,d),e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",c),e.attachEvent&&!(e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)):
(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl=
O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b||
(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this);