Merge "Improve login and logout + replaced tabs by spaces"
This commit is contained in:
commit
404011bf7e
68
Gruntfile.js
68
Gruntfile.js
@ -18,13 +18,13 @@ module.exports = function (grunt) {
|
||||
|
||||
clean: {
|
||||
dist: [
|
||||
'<%= project.dist %>/assets/',
|
||||
'<%= project.dist %>/bower_components/',
|
||||
'<%= project.dist %>/components/',
|
||||
'<%= project.dist %>/js/',
|
||||
'<%= project.dist %>/templates/',
|
||||
'<%= project.dist %>/index.html'
|
||||
],
|
||||
'<%= project.dist %>/assets/',
|
||||
'<%= project.dist %>/bower_components/',
|
||||
'<%= project.dist %>/components/',
|
||||
'<%= project.dist %>/js/',
|
||||
'<%= project.dist %>/templates/',
|
||||
'<%= project.dist %>/index.html'
|
||||
],
|
||||
tmp: ['<%= project.tmp %>/']
|
||||
},
|
||||
|
||||
@ -84,31 +84,31 @@ module.exports = function (grunt) {
|
||||
},
|
||||
|
||||
jshint: { // configure the task
|
||||
options: {
|
||||
node: true,
|
||||
loopfunc: true,
|
||||
globals: {
|
||||
document: true,
|
||||
angular: true,
|
||||
jQuery: true,
|
||||
$: true,
|
||||
describe: true,
|
||||
it: true,
|
||||
expect: true,
|
||||
beforeEach: true,
|
||||
inject: true
|
||||
},
|
||||
force: true
|
||||
},
|
||||
all: [
|
||||
'karma.conf.js',
|
||||
'Gruntfile.js',
|
||||
'<%= project.app %>/app.js',
|
||||
'<%= project.app %>/**/*.js',
|
||||
'!<%= project.app %>/bower_components/**',
|
||||
'!<%= project.app %>/**/live.js',
|
||||
'!<%= project.app %>/**/adagios.js'
|
||||
]
|
||||
options: {
|
||||
node: true,
|
||||
loopfunc: true,
|
||||
globals: {
|
||||
document: true,
|
||||
angular: true,
|
||||
jQuery: true,
|
||||
$: true,
|
||||
describe: true,
|
||||
it: true,
|
||||
expect: true,
|
||||
beforeEach: true,
|
||||
inject: true
|
||||
},
|
||||
force: true
|
||||
},
|
||||
all: [
|
||||
'karma.conf.js',
|
||||
'Gruntfile.js',
|
||||
'<%= project.app %>/app.js',
|
||||
'<%= project.app %>/**/*.js',
|
||||
'!<%= project.app %>/bower_components/**',
|
||||
'!<%= project.app %>/**/live.js',
|
||||
'!<%= project.app %>/**/adagios.js'
|
||||
]
|
||||
},
|
||||
|
||||
useminPrepare: {
|
||||
@ -166,8 +166,8 @@ module.exports = function (grunt) {
|
||||
'<%= project.app %>/components/live/surveil.js',
|
||||
'<%= project.assets %>/sass/{,*/}*.{scss,sass}'
|
||||
],
|
||||
tasks: ['production:surveil']
|
||||
},
|
||||
tasks: ['production:surveil']
|
||||
},
|
||||
options: {
|
||||
livereload: true
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
angular.module('bansho', [
|
||||
'ngRoute',
|
||||
'angular.filter',
|
||||
'ngCookies',
|
||||
'angular.filter',
|
||||
'bansho.config',
|
||||
'bansho.authentication',
|
||||
'bansho.utils.promiseManager',
|
||||
|
@ -1,22 +1,22 @@
|
||||
var AdagiosUI = (function() {
|
||||
"use strict";
|
||||
|
||||
// States for UI modifications
|
||||
var state = {
|
||||
visible: 'state--visible',
|
||||
hidden: 'state--hidden',
|
||||
current: 'state--current',
|
||||
open: 'state--open',
|
||||
fadeIn: 'state--fadein',
|
||||
fadeOut: 'state--fadeout',
|
||||
hasChild: 'state--haschild'
|
||||
};
|
||||
// States for UI modifications
|
||||
var state = {
|
||||
visible: 'state--visible',
|
||||
hidden: 'state--hidden',
|
||||
current: 'state--current',
|
||||
open: 'state--open',
|
||||
fadeIn: 'state--fadein',
|
||||
fadeOut: 'state--fadeout',
|
||||
hasChild: 'state--haschild'
|
||||
};
|
||||
|
||||
// Breakpoints for the responsive web design
|
||||
var mquery = {
|
||||
phone: 480,
|
||||
tablet: 959
|
||||
};
|
||||
// Breakpoints for the responsive web design
|
||||
var mquery = {
|
||||
phone: 480,
|
||||
tablet: 959
|
||||
};
|
||||
|
||||
var test = function() {
|
||||
console.log();
|
||||
@ -37,12 +37,12 @@ var AdagiosUI = (function() {
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
state: state,
|
||||
test: test,
|
||||
mquery: mquery,
|
||||
return {
|
||||
state: state,
|
||||
test: test,
|
||||
mquery: mquery,
|
||||
syncBkgCheckbox : syncBkgCheckbox,
|
||||
closeSidebar : closeSidebar
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -55,3 +55,8 @@
|
||||
@import '../../components/topbar/topbar';
|
||||
@import '../../components/sidebar/sidebar';
|
||||
@import '../../components/tactical/tactical';
|
||||
|
||||
//----------------------------------*\
|
||||
// TEMPORARY MODULES
|
||||
//----------------------------------*/
|
||||
@import 'temporary';
|
||||
|
@ -207,7 +207,7 @@ table {
|
||||
//overflow-x:auto;
|
||||
|
||||
//@include medium-and-up-screen {
|
||||
// display:table;
|
||||
// display:table;
|
||||
// overflow-x:visible;
|
||||
//}
|
||||
}
|
||||
|
@ -34,15 +34,15 @@
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
|
||||
&.focusable:active,
|
||||
&.focusable:focus {
|
||||
clip: auto;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
position: static;
|
||||
width: auto;
|
||||
}
|
||||
&.focusable:active,
|
||||
&.focusable:focus {
|
||||
clip: auto;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
position: static;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
@include medium-and-up-screen {
|
||||
border:0;
|
||||
display:table;
|
||||
display:table;
|
||||
min-height:0;
|
||||
overflow-x:visible;
|
||||
width:100%;
|
||||
|
32
app/assets/sass/temporary.scss
Normal file
32
app/assets/sass/temporary.scss
Normal file
@ -0,0 +1,32 @@
|
||||
.centered {
|
||||
position: fixed;
|
||||
margin-top: 15px;
|
||||
left: 50%;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
.bansho-title {
|
||||
color: #ddd;
|
||||
font-size: 300%;
|
||||
padding-bottom: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.field {
|
||||
float: right;
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 85px;
|
||||
padding-right: 15px;
|
||||
}
|
@ -1,19 +1,31 @@
|
||||
<form name="loginForm"
|
||||
ng-controller="LoginController"
|
||||
ng-submit="login(credentials)" novalidate>
|
||||
<div class="centered">
|
||||
<h1 class="bansho-title">Bansho</h1>
|
||||
<p>Web client for Surveil</p>
|
||||
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username"
|
||||
ng-model="credentials.auth.passwordCredentials.username">
|
||||
<h2>Login</h2>
|
||||
<br>
|
||||
<form name="loginForm"
|
||||
ng-controller="LoginController"
|
||||
ng-submit="login(credentials)" novalidate>
|
||||
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password"
|
||||
ng-model="credentials.auth.passwordCredentials.password">
|
||||
<div class="form-group">
|
||||
<label for="username" class="label">Username:</label>
|
||||
<input type="text" id="username" class="form-control field"
|
||||
ng-model="credentials.auth.passwordCredentials.username">
|
||||
</div>
|
||||
|
||||
<label for="tenantName">Tenant Name:</label>
|
||||
<input type="text" id="tenant-name"
|
||||
ng-model="credentials.auth.tenantName">
|
||||
<div class="form-group">
|
||||
<label for="password" class="label">Password:</label>
|
||||
<input type="password" class="form-control field" id="password"
|
||||
ng-model="credentials.auth.passwordCredentials.password">
|
||||
</div>
|
||||
|
||||
<button type="submit">Login</button>
|
||||
<div class="form-group">
|
||||
<label for="tenantName" class="label">Tenant Name:</label>
|
||||
<input type="text" id="tenant-name"class="form-control field"
|
||||
ng-model="credentials.auth.tenantName">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@ angular.module('bansho.authentication', [])
|
||||
}])
|
||||
|
||||
.controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', function ($scope, $rootScope, $location, authService, configManager) {
|
||||
var login = function (credentials) {
|
||||
var login = function (credentials) {
|
||||
authService.login(credentials);
|
||||
};
|
||||
|
||||
@ -25,27 +25,31 @@ angular.module('bansho.authentication', [])
|
||||
};
|
||||
|
||||
$scope.login = function() {
|
||||
login($scope.credentials);
|
||||
};
|
||||
|
||||
configManager.loadDevelopmentConfig().then(function () {
|
||||
var devConfig = configManager.getDevelopmentConfig();
|
||||
if (devConfig.env === 'development') {
|
||||
login({
|
||||
'auth': {
|
||||
'tenantName': '',
|
||||
'passwordCredentials': {
|
||||
'username': devConfig.username,
|
||||
'password': devConfig.password
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
login($scope.credentials);
|
||||
};
|
||||
|
||||
if (authService.isAuthenticated()) {
|
||||
login($scope.credentials);
|
||||
}
|
||||
|
||||
configManager.loadDevelopmentConfig().then(function () {
|
||||
var devConfig = configManager.getDevelopmentConfig();
|
||||
if (devConfig.env === 'development') {
|
||||
login({
|
||||
'auth': {
|
||||
'tenantName': '',
|
||||
'passwordCredentials': {
|
||||
'username': devConfig.username,
|
||||
'password': devConfig.password
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
// Development config failed
|
||||
});
|
||||
|
||||
}, function () {
|
||||
// Development config failed
|
||||
});
|
||||
|
||||
}])
|
||||
|
||||
.factory('authService', ['$http', '$location', '$rootScope', 'session', 'configManager', function ($http, $location, $rootScope, session, configManager) {
|
||||
@ -73,21 +77,33 @@ angular.module('bansho.authentication', [])
|
||||
};
|
||||
|
||||
authService.isAuthenticated = function () {
|
||||
return !!session.sessionId;
|
||||
return !!session.isUserConnected();
|
||||
};
|
||||
|
||||
authService.logout = function () {
|
||||
$rootScope.isAuthenticated = false;
|
||||
session.destroy();
|
||||
$location.path('/login');
|
||||
};
|
||||
|
||||
|
||||
return authService;
|
||||
}])
|
||||
|
||||
.service('session', function () {
|
||||
.service('session', ['$cookies', function ($cookies) {
|
||||
this.isUserConnected = function () {
|
||||
return $cookies.connected === 'true';
|
||||
};
|
||||
|
||||
this.create = function (sessionId, expirationTime) {
|
||||
this.sessionId = sessionId;
|
||||
this.expirationTime = expirationTime;
|
||||
$cookies.connected = 'true';
|
||||
};
|
||||
|
||||
this.destroy = function () {
|
||||
this.sessionId = null;
|
||||
this.expirationTime = null;
|
||||
$cookies.connected = 'false';
|
||||
};
|
||||
});
|
||||
}]);
|
||||
|
@ -5,26 +5,26 @@ angular.module('bansho.config', [])
|
||||
|
||||
.service('configManager', ['$http', '$q', function ($http, $q) {
|
||||
var config = {},
|
||||
developmentConfig = {};
|
||||
developmentConfig = {};
|
||||
|
||||
this.loadDevelopmentConfig = function() {
|
||||
var promise = $q.defer();
|
||||
this.loadDevelopmentConfig = function() {
|
||||
var promise = $q.defer();
|
||||
|
||||
$http.get('components/config/developmentConfig.json')
|
||||
.success(function (config) {
|
||||
developmentConfig = config;
|
||||
promise.resolve();
|
||||
})
|
||||
.error(function() {
|
||||
promise.reject();
|
||||
});
|
||||
$http.get('components/config/developmentConfig.json')
|
||||
.success(function (config) {
|
||||
developmentConfig = config;
|
||||
promise.resolve();
|
||||
})
|
||||
.error(function() {
|
||||
promise.reject();
|
||||
});
|
||||
|
||||
return promise.promise;
|
||||
};
|
||||
return promise.promise;
|
||||
};
|
||||
|
||||
this.getDevelopmentConfig = function () {
|
||||
return developmentConfig;
|
||||
};
|
||||
this.getDevelopmentConfig = function () {
|
||||
return developmentConfig;
|
||||
};
|
||||
|
||||
this.loadByTemplate = function (templateName, destination) {
|
||||
var viewsConfig = config.data;
|
||||
|
@ -219,13 +219,13 @@
|
||||
]
|
||||
},
|
||||
"host": {
|
||||
"title": "Host",
|
||||
"refreshInterval": 0,
|
||||
"template": "host"
|
||||
"title": "Host",
|
||||
"refreshInterval": 0,
|
||||
"template": "host"
|
||||
},
|
||||
"service": {
|
||||
"title": "Service",
|
||||
"refreshInterval": 0,
|
||||
"template": "service"
|
||||
"title": "Service",
|
||||
"refreshInterval": 0,
|
||||
"template": "service"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"env": "development",
|
||||
"username":"",
|
||||
"password":""
|
||||
"env": "production",
|
||||
"username":"",
|
||||
"password":""
|
||||
}
|
||||
|
@ -324,20 +324,20 @@ angular.module('bansho.live', [])
|
||||
};
|
||||
|
||||
var acknowledge = function (host_name, service_description, attrs) {
|
||||
var data = {};
|
||||
var data = {};
|
||||
|
||||
data.host_name = host_name;
|
||||
if (attrs.sticky) {
|
||||
data.sticky = parseInt(attrs.sticky, 10);
|
||||
}
|
||||
if (attrs.sticky) {
|
||||
data.sticky = parseInt(attrs.sticky, 10);
|
||||
}
|
||||
|
||||
if (attrs.notify) {
|
||||
data.notify = parseInt(attrs.notify, 10);
|
||||
}
|
||||
if (attrs.notify) {
|
||||
data.notify = parseInt(attrs.notify, 10);
|
||||
}
|
||||
|
||||
if (attrs.persistent) {
|
||||
data.persistent = parseInt(attrs.persistent, 10);
|
||||
}
|
||||
if (attrs.persistent) {
|
||||
data.persistent = parseInt(attrs.persistent, 10);
|
||||
}
|
||||
|
||||
if (service_description !== undefined) {
|
||||
data.service_description = service_description;
|
||||
@ -353,47 +353,47 @@ angular.module('bansho.live', [])
|
||||
};
|
||||
|
||||
var downtime = function (host_name, service_description, attrs) {
|
||||
attrs.host_name = host_name;
|
||||
attrs.host_name = host_name;
|
||||
if (service_description !== undefined) {
|
||||
attrs.service_description = service_description;
|
||||
}
|
||||
|
||||
return $http({
|
||||
url: '/surveil/v2/actions/downtime/',
|
||||
method: 'POST',
|
||||
data: attrs
|
||||
});
|
||||
return $http({
|
||||
url: '/surveil/v2/actions/downtime/',
|
||||
method: 'POST',
|
||||
data: attrs
|
||||
});
|
||||
};
|
||||
|
||||
var recheck = function (host_name, service_description) {
|
||||
var attrs = {};
|
||||
attrs.host_name = host_name;
|
||||
var attrs = {};
|
||||
attrs.host_name = host_name;
|
||||
if (service_description !== undefined) {
|
||||
attrs.service_description = service_description;
|
||||
}
|
||||
|
||||
return $http({
|
||||
url: '/surveil/v2/actions/recheck/',
|
||||
method: 'POST',
|
||||
data: attrs
|
||||
});
|
||||
return $http({
|
||||
url: '/surveil/v2/actions/recheck/',
|
||||
method: 'POST',
|
||||
data: attrs
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
getHost: getHost,
|
||||
getObjects : getObjects,
|
||||
getService : getService,
|
||||
hostQueryTransform: hostQueryTransform,
|
||||
acknowledge: acknowledge,
|
||||
getHostOpenProblems: getHostOpenProblems,
|
||||
hostMiddleware: hostMiddleware,
|
||||
getServiceProblems: getServiceProblems,
|
||||
getServiceOpenProblems: getServiceOpenProblems,
|
||||
getHostProblems: getHostProblems,
|
||||
getTableData: getTableData,
|
||||
getTotalHosts: getTotalHosts,
|
||||
getTotalServices: getTotalServices,
|
||||
downtime: downtime,
|
||||
recheck: recheck
|
||||
return {
|
||||
getHost: getHost,
|
||||
getObjects : getObjects,
|
||||
getService : getService,
|
||||
hostQueryTransform: hostQueryTransform,
|
||||
acknowledge: acknowledge,
|
||||
getHostOpenProblems: getHostOpenProblems,
|
||||
hostMiddleware: hostMiddleware,
|
||||
getServiceProblems: getServiceProblems,
|
||||
getServiceOpenProblems: getServiceOpenProblems,
|
||||
getHostProblems: getHostProblems,
|
||||
getTableData: getTableData,
|
||||
getTotalHosts: getTotalHosts,
|
||||
getTotalServices: getTotalServices,
|
||||
downtime: downtime,
|
||||
recheck: recheck
|
||||
};
|
||||
}]);
|
||||
|
@ -1,90 +1,90 @@
|
||||
<menu class="filters" ng-controller="TableActionbarCtrl">
|
||||
<ul class="filters__list clearfix">
|
||||
<li class="filters__item filters__item--problems">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersProblems"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersProblems">
|
||||
<span>{{ actionbarFilters.activeFilter.text }}</span>
|
||||
<i class="ico-down-dir"></i>
|
||||
</button>
|
||||
<ul class="filters__list clearfix">
|
||||
<li class="filters__item filters__item--problems">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersProblems"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersProblems">
|
||||
<span>{{ actionbarFilters.activeFilter.text }}</span>
|
||||
<i class="ico-down-dir"></i>
|
||||
</button>
|
||||
|
||||
<div class="filters__panel collapse" id="filtersProblems">
|
||||
<ul class="filters__sublist">
|
||||
<li class="filters__subitem" ng-repeat="actionbarFilter in actionbarFilters.possibleFilters" ng-click="activateFilter($index)">
|
||||
<a class="filters__link state--current" ng-if="actionbarFilter === actionbarFilters.activeFilter">{{ actionbarFilter.text }}</a>
|
||||
<a class="filters__link" ng-if="actionbarFilter !== actionbarFilters.activeFilter">{{ actionbarFilter.text }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="filters__item filters__item--recheck">
|
||||
<bansho-recheck-button></bansho-recheck-button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--acknowledge" data-mover="true">
|
||||
<button class="filters__button" type="button" ng-click="switchAcknowledgeForm()">
|
||||
<span class="visuallyhidden">Acknowledge</span>
|
||||
<i class="ico-thumbs-up"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--downtime" data-mover="true">
|
||||
<button class="filters__button" type="button" ng-click="switchDowntimeForm()">
|
||||
<span class="visuallyhidden">Downtime</span>
|
||||
<i class="ico-clock"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--more clearfix">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersMore"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersMore">
|
||||
<span>More</span>
|
||||
<i class="ico-down-dir"></i>
|
||||
</button>
|
||||
<div class="filters__panel collapse" id="filtersProblems">
|
||||
<ul class="filters__sublist">
|
||||
<li class="filters__subitem" ng-repeat="actionbarFilter in actionbarFilters.possibleFilters" ng-click="activateFilter($index)">
|
||||
<a class="filters__link state--current" ng-if="actionbarFilter === actionbarFilters.activeFilter">{{ actionbarFilter.text }}</a>
|
||||
<a class="filters__link" ng-if="actionbarFilter !== actionbarFilters.activeFilter">{{ actionbarFilter.text }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="filters__item filters__item--recheck">
|
||||
<bansho-recheck-button></bansho-recheck-button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--acknowledge" data-mover="true">
|
||||
<button class="filters__button" type="button" ng-click="switchAcknowledgeForm()">
|
||||
<span class="visuallyhidden">Acknowledge</span>
|
||||
<i class="ico-thumbs-up"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--downtime" data-mover="true">
|
||||
<button class="filters__button" type="button" ng-click="switchDowntimeForm()">
|
||||
<span class="visuallyhidden">Downtime</span>
|
||||
<i class="ico-clock"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="filters__item filters__item--more clearfix">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersMore"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersMore">
|
||||
<span>More</span>
|
||||
<i class="ico-down-dir"></i>
|
||||
</button>
|
||||
|
||||
<div class="filters__panel collapse" id="filtersMore">
|
||||
<ul class="filters__sublist">
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More I</a>
|
||||
</li>
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More II</a>
|
||||
</li>
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More III</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="filters__item clearfix">
|
||||
<input id=filter__search" type="search" ng-model="actionbarFilters.searchFilter"/>{{ actionbarFilters.searchFilter }}
|
||||
</li>
|
||||
<li class="filters__item filters__item--settings">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersSettings"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersSettings">
|
||||
<span class="visuallyhidden">Filters Settings</span>
|
||||
<i class="ico-cog"></i>
|
||||
</button>
|
||||
<div class="filters__panel collapse" id="filtersMore">
|
||||
<ul class="filters__sublist">
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More I</a>
|
||||
</li>
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More II</a>
|
||||
</li>
|
||||
<li class="filters__subitem">
|
||||
<a class="filters__link" href="#">More III</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="filters__item clearfix">
|
||||
<input id=filter__search" type="search" ng-model="actionbarFilters.searchFilter"/>{{ actionbarFilters.searchFilter }}
|
||||
</li>
|
||||
<li class="filters__item filters__item--settings">
|
||||
<button class="filters__button"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#filtersSettings"
|
||||
aria-expanded="false"
|
||||
aria-controls="filtersSettings">
|
||||
<span class="visuallyhidden">Filters Settings</span>
|
||||
<i class="ico-cog"></i>
|
||||
</button>
|
||||
|
||||
<div class="filters__panel collapse" id="filtersSettings">
|
||||
<ul class="filters__sublist">
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filters__panel collapse" id="filtersSettings">
|
||||
<ul class="filters__sublist">
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<bansho-acknowledge-form ng-show="isAcknowledgeShown" is-shown="isAcknowledgeShown" selected-hosts="selected"> </bansho-acknowledge-form>
|
||||
<bansho-acknowledge-form ng-show="isAcknowledgeShown" is-shown="isAcknowledgeShown" selected-hosts="selected"> </bansho-acknowledge-form>
|
||||
|
||||
<bansho-downtime-form ng-show="isDowntimeShown" is-shown="isDowntimeShown" selected-hosts="selected"> </bansho-downtime-form>
|
||||
<bansho-downtime-form ng-show="isDowntimeShown" is-shown="isDowntimeShown" selected-hosts="selected"> </bansho-downtime-form>
|
||||
</menu>
|
||||
|
@ -30,19 +30,19 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live'])
|
||||
.controller('TableActionbarCtrl', ['$scope', '$filter', 'backendClient', 'actionbarFilters', 'tablesConfig',
|
||||
function ($scope, $filter, backendClient, actionbarFilters, tablesConfig, actionbarSelectFilter) {
|
||||
$scope.isDowntimeShown = false;
|
||||
$scope.isAcknowledgeShown = false;
|
||||
$scope.isAcknowledgeShown = false;
|
||||
|
||||
$scope.switchDowntimeForm = function () {
|
||||
$scope.isAcknowledgeShown = false;
|
||||
$scope.switchDowntimeForm = function () {
|
||||
$scope.isAcknowledgeShown = false;
|
||||
|
||||
$scope.isDowntimeShown = !$scope.isDowntimeShown;
|
||||
};
|
||||
$scope.isDowntimeShown = !$scope.isDowntimeShown;
|
||||
};
|
||||
|
||||
$scope.switchAcknowledgeForm = function () {
|
||||
$scope.isDowntimeShown = false;
|
||||
$scope.switchAcknowledgeForm = function () {
|
||||
$scope.isDowntimeShown = false;
|
||||
|
||||
$scope.isAcknowledgeShown = !$scope.isAcknowledgeShown;
|
||||
};
|
||||
$scope.isAcknowledgeShown = !$scope.isAcknowledgeShown;
|
||||
};
|
||||
|
||||
$scope.actionbarFilters = actionbarFilters;
|
||||
$scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0];
|
||||
|
@ -1,39 +1,39 @@
|
||||
<h4 id="acknowledgeModalLabel">Acknowlege</h4>
|
||||
<form data-ng-submit="acknowledgeProblems()">
|
||||
<div>
|
||||
<label for="author">Author :</label>
|
||||
<input type="text" id="acknowledge-author" ng-model="attrs.author">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sticky">Sticky :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-sticky"
|
||||
ng-model="attrs.sticky"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div>
|
||||
<div>
|
||||
<label for="notify">Notify :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-notify"
|
||||
ng-model="attrs.notify"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div >
|
||||
<div>
|
||||
<label for="persistent">Persistent :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-persistent"
|
||||
ng-model="attrs.persistent"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div>
|
||||
<div>
|
||||
<label for="comment">Comment :</label>
|
||||
<input type="message-text" id="acknowledge-comment" ng-model="attrs.comment">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" ng-click="isShown = !isShown">Close</button>
|
||||
<button type="button" ng-click="acknowledgeProblems()">Send</button>
|
||||
</div>
|
||||
<div>
|
||||
<label for="author">Author :</label>
|
||||
<input type="text" id="acknowledge-author" ng-model="attrs.author">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sticky">Sticky :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-sticky"
|
||||
ng-model="attrs.sticky"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div>
|
||||
<div>
|
||||
<label for="notify">Notify :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-notify"
|
||||
ng-model="attrs.notify"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div >
|
||||
<div>
|
||||
<label for="persistent">Persistent :</label>
|
||||
<input type="checkbox"
|
||||
id="acknowledge-persistent"
|
||||
ng-model="attrs.persistent"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
</div>
|
||||
<div>
|
||||
<label for="comment">Comment :</label>
|
||||
<input type="message-text" id="acknowledge-comment" ng-model="attrs.comment">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" ng-click="isShown = !isShown">Close</button>
|
||||
<button type="button" ng-click="acknowledgeProblems()">Send</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -2,134 +2,134 @@
|
||||
|
||||
angular.module('bansho.table.actionbar')
|
||||
|
||||
.directive('banshoAcknowledgeForm', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/acknowledge_form.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoAcknowledgeFormCtrl'
|
||||
};
|
||||
})
|
||||
.directive('banshoAcknowledgeForm', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/acknowledge_form.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoAcknowledgeFormCtrl'
|
||||
};
|
||||
})
|
||||
|
||||
.controller('banshoAcknowledgeFormCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
.controller('banshoAcknowledgeFormCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
|
||||
$scope.acknowledgeProblems = function () {
|
||||
angular.forEach(tablesConfig, function (tableConfig) {
|
||||
var entries = $filter('filter')(tableConfig.entries,
|
||||
actionbarFilters.searchFilter);
|
||||
$scope.acknowledgeProblems = function () {
|
||||
angular.forEach(tablesConfig, function (tableConfig) {
|
||||
var entries = $filter('filter')(tableConfig.entries,
|
||||
actionbarFilters.searchFilter);
|
||||
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
|
||||
backendClient.acknowledge(entry.host_name, service_description, $scope.attrs).error(function (data) {
|
||||
throw new Error('Acknowledge request failed');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}])
|
||||
backendClient.acknowledge(entry.host_name, service_description, $scope.attrs).error(function (data) {
|
||||
throw new Error('Acknowledge request failed');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('banshoDowntimeForm', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/downtime_form.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoDowntimeFormCtrl'
|
||||
};
|
||||
})
|
||||
.directive('banshoDowntimeForm', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/downtime_form.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoDowntimeFormCtrl'
|
||||
};
|
||||
})
|
||||
|
||||
.controller('banshoDowntimeFormCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
.controller('banshoDowntimeFormCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
|
||||
$scope.messages = [];
|
||||
$scope.messages = [];
|
||||
|
||||
$scope.sendDowntime = function () {
|
||||
angular.forEach(tablesConfig, function (table) {
|
||||
var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter);
|
||||
$scope.sendDowntime = function () {
|
||||
angular.forEach(tablesConfig, function (table) {
|
||||
var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter);
|
||||
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
|
||||
backendClient.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " success ",
|
||||
type: "success"
|
||||
});
|
||||
$scope.isShown = false;
|
||||
},
|
||||
function (error) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " error",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}])
|
||||
backendClient.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " success ",
|
||||
type: "success"
|
||||
});
|
||||
$scope.isShown = false;
|
||||
},
|
||||
function (error) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " error",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('banshoRecheckButton', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/recheck_button.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoRecheckButtonCtrl'
|
||||
};
|
||||
})
|
||||
.directive('banshoRecheckButton', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'components/table/actionbar/actions/recheck_button.html',
|
||||
scope: {
|
||||
isShown: '='
|
||||
},
|
||||
controller: 'banshoRecheckButtonCtrl'
|
||||
};
|
||||
})
|
||||
|
||||
.controller('banshoRecheckButtonCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
.controller('banshoRecheckButtonCtrl',
|
||||
['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient',
|
||||
function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) {
|
||||
|
||||
$scope.messages = [];
|
||||
$scope.messages = [];
|
||||
|
||||
$scope.sendRecheck = function () {
|
||||
angular.forEach(tablesConfig, function (table) {
|
||||
var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter);
|
||||
$scope.sendRecheck = function () {
|
||||
angular.forEach(tablesConfig, function (table) {
|
||||
var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter);
|
||||
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
angular.forEach(entries, function (entry) {
|
||||
var service_description;
|
||||
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
if (entry.is_checked) {
|
||||
if ('description' in entry) {
|
||||
service_description = entry.description;
|
||||
}
|
||||
|
||||
backendClient.recheck(entry.host_name, service_description).then(function (data) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " success ",
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
function (error) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " error",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
backendClient.recheck(entry.host_name, service_description).then(function (data) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " success ",
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
function (error) {
|
||||
$scope.messages.push({
|
||||
text: entry.host_name + " error",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
@ -1,28 +1,28 @@
|
||||
<div ng-repeat="message in messages">{{message.text}} + {{message.type}}</div>
|
||||
<h4>Downtime</h4>
|
||||
<form ng-submit="sendDowntime()">
|
||||
<div>
|
||||
<label for="author">Author :</label>
|
||||
<input type="text" id="author" ng-model="attrs.author">
|
||||
</div>
|
||||
<div>
|
||||
<label for="comment">Comment :</label>
|
||||
<input type="message-text" id="comment" ng-model="attrs.comment">
|
||||
</div>
|
||||
<div>
|
||||
<label for="duration">Duration :</label>
|
||||
<input type="number" id="duration" ng-model="attrs.duration">
|
||||
</div>
|
||||
<div>
|
||||
<label for="start_time">Start time :</label>
|
||||
<input type="number" id="start_time" ng-model="attrs.start_time">
|
||||
</div>
|
||||
<div>
|
||||
<label for="end_time">End time :</label>
|
||||
<input type="number" id="end_time" ng-model="attrs.end_time">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" ng-click="isShown = !isShown">Close</button>
|
||||
<button type="submit">Send</button>
|
||||
</div>
|
||||
<div>
|
||||
<label for="author">Author :</label>
|
||||
<input type="text" id="author" ng-model="attrs.author">
|
||||
</div>
|
||||
<div>
|
||||
<label for="comment">Comment :</label>
|
||||
<input type="message-text" id="comment" ng-model="attrs.comment">
|
||||
</div>
|
||||
<div>
|
||||
<label for="duration">Duration :</label>
|
||||
<input type="number" id="duration" ng-model="attrs.duration">
|
||||
</div>
|
||||
<div>
|
||||
<label for="start_time">Start time :</label>
|
||||
<input type="number" id="start_time" ng-model="attrs.start_time">
|
||||
</div>
|
||||
<div>
|
||||
<label for="end_time">End time :</label>
|
||||
<input type="number" id="end_time" ng-model="attrs.end_time">
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" ng-click="isShown = !isShown">Close</button>
|
||||
<button type="submit">Send</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<button class="filters__button" type="button" ng-click="sendRecheck()">
|
||||
<span class="visuallyhidden">Recheck</span>
|
||||
<span class="visuallyhidden">Recheck</span>
|
||||
<i class="ico-arrows-cw"></i>
|
||||
</button>
|
||||
|
@ -131,16 +131,7 @@
|
||||
<li class="topbar__settings__subitem"><a href="#">Missing Plugins</a></li>
|
||||
<li class="topbar__settings__subitem"><a href="#">Object History</a></li>
|
||||
<li class="topbar__settings__subitem"><a href="#">Configure</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="topbar__settings__item">
|
||||
<span class="topbar__settings__category">Nagios</span>
|
||||
|
||||
<ul class="topbar__settings__sublist">
|
||||
<li class="topbar__settings__subitem"><a href="#">Settings</a></li>
|
||||
<li class="topbar__settings__subitem"><a href="#">Edit nagios.cfg</a></li>
|
||||
<li class="topbar__settings__subitem"><a href="#">Nagios Service</a></li>
|
||||
<li class="topbar__settings__subitem"><a href="#">Pnp intergration</a></li>
|
||||
<li class="topbar__settings__subitem" ng-click="logout()"><a>Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -2,27 +2,31 @@
|
||||
|
||||
angular.module('bansho.topbar', ['bansho.live'])
|
||||
|
||||
.controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager',
|
||||
function ($rootScope, $scope, $interval, backendClient, promisesManager) {
|
||||
.controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager', 'authService',
|
||||
function ($rootScope, $scope, $interval, backendClient, promisesManager, authService) {
|
||||
var getData,
|
||||
hostProblems,
|
||||
serviceProblems;
|
||||
|
||||
getData = function () {
|
||||
if ($rootScope.isAuthenticated) {
|
||||
backendClient.getServiceProblems().success(function (data) {
|
||||
serviceProblems = data.length;
|
||||
backendClient.getHostProblems().success(function (data) {
|
||||
hostProblems = data.length;
|
||||
$scope.allProblems = serviceProblems + hostProblems;
|
||||
});
|
||||
});
|
||||
}
|
||||
if ($rootScope.isAuthenticated) {
|
||||
backendClient.getServiceProblems().success(function (data) {
|
||||
serviceProblems = data.length;
|
||||
backendClient.getHostProblems().success(function (data) {
|
||||
hostProblems = data.length;
|
||||
$scope.allProblems = serviceProblems + hostProblems;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Change hardcoded interval when the topbar dashboard will be implemented
|
||||
promisesManager.addAjaxPromise($interval(getData, 10000));
|
||||
getData();
|
||||
getData();
|
||||
|
||||
$scope.logout = function () {
|
||||
authService.logout();
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('banshoTopbar', function () {
|
||||
|
@ -15,6 +15,7 @@
|
||||
<!-- build:js js/app.min.js -->
|
||||
<script src="bower_components/angular/angular.js"></script>
|
||||
<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
|
||||
<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
|
||||
<script src="bower_components/angular-route/angular-route.js"></script>
|
||||
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
||||
<script src="bower_components/moment/moment.js"></script>
|
||||
|
15
bower.json
15
bower.json
@ -5,15 +5,16 @@
|
||||
"license": "AGPLv3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"angular": "1.2.x",
|
||||
"angular-route": "1.2.x",
|
||||
"angular-loader": "1.2.x",
|
||||
"angular-mocks": "~1.2.x",
|
||||
"html5-boilerplate": "~4.3.0",
|
||||
"angular": "~1.3.15",
|
||||
"angular-route": "~1.3.15",
|
||||
"angular-loader": "~1.3.15",
|
||||
"angular-mocks": "~1.3.15",
|
||||
"html5-boilerplate": "~5.2.0",
|
||||
"bootstrap-sass-official": "3.3.1",
|
||||
"fontawesome": "4.2.0",
|
||||
"fontawesome": "~4.3.0",
|
||||
"justgage-toorshia": "master",
|
||||
"moment": "~2.9.0",
|
||||
"angular-filter": "~0.5.4"
|
||||
"angular-filter": "~0.5.4",
|
||||
"angular-cookies": "~1.3.15"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user