mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-07 10:18:57 +00:00
Merge pull request #1037 from wazuh/issue-1034
New Feedbacks and improvements in configuration sections
This commit is contained in:
commit
b17c5c5abd
@ -167,32 +167,75 @@ export class AgentsController {
|
||||
this.$scope.isString = item => typeof item === 'string';
|
||||
this.$scope.hasSize = obj =>
|
||||
obj && typeof obj === 'object' && Object.keys(obj).length;
|
||||
this.$scope.switchConfigTab = (configurationTab, sections) =>
|
||||
this.$scope.switchConfigTab = (configurationTab, sections, navigate = true) => {
|
||||
this.$scope.navigate = navigate;
|
||||
try {
|
||||
this.$scope.configSubTab = JSON.stringify({ 'configurationTab': configurationTab, 'sections': sections });
|
||||
if (!this.$location.search().configSubTab) {
|
||||
this.appState.setSessionStorageItem('configSubTab', this.$scope.configSubTab);
|
||||
this.$location.search('configSubTab', true);
|
||||
}
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Set configuration path');
|
||||
}
|
||||
this.configurationHandler.switchConfigTab(
|
||||
configurationTab,
|
||||
sections,
|
||||
this.$scope,
|
||||
this.$scope.agent.id
|
||||
);
|
||||
this.$scope.switchWodle = wodleName =>
|
||||
}
|
||||
this.$scope.switchWodle = (wodleName, navigate = true) => {
|
||||
this.$scope.navigate = navigate;
|
||||
this.$scope.configWodle = wodleName;
|
||||
if (!this.$location.search().configWodle) {
|
||||
this.$location.search('configWodle', this.$scope.configWodle);
|
||||
}
|
||||
this.configurationHandler.switchWodle(
|
||||
wodleName,
|
||||
this.$scope,
|
||||
this.$scope.agent.id
|
||||
);
|
||||
this.$scope.switchConfigurationTab = configurationTab =>
|
||||
)
|
||||
};
|
||||
this.$scope.switchConfigurationTab = (configurationTab, navigate) => {
|
||||
this.$scope.navigate = navigate;
|
||||
this.configurationHandler.switchConfigurationTab(
|
||||
configurationTab,
|
||||
this.$scope
|
||||
);
|
||||
this.$scope.switchConfigurationSubTab = configurationSubTab =>
|
||||
if (!this.$scope.navigate) {
|
||||
const configSubTab = this.$location.search().configSubTab;
|
||||
if (configSubTab) {
|
||||
try {
|
||||
const config = this.appState.getSessionStorageItem('configSubTab');
|
||||
const configSubTabObj = JSON.parse(config);
|
||||
this.$scope.switchConfigTab(configSubTabObj.configurationTab, configSubTabObj.sections, false);
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Get configuration path');
|
||||
}
|
||||
} else {
|
||||
const configWodle = this.$location.search().configWodle;
|
||||
if (configWodle) {
|
||||
this.$scope.switchWodle(configWodle, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$location.search('configSubTab', null);
|
||||
this.appState.removeSessionStorageItem('configSubTab');
|
||||
this.$location.search('configWodle', null);
|
||||
}
|
||||
}
|
||||
this.$scope.switchConfigurationSubTab = configurationSubTab => {
|
||||
this.configurationHandler.switchConfigurationSubTab(
|
||||
configurationSubTab,
|
||||
this.$scope
|
||||
);
|
||||
}
|
||||
this.$scope.updateSelectedItem = i => (this.$scope.selectedItem = i);
|
||||
this.$scope.getIntegration = list =>
|
||||
this.configurationHandler.getIntegration(list, this.$scope);
|
||||
|
||||
this.$scope.$on('$routeChangeStart', () => this.appState.removeSessionStorageItem('configSubTab'));
|
||||
}
|
||||
|
||||
createMetrics(metricsObject) {
|
||||
|
@ -12,10 +12,12 @@
|
||||
import { ConfigurationHandler } from '../../utils/config-handler';
|
||||
|
||||
export class ConfigurationController {
|
||||
constructor($scope, errorHandler, apiReq) {
|
||||
constructor($scope, $location, errorHandler, apiReq, appState) {
|
||||
this.$scope = $scope;
|
||||
this.errorHandler = errorHandler;
|
||||
this.apiReq = apiReq;
|
||||
this.appState = appState;
|
||||
this.$location = $location;
|
||||
this.$scope.load = false;
|
||||
this.$scope.isArray = Array.isArray;
|
||||
this.configurationHandler = new ConfigurationHandler(apiReq, errorHandler);
|
||||
@ -32,19 +34,60 @@ export class ConfigurationController {
|
||||
this.$scope.isString = item => typeof item === 'string';
|
||||
this.$scope.hasSize = obj =>
|
||||
obj && typeof obj === 'object' && Object.keys(obj).length;
|
||||
this.$scope.switchConfigTab = (configurationTab, sections) =>
|
||||
this.$scope.switchConfigTab = (configurationTab, sections, navigate = true) => {
|
||||
this.$scope.navigate = navigate;
|
||||
try {
|
||||
this.$scope.configSubTab = JSON.stringify({ 'configurationTab': configurationTab, 'sections': sections });
|
||||
if (!this.$location.search().configSubTab) {
|
||||
this.appState.setSessionStorageItem('configSubTab', this.$scope.configSubTab);
|
||||
this.$location.search('configSubTab', true);
|
||||
}
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Set configuration path');
|
||||
}
|
||||
this.configurationHandler.switchConfigTab(
|
||||
configurationTab,
|
||||
sections,
|
||||
this.$scope
|
||||
);
|
||||
this.$scope.switchWodle = wodleName =>
|
||||
)
|
||||
};
|
||||
this.$scope.switchWodle = (wodleName, navigate = true) => {
|
||||
this.$scope.navigate = navigate;
|
||||
this.$scope.configWodle = wodleName;
|
||||
if (!this.$location.search().configWodle) {
|
||||
this.$location.search('configWodle', this.$scope.configWodle);
|
||||
}
|
||||
this.configurationHandler.switchWodle(wodleName, this.$scope);
|
||||
this.$scope.switchConfigurationTab = configurationTab =>
|
||||
}
|
||||
|
||||
this.$scope.switchConfigurationTab = (configurationTab, navigate) => {
|
||||
this.$scope.navigate = navigate;
|
||||
this.configurationHandler.switchConfigurationTab(
|
||||
configurationTab,
|
||||
this.$scope
|
||||
);
|
||||
)
|
||||
if (!this.$scope.navigate) {
|
||||
let configSubTab = this.$location.search().configSubTab;
|
||||
if (configSubTab) {
|
||||
try {
|
||||
const config = this.appState.getSessionStorageItem('configSubTab');
|
||||
const configSubTabObj = JSON.parse(config);
|
||||
this.$scope.switchConfigTab(configSubTabObj.configurationTab, configSubTabObj.sections, false);
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Get configuration path');
|
||||
}
|
||||
} else {
|
||||
let configWodle = this.$location.search().configWodle;
|
||||
if (configWodle) {
|
||||
this.$scope.switchWodle(configWodle, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$location.search('configSubTab', null);
|
||||
this.appState.removeSessionStorageItem('configSubTab');
|
||||
this.$location.search('configWodle', null);
|
||||
}
|
||||
};
|
||||
this.$scope.switchConfigurationSubTab = configurationSubTab =>
|
||||
this.configurationHandler.switchConfigurationSubTab(
|
||||
configurationSubTab,
|
||||
@ -53,5 +96,7 @@ export class ConfigurationController {
|
||||
this.$scope.updateSelectedItem = i => (this.$scope.selectedItem = i);
|
||||
this.$scope.getIntegration = list =>
|
||||
this.configurationHandler.getIntegration(list, this.$scope);
|
||||
|
||||
this.$scope.$on('$routeChangeStart', () => this.appState.removeSessionStorageItem('configSubTab'));
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +388,11 @@ kbn-vis .vis-container {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
md-sidenav {
|
||||
width: 250px!important;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Dev tools styles */
|
||||
|
||||
.wz-dev-box {
|
||||
|
@ -107,4 +107,16 @@ export class AppState {
|
||||
getCurrentDevTools() {
|
||||
return this.$window.localStorage.getItem('currentDevTools');
|
||||
}
|
||||
|
||||
setSessionStorageItem(key, value) {
|
||||
this.$window.sessionStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
getSessionStorageItem(key) {
|
||||
return this.$window.sessionStorage.getItem(key);
|
||||
}
|
||||
|
||||
removeSessionStorageItem(key) {
|
||||
this.$window.sessionStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
<span> / </span>
|
||||
<span class="wz-text-link cursor-pointer" ng-click="switchTab('welcome')">{{agent.name}} ({{agent.id}})</span>
|
||||
<span> / </span>
|
||||
<span class="wz-text-link cursor-pointer" ng-click="switchConfigurationTab('welcome')">{{ tabNames[tab] }}</span>
|
||||
<span class="wz-text-link cursor-pointer" ng-click="switchConfigurationTab('welcome', true)">{{ tabNames[tab] }}</span>
|
||||
<span> / </span>
|
||||
<span>{{ tabNames[configurationTab] === 'Alerts' ? 'Labels' : tabNames[configurationTab] }}</span>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<!-- Headline -->
|
||||
<div layout="column" layout-padding>
|
||||
<div>
|
||||
<span class="font-size-18">Client configuration</span>
|
||||
<span class="font-size-18">Communication</span>
|
||||
</div>
|
||||
<span class="md-subheader">Settings related to the connection with the manager</span>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div flex="auto" layout="column" ng-controller="managementConfigurationController" ng-if="mctrl.tab === 'configuration'" ng-init="switchConfigurationTab('welcome')">
|
||||
<div flex="auto" layout="column" ng-controller="managementConfigurationController" ng-if="mctrl.tab === 'configuration'" ng-init="switchConfigurationTab('welcome', false)">
|
||||
|
||||
<!-- Navigation section -->
|
||||
<div layout="row" layout-align="start center">
|
||||
@ -14,7 +14,7 @@
|
||||
<div ng-if="configurationTab !== 'welcome'">
|
||||
<span class="wz-text-link cursor-pointer" ng-click="mctrl.switchTab('welcome')">Management</span>
|
||||
<span> / </span>
|
||||
<span class="wz-text-link cursor-pointer" ng-click="switchConfigurationTab('welcome')">{{ mctrl.tabNames[mctrl.tab] }}</span>
|
||||
<span class="wz-text-link cursor-pointer" ng-click="switchConfigurationTab('welcome', true)">{{ mctrl.tabNames[mctrl.tab] }}</span>
|
||||
<span> / </span>
|
||||
<span>{{ mctrl.tabNames[configurationTab] }}</span>
|
||||
</div>
|
||||
|
@ -60,7 +60,7 @@
|
||||
</md-list-item>
|
||||
<md-list-item flex="100" flex-gt-md="50" flex-gt-lg="33" class="md-2-line" ng-if="agent && agent.id !== '000'">
|
||||
<div class="md-list-item-text">
|
||||
<h3 class="wz-text-link" ng-click="switchConfigTab('client', [{component:'agent',configuration:'client'}])">Client configuration</h3>
|
||||
<h3 class="wz-text-link" ng-click="switchConfigTab('client', [{component:'agent',configuration:'client'}])">Communication</h3>
|
||||
<p>Settings related to the connection with the manager</p>
|
||||
</div>
|
||||
</md-list-item>
|
||||
|
Loading…
Reference in New Issue
Block a user