mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Prettier
This commit is contained in:
parent
b25b323a7f
commit
3c387a882f
@ -236,7 +236,11 @@ export class AgentsPreviewController {
|
||||
|
||||
async refreshAgentsStats() {
|
||||
try {
|
||||
const data = await this.genericReq.request('GET', '/api/agents-unique/' + this.api, {});
|
||||
const data = await this.genericReq.request(
|
||||
'GET',
|
||||
'/api/agents-unique/' + this.api,
|
||||
{}
|
||||
);
|
||||
this.summary = ((data.data || {}).result || {}).summary || {};
|
||||
} catch (error) {
|
||||
this.errorHandler.handle('Error refreshing agents stats');
|
||||
|
@ -79,10 +79,13 @@ class WzConfigViewer {
|
||||
const windows = $(window).height();
|
||||
const offsetTop = getPosition(editorContainer[0]).y;
|
||||
const bottom = $scope.isLogs ? 75 : 20;
|
||||
const headerContainer = $('.wzXmlEditorHeader')
|
||||
const headerContainerHeight = headerContainer.height() + 30 ? headerContainer.height() + 30 : 80;
|
||||
const headerContainer = $('.wzXmlEditorHeader');
|
||||
const headerContainerHeight =
|
||||
headerContainer.height() + 30 ? headerContainer.height() + 30 : 80;
|
||||
editorContainer.height(windows - (offsetTop + bottom));
|
||||
$('.wzXmlEditorBody .CodeMirror').height(windows - (offsetTop + bottom + headerContainerHeight));
|
||||
$('.wzXmlEditorBody .CodeMirror').height(
|
||||
windows - (offsetTop + bottom + headerContainerHeight)
|
||||
);
|
||||
}, 1);
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@ import { uiModules } from 'ui/modules';
|
||||
import discoverTemplate from '../templates/kibana-template/kibana-discover-template.html';
|
||||
|
||||
uiModules.get('app/wazuh', ['kibana/courier']).directive('kbnDis', [
|
||||
function () {
|
||||
function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {},
|
||||
@ -121,7 +121,7 @@ const app = uiModules.get('apps/discover', [
|
||||
'app/wazuh'
|
||||
]);
|
||||
|
||||
app.directive('discoverAppW', function () {
|
||||
app.directive('discoverAppW', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
controllerAs: 'discoverApp',
|
||||
@ -181,7 +181,7 @@ function discoverController(
|
||||
$scope.fetchStatus = fetchStatuses.UNINITIALIZED;
|
||||
$scope.refreshInterval = timefilter.getRefreshInterval();
|
||||
|
||||
$scope.intervalEnabled = function (interval) {
|
||||
$scope.intervalEnabled = function(interval) {
|
||||
return interval.val !== 'custom';
|
||||
};
|
||||
|
||||
@ -397,23 +397,23 @@ function discoverController(
|
||||
bucketsDescription:
|
||||
$scope.bucketInterval.scale > 1
|
||||
? i18n.translate(
|
||||
'kbn.discover.bucketIntervalTooltip.tooLargeBucketsText',
|
||||
{
|
||||
defaultMessage: 'buckets that are too large'
|
||||
}
|
||||
)
|
||||
'kbn.discover.bucketIntervalTooltip.tooLargeBucketsText',
|
||||
{
|
||||
defaultMessage: 'buckets that are too large'
|
||||
}
|
||||
)
|
||||
: i18n.translate(
|
||||
'kbn.discover.bucketIntervalTooltip.tooManyBucketsText',
|
||||
{
|
||||
defaultMessage: 'too many buckets'
|
||||
}
|
||||
),
|
||||
'kbn.discover.bucketIntervalTooltip.tooManyBucketsText',
|
||||
{
|
||||
defaultMessage: 'too many buckets'
|
||||
}
|
||||
),
|
||||
bucketIntervalDescription: $scope.bucketInterval.description
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$watchCollection('state.columns', function () {
|
||||
$scope.$watchCollection('state.columns', function() {
|
||||
$state.save();
|
||||
});
|
||||
|
||||
@ -427,20 +427,20 @@ function discoverController(
|
||||
indexPatternList: $route.current.locals.ip.list
|
||||
};
|
||||
|
||||
const init = _.once(function () {
|
||||
const init = _.once(function() {
|
||||
stateMonitor = stateMonitorFactory.create($state, getStateDefaults());
|
||||
stateMonitor.onChange(status => {
|
||||
$appStatus.dirty = status.dirty || !savedSearch.id;
|
||||
});
|
||||
$scope.$on('$destroy', () => stateMonitor.destroy());
|
||||
|
||||
$scope.updateDataSource().then(function () {
|
||||
$scope.$listen(timefilter, 'fetch', function () {
|
||||
$scope.updateDataSource().then(function() {
|
||||
$scope.$listen(timefilter, 'fetch', function() {
|
||||
$scope.fetch();
|
||||
// WAZUH
|
||||
// WAZUH
|
||||
$rootScope.$broadcast('updateVis');
|
||||
});
|
||||
$scope.$listen(timefilter, 'autoRefreshFetch', function () {
|
||||
$scope.$listen(timefilter, 'autoRefreshFetch', function() {
|
||||
$scope.fetch();
|
||||
});
|
||||
$scope.$listen(timefilter, 'refreshIntervalUpdate', () => {
|
||||
@ -450,7 +450,7 @@ function discoverController(
|
||||
$scope.updateTime();
|
||||
});
|
||||
|
||||
$scope.$watchCollection('state.sort', function (sort) {
|
||||
$scope.$watchCollection('state.sort', function(sort) {
|
||||
if (!sort) return;
|
||||
|
||||
// get the current sort from {key: val} to ["key", "val"];
|
||||
@ -471,7 +471,7 @@ function discoverController(
|
||||
$scope.filters = queryFilter.getFilters();
|
||||
$scope
|
||||
.updateDataSource()
|
||||
.then(function () {
|
||||
.then(function() {
|
||||
/////////////////////////////// WAZUH ///////////////////////////////////
|
||||
if (!filtersAreReady()) return;
|
||||
discoverPendingUpdates.removeAll();
|
||||
@ -504,19 +504,19 @@ function discoverController(
|
||||
);
|
||||
|
||||
// update data source when hitting forward/back and the query changes
|
||||
$scope.$listen($state, 'fetch_with_changes', function (diff) {
|
||||
$scope.$listen($state, 'fetch_with_changes', function(diff) {
|
||||
if (diff.indexOf('query') >= 0) $scope.fetch();
|
||||
});
|
||||
|
||||
$scope.$watch('opts.timefield', function (timefield) {
|
||||
$scope.$watch('opts.timefield', function(timefield) {
|
||||
$scope.enableTimeRangeSelector = !!timefield;
|
||||
});
|
||||
|
||||
$scope.$watch('state.interval', function () {
|
||||
$scope.$watch('state.interval', function() {
|
||||
$scope.fetch();
|
||||
});
|
||||
|
||||
$scope.$watch('vis.aggs', function () {
|
||||
$scope.$watch('vis.aggs', function() {
|
||||
// no timefield, no vis, nothing to update
|
||||
if (!$scope.opts.timefield) return;
|
||||
|
||||
@ -556,7 +556,7 @@ function discoverController(
|
||||
else return status.NO_RESULTS;
|
||||
}
|
||||
|
||||
return function () {
|
||||
return function() {
|
||||
const current = {
|
||||
rows: $scope.rows,
|
||||
fetchStatus: $scope.fetchStatus
|
||||
@ -599,15 +599,15 @@ function discoverController(
|
||||
let filters = queryFilter.getFilters();
|
||||
filters = Array.isArray(filters)
|
||||
? filters.filter(
|
||||
item => (((item || {}).$state || {}).store || '') === 'appState'
|
||||
)
|
||||
item => (((item || {}).$state || {}).store || '') === 'appState'
|
||||
)
|
||||
: [];
|
||||
if (!filters || !filters.length) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
$scope.opts.fetch = $scope.fetch = function () {
|
||||
$scope.opts.fetch = $scope.fetch = function() {
|
||||
// Wazuh filters are not ready yet
|
||||
if (!filtersAreReady()) return;
|
||||
// ignore requests to fetch before the app inits
|
||||
@ -623,7 +623,7 @@ function discoverController(
|
||||
$scope
|
||||
.updateDataSource()
|
||||
.then(setupVisualization)
|
||||
.then(function () {
|
||||
.then(function() {
|
||||
$state.save();
|
||||
$scope.fetchStatus = fetchStatuses.LOADING;
|
||||
logInspectorRequest();
|
||||
@ -645,7 +645,7 @@ function discoverController(
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateQueryAndFetch = function ({ query, dateRange }) {
|
||||
$scope.updateQueryAndFetch = function({ query, dateRange }) {
|
||||
// Wazuh filters are not ready yet
|
||||
if (!filtersAreReady()) return;
|
||||
$rootScope.$broadcast('updateVis');
|
||||
@ -725,7 +725,7 @@ function discoverController(
|
||||
.ok({ json: resp });
|
||||
}
|
||||
|
||||
$scope.updateTime = function () {
|
||||
$scope.updateTime = function() {
|
||||
/////////////////////////////// WAZUH ///////////////////////////////////
|
||||
if ($location.search().tab != 'configuration') {
|
||||
loadedVisualizations.removeAll();
|
||||
@ -740,26 +740,26 @@ function discoverController(
|
||||
$scope.time = timefilter.getTime();
|
||||
};
|
||||
|
||||
$scope.toMoment = function (datetime) {
|
||||
$scope.toMoment = function(datetime) {
|
||||
return moment(datetime).format(config.get('dateFormat'));
|
||||
};
|
||||
|
||||
$scope.updateRefreshInterval = function () {
|
||||
$scope.updateRefreshInterval = function() {
|
||||
$scope.refreshInterval = timefilter.getRefreshInterval();
|
||||
};
|
||||
|
||||
$scope.onRefreshChange = function ({ isPaused, refreshInterval }) {
|
||||
$scope.onRefreshChange = function({ isPaused, refreshInterval }) {
|
||||
timefilter.setRefreshInterval({
|
||||
pause: isPaused,
|
||||
value: refreshInterval ? refreshInterval : $scope.refreshInterval.value
|
||||
});
|
||||
};
|
||||
|
||||
$scope.resetQuery = function () {
|
||||
$scope.resetQuery = function() {
|
||||
kbnUrl.change('/discover/{{id}}', { id: $route.current.params.id });
|
||||
};
|
||||
|
||||
$scope.newQuery = function () {
|
||||
$scope.newQuery = function() {
|
||||
kbnUrl.change('/discover');
|
||||
};
|
||||
|
||||
@ -776,7 +776,7 @@ function discoverController(
|
||||
};
|
||||
|
||||
// TODO: On array fields, negating does not negate the combination, rather all terms
|
||||
$scope.filterQuery = function (field, values, operation) {
|
||||
$scope.filterQuery = function(field, values, operation) {
|
||||
// Commented due to https://github.com/elastic/kibana/issues/22426
|
||||
//$scope.indexPattern.popularizeField(field, 1);
|
||||
filterActions.addFilter(
|
||||
@ -804,18 +804,18 @@ function discoverController(
|
||||
columnActions.moveColumn($scope.state.columns, columnName, newIndex);
|
||||
};
|
||||
|
||||
$scope.scrollToTop = function () {
|
||||
$scope.scrollToTop = function() {
|
||||
$window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
$scope.scrollToBottom = function () {
|
||||
$scope.scrollToBottom = function() {
|
||||
// delay scrolling to after the rows have been rendered
|
||||
$timeout(() => {
|
||||
$element.find('#discoverBottomMarker').focus();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
$scope.showAllRows = function () {
|
||||
$scope.showAllRows = function() {
|
||||
$scope.minimumVisibleRows = $scope.hits;
|
||||
};
|
||||
|
||||
@ -872,7 +872,7 @@ function discoverController(
|
||||
.onSearchRequestStart(searchSource, searchRequest);
|
||||
});
|
||||
|
||||
$scope.searchSource.setField('aggs', function () {
|
||||
$scope.searchSource.setField('aggs', function() {
|
||||
//////////////////// WAZUH ////////////////////////////////
|
||||
const result = $scope.vis.getAggConfig().toDsl();
|
||||
if (((result[2] || {}).date_histogram || {}).interval === '0ms') {
|
||||
@ -1005,7 +1005,7 @@ function discoverController(
|
||||
|
||||
queryFilter
|
||||
.addFilters(wzCurrentFilters)
|
||||
.then(() => { })
|
||||
.then(() => {})
|
||||
.catch(error => console.log(error.message || error)); // eslint-disable-line
|
||||
}
|
||||
};
|
||||
@ -1014,11 +1014,10 @@ function discoverController(
|
||||
const currentFilters = queryFilter.getFilters();
|
||||
if (currentFilters) {
|
||||
return currentFilters.filter(
|
||||
item =>
|
||||
((item || {}).$state || {}).store === 'globalState'
|
||||
item => ((item || {}).$state || {}).store === 'globalState'
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const wzEventFiltersListener = $rootScope.$on(
|
||||
'wzEventFilters',
|
||||
|
Loading…
Reference in New Issue
Block a user