Add single cell and modify config
Change-Id: I7c1349248dc64c73efe6b7aefb46e82d29a4cce7
This commit is contained in:
parent
81484834dc
commit
68e3f89633
@ -333,7 +333,6 @@ time.data-table__data {
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(368 / 1200);
|
||||
}
|
||||
@ -352,10 +351,6 @@ time.data-table__data {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(500 / 1200);
|
||||
}
|
||||
|
||||
.data-table__service__summary {
|
||||
font-style:italic;
|
||||
margin-left:0;
|
||||
@ -373,3 +368,33 @@ time.data-table__data {
|
||||
color:$_color_light_delta;
|
||||
}
|
||||
}
|
||||
|
||||
.data-table__ {
|
||||
@include medium-and-up-screen {
|
||||
width:auto;
|
||||
}
|
||||
}
|
||||
|
||||
.data-table__xsmall {
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(100 / 1200);
|
||||
}
|
||||
}
|
||||
|
||||
.data-table__small {
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(200 / 1200);
|
||||
}
|
||||
}
|
||||
|
||||
.data-table__medium {
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(368 / 1200);
|
||||
}
|
||||
}
|
||||
|
||||
.data-table__large {
|
||||
@include medium-and-up-screen {
|
||||
width:percentage(500 / 1200);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"env": "production",
|
||||
"username":"",
|
||||
"password":"",
|
||||
"useStoredConfig": false,
|
||||
"useStoredConfig": true,
|
||||
"surveilApiUrl": "surveil/v2",
|
||||
"surveilAuthUrl": "surveil/v2/auth",
|
||||
"refreshInterval": -1
|
||||
|
@ -24,7 +24,7 @@
|
||||
{
|
||||
"type": "panel",
|
||||
"attributes": {
|
||||
"panelId": "openProblems"
|
||||
"panelId": "allProblems"
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
@ -94,7 +94,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0,
|
||||
1
|
||||
]
|
||||
@ -152,30 +152,56 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Address",
|
||||
"Duration",
|
||||
"Last check",
|
||||
"Host status"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_host_address",
|
||||
"status_duration",
|
||||
"status_last_check",
|
||||
"status_host_status"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "hostOpenProblems",
|
||||
"headerFollow": false,
|
||||
"isWrappable": false,
|
||||
"checkColumn": true,
|
||||
"noRepeatCell": "",
|
||||
"pagingbar": false
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "host_address",
|
||||
"title": "Address"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-host-status",
|
||||
"attributes": {
|
||||
"title": "Host status"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
@ -188,28 +214,49 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 1,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Service check",
|
||||
"Duration",
|
||||
"Last check"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_service_check",
|
||||
"status_duration",
|
||||
"status_last_check"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 1,
|
||||
"inputSource": "serviceOpenProblemsOnly",
|
||||
"headerFollow": false,
|
||||
"isWrappable": true,
|
||||
"checkColumn": true,
|
||||
"noRepeatCell": "host",
|
||||
"pagingbar": false
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-service-check",
|
||||
"attributes": {
|
||||
"title": "Service check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -223,7 +270,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
2,
|
||||
3
|
||||
]
|
||||
@ -281,30 +328,56 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 2,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Address",
|
||||
"Duration",
|
||||
"Lastcheck",
|
||||
"Hoststatus"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_host_address",
|
||||
"status_duration",
|
||||
"status_last_check",
|
||||
"status_host_status"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 2,
|
||||
"inputSource": "hostsProblems",
|
||||
"headerFollow": false,
|
||||
"isWrappable": false,
|
||||
"checkColumn": true,
|
||||
"noRepeatCell": "",
|
||||
"pagingbar": false
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "host_address",
|
||||
"title": "Address"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-host-status",
|
||||
"attributes": {
|
||||
"title": "Host status"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
@ -317,28 +390,49 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 3,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Service check",
|
||||
"Duration",
|
||||
"Last check"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_service_check",
|
||||
"status_duration",
|
||||
"status_last_check"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 3,
|
||||
"inputSource": "servicesProblems",
|
||||
"headerFollow": false,
|
||||
"isWrappable": true,
|
||||
"checkColumn": true,
|
||||
"noRepeatCell": "host",
|
||||
"pagingbar": false
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-service-check",
|
||||
"attributes": {
|
||||
"title": "Service check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -355,13 +449,13 @@
|
||||
{
|
||||
"type": "title",
|
||||
"attributes": {
|
||||
"title": "Hosts"
|
||||
"title": "Hosts status"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -410,30 +504,59 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Address",
|
||||
"Duration",
|
||||
"Last check",
|
||||
"Host status"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_host_address",
|
||||
"status_duration",
|
||||
"status_last_check",
|
||||
"status_host_status"
|
||||
]
|
||||
},
|
||||
"headerFollow": true,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "hosts",
|
||||
"headerFollow": true,
|
||||
"isWrappable": false,
|
||||
"noRepeatCell": "",
|
||||
"checkColumn": true,
|
||||
"pagingbar": true
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
},
|
||||
"class": "host"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "host_address",
|
||||
"title": "Address"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check",
|
||||
"class": "small"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-host-status",
|
||||
"attributes": {
|
||||
"title": "Host status",
|
||||
"class": "small"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -454,7 +577,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -503,28 +626,62 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Service check",
|
||||
"Duration",
|
||||
"Last check"
|
||||
],
|
||||
"name": [
|
||||
"status_host",
|
||||
"status_service_check",
|
||||
"status_duration",
|
||||
"status_last_check"
|
||||
]
|
||||
},
|
||||
"headerFollow": true,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "services",
|
||||
"headerFollow": true,
|
||||
"isWrappable": false,
|
||||
"checkColumn": true,
|
||||
"noRepeatCell": "host",
|
||||
"pagingbar": true
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-status-host",
|
||||
"attributes": {
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-service-check",
|
||||
"attributes": {
|
||||
"title": "Service check",
|
||||
"url": {
|
||||
"view": "service",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_host_name"
|
||||
},
|
||||
{
|
||||
"urlParam": "service_description",
|
||||
"entryKey": "service_service_description"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-duration",
|
||||
"attributes": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-status-last-check",
|
||||
"attributes": {
|
||||
"title": "Last check"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -545,7 +702,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -582,32 +739,64 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Event type",
|
||||
"Output",
|
||||
"Hostname",
|
||||
"Service",
|
||||
"Time",
|
||||
"Complete data"
|
||||
],
|
||||
"name": [
|
||||
"status_event_event_type",
|
||||
"status_event_output",
|
||||
"status_event_host_name",
|
||||
"status_event_service",
|
||||
"status_event_time",
|
||||
"status_event"
|
||||
]
|
||||
},
|
||||
"headerFollow": true,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "events",
|
||||
"headerFollow": true,
|
||||
"isWrappable": false,
|
||||
"checkColumn": false,
|
||||
"noRepeatCell": "",
|
||||
"pagingbar": true
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "event_event_type",
|
||||
"title": "Type"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "event_output",
|
||||
"title": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "event_host_name",
|
||||
"title": "Hostname"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "event_service_description",
|
||||
"title": "Service description"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "event_time",
|
||||
"title": "Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-other-fields",
|
||||
"attributes": {
|
||||
"title": "Other fields",
|
||||
"skipFields": [
|
||||
"event_time",
|
||||
"event_host_name",
|
||||
"event_output",
|
||||
"event_event_type",
|
||||
"event_service_description"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -727,13 +916,13 @@
|
||||
{
|
||||
"type": "title",
|
||||
"attributes": {
|
||||
"title": "ConfigHosts"
|
||||
"title": "Hosts configuration"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -770,29 +959,53 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"refreshInterval": 30,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Host",
|
||||
"Address",
|
||||
"Use",
|
||||
"Enable"
|
||||
],
|
||||
"name": [
|
||||
"config_host",
|
||||
"config_host_address",
|
||||
"config_host_use",
|
||||
"config_host_register"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "hostsConfig",
|
||||
"headerFollow": false,
|
||||
"isWrappable": false,
|
||||
"noRepeatCell": "",
|
||||
"checkColumn": false,
|
||||
"pagingbar": true
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "host_name",
|
||||
"title": "Hosts",
|
||||
"url": {
|
||||
"view": "host",
|
||||
"params": [
|
||||
{
|
||||
"urlParam": "host_name",
|
||||
"entryKey": "host_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "use",
|
||||
"title": "Use"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-config-host-register",
|
||||
"attributes": {
|
||||
"title": "Register",
|
||||
"class": "xsmall"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -813,7 +1026,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -850,24 +1063,40 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"cells": {
|
||||
"text": [
|
||||
"Template",
|
||||
"Use"
|
||||
],
|
||||
"name": [
|
||||
"config_host_name",
|
||||
"config_host_use"
|
||||
]
|
||||
},
|
||||
"headerFollow": false,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "hostsConfigTemplate",
|
||||
"headerFollow": false,
|
||||
"isWrappable": false,
|
||||
"noRepeatCell": "",
|
||||
"checkColumn": false,
|
||||
"pagingbar": true
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "name",
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "use",
|
||||
"title": "Use"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-other-fields",
|
||||
"attributes": {
|
||||
"title": "Other fields",
|
||||
"skipFields": [
|
||||
"use",
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -888,7 +1117,7 @@
|
||||
{
|
||||
"type": "actionbar",
|
||||
"attributes": {
|
||||
"tableId": [
|
||||
"datasourceId": [
|
||||
0
|
||||
]
|
||||
},
|
||||
@ -910,9 +1139,9 @@
|
||||
{
|
||||
"type": "table",
|
||||
"attributes": {
|
||||
"tableId": 0,
|
||||
"headerFollow": true,
|
||||
"datasourceId": 0,
|
||||
"inputSource": "commands",
|
||||
"headerFollow": true,
|
||||
"isWrappable": false,
|
||||
"noRepeatCell": "",
|
||||
"checkColumn": false,
|
||||
@ -925,7 +1154,30 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "command_name",
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "command_line",
|
||||
"title": "Line"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cell-single",
|
||||
"attributes": {
|
||||
"entryKey": "module_type",
|
||||
"title": "Module Type"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -953,6 +1205,5 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,33 +14,33 @@ angular.module('bansho.datasource', ['bansho.surveil'])
|
||||
filteredData = [],
|
||||
listeners = [];
|
||||
|
||||
function notifyDataChanged(tableId) {
|
||||
angular.forEach(listeners[tableId], function (callback) {
|
||||
callback(filteredData[tableId], config[tableId].isCheckAll);
|
||||
function notifyDataChanged(datasourceId) {
|
||||
angular.forEach(listeners[datasourceId], function (callback) {
|
||||
callback(filteredData[datasourceId], config[datasourceId].isCheckAll);
|
||||
});
|
||||
}
|
||||
|
||||
function filterData(tableId) {
|
||||
filteredData[tableId] = $filter('filter')(data[tableId], config[tableId].searchFilter);
|
||||
notifyDataChanged(tableId);
|
||||
function filterData(datasourceId) {
|
||||
filteredData[datasourceId] = $filter('filter')(data[datasourceId], config[datasourceId].searchFilter);
|
||||
notifyDataChanged(datasourceId);
|
||||
}
|
||||
|
||||
function refreshTableData(tableId) {
|
||||
var conf = config[tableId],
|
||||
function refreshTableData(datasourceId) {
|
||||
var conf = config[datasourceId],
|
||||
inputSource = componentsConfig.getInputSource(conf.inputSource),
|
||||
filter = componentsConfig.getFilter(inputSource.filter).filter,
|
||||
promise;
|
||||
|
||||
if (config[tableId].queryFilter) {
|
||||
filter = componentsConfig.mergeFilters([config[tableId].queryFilter, filter]);
|
||||
if (config[datasourceId].queryFilter) {
|
||||
filter = componentsConfig.mergeFilters([config[datasourceId].queryFilter, filter]);
|
||||
}
|
||||
|
||||
promise = providerServices[inputSource.provider].getData([], filter, inputSource.endpoint, conf.queryPaging);
|
||||
|
||||
promise.then(function (newData) {
|
||||
data[tableId] = newData;
|
||||
config[tableId].isCheckAll = false;
|
||||
filterData(tableId);
|
||||
data[datasourceId] = newData;
|
||||
config[datasourceId].isCheckAll = false;
|
||||
filterData(datasourceId);
|
||||
}, function (error) {
|
||||
throw new Error('getTableData : Query failed' + error);
|
||||
});
|
||||
@ -48,76 +48,76 @@ angular.module('bansho.datasource', ['bansho.surveil'])
|
||||
|
||||
return {
|
||||
refreshTableData: refreshTableData,
|
||||
addTable: function (tableId, conf) {
|
||||
config[tableId] = conf;
|
||||
config[tableId].requestFields = [];
|
||||
angular.forEach(config[tableId].cells.name, function (cell) {
|
||||
addTable: function (datasourceId, conf) {
|
||||
config[datasourceId] = conf;
|
||||
config[datasourceId].requestFields = [];
|
||||
angular.forEach(config[datasourceId].columns, function (cell) {
|
||||
angular.forEach(tableGlobalConfig.cellToFieldsMap[cell], function (_value) {
|
||||
config[tableId].requestFields.push(_value);
|
||||
config[datasourceId].requestFields.push(_value);
|
||||
});
|
||||
});
|
||||
|
||||
if (config[tableId].pagingbar) {
|
||||
config[tableId].queryPaging = {
|
||||
if (config[datasourceId].pagingbar) {
|
||||
config[datasourceId].queryPaging = {
|
||||
page: 0,
|
||||
size: configManager.getPagingSize()
|
||||
};
|
||||
}
|
||||
},
|
||||
getConfig: function (tableId) {
|
||||
return config[tableId];
|
||||
getConfig: function (datasourceId) {
|
||||
return config[datasourceId];
|
||||
},
|
||||
forEachCheckedEntry: function (tableId, callbackIsChecked) {
|
||||
angular.forEach(filteredData[tableId], function (entry) {
|
||||
forEachCheckedEntry: function (datasourceId, callbackIsChecked) {
|
||||
angular.forEach(filteredData[datasourceId], function (entry) {
|
||||
if (entry.is_checked) {
|
||||
callbackIsChecked(entry);
|
||||
}
|
||||
});
|
||||
|
||||
notifyDataChanged(tableId);
|
||||
notifyDataChanged(datasourceId);
|
||||
},
|
||||
registerDataChanged: function (tableId, callback) {
|
||||
if (!listeners[tableId]) {
|
||||
listeners[tableId] = [];
|
||||
registerDataChanged: function (datasourceId, callback) {
|
||||
if (!listeners[datasourceId]) {
|
||||
listeners[datasourceId] = [];
|
||||
}
|
||||
|
||||
listeners[tableId].push(callback);
|
||||
listeners[datasourceId].push(callback);
|
||||
},
|
||||
setAllCheckTable: function (tableId, isChecked) {
|
||||
config[tableId].isCheckAll = isChecked;
|
||||
angular.forEach(filteredData[tableId], function (entry) {
|
||||
setAllCheckTable: function (datasourceId, isChecked) {
|
||||
config[datasourceId].isCheckAll = isChecked;
|
||||
angular.forEach(filteredData[datasourceId], function (entry) {
|
||||
entry.is_checked = isChecked;
|
||||
});
|
||||
|
||||
notifyDataChanged(tableId, isChecked);
|
||||
notifyDataChanged(datasourceId, isChecked);
|
||||
},
|
||||
setSearchFilter: function (tableId, searchFilter) {
|
||||
config[tableId].searchFilter = searchFilter;
|
||||
filterData(tableId);
|
||||
setSearchFilter: function (datasourceId, searchFilter) {
|
||||
config[datasourceId].searchFilter = searchFilter;
|
||||
filterData(datasourceId);
|
||||
},
|
||||
setQueryFilter: function (tableId, queryFilter) {
|
||||
config[tableId].queryFilter = queryFilter;
|
||||
refreshTableData(tableId);
|
||||
setQueryFilter: function (datasourceId, queryFilter) {
|
||||
config[datasourceId].queryFilter = queryFilter;
|
||||
refreshTableData(datasourceId);
|
||||
},
|
||||
nextPage: function (tableId) {
|
||||
config[tableId].queryPaging.page += 1;
|
||||
refreshTableData(tableId);
|
||||
nextPage: function (datasourceId) {
|
||||
config[datasourceId].queryPaging.page += 1;
|
||||
refreshTableData(datasourceId);
|
||||
},
|
||||
previousPage: function (tableId) {
|
||||
if (config[tableId].queryPaging.page > 0) {
|
||||
config[tableId].queryPaging.page -= 1;
|
||||
refreshTableData(tableId);
|
||||
previousPage: function (datasourceId) {
|
||||
if (config[datasourceId].queryPaging.page > 0) {
|
||||
config[datasourceId].queryPaging.page -= 1;
|
||||
refreshTableData(datasourceId);
|
||||
}
|
||||
},
|
||||
getPage: function (tableId) {
|
||||
return config[tableId].queryPaging.page;
|
||||
getPage: function (datasourceId) {
|
||||
return config[datasourceId].queryPaging.page;
|
||||
},
|
||||
setPageSize: function (tableId, pageSize) {
|
||||
config[tableId].queryPaging.size = pageSize;
|
||||
refreshTableData(tableId);
|
||||
setPageSize: function (datasourceId, pageSize) {
|
||||
config[datasourceId].queryPaging.size = pageSize;
|
||||
refreshTableData(datasourceId);
|
||||
},
|
||||
getPageSize: function (tableId) {
|
||||
return config[tableId].queryPaging.size;
|
||||
getPageSize: function (datasourceId) {
|
||||
return config[datasourceId].queryPaging.size;
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
@ -9,11 +9,11 @@ angular.module('bansho.actionbar', ['bansho.datasource', 'bansho.surveil', 'bans
|
||||
},
|
||||
templateUrl: 'components/directive/actionbar/actionbar.html',
|
||||
link: function (scope, element) {
|
||||
scope.tableId = scope.options.attributes.tableId;
|
||||
scope.datasourceId = scope.options.attributes.datasourceId;
|
||||
scope.components = scope.options.components;
|
||||
|
||||
angular.forEach(scope.components, function (component) {
|
||||
component.attributes.tableId = scope.tableId;
|
||||
component.attributes.datasourceId = scope.datasourceId;
|
||||
});
|
||||
|
||||
$compile(element.contents())(scope);
|
||||
|
@ -16,8 +16,8 @@ angular.module('bansho.actionbar')
|
||||
};
|
||||
|
||||
$scope.acknowledgeProblems = function () {
|
||||
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||
angular.forEach($scope.options.attributes.datasourceId, function (datasourceId) {
|
||||
datasource.forEachCheckedEntry(datasourceId, function (entry) {
|
||||
surveilActions.acknowledge(entry.host_host_name, entry.service_service_description, $scope.attrs).then(function (data) {
|
||||
notifications.push('success', 'Acknowledgement', 'Acknowledged ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||
},
|
||||
@ -26,7 +26,7 @@ angular.module('bansho.actionbar')
|
||||
});
|
||||
});
|
||||
|
||||
datasource.setAllCheckTable(tableId, false);
|
||||
datasource.setAllCheckTable(datasourceId, false);
|
||||
});
|
||||
|
||||
$scope.isAcknowledgeFormShown = false;
|
||||
|
@ -10,7 +10,7 @@ angular.module('bansho.actionbar')
|
||||
},
|
||||
controller: ['$scope', 'datasource', 'surveilActions', 'notifications',
|
||||
function ($scope, datasource, surveilActions, notifications) {
|
||||
$scope.tableId = $scope.options.attributes.tableId;
|
||||
$scope.datasourceId = $scope.options.attributes.datasourceId;
|
||||
|
||||
$scope.isDowntimeFormShown = false;
|
||||
$scope.switchDowntimeFormShown = function () {
|
||||
@ -18,8 +18,8 @@ angular.module('bansho.actionbar')
|
||||
};
|
||||
|
||||
$scope.sendDowntime = function () {
|
||||
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||
angular.forEach($scope.options.attributes.datasourceId, function (datasourceId) {
|
||||
datasource.forEachCheckedEntry(datasourceId, function (entry) {
|
||||
surveilActions.downtime(entry.host_host_name, entry.service_service_description, $scope.attrs).then(function (data) {
|
||||
notifications.push('success', 'Downtime', 'Added downtime for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||
},
|
||||
@ -28,7 +28,7 @@ angular.module('bansho.actionbar')
|
||||
});
|
||||
});
|
||||
|
||||
datasource.setAllCheckTable(tableId, false);
|
||||
datasource.setAllCheckTable(datasourceId, false);
|
||||
});
|
||||
|
||||
$scope.isDowntimeFormShown = false;
|
||||
|
@ -9,7 +9,7 @@ angular.module('bansho.actionbar')
|
||||
},
|
||||
templateUrl: 'components/directive/actionbar/component_filter/filter.html',
|
||||
controller: ['$scope', 'datasource', function ($scope, datasource) {
|
||||
$scope.tableId = $scope.options.attributes.tableId;
|
||||
$scope.datasourceId = $scope.options.attributes.datasourceId;
|
||||
|
||||
$scope.filters = [];
|
||||
angular.forEach($scope.options.attributes.filters, function (filter) {
|
||||
@ -39,8 +39,8 @@ angular.module('bansho.actionbar')
|
||||
$scope.activateFilter = function (item) {
|
||||
$scope.activeFilter = $scope.filters[item];
|
||||
|
||||
angular.forEach($scope.tableId, function (tableId) {
|
||||
datasource.setQueryFilter(tableId, $scope.activeFilter.filter);
|
||||
angular.forEach($scope.datasourceId, function (datasourceId) {
|
||||
datasource.setQueryFilter(datasourceId, $scope.activeFilter.filter);
|
||||
});
|
||||
$scope.isShown = false;
|
||||
};
|
||||
|
@ -11,8 +11,8 @@ angular.module('bansho.actionbar')
|
||||
controller: ['$scope', 'datasource', 'surveilActions', 'notifications',
|
||||
function ($scope, datasource, surveilActions, notifications) {
|
||||
$scope.sendRecheck = function () {
|
||||
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||
angular.forEach($scope.options.attributes.datasourceId, function (datasourceId) {
|
||||
datasource.forEachCheckedEntry(datasourceId, function (entry) {
|
||||
surveilActions.recheck(entry.host_host_name, entry.service_service_description).then(function (data) {
|
||||
notifications.push('success', 'Recheck', 'Scheduled recheck for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||
},
|
||||
@ -21,7 +21,7 @@ angular.module('bansho.actionbar')
|
||||
});
|
||||
});
|
||||
|
||||
datasource.setAllCheckTable(tableId, false);
|
||||
datasource.setAllCheckTable(datasourceId, false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ angular.module('bansho.actionbar')
|
||||
templateUrl: 'components/directive/actionbar/component_search_filter/search_filter.html',
|
||||
controller: ['$scope', 'datasource', function ($scope, datasource) {
|
||||
$scope.searchFilterChange = function () {
|
||||
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||
datasource.setSearchFilter(tableId, $scope.searchFilter);
|
||||
angular.forEach($scope.options.attributes.datasourceId, function (datasourceId) {
|
||||
datasource.setSearchFilter(datasourceId, $scope.searchFilter);
|
||||
});
|
||||
};
|
||||
}]
|
||||
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__host {{entry[cell_name + '_additionnalClass']}}" ng-controller="CellConfigHostCtrl">
|
||||
<a class="data-table__data" href="#/view?view=host&host_name={{entry.host_name}}">{{entry.host_name}}</a>
|
||||
</td>
|
@ -1,12 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_config_host', ['bansho.table'])
|
||||
|
||||
.controller('CellConfigHostCtrl', ['$scope', function ($scope) {
|
||||
$scope.cell_name = 'host';
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.config_host = ['host_name'];
|
||||
tableGlobalConfig.cellWrappableField.config_host = 'host_name';
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__hostaddress">
|
||||
<span class="data-table__data">{{entry.address}}</span>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_config_host_address', ['bansho.table'])
|
||||
|
||||
.controller('CellConfigHostAddressCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.config_host_address = ['address'];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__hostname">
|
||||
<span class="data-table__data">{{entry.name}}</span>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_config_host_name', ['bansho.table'])
|
||||
|
||||
.controller('CellConfigHostNameCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.config_host_use = ['name'];
|
||||
}]);
|
@ -1,3 +1,3 @@
|
||||
<td class="data-table__hostregister" data-ng-controller="CellConfigHostRegisterCtrl">
|
||||
<span class="data-table__data fa {{activityClass}}"></span>
|
||||
</td>
|
||||
<span data-ng-controller="CellConfigHostRegisterCtrl">
|
||||
<i class="data-table__data fa {{activityClass}}" />
|
||||
</span>
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_config_host_register', ['bansho.table'])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellConfigHostRegisterCtrl', ['$scope', function ($scope) {
|
||||
if ($scope.register === 0) {
|
||||
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__hostuse">
|
||||
<span class="data-table__data">{{entry.use}}</span>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_config_host_use', ['bansho.table'])
|
||||
|
||||
.controller('CellConfigHostUseCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.config_host_use = ['use'];
|
||||
}]);
|
@ -1,4 +1,4 @@
|
||||
<td data-ng-click="toggleExpansion()" class="data-table__event" data-ng-controller="CellStatusEventCtrl">
|
||||
<span data-ng-click="toggleExpansion()" data-ng-controller="CellOtherFieldsCtrl">
|
||||
<p class="data-table__data">
|
||||
<i data-ng-class="{'ico-down-dir': isExpanded, 'ico-right-dir': !isExpanded}"></i>
|
||||
<span data-ng-repeat="(k, e) in filter(entry)">
|
||||
@ -6,4 +6,4 @@
|
||||
<span data-ng-show="isExpanded"><br></span>
|
||||
</span>
|
||||
</p>
|
||||
</td>
|
||||
</span>
|
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellOtherFieldsCtrl', ['$scope', function ($scope) {
|
||||
$scope.attributes = JSON.parse($scope.attributes);
|
||||
|
||||
$scope.isExpanded = false;
|
||||
$scope.toggleExpansion = function () {
|
||||
$scope.isExpanded = !$scope.isExpanded;
|
||||
};
|
||||
|
||||
$scope.skipFields = {
|
||||
"undefined_additionnalClass": true
|
||||
};
|
||||
angular.forEach($scope.attributes.skipFields, function (value) {
|
||||
$scope.skipFields[value] = true;
|
||||
});
|
||||
|
||||
$scope.filter = function (entry) {
|
||||
var result = {};
|
||||
angular.forEach(entry, function(value, key) {
|
||||
if (!$scope.skipFields[key]) {
|
||||
result[key] = entry[key];
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}]);
|
@ -0,0 +1,3 @@
|
||||
<span data-ng-controller="CellSingleCtrl" class="data-table__data">
|
||||
{{entry[attributes.entryKey]}}
|
||||
</span>
|
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table')
|
||||
.controller('CellSingleCtrl', ['$scope', function ($scope) {
|
||||
$scope.attributes = JSON.parse($scope.attributes);
|
||||
}]);
|
@ -1,3 +1 @@
|
||||
<td class="data-table__duration">
|
||||
<time class="data-table__data">{{entry.service_last_state_change | timeElapsed}}</time>
|
||||
</td>
|
||||
<time class="data-table__data">{{entry.service_last_state_change | timeElapsed}}</time>
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_duration', ['bansho.table'])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellStatusDurationCtrl', [function () {
|
||||
angular.noop();
|
||||
|
@ -1,40 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventCtrl', ['$scope', function ($scope) {
|
||||
$scope.isExpanded = false;
|
||||
$scope.toggleExpansion = function () {
|
||||
$scope.isExpanded = !$scope.isExpanded;
|
||||
};
|
||||
|
||||
var shownOutput = {
|
||||
'event_attempts': true,
|
||||
'event_contact': true,
|
||||
'event_notification_method': true,
|
||||
'event_notification_type': true,
|
||||
'event_state': true,
|
||||
'event_state_type': true
|
||||
};
|
||||
|
||||
$scope.filter = function (entry) {
|
||||
var result = {};
|
||||
angular.forEach(entry, function(value, key) {
|
||||
if (shownOutput[key]) {
|
||||
result[key.substring(6)] = value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.status_output = [
|
||||
'attempts',
|
||||
'contact',
|
||||
'notification_method',
|
||||
'notification_type',
|
||||
'state',
|
||||
'state_type'
|
||||
];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__event_type">
|
||||
<p class="data-table__data">{{entry.event_event_type}}</p>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event_event_type', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventEventTypeCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.event_type = ['event_type'];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__event_host_name">
|
||||
<p class="data-table__data">{{entry.event_host_name}}</p>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event_host_name', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventTypeCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.host_name = ['host_name'];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__event_output">
|
||||
<p class="data-table__data">{{entry.event_output}}</p>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event_output', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventOutputCtrl', ['$scope', function ($scope) {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.status_output = ['output'];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__event_service_description">
|
||||
<p class="data-table__data">{{entry.event_service_description}}</p>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event_service', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventServiceCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.service_description = ['service_description'];
|
||||
}]);
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__time">
|
||||
<time class="data-table__data">{{entry.event_time}}</time>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_event_time', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusEventTime', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.status_time = ['time'];
|
||||
}]);
|
@ -1,3 +1,3 @@
|
||||
<td class="data-table__host {{entry[cell_name + '_additionnalClass']}} {{state}}" ng-controller="CellStatusHostCtrl">
|
||||
<a class="data-table__data" href="#/view?view=host&host_name={{entry.host_host_name}}">{{entry.host_host_name}}</a>
|
||||
</td>
|
||||
<span class="{{state}}" data-ng-controller="CellStatusHostCtrl">
|
||||
<a class="data-table__data">{{entry.host_host_name}}</a>
|
||||
</span>
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_host', ['bansho.table'])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellStatusHostCtrl', ['$scope', function ($scope) {
|
||||
$scope.cell_name = 'host';
|
||||
|
@ -1,3 +0,0 @@
|
||||
<td class="data-table__hostaddress" ng-controller="CellStatusHostAddressCtrl">
|
||||
<span class="data-table__data">{{entry.host_address}}</span>
|
||||
</td>
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_host_address', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusHostAddressCtrl', [function () {
|
||||
angular.noop();
|
||||
}])
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.status_host_address = ['address'];
|
||||
}]);
|
@ -1,3 +1 @@
|
||||
<td ng-controller="CellStatusHostStatusCtrl">
|
||||
<span class="data-table__data {{entry.host_state}}">{{entry.host_state}}</span>
|
||||
</td>
|
||||
<span class="data-table__data {{entry.host_state}}">{{entry.host_state}}</span>
|
||||
|
@ -1,10 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_host_status', ['bansho.table'])
|
||||
|
||||
.controller('CellStatusHostStatusCtrl', ['$scope', function ($scope) {
|
||||
angular.noop();
|
||||
}])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||
tableGlobalConfig.cellToFieldsMap.status_host_status = ['state', 'last_check', 'parents'];
|
||||
|
@ -1,3 +1 @@
|
||||
<td class="data-table__lastcheck">
|
||||
<time class="data-table__data">{{entry.host_last_check * 1000 | date: "medium"}}</time>
|
||||
</td>
|
||||
<time class="data-table__data">{{entry.host_last_check * 1000 | date: "medium"}}</time>
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_last_check', ['bansho.table'])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellStatusLastCheckCtrl', [function () {
|
||||
angular.noop();
|
||||
|
@ -1,8 +1,8 @@
|
||||
<td class="data-table__service {{state}}" ng-controller="CellStatusServiceCheckCtrl">
|
||||
<span class="data-table__service {{state}}" ng-controller="CellStatusServiceCheckCtrl">
|
||||
<dl class="data-table__data">
|
||||
<dt class="data-table__service__name">
|
||||
<a href="#/view?view=service&host_name={{entry.host_host_name}}&service_description={{entry.service_service_description}}">{{entry.service_service_description}}</a>
|
||||
<span>{{entry.service_service_description}}</span>
|
||||
</dt>
|
||||
<dd class="data-table__service__summary">{{entry.service_plugin_output}}</dd>
|
||||
</dl>
|
||||
</td>
|
||||
</span>
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('bansho.table.cell_status_service_check', ['bansho.table'])
|
||||
angular.module('bansho.table')
|
||||
|
||||
.controller('CellStatusServiceCheckCtrl', ['$scope', function ($scope) {
|
||||
if ($scope.entry.service_state === 'OK') {
|
||||
|
@ -10,20 +10,20 @@ angular.module('bansho.table.pagingbar', ['bansho.datasource', 'bansho.surveil',
|
||||
templateUrl: 'components/directive/table/pagingbar/pagingbar.html',
|
||||
controller: ['$scope', 'datasource',
|
||||
function ($scope, datasource) {
|
||||
$scope.tableId = $scope.options.attributes.tableId;
|
||||
$scope.datasourceId = $scope.options.attributes.datasourceId;
|
||||
$scope.pageSizes = [5, 25, 50, 75, 100];
|
||||
|
||||
$scope.page = datasource.getPage($scope.tableId);
|
||||
$scope.size = datasource.getPageSize($scope.tableId);
|
||||
$scope.page = datasource.getPage($scope.datasourceId);
|
||||
$scope.size = datasource.getPageSize($scope.datasourceId);
|
||||
|
||||
$scope.previousPage = function () {
|
||||
datasource.previousPage($scope.tableId);
|
||||
$scope.page = datasource.getPage($scope.tableId);
|
||||
datasource.previousPage($scope.datasourceId);
|
||||
$scope.page = datasource.getPage($scope.datasourceId);
|
||||
};
|
||||
|
||||
$scope.nextPage = function () {
|
||||
datasource.nextPage($scope.tableId);
|
||||
$scope.page = datasource.getPage($scope.tableId);
|
||||
datasource.nextPage($scope.datasourceId);
|
||||
$scope.page = datasource.getPage($scope.datasourceId);
|
||||
};
|
||||
|
||||
$scope.setPageSize = function (pageSize) {
|
||||
@ -32,7 +32,7 @@ angular.module('bansho.table.pagingbar', ['bansho.datasource', 'bansho.surveil',
|
||||
|
||||
$scope.$watch('size', function (newValue) {
|
||||
if (newValue !== "") {
|
||||
datasource.setPageSize($scope.tableId, newValue);
|
||||
datasource.setPageSize($scope.datasourceId, newValue);
|
||||
}
|
||||
});
|
||||
}]
|
||||
|
@ -1,70 +1,26 @@
|
||||
<div>
|
||||
<table class="data-table">
|
||||
<thead class="moving-thead">
|
||||
<tr>
|
||||
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
|
||||
</th>
|
||||
<span data-ng-hide="allCells">
|
||||
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
|
||||
{{cellsText[i]}}
|
||||
<i class="ico-up-dir"></i>
|
||||
</th>
|
||||
</span>
|
||||
<span data-ng-show="allCells">
|
||||
<th ng-repeat="(key, value) in columns" class="data-table__host">
|
||||
{{key}}
|
||||
<i class="ico-up-dir"></i>
|
||||
</th>
|
||||
</span>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<thead class="static-thead">
|
||||
<tr>
|
||||
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
|
||||
</th>
|
||||
<span data-ng-hide="allCells">
|
||||
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
|
||||
{{cellsText[i]}}
|
||||
<i class="ico-up-dir"></i>
|
||||
</th>
|
||||
</span>
|
||||
<span data-ng-show="allCells">
|
||||
<th ng-repeat="(key, value) in columns" class="data-table__host">
|
||||
{{key}}
|
||||
<i class="ico-up-dir"></i>
|
||||
</th>
|
||||
</span>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody data-ng-if="!allCells" class="{{entry.child_class}}"
|
||||
ng-repeat="(groupByKey, groupByItems) in entries | groupBy:'host_name'">
|
||||
<tr ng-repeat="entry in groupByItems | noRepeat:this | wrappableStyle:this">
|
||||
<td data-ng-show="checkColumn">
|
||||
<md-checkbox aria-label='Check' ng-model="entry.is_checked"></md-checkbox>
|
||||
</td>
|
||||
<td bansho-cell cell-name="{{cell}}" ng-repeat="cell in cellsName"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody data-ng-if="allCells" class="{{entry.child_class}}">
|
||||
<tr ng-repeat="(key, entry) in entries">
|
||||
<td data-ng-show="checkColumn">
|
||||
<md-checkbox aria-label='Check' ng-model="entry.is_checked"></md-checkbox>
|
||||
</td>
|
||||
<td ng-repeat="(key, value) in columns">
|
||||
<a data-ng-show="cellUrls[key]"
|
||||
ng-click="createUrl(entry, cellUrls[key])">
|
||||
{{entry[key]}}
|
||||
</a>
|
||||
<span data-ng-hide="cellUrls[key]">
|
||||
{{entry[key]}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<bansho-pagingbar data-ng-if="pagingbar" options="options"></bansho-pagingbar>
|
||||
<table class="data-table">
|
||||
<thead data-ng-repeat="head in ['moving-thead', 'static-thead']" data-ng-class="head">
|
||||
<tr>
|
||||
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||
<md-checkbox aria-label='Check all' data-ng-model="isCheckAll" data-ng-change="onCheckChange()"></md-checkbox>
|
||||
</th>
|
||||
<th ng-repeat="column in columns" class="data-table__{{column.attributes.class}}">
|
||||
{{column.title}} <i class="ico-up-dir"></i>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-ng-repeat="(groupByKey, groupByItems) in entries | groupBy:'host_host_name'">
|
||||
<tr data-ng-repeat="entry in groupByItems | noRepeat:this | wrappableStyle:this">
|
||||
<td data-ng-show="checkColumn">
|
||||
<md-checkbox aria-label='Check' data-ng-model="entry.is_checked"></md-checkbox>
|
||||
</td>
|
||||
<td data-ng-repeat="cell in columns"
|
||||
data-ng-click="createUrl(entry, cell.attributes)">
|
||||
<bansho-cell type="{{cell.type}}" attributes="{{cell.attributes}}"></bansho-cell>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<bansho-pagingbar data-ng-if="pagingbar" options="options"></bansho-pagingbar>
|
||||
</div>
|
||||
|
@ -3,125 +3,112 @@
|
||||
angular.module('bansho.table', ['bansho.datasource',
|
||||
'bansho.actionbar',
|
||||
'bansho.filters',
|
||||
'bansho.table.cell_status_host',
|
||||
'bansho.table.cell_status_event',
|
||||
'bansho.table.cell_status_service_check',
|
||||
'bansho.table.cell_status_last_check',
|
||||
'bansho.table.cell_status_host_address',
|
||||
'bansho.table.cell_status_host_status',
|
||||
'bansho.table.cell_config_host',
|
||||
'bansho.table.cell_config_host_register',
|
||||
'bansho.table.pagingbar',
|
||||
'ngMaterial'
|
||||
])
|
||||
|
||||
.directive('banshoTable', ['datasource',
|
||||
function (datasource) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
options: '='
|
||||
},
|
||||
templateUrl: 'components/directive/table/table.html',
|
||||
controller: ['$scope', '$window', 'headerFollow', 'datasource', 'templateManager',
|
||||
function ($scope, $window, headerFollow, datasource, templateManager) {
|
||||
var conf = {},
|
||||
i;
|
||||
|
||||
$scope.tableId = $scope.options.attributes.tableId;
|
||||
|
||||
// Create table configuration
|
||||
conf.title = $scope.options.attributes.title;
|
||||
|
||||
conf.cells = {'text': [], 'name': []};
|
||||
if ($scope.options.attributes.cells) {
|
||||
$scope.allCells = false;
|
||||
conf.cells.text = $scope.options.attributes.cells.text;
|
||||
conf.cells.name = $scope.options.attributes.cells.name;
|
||||
} else {
|
||||
$scope.allCells = true;
|
||||
}
|
||||
|
||||
$scope.cellUrls = $scope.options.attributes.cellUrls;
|
||||
$scope.createUrl = function (entry, urlParam) {
|
||||
var url = "/#/view?view=" + urlParam.view;
|
||||
angular.forEach(urlParam.params, function (paramName) {
|
||||
url += '&' + paramName + '=' + entry[paramName];
|
||||
});
|
||||
$window.location = url;
|
||||
};
|
||||
|
||||
conf.inputSource = $scope.options.attributes.inputSource;
|
||||
conf.isWrappable = $scope.options.attributes.isWrappable;
|
||||
conf.pagingbar = $scope.options.attributes.pagingbar;
|
||||
conf.noRepeatCell = $scope.options.attributes.noRepeatCell;
|
||||
|
||||
datasource.addTable($scope.tableId, conf);
|
||||
|
||||
// Handle table layout
|
||||
$scope.checkColumn = $scope.options.attributes.checkColumn;
|
||||
$scope.pagingbar = conf.pagingbar;
|
||||
|
||||
|
||||
if ($scope.options.attributes.headerFollow) {
|
||||
headerFollow.activate();
|
||||
} else {
|
||||
headerFollow.deactivate();
|
||||
}
|
||||
|
||||
$scope.cellsName = conf.cells.name;
|
||||
$scope.cellsText = conf.cells.text;
|
||||
$scope.cellIndexes = [];
|
||||
for (i = 0; i < $scope.cellsName.length; i += 1) {
|
||||
$scope.cellIndexes.push(i);
|
||||
}
|
||||
|
||||
$scope.onCheckChange = function () {
|
||||
datasource.setAllCheckTable($scope.tableId, $scope.isCheckAll);
|
||||
};
|
||||
|
||||
datasource.registerDataChanged($scope.tableId, function (data, isCheckAll) {
|
||||
$scope.isCheckAll = isCheckAll;
|
||||
$scope.entries = data;
|
||||
if ($scope.allCells) {
|
||||
$scope.columns = {};
|
||||
angular.forEach($scope.entries, function (entry) {
|
||||
angular.forEach(entry, function (value, key) {
|
||||
$scope.columns[key] = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
datasource.refreshTableData($scope.tableId);
|
||||
templateManager.addInterval(function refreshTable () {
|
||||
datasource.refreshTableData($scope.tableId);
|
||||
});
|
||||
}]
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
.directive('banshoCell', ['$http', '$compile', function ($http, $compile) {
|
||||
.directive('banshoTable', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
compile: function () {
|
||||
return function (scope, element, attrs) {
|
||||
if (!attrs.cellName) {
|
||||
throw new Error('<bansho-cell> "cell-name" attribute must be defined');
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
options: '='
|
||||
},
|
||||
templateUrl: 'components/directive/table/table.html',
|
||||
controller: ['$scope', '$window', 'headerFollow', 'datasource', 'templateManager',
|
||||
function ($scope, $window, headerFollow, datasource, templateManager) {
|
||||
// Manage attributes.
|
||||
$scope.datasourceId = $scope.options.attributes.datasourceId;
|
||||
$scope.checkColumn = $scope.options.attributes.checkColumn;
|
||||
$scope.pagingbar = $scope.options.attributes.pagingbar;
|
||||
|
||||
if ($scope.options.attributes.headerFollow) {
|
||||
headerFollow.activate();
|
||||
} else {
|
||||
headerFollow.deactivate();
|
||||
}
|
||||
|
||||
var template = 'components/directive/table/cell_' + attrs.cellName + '/cell_' + attrs.cellName + '.html';
|
||||
$scope.cellUrls = $scope.options.attributes.cellUrls;
|
||||
|
||||
$http.get(template, { cache: true })
|
||||
.success(function (data) {
|
||||
var td = $compile(data)(scope);
|
||||
// HACK : replaceWith is a necessary hack because <tr> only accepts <td> as a child
|
||||
element.replaceWith(td);
|
||||
// Handle components.
|
||||
$scope.columns = [];
|
||||
angular.forEach($scope.options.components, function (cell) {
|
||||
$scope.columns.push({
|
||||
type: cell.type,
|
||||
title: cell.attributes.title,
|
||||
attributes: cell.attributes
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Add table configuration.
|
||||
datasource.addTable($scope.datasourceId, {
|
||||
columns: $scope.columns,
|
||||
inputSource: $scope.options.attributes.inputSource,
|
||||
pagingbar: $scope.options.attributes.pagingbar
|
||||
});
|
||||
datasource.registerDataChanged($scope.datasourceId, function (data, isCheckAll) {
|
||||
$scope.isCheckAll = isCheckAll;
|
||||
$scope.entries = data;
|
||||
});
|
||||
datasource.refreshTableData($scope.datasourceId);
|
||||
templateManager.addInterval(function refreshTable () {
|
||||
datasource.refreshTableData($scope.datasourceId);
|
||||
});
|
||||
|
||||
// Table functions.
|
||||
$scope.createUrl = function (entry, attributes) {
|
||||
if (attributes.url) {
|
||||
var url = "/#/view?view=" + attributes.url.view;
|
||||
angular.forEach(attributes.url.params, function (value) {
|
||||
url += '&' + value.urlParam + '=' + entry[value.entryKey];
|
||||
});
|
||||
$window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.onCheckChange = function () {
|
||||
datasource.setAllCheckTable($scope.datasourceId, $scope.isCheckAll);
|
||||
};
|
||||
}]
|
||||
};
|
||||
}])
|
||||
})
|
||||
|
||||
.directive('banshoCell', ['$http', '$compile', 'tableGlobalConfig',
|
||||
function ($http, $compile, tableGlobalConfig) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
compile: function () {
|
||||
return function (scope, element, attrs) {
|
||||
var attributes = attrs.attributes,
|
||||
template = 'components/directive/table/';
|
||||
|
||||
if (!attrs.type) {
|
||||
throw new Error('Directive bansho-cell "type" attribute must be defined');
|
||||
}
|
||||
|
||||
if (!attributes) {
|
||||
throw new Error('Directive bansho-cell "attributes" attribute must be defined');
|
||||
}
|
||||
|
||||
if (attrs.type == 'cell-single') {
|
||||
template += 'cell_single/cell_single.html';
|
||||
scope.attributes = attributes;
|
||||
tableGlobalConfig[attrs.title] = scope.entryKey;
|
||||
} else if (attrs.type == 'cell-other-fields') {
|
||||
template += 'cell_other_fields/cell_other_fields.html';
|
||||
scope.attributes = attributes;
|
||||
} else {
|
||||
var templateName = "cell_" + attrs.type.substring(5).replace(/-/g, "_");
|
||||
template += templateName + '/' + templateName + '.html';
|
||||
}
|
||||
|
||||
$http.get(template, { cache: true })
|
||||
.success(function (data) {
|
||||
element.replaceWith($compile(data)(scope));
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.filter('wrappableStyle', ['datasource', 'tableGlobalConfig', function (datasource, tableGlobalConfig) {
|
||||
return function (input, scope) {
|
||||
@ -130,13 +117,13 @@ angular.module('bansho.table', ['bansho.datasource',
|
||||
parent_found = false,
|
||||
class_name = ['', ''],
|
||||
i,
|
||||
fieldToWrap = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.tableId).noRepeatCell];
|
||||
fieldToWrap = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.datasourceId).noRepeatCell];
|
||||
|
||||
if (fieldToWrap === undefined) {
|
||||
return input;
|
||||
}
|
||||
|
||||
if (datasource.getConfig(scope.tableId).isWrappable) {
|
||||
if (datasource.getConfig(scope.datasourceId).isWrappable) {
|
||||
class_name = ['state--hasChild', 'state--isChild'];
|
||||
}
|
||||
|
||||
@ -169,8 +156,8 @@ angular.module('bansho.table', ['bansho.datasource',
|
||||
return function (items, scope) {
|
||||
var newItems = [],
|
||||
previous,
|
||||
fieldToCompare = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.tableId).noRepeatCell],
|
||||
newAttr = datasource.getConfig(scope.tableId).noRepeatCell + "_additionnalClass";
|
||||
fieldToCompare = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.datasourceId).noRepeatCell],
|
||||
newAttr = datasource.getConfig(scope.datasourceId).noRepeatCell + "_additionnalClass";
|
||||
|
||||
angular.forEach(items, function (item) {
|
||||
|
||||
|
@ -86,23 +86,13 @@
|
||||
<script src="components/directive/table/pagingbar/pagingbar.js"></script>
|
||||
<script src="components/directive/table/cell_status_duration/cell_status_duration.js"></script>
|
||||
|
||||
<script src="components/directive/table/cell_config_host/cell_config_host.js"></script>
|
||||
<script src="components/directive/table/cell_config_host_address/cell_config_host_address.js"></script>
|
||||
<script src="components/directive/table/cell_config_host_name/cell_config_host_name.js"></script>
|
||||
<script src="components/directive/table/cell_single/cell_single.js"></script>
|
||||
<script src="components/directive/table/cell_config_host_register/cell_config_host_register.js"></script>
|
||||
<script src="components/directive/table/cell_config_host_use/cell_config_host_use.js"></script>
|
||||
|
||||
<script src="components/directive/table/cell_status_event/cell_status_event.js"></script>
|
||||
<script src="components/directive/table/cell_status_event_event_type/cell_status_event_event_type.js"></script>
|
||||
<script src="components/directive/table/cell_status_event_output/cell_status_event_output.js"></script>
|
||||
<script src="components/directive/table/cell_status_event_host_name/cell_status_event_host_name.js"></script>
|
||||
<script src="components/directive/table/cell_status_event_service/cell_status_event_service.js"></script>
|
||||
<script src="components/directive/table/cell_status_event_time/cell_status_event_time.js"></script>
|
||||
|
||||
<script src="components/directive/table/cell_other_fields/cell_other_fields.js"></script>
|
||||
<script src="components/directive/table/cell_status_host/cell_status_host.js"></script>
|
||||
<script src="components/directive/table/cell_status_last_check/cell_status_last_check.js"></script>
|
||||
<script src="components/directive/table/cell_status_service_check/cell_status_service_check.js"></script>
|
||||
<script src="components/directive/table/cell_status_host_address/cell_status_host_address.js"></script>
|
||||
<script src="components/directive/table/cell_status_host_status/cell_status_host_status.js"></script>
|
||||
<script src="components/directive/state_icon/state_icon.js"></script>
|
||||
<script src="components/grafana/grafana.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user