From 56db6056fdad0085e7c66b66feaf8f6c44d3606e Mon Sep 17 00:00:00 2001 From: dietmarj Date: Tue, 28 Jun 2022 05:12:57 +0200 Subject: [PATCH 01/56] fieldslist in logentries --- src/Template/Logentries/index.php | 27 ++++++++++++++----- .../Logentries/LogentriesIndexController.js | 22 ++++++++++++++- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/Template/Logentries/index.php b/src/Template/Logentries/index.php index ede64e7f78..c9459abc6f 100644 --- a/src/Template/Logentries/index.php +++ b/src/Template/Logentries/index.php @@ -51,9 +51,12 @@ - +
@@ -133,20 +136,30 @@ class="btn btn-xs btn-danger">
+ +
Fields: +
+ {{field.field}} +
+
+ + - - - @@ -155,13 +168,13 @@ class="btn btn-xs btn-danger"> {{logentry}} - - - diff --git a/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js b/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js index 1f9961eedd..5aec1848a0 100644 --- a/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js +++ b/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js @@ -19,10 +19,26 @@ angular.module('openITCOCKPIT') }; }; /*** Filter end ***/ - + /*** FieldSettings DJ ***/ + $scope.fields = [ + { + field: 'Date', + selected: true + }, + { + field: 'Type', + selected: true + }, + { + field: 'Record', + selected: true + }, + ]; + /*** FieldSettings DJ end***/ $scope.init = true; $scope.showFilter = false; + $scope.showFields = false; $scope.load = function(){ @@ -66,6 +82,10 @@ angular.module('openITCOCKPIT') $scope.showFilter = !$scope.showFilter === true; }; + $scope.triggerFields = function(){ + $scope.showFields = !$scope.showFields === true; + }; + $scope.resetFilter = function(){ defaultFilter(); }; From 1955f4570c93617858f264e5d760f5ac0d3442a2 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Tue, 28 Jun 2022 06:59:19 +0200 Subject: [PATCH 02/56] hosts browser fieldlist --- src/Template/Browsers/index.php | 40 ++++++++++++++----- src/Template/Logentries/index.php | 21 +++++----- .../Hosts/BrowsersIndexController.js | 33 +++++++++++++++ 3 files changed, 74 insertions(+), 20 deletions(-) diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 86aa3effe1..2240e7c8ee 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -214,9 +214,12 @@ class="pointer text-primary" - +
@@ -409,6 +412,13 @@ class="btn btn-xs btn-danger">
+
Fields: +
+ {{field.field}} +
+
+ + +
+ {{ logentry.entry_time }} + {{ logentry.logentry_type_string }} +
@@ -442,29 +452,33 @@ class="btn btn-xs btn-danger"> + - - - - - @@ -543,24 +557,28 @@ class="txt-color-blueDark" - + + - - - - diff --git a/src/Template/Logentries/index.php b/src/Template/Logentries/index.php index c9459abc6f..3bb6b0c6c2 100644 --- a/src/Template/Logentries/index.php +++ b/src/Template/Logentries/index.php @@ -137,29 +137,32 @@ class="btn btn-xs btn-danger">
-
Fields: -
- {{field.field}} +
Fields: +
+ {{field.field}} +
-
+ + + + + + + + + {{ host.Host.description }} + {{ host.Host.address }} + {{ host.Hoststatus.last_state_change }} + {{ host.Hoststatus.lastCheck }} +
+ {{ host.Host.satelliteName }}
- - - diff --git a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js index 0e9cf1dee2..bf1ef3bde0 100644 --- a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js @@ -10,6 +10,34 @@ angular.module('openITCOCKPIT') containerFilter: '' }; $scope.recursiveBrowser = false; + /*** FieldSettings DJ ***/ + $scope.fields = [ + { + field: 'Description', + selected: false + }, + { + field: 'Address', + selected: true + }, + { + field: 'Last state change', + selected: true + }, + { + field: 'Last check', + selected: true + }, + { + field: 'Host output', + selected: true + }, + { + field: 'Instance', + selected: true + }, + ]; + /*** FieldSettings DJ end***/ /*** Filter Settings ***/ @@ -40,6 +68,7 @@ angular.module('openITCOCKPIT') $scope.init = true; $scope.showFilter = false; + $scope.showFields = false; $scope.load = function(){ @@ -133,6 +162,10 @@ angular.module('openITCOCKPIT') $scope.showFilter = !$scope.showFilter === true; }; + $scope.triggerFields = function(){ + $scope.showFields = !$scope.showFields === true; + }; + $scope.resetFilter = function(){ defaultFilter(); $scope.undoSelection(); From 148dcb29741f67591f769379f72691face885f51 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Wed, 29 Jun 2022 20:22:09 +0200 Subject: [PATCH 03/56] complete host browser fieldlist --- src/Model/Table/HostsTable.php | 8 +- src/Template/Browsers/index.php | 221 +++++++++++++++--- src/itnovum/openITCOCKPIT/Core/Views/Host.php | 22 +- .../Hosts/BrowsersIndexController.js | 41 +++- 4 files changed, 258 insertions(+), 34 deletions(-) diff --git a/src/Model/Table/HostsTable.php b/src/Model/Table/HostsTable.php index 284ece1aa0..0b801189f4 100644 --- a/src/Model/Table/HostsTable.php +++ b/src/Model/Table/HostsTable.php @@ -784,7 +784,7 @@ public function getHostsIndex(HostFilter $HostFilter, HostConditions $HostCondit 'Hosts.container_id', 'Hosts.tags', 'Hosts.priority', - + 'Hosts.notes', 'Hoststatus.current_state', 'Hoststatus.last_check', 'Hoststatus.next_check', @@ -832,6 +832,7 @@ public function getHostsIndex(HostFilter $HostFilter, HostConditions $HostCondit 'Hosttemplates.uuid', 'Hosttemplates.name', 'Hosttemplates.description', + 'Hosttemplates.notes', 'Hosttemplates.active_checks_enabled', 'Hosttemplates.tags', 'Hosttemplates.priority', @@ -934,11 +935,12 @@ public function getHostsIndexStatusengine3(HostFilter $HostFilter, HostCondition 'Hosts.address', 'Hosts.satellite_id', 'Hosts.container_id', + 'Hosts.hosttemplate_id', 'Hosts.tags', 'Hosts.priority', //'keywords' => 'IF((Hosts.tags IS NULL OR Hosts.tags=""), Hosttemplates.tags, Hosts.tags)', //'not_keywords' => 'IF((Hosts.tags IS NULL OR Hosts.tags=""), Hosttemplates.tags, Hosts.tags)', - + 'Hosts.notes', 'Hoststatus.current_state', 'Hoststatus.last_check', 'Hoststatus.next_check', @@ -980,12 +982,12 @@ public function getHostsIndexStatusengine3(HostFilter $HostFilter, HostCondition 'Hosttemplates.uuid', 'Hosttemplates.name', 'Hosttemplates.description', + 'Hosttemplates.notes', 'Hosttemplates.active_checks_enabled', 'Hosttemplates.tags', 'Hosttemplates.priority', 'hostpriority' => $query->newExpr('IF(Hosts.priority IS NULL, Hosttemplates.priority, Hosts.priority)'), 'hostdescription' => $query->newExpr('IF(Hosts.description IS NULL, Hosttemplates.description, Hosts.description)') - ] ] ]); diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 2240e7c8ee..7ff944fd4f 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -412,13 +412,83 @@ class="btn btn-xs btn-danger">
-
Fields: -
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Acl->hasPermission('serviceList', 'services')): ?> +
+ +
+
+
+ +
+
+
+
+
+ + + +
+ + +
@@ -427,62 +497,83 @@ class="btn btn-xs btn-danger"> - - - - + - - + + - - - - - - + Acl->hasPermission('serviceList', 'services')): ?> + + + + + @@ -498,7 +589,7 @@ class="btn btn-xs btn-danger"> - - - + + - - + + - - - - - - + Acl->hasPermission('serviceList', 'services')): ?> + + + +
+ + + + + + + + + P + + + + + + + + + + + + + +
+ @@ -509,12 +600,27 @@ class="btn btn-xs btn-danger"> title=""> + + +
+ + +
+
+ + +
+
Acl->hasPermission('serviceList', 'services')): ?> - + - + P + + + Acl->hasPermission('browser', 'hosts')): ?> @@ -557,31 +669,82 @@ class="txt-color-blueDark" + {{ host.Host.description }} + {{ host.Host.address }} + {{ host.Hoststatus.last_state_change }} + {{ host.Hoststatus.lastCheck }} +
+ {{ host.Host.satelliteName }} + + + {{ host.Host.notes }} +
Acl->hasPermission('edit', 'hosts')): ?> diff --git a/src/itnovum/openITCOCKPIT/Core/Views/Host.php b/src/itnovum/openITCOCKPIT/Core/Views/Host.php index 2b85a1150a..cbd002f843 100644 --- a/src/itnovum/openITCOCKPIT/Core/Views/Host.php +++ b/src/itnovum/openITCOCKPIT/Core/Views/Host.php @@ -99,6 +99,11 @@ class Host { */ private $priority; + /** + * @var string|null + */ + private $notes; + /** * Host constructor. * @param array $host @@ -130,10 +135,18 @@ public function __construct($host, $allowEdit = false) { $this->address = $host['Host']['address']; } - if (isset($host['Host']['description'])) { + if (empty($host['Host']['description']) && isset($host['Hosttemplate']['description'])) { + $this->description = $host['Hosttemplate']['description']; + } else { $this->description = $host['Host']['description']; } + if (empty($host['Host']['notes']) && isset($host['Hosttemplate']['notes'])) { + $this->notes = $host['Hosttemplate']['notes']; + } else { + $this->notes = $host['Host']['notes']; + } + if (isset($host['Host']['hosttemplate_id'])) { $this->hosttemplate_id = (int)$host['Host']['hosttemplate_id']; } @@ -232,6 +245,13 @@ public function getDescription() { return $this->description; } + /** + * @return string + */ + public function getNotes() { + return $this->notes; + } + /** * @return bool|int */ diff --git a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js index bf1ef3bde0..fd863fb81f 100644 --- a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js @@ -12,6 +12,38 @@ angular.module('openITCOCKPIT') $scope.recursiveBrowser = false; /*** FieldSettings DJ ***/ $scope.fields = [ + { + field: 'Host status', + selected: true + }, + { + field: 'is acknowledged', + selected: true + }, + { + field: 'is in downtime', + selected: true + }, + { + field: 'Notifications enabled', + selected: false + }, + { + field: 'Grapher', + selected: true + }, + { + field: 'shared', + selected: true + }, + { + field: 'passively transfered Host', + selected: true + }, + { + field: 'Priority', + selected: false + }, { field: 'Description', selected: false @@ -36,6 +68,14 @@ angular.module('openITCOCKPIT') field: 'Instance', selected: true }, + { + field: 'Service Summary', + selected: false + }, + { + field: 'Notes', + selected: false + }, ]; /*** FieldSettings DJ end***/ @@ -69,7 +109,6 @@ angular.module('openITCOCKPIT') $scope.init = true; $scope.showFilter = false; $scope.showFields = false; - $scope.load = function(){ $http.get("/browsers/index/" + $scope.containerId + ".json", { From e36055bf17e678bbebdc1e10ff89abf40d8cc0f8 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Wed, 29 Jun 2022 21:05:56 +0200 Subject: [PATCH 04/56] fix for new Hosts.notes field in ServicesTable class --- src/Model/Table/ServicesTable.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Table/ServicesTable.php b/src/Model/Table/ServicesTable.php index bf08805e2d..a329a5298a 100644 --- a/src/Model/Table/ServicesTable.php +++ b/src/Model/Table/ServicesTable.php @@ -1824,6 +1824,7 @@ public function getServiceIndex(ServiceConditions $ServiceConditions, $PaginateO 'Hosts.description', 'Hosts.address', 'Hosts.disabled', + 'Hosts.notes' ]) ->innerJoinWith('Hosts') ->innerJoinWith('Hosts.HostsToContainersSharing', function (Query $q) use ($ServiceConditions) { @@ -1993,7 +1994,8 @@ public function getServiceIndexStatusengine3(ServiceConditions $ServiceCondition 'Hosts.description', 'Hosts.address', 'Hosts.disabled', - 'Hosts.satellite_id' + 'Hosts.satellite_id', + 'Hosts.notes' ]) ->innerJoinWith('Hosts') ->innerJoinWith('Hosts.HostsToContainersSharing', function (Query $q) use ($ServiceConditions) { From 8fc64c902f0d0f2df3b9a5c3da09a2fb6ff47821 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Mon, 4 Jul 2022 08:15:32 +0200 Subject: [PATCH 05/56] fieldconfig as dropdown --- src/Template/Browsers/index.php | 228 ++++++++++++------ .../Hosts/BrowsersIndexController.js | 94 +++----- 2 files changed, 180 insertions(+), 142 deletions(-) diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 7ff944fd4f..138d4e9630 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -217,9 +217,10 @@ class="pointer text-primary" -
@@ -413,7 +414,7 @@ class="btn btn-xs btn-danger">
-
+
+ +
- + - - - - - - - - - - - - - - Acl->hasPermission('serviceList', 'services')): ?> - - @@ -585,11 +662,11 @@ class="btn btn-xs btn-danger"> ng-show="host.Host.allow_edit"> - - - - - - - - - - - - - - - Acl->hasPermission('serviceList', 'services')): ?> - - diff --git a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js index fd863fb81f..713f9064e0 100644 --- a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js @@ -1,5 +1,5 @@ angular.module('openITCOCKPIT') - .controller('BrowsersIndexController', function($scope, $http, $rootScope, $httpParamSerializer, $stateParams, SortService, MassChangeService, QueryStringService, $state){ + .controller('BrowsersIndexController', function($scope, $http, $window, $rootScope, $httpParamSerializer, $stateParams, SortService, MassChangeService, QueryStringService, $state){ SortService.setSort('Hoststatus.current_state'); SortService.setDirection('desc'); @@ -11,73 +11,11 @@ angular.module('openITCOCKPIT') }; $scope.recursiveBrowser = false; /*** FieldSettings DJ ***/ - $scope.fields = [ - { - field: 'Host status', - selected: true - }, - { - field: 'is acknowledged', - selected: true - }, - { - field: 'is in downtime', - selected: true - }, - { - field: 'Notifications enabled', - selected: false - }, - { - field: 'Grapher', - selected: true - }, - { - field: 'shared', - selected: true - }, - { - field: 'passively transfered Host', - selected: true - }, - { - field: 'Priority', - selected: false - }, - { - field: 'Description', - selected: false - }, - { - field: 'Address', - selected: true - }, - { - field: 'Last state change', - selected: true - }, - { - field: 'Last check', - selected: true - }, - { - field: 'Host output', - selected: true - }, - { - field: 'Instance', - selected: true - }, - { - field: 'Service Summary', - selected: false - }, - { - field: 'Notes', - selected: false - }, - ]; + //$scope.fields = []; + /*** FieldSettings DJ end***/ + //$scope.fields = [true,true,true,false,true,true,true,false,true,false,true,true,true,true,true,false,false]; + $scope.fields = []; /*** Filter Settings ***/ @@ -101,6 +39,27 @@ angular.module('openITCOCKPIT') }; }; /*** Filter end ***/ + $scope.defaultFields = function(){ + console.log('DefaultFields'); + $scope.fields = [true,true,true,false,true,true,true,false,true,false,true,true,true,true,true,false,false]; + }; + + $scope.saveFields = function(){ + console.log('SaveFields'); + $window.localStorage.removeItem('hostbrowserFields'); + $window.localStorage.setItem('hostbrowserFields',JSON.stringify($scope.fields)); + + } + + $scope.loadFields = function(){ + var fields = JSON.parse($window.localStorage.getItem('hostbrowserFields')); + if(typeof fields !== undefined && Array.isArray(fields) && fields.length == 17) { + $scope.fields = fields; + }else { + $scope.defaultFields() + } + } + $scope.massChange = {}; $scope.selectedElements = 0; $scope.deleteUrl = '/hosts/delete/'; @@ -281,6 +240,7 @@ angular.module('openITCOCKPIT') //Fire on page load + $scope.loadFields(); defaultFilter(); SortService.setCallback($scope.load); From 5b5e6adda71383d2dabe92cada931c39c0059535 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Thu, 7 Jul 2022 02:13:17 +0200 Subject: [PATCH 06/56] hostbrowser column config complete --- src/Controller/AngularController.php | 9 + src/Lib/AclDependencies.php | 4 +- .../Angular/columns_config_export.php | 75 +++++++ .../Angular/columns_config_import.php | 80 +++++++ src/Template/Browsers/index.php | 207 ++++++------------ src/Template/Logentries/index.php | 24 +- .../Hosts/BrowsersIndexController.js | 36 +-- .../Logentries/LogentriesIndexController.js | 22 -- .../ColumnsConfigExportDirective.js | 31 +++ .../ColumnsConfigImportDirective.js | 38 ++++ 10 files changed, 323 insertions(+), 203 deletions(-) create mode 100644 src/Template/Angular/columns_config_export.php create mode 100644 src/Template/Angular/columns_config_import.php create mode 100644 webroot/js/scripts/directives/ColumnsConfigExportDirective.js create mode 100644 webroot/js/scripts/directives/ColumnsConfigImportDirective.js diff --git a/src/Controller/AngularController.php b/src/Controller/AngularController.php index 8e50fbe2d6..26c91946f4 100644 --- a/src/Controller/AngularController.php +++ b/src/Controller/AngularController.php @@ -1261,4 +1261,13 @@ public function wizardInterfaceFilter() { //Only ship HTML template return; } + + public function columns_config_import() { + //Only ship HTML template + return; + } + public function columns_config_export() { + //Only ship HTML template + return; + } } diff --git a/src/Lib/AclDependencies.php b/src/Lib/AclDependencies.php index cb48f2efbb..fc8d85d754 100644 --- a/src/Lib/AclDependencies.php +++ b/src/Lib/AclDependencies.php @@ -139,7 +139,9 @@ public function __construct() { ->allow('Angular', 'message_of_the_day') ->allow('Angular', 'regexHelpTooltip') ->allow('Angular', 'wizardFilter') - ->allow('Angular', 'wizardInterfaceFilter'); + ->allow('Angular', 'wizardInterfaceFilter') + ->allow('Angular', 'columnsConfigImport') + ->allow('Angular', 'columnsConfigExport'); $this ->allow('Agentconnector', 'register_agent') diff --git a/src/Template/Angular/columns_config_export.php b/src/Template/Angular/columns_config_export.php new file mode 100644 index 0000000000..65086c551b --- /dev/null +++ b/src/Template/Angular/columns_config_export.php @@ -0,0 +1,75 @@ + +// +// This file is dual licensed +// +// 1. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +// 2. +// If you purchased an openITCOCKPIT Enterprise Edition you can use this file +// under the terms of the openITCOCKPIT Enterprise Edition license agreement. +// License agreement and license key will be shipped with the order +// confirmation. + +/** + * @var \App\View\AppView $this + * + */ +?> + + + + + + diff --git a/src/Template/Angular/columns_config_import.php b/src/Template/Angular/columns_config_import.php new file mode 100644 index 0000000000..c5e048ba7b --- /dev/null +++ b/src/Template/Angular/columns_config_import.php @@ -0,0 +1,80 @@ + +// +// This file is dual licensed +// +// 1. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +// 2. +// If you purchased an openITCOCKPIT Enterprise Edition you can use this file +// under the terms of the openITCOCKPIT Enterprise Edition license agreement. +// License agreement and license key will be shipped with the order +// confirmation. + +/** + * @var \App\View\AppView $this + * + */ +?> + + + + + diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 138d4e9630..0fc36c1314 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -410,159 +410,76 @@ class="btn btn-xs btn-danger"> - - -
+ + - - -
+ + + +
+ + + + + + + + + P + + + + + + + + + + + @@ -600,12 +677,12 @@ class="btn btn-xs btn-danger"> title=""> + +
@@ -620,7 +697,7 @@ class="btn btn-xs btn-danger">
+ Acl->hasPermission('serviceList', 'services')): ?> + @@ -644,14 +721,14 @@ class="txt-color-blueDark" title=""> + P + + Acl->hasPermission('browser', 'hosts')): ?> {{ host.Host.hostname }} @@ -669,33 +746,33 @@ class="txt-color-blueDark" + {{ host.Host.description }} + {{ host.Host.address }} + {{ host.Hoststatus.last_state_change }} + {{ host.Hoststatus.lastCheck }} +
+ {{ host.Host.satelliteName }} +
Acl->hasPermission('index', 'services')): ?>
+ + {{ host.Host.notes }}
diff --git a/src/Template/Logentries/index.php b/src/Template/Logentries/index.php index 3bb6b0c6c2..ac5d855923 100644 --- a/src/Template/Logentries/index.php +++ b/src/Template/Logentries/index.php @@ -54,9 +54,6 @@ -
@@ -136,32 +133,23 @@ class="btn btn-xs btn-danger">
- -
Fields: -
- {{field.field}} -
-
-
- - - {{logentry}} - - - diff --git a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js index 713f9064e0..69a82fbbe8 100644 --- a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js @@ -10,15 +10,12 @@ angular.module('openITCOCKPIT') containerFilter: '' }; $scope.recursiveBrowser = false; - /*** FieldSettings DJ ***/ - //$scope.fields = []; - /*** FieldSettings DJ end***/ - //$scope.fields = [true,true,true,false,true,true,true,false,true,false,true,true,true,true,true,false,false]; - $scope.fields = []; + /*** column settings DJ ***/ + $scope.fields = []; + $scope.columnsLength = 17; - /*** Filter Settings ***/ /*** Filter Settings ***/ var defaultFilter = function(){ $scope.filter = { @@ -39,27 +36,32 @@ angular.module('openITCOCKPIT') }; }; /*** Filter end ***/ - $scope.defaultFields = function(){ - console.log('DefaultFields'); + + /*** columns functions ***/ + $scope.defaultColumns = function(){ $scope.fields = [true,true,true,false,true,true,true,false,true,false,true,true,true,true,true,false,false]; }; - $scope.saveFields = function(){ - console.log('SaveFields'); - $window.localStorage.removeItem('hostbrowserFields'); - $window.localStorage.setItem('hostbrowserFields',JSON.stringify($scope.fields)); + $scope.saveColumns = function(){ + $window.localStorage.removeItem('hostbrowserColumns'); + $window.localStorage.setItem('hostbrowserColumns',JSON.stringify($scope.fields)); } - $scope.loadFields = function(){ - var fields = JSON.parse($window.localStorage.getItem('hostbrowserFields')); - if(typeof fields !== undefined && Array.isArray(fields) && fields.length == 17) { + $scope.loadColumns = function(){ + var fields = JSON.parse($window.localStorage.getItem('hostbrowserColumns')); + if(typeof fields !== undefined && Array.isArray(fields) && fields.length == $scope.columnsLength) { $scope.fields = fields; }else { - $scope.defaultFields() + $scope.defaultColumns() } } + $scope.triggerLoadColumns= function(fields){ + $scope.fields = fields; + }; + /*** end columns functions ***/ + $scope.massChange = {}; $scope.selectedElements = 0; $scope.deleteUrl = '/hosts/delete/'; @@ -240,7 +242,7 @@ angular.module('openITCOCKPIT') //Fire on page load - $scope.loadFields(); + $scope.loadColumns(); // load column config defaultFilter(); SortService.setCallback($scope.load); diff --git a/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js b/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js index 5aec1848a0..98955d8c36 100644 --- a/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js +++ b/webroot/js/scripts/controllers/Logentries/LogentriesIndexController.js @@ -18,27 +18,9 @@ angular.module('openITCOCKPIT') } }; }; - /*** Filter end ***/ - /*** FieldSettings DJ ***/ - $scope.fields = [ - { - field: 'Date', - selected: true - }, - { - field: 'Type', - selected: true - }, - { - field: 'Record', - selected: true - }, - ]; - /*** FieldSettings DJ end***/ $scope.init = true; $scope.showFilter = false; - $scope.showFields = false; $scope.load = function(){ @@ -82,10 +64,6 @@ angular.module('openITCOCKPIT') $scope.showFilter = !$scope.showFilter === true; }; - $scope.triggerFields = function(){ - $scope.showFields = !$scope.showFields === true; - }; - $scope.resetFilter = function(){ defaultFilter(); }; diff --git a/webroot/js/scripts/directives/ColumnsConfigExportDirective.js b/webroot/js/scripts/directives/ColumnsConfigExportDirective.js new file mode 100644 index 0000000000..fa4cdba3b7 --- /dev/null +++ b/webroot/js/scripts/directives/ColumnsConfigExportDirective.js @@ -0,0 +1,31 @@ +angular.module('openITCOCKPIT').directive('columnsConfigExport', function($http, $window, NotyService, $state){ + return { + restrict: 'E', + templateUrl: '/angular/columns_config_export.html', + scope: { + fields: '=', + callback: '=', + stateName: '@' + }, + controller: function($scope){ + $scope.init = true; + $scope.FieldVals = $scope.fields; + + $scope.copy2Clipboard = function(){ + navigator.clipboard.writeText($scope.configString); + }; + + $scope.$watchCollection('fields', function(values){ + $scope.configString = JSON.stringify({ + key: $scope.stateName, + value: values + }); + }); + + }, + + link: function(scope, element, attr){ + + } + }; +}); diff --git a/webroot/js/scripts/directives/ColumnsConfigImportDirective.js b/webroot/js/scripts/directives/ColumnsConfigImportDirective.js new file mode 100644 index 0000000000..15e5f53013 --- /dev/null +++ b/webroot/js/scripts/directives/ColumnsConfigImportDirective.js @@ -0,0 +1,38 @@ +angular.module('openITCOCKPIT').directive('columnsConfigImport', function($http, $window, NotyService, $state){ + return { + restrict: 'E', + templateUrl: '/angular/columns_config_import.html', + scope: { + fields: '=', + callback: '=', + stateName: '@' + }, + controller: function($scope){ + $scope.init = true; + $scope.FieldVals = $scope.fields; + $scope.importString = ''; + + $scope.setConfig = function(){ + try{ + var configObject = JSON.parse($scope.importString); + if(configObject.key == $scope.stateName && Array.isArray(configObject.value)){ + $scope.callback(configObject.value) + $('#importFieldsModal').modal('hide'); + }else if(configObject.key != $scope.stateName){ + $scope.error = 'Column config is not for this table'; + //NotyService.genericError(); + }else{ + $scope.error = 'Unable to import config'; + } + } catch(err) { + $scope.error = err.message; + } + } + + }, + + link: function(scope, element, attr){ + + } + }; +}); From d17b27a0098963e0db2f0488acb8317ee2c80f71 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Thu, 7 Jul 2022 03:22:26 +0200 Subject: [PATCH 07/56] translations --- resources/locales/de_DE/default.po | 38 +++++++++++++++++++ resources/locales/en_US/default.po | 36 ++++++++++++++++++ .../Angular/columns_config_export.php | 4 +- .../Angular/columns_config_import.php | 2 +- src/Template/Browsers/index.php | 2 +- 5 files changed, 78 insertions(+), 4 deletions(-) diff --git a/resources/locales/de_DE/default.po b/resources/locales/de_DE/default.po index 6f1874b8a5..4e553e2c76 100644 --- a/resources/locales/de_DE/default.po +++ b/resources/locales/de_DE/default.po @@ -10682,6 +10682,44 @@ msgstr "Host Ausgabe" msgid "Instance" msgstr "Instanz" +#: src/Template/Browsers/index.php:415 +msgid "Column configuration" +msgstr "Spaltenkonfiguration" + + +#: src/Template/Browsers/index.php:419 +msgid "Columns" +msgstr "Spalten" + +#: src/Template/Browsers/index.php:466 +msgid "Save Columns configuration in browser" +msgstr "Spaltenkonfiguration in Browser speichern" + +#: src/Template/Angular/columns_config_import.php:33 +msgid "Import configuration" +msgstr "Import Konfiguration" + +#: src/Template/Angular/columns_config_import.php:54 +msgid "Paste a column configuration string" +msgstr "Erhaltenen Spaltenkonfiguration einfügen" + + +#: src/Template/Angular/columns_config_import.php:42 +msgid "Import column configuration" +msgstr "Import Spaltenkonfiguration" + +#: src/Template/Angular/columns_config_export.php:43 +msgid "Share configuration" +msgstr "Teile Konfiguration" + +#: src/Template/Angular/columns_config_export.php:43 +msgid "Share column configuration" +msgstr "Teile Spaltenkonfiguration" + +#: src/Template/Angular/columns_config_export.php:51 +msgid "Share this column configuration string" +msgstr "Teile diese Spaltenkonfiguration" + #: src/Template/Browsers/index.php:492 #: src/Template/Currentstatereports/index.php:316 #: src/Template/Currentstatereports/index.php:369 diff --git a/resources/locales/en_US/default.po b/resources/locales/en_US/default.po index af6e26ba00..984156fa58 100644 --- a/resources/locales/en_US/default.po +++ b/resources/locales/en_US/default.po @@ -10681,6 +10681,42 @@ msgstr "" msgid "Instance" msgstr "" +#: src/Template/Browsers/index.php:415 +msgid "Column configuration" +msgstr "" + +#: src/Template/Browsers/index.php:419 +msgid "Columns" +msgstr "" + +#: src/Template/Browsers/index.php:466 +msgid "Save Columns configuration in browser" +msgstr "" + +#: src/Template/Angular/columns_config_import.php:33 +msgid "Import configuration" +msgstr "" + +#: src/Template/Angular/columns_config_import.php:42 +msgid "Import column configuration" +msgstr "" + +#: src/Template/Angular/columns_config_import.php:54 +msgid "Paste a column configuration string" +msgstr "" + +#: src/Template/Angular/columns_config_export.php:33 +msgid "Share configuration" +msgstr "" + +#: src/Template/Angular/columns_config_export.php:43 +msgid "Share column configuration" +msgstr "" + +#: src/Template/Angular/columns_config_export.php:51 +msgid "Share this column configuration string" +msgstr "" + #: src/Template/Browsers/index.php:492 #: src/Template/Currentstatereports/index.php:316 #: src/Template/Currentstatereports/index.php:369 diff --git a/src/Template/Angular/columns_config_export.php b/src/Template/Angular/columns_config_export.php index 65086c551b..1307f2ce92 100644 --- a/src/Template/Angular/columns_config_export.php +++ b/src/Template/Angular/columns_config_export.php @@ -40,7 +40,7 @@
@@ -171,13 +159,13 @@ class="btn btn-xs btn-danger">
+ {{ logentry.entry_time }} + {{ logentry.logentry_type_string }} +
diff --git a/src/Template/Hosts/index.php b/src/Template/Hosts/index.php index 95b08d8019..64ddcce76e 100644 --- a/src/Template/Hosts/index.php +++ b/src/Template/Hosts/index.php @@ -480,84 +480,169 @@ class="btn btn-xs btn-danger"> + + + + + + + + + + + +
- + - - - - + + - - - - + + - - - - Acl->hasPermission('serviceList', 'services')): ?> - + + + @@ -569,11 +654,11 @@ class="btn btn-xs btn-danger"> ng-show="host.Host.allow_edit"> - - - - - + - - - - + + - - - - Acl->hasPermission('serviceList', 'services')): ?> - + + + @@ -564,8 +563,7 @@ class="btn btn-xs btn-danger"> - diff --git a/src/Template/Hosts/index.php b/src/Template/Hosts/index.php index 64ddcce76e..157076daec 100644 --- a/src/Template/Hosts/index.php +++ b/src/Template/Hosts/index.php @@ -602,8 +602,7 @@ class="btn btn-xs btn-danger"> - @@ -638,8 +637,7 @@ class="btn btn-xs btn-danger"> - From 8825249fc87b24337c3cddfe8d468bd8404dfec4 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Thu, 7 Jul 2022 07:42:40 +0200 Subject: [PATCH 10/56] more translation --- resources/locales/de_DE/default.po | 7 +++++++ resources/locales/en_US/default.po | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/resources/locales/de_DE/default.po b/resources/locales/de_DE/default.po index 4e553e2c76..cdf2aba76c 100644 --- a/resources/locales/de_DE/default.po +++ b/resources/locales/de_DE/default.po @@ -10682,6 +10682,13 @@ msgstr "Host Ausgabe" msgid "Instance" msgstr "Instanz" +#: src/Template/Browsers/index.php:567 +#: src/Template/Browsers/index.php:438 +#: src/Template/Hosts/index.php:641 +#: src/Template/Hosts/index.php:510 +msgid "Host notes" +msgstr "Hostnotizen" + #: src/Template/Browsers/index.php:415 msgid "Column configuration" msgstr "Spaltenkonfiguration" diff --git a/resources/locales/en_US/default.po b/resources/locales/en_US/default.po index 984156fa58..09597adc1e 100644 --- a/resources/locales/en_US/default.po +++ b/resources/locales/en_US/default.po @@ -10681,6 +10681,13 @@ msgstr "" msgid "Instance" msgstr "" +#: src/Template/Browsers/index.php:567 +#: src/Template/Browsers/index.php:438 +#: src/Template/Hosts/index.php:641 +#: src/Template/Hosts/index.php:510 +msgid "Host notes" +msgstr "" + #: src/Template/Browsers/index.php:415 msgid "Column configuration" msgstr "" From e2bf63db2fcd86c4989d1e104355551576802e18 Mon Sep 17 00:00:00 2001 From: dietmarj Date: Thu, 7 Jul 2022 17:37:14 +0200 Subject: [PATCH 11/56] heredoc replace --- src/Template/Browsers/index.php | 21 +++++++++------------ src/Template/Hosts/index.php | 27 ++++++++++++--------------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 8dcfc90711..42ec23dd4d 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -437,26 +437,23 @@ class="btn btn-xs btn-danger"> __('Service Summary '), __('Host notes')]; foreach(array_chunk($list, 6, true) as $chunk): - echo << -COLL; + echo '
'; foreach($chunk as $index => $name): if ($name == __('Service Summary ') && !$this->Acl->hasPermission('index', 'services') ): continue; endif; - echo << -ITEM; + -COLlEND; - endforeach;?> + echo '
'; + endforeach; + ?>
+ + + + + + + + + P + + + + + + + + + + + + +
+ + @@ -584,11 +669,11 @@ class="btn btn-xs btn-danger"> title=""> + +
@@ -602,8 +687,20 @@ class="btn btn-xs btn-danger">
- + + Acl->hasPermission('serviceList', 'services')): ?> + + + + + + + + @@ -614,14 +711,14 @@ class="btn btn-xs btn-danger"> title=""> + P + + Acl->hasPermission('browser', 'hosts')): ?> {{ host.Host.hostname }} @@ -639,28 +736,32 @@ class="btn btn-xs btn-danger"> + + {{ host.Host.description }} + {{ host.Host.address }} + {{ host.Hoststatus.last_state_change }} + {{ host.Hoststatus.lastCheck }} +
+ {{ host.Host.satelliteName }} +
Acl->hasPermission('index', 'services')): ?>
+ {{ host.Host.notes }} +
Acl->hasPermission('edit', 'hosts')): ?> diff --git a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js index 69a82fbbe8..05bf9ecfe2 100644 --- a/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/BrowsersIndexController.js @@ -11,11 +11,6 @@ angular.module('openITCOCKPIT') }; $scope.recursiveBrowser = false; - - /*** column settings DJ ***/ - $scope.fields = []; - $scope.columnsLength = 17; - /*** Filter Settings ***/ var defaultFilter = function(){ $scope.filter = { @@ -37,19 +32,43 @@ angular.module('openITCOCKPIT') }; /*** Filter end ***/ - /*** columns functions ***/ + /*** column vars ***/ + $scope.fields = []; + $scope.columnsLength = 17; + $scope.columnsTableKey = 'hostbrowserColumns'; + + /*** columns functions + columns: + ['Hoststatus', + 'is acknowledged', + 'is in downtime', + 'Notifications enabled', + 'Grapher', + 'Shared', + 'Passively transferred host', + 'Priority', + 'Host name', + 'Host description', + 'IP address', + 'Last state change', + 'Last check', + 'Host output', + 'Instance', + 'Service Summary ', + 'Host notes'] ***/ $scope.defaultColumns = function(){ $scope.fields = [true,true,true,false,true,true,true,false,true,false,true,true,true,true,true,false,false]; + $window.localStorage.removeItem($scope.columnsTableKey); }; $scope.saveColumns = function(){ - $window.localStorage.removeItem('hostbrowserColumns'); - $window.localStorage.setItem('hostbrowserColumns',JSON.stringify($scope.fields)); + $window.localStorage.removeItem($scope.columnsTableKey); + $window.localStorage.setItem($scope.columnsTableKey,JSON.stringify($scope.fields)); } $scope.loadColumns = function(){ - var fields = JSON.parse($window.localStorage.getItem('hostbrowserColumns')); + var fields = JSON.parse($window.localStorage.getItem($scope.columnsTableKey)); if(typeof fields !== undefined && Array.isArray(fields) && fields.length == $scope.columnsLength) { $scope.fields = fields; }else { diff --git a/webroot/js/scripts/controllers/Hosts/HostsIndexController.js b/webroot/js/scripts/controllers/Hosts/HostsIndexController.js index b38374f599..18fcd71954 100644 --- a/webroot/js/scripts/controllers/Hosts/HostsIndexController.js +++ b/webroot/js/scripts/controllers/Hosts/HostsIndexController.js @@ -1,5 +1,5 @@ angular.module('openITCOCKPIT') - .controller('HostsIndexController', function($scope, $http, $rootScope, $httpParamSerializer, SortService, MassChangeService, NotyService, QueryStringService, $stateParams){ + .controller('HostsIndexController', function($scope, $http, $window, $rootScope, $httpParamSerializer, SortService, MassChangeService, NotyService, QueryStringService, $stateParams){ $rootScope.lastObjectName = null; SortService.setSort(QueryStringService.getStateValue($stateParams, 'sort', 'Hoststatus.current_state')); SortService.setDirection(QueryStringService.getStateValue($stateParams, 'direction', 'desc')); @@ -51,6 +51,55 @@ angular.module('openITCOCKPIT') $scope.showFilter = false; $scope.showBookmarkFilter = false; + /*** column vars ***/ + $scope.fields = []; + $scope.columnsLength = 17; + $scope.columnsTableKey = 'hostindexColumns'; + + /*** columns functions + columns: + ['Hoststatus', + 'is acknowledged', + 'is in downtime', + 'Notifications enabled', + 'Grapher', + 'Shared', + 'Passively transferred host', + 'Priority', + 'Host name', + 'Host description', + 'IP address', + 'Last state change', + 'Last check', + 'Host output', + 'Instance', + 'Service Summary ', + 'Host notes'] ***/ + $scope.defaultColumns = function(){ + $scope.fields = [true,true,true,true,false,true,true,true,true,false,true,true,true,true,true,true,false]; + $window.localStorage.removeItem($scope.columnsTableKey); + }; + + $scope.saveColumns = function(){ + $window.localStorage.removeItem($scope.columnsTableKey); + $window.localStorage.setItem($scope.columnsTableKey,JSON.stringify($scope.fields)); + + } + + $scope.loadColumns = function(){ + var fields = JSON.parse($window.localStorage.getItem($scope.columnsTableKey)); + if(typeof fields !== undefined && Array.isArray(fields) && fields.length == $scope.columnsLength) { + $scope.fields = fields; + }else { + $scope.defaultColumns() + } + } + + $scope.triggerLoadColumns= function(fields){ + $scope.fields = fields; + }; + /*** end columns functions ***/ + $scope.load = function(){ //console.trace(); lastHostUuid = null; @@ -293,6 +342,7 @@ angular.module('openITCOCKPIT') //Fire on page load defaultFilter(); + $scope.loadColumns(); // load column config //$scope.loadDefaultFilterBookmark(); SortService.setCallback($scope.load); From f558c36b6e8eb510d4a6876474080a009514930f Mon Sep 17 00:00:00 2001 From: dietmarj Date: Thu, 7 Jul 2022 05:43:38 +0200 Subject: [PATCH 09/56] descriptions not sortable --- src/Template/Browsers/index.php | 6 ++---- src/Template/Hosts/index.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Template/Browsers/index.php b/src/Template/Browsers/index.php index 2b6f88bf31..8dcfc90711 100755 --- a/src/Template/Browsers/index.php +++ b/src/Template/Browsers/index.php @@ -527,8 +527,7 @@ class="btn btn-xs btn-danger"> -
- + - + - + - +