Lint and prettier

This commit is contained in:
JuanCarlos 2019-07-25 16:44:55 +02:00 committed by Jesús Ángel
parent 3797a66e6b
commit b7d160652d
12 changed files with 68 additions and 30 deletions

View File

@ -862,7 +862,9 @@ export class AgentsController {
{} {}
); );
this.errorHandler.info( this.errorHandler.info(
`Policy monitoring scan launched successfully on agent ${this.$scope.agent.id}`, `Policy monitoring scan launched successfully on agent ${
this.$scope.agent.id
}`,
'' ''
); );
} catch (error) { } catch (error) {

View File

@ -109,13 +109,13 @@ export class FilesController {
isOverwrite: !!this.overwriteError isOverwrite: !!this.overwriteError
}; };
(isNewFile && this.$scope.type === 'rules') || (isNewFile && this.$scope.type === 'rules') ||
(!isNewFile && this.$scope.currentFile.type === 'rule') (!isNewFile && this.$scope.currentFile.type === 'rule')
? (objParam.rule = isNewFile ? (objParam.rule = isNewFile
? this.selectedItem ? this.selectedItem
: this.$scope.currentFile) : this.$scope.currentFile)
: (objParam.decoder = isNewFile : (objParam.decoder = isNewFile
? this.selectedItem ? this.selectedItem
: this.$scope.currentFile); : this.$scope.currentFile);
this.$scope.$broadcast('saveXmlFile', objParam); this.$scope.$broadcast('saveXmlFile', objParam);
this.$scope.$applyAsync(); this.$scope.$applyAsync();
} }
@ -142,7 +142,7 @@ export class FilesController {
this.$scope.$applyAsync(); this.$scope.$applyAsync();
}); });
this.$scope.$on('closeRulesetFile', (ev) => { this.$scope.$on('closeRulesetFile', () => {
this.$scope.closeEditingFile(true); this.$scope.closeEditingFile(true);
this.$scope.$applyAsync(); this.$scope.$applyAsync();
}); });
@ -170,13 +170,13 @@ export class FilesController {
this.$scope.fetchedXML = this.$scope.fetchedXML =
this.$scope.type === 'rules' this.$scope.type === 'rules'
? await this.rulesetHandler.getRuleConfiguration( ? await this.rulesetHandler.getRuleConfiguration(
this.$scope.currentFile.file, this.$scope.currentFile.file,
readonly readonly
) )
: await this.rulesetHandler.getDecoderConfiguration( : await this.rulesetHandler.getDecoderConfiguration(
this.$scope.currentFile.file, this.$scope.currentFile.file,
readonly readonly
); );
this.$scope.$applyAsync(); this.$scope.$applyAsync();
if (!readonly) { if (!readonly) {
this.$scope.$broadcast('fetchedFile', { data: this.$scope.fetchedXML }); this.$scope.$broadcast('fetchedFile', { data: this.$scope.fetchedXML });

View File

@ -537,7 +537,9 @@ export function GroupsController(
})); }));
$scope.failedErrors = groupBy(failedErrors, 'message') || false; $scope.failedErrors = groupBy(failedErrors, 'message') || false;
errorHandler.info( errorHandler.info(
`Group has been updated but an error has occurred with ${failedIds.length} agents`, `Group has been updated but an error has occurred with ${
failedIds.length
} agents`,
'', '',
true true
); );

View File

@ -205,7 +205,9 @@ export class ApiTable extends Component {
<EuiButtonIcon <EuiButtonIcon
onClick={() => this.toggleDetails(item)} onClick={() => this.toggleDetails(item)}
aria-label={ aria-label={
itemIdToExpandedRowMap[item.id] ? 'Collapse edition' : 'Expand edition' itemIdToExpandedRowMap[item.id]
? 'Collapse edition'
: 'Expand edition'
} }
iconType={ iconType={
itemIdToExpandedRowMap[item.id] ? 'arrowUp' : 'arrowDown' itemIdToExpandedRowMap[item.id] ? 'arrowUp' : 'arrowDown'

View File

@ -219,7 +219,9 @@ export class SettingsController {
this.$scope.$applyAsync(); this.$scope.$applyAsync();
this.errorHandler.info( this.errorHandler.info(
`API ${this.apiEntries[index]._source.cluster_info.manager} set as default`, `API ${
this.apiEntries[index]._source.cluster_info.manager
} set as default`,
'Settings' 'Settings'
); );

View File

@ -135,7 +135,10 @@ class WzRegisterAgents {
try { try {
const data = await apiReq.request( const data = await apiReq.request(
'PUT', 'PUT',
`/agents/${$scope.registerObj.systems[$scope.registerObj.selectedSystem].steps[3].id}/restart`, `/agents/${
$scope.registerObj.systems[$scope.registerObj.selectedSystem]
.steps[3].id
}/restart`,
{} {}
); );
const result = ((data || {}).data || {}).data || false; const result = ((data || {}).data || {}).data || false;
@ -143,7 +146,10 @@ class WzRegisterAgents {
throw new Error('Unexpected error restarting agent'); throw new Error('Unexpected error restarting agent');
} }
errorHandler.info( errorHandler.info(
`Success. Agent ${$scope.registerObj.systems[$scope.registerObj.selectedSystem].steps[0].agentName} has been registered.` `Success. Agent ${
$scope.registerObj.systems[$scope.registerObj.selectedSystem]
.steps[0].agentName
} has been registered.`
); );
$scope.nextStep(); $scope.nextStep();
} catch (error) { } catch (error) {

View File

@ -286,7 +286,9 @@ app.directive('wzXmlFileEditor', function() {
} catch (err) { } catch (err) {
params.showRestartManager = 'warn'; params.showRestartManager = 'warn';
} }
const msg = `Success. Node (${params.node}) configuration has been updated`; const msg = `Success. Node (${
params.node
}) configuration has been updated`;
params.showRestartManager params.showRestartManager
? params.showRestartManager !== 'warn' ? params.showRestartManager !== 'warn'
? showRestartMessage(msg, params.node) ? showRestartMessage(msg, params.node)

View File

@ -159,7 +159,9 @@ export class WazuhApiElasticCtrl {
); );
log( log(
'wazuh-api-elastic:saveAPI', 'wazuh-api-elastic:saveAPI',
`${req.payload.user}:*****@${req.payload.url}:${req.payload.port} entry saved successfully`, `${req.payload.user}:*****@${req.payload.url}:${
req.payload.port
} entry saved successfully`,
'debug' 'debug'
); );

View File

@ -46,7 +46,9 @@ export class WazuhElasticCtrl {
if (source.installationDate && source.lastRestart) { if (source.installationDate && source.lastRestart) {
log( log(
'wazuh-elastic:getTimeStamp', 'wazuh-elastic:getTimeStamp',
`Installation date: ${data.hits.hits[0]._source.installationDate}. Last restart: ${data.hits.hits[0]._source.lastRestart}`, `Installation date: ${
data.hits.hits[0]._source.installationDate
}. Last restart: ${data.hits.hits[0]._source.lastRestart}`,
'debug' 'debug'
); );
return { return {
@ -505,7 +507,9 @@ export class WazuhElasticCtrl {
let query = ''; let query = '';
if (title === 'Wazuh App Cluster Overview') { if (title === 'Wazuh App Cluster Overview') {
for (const node of nodes) { for (const node of nodes) {
query += `.es(index=${pattern_name},q="cluster.name: ${name} AND cluster.node: ${node.name}").label("${node.name}"),`; query += `.es(index=${pattern_name},q="cluster.name: ${name} AND cluster.node: ${
node.name
}").label("${node.name}"),`;
} }
query = query.substring(0, query.length - 1); query = query.substring(0, query.length - 1);
} else if (title === 'Wazuh App Cluster Overview Manager') { } else if (title === 'Wazuh App Cluster Overview Manager') {

View File

@ -1041,12 +1041,16 @@ export class WazuhReportingCtrl {
if (lastScan && lastScan.data) { if (lastScan && lastScan.data) {
if (lastScan.data.start && lastScan.data.end) { if (lastScan.data.start && lastScan.data.end) {
this.dd.content.push({ this.dd.content.push({
text: `Last policy monitoring scan was executed from ${lastScan.data.start} to ${lastScan.data.end}.`, text: `Last policy monitoring scan was executed from ${
lastScan.data.start
} to ${lastScan.data.end}.`,
style: 'standard' style: 'standard'
}); });
} else if (lastScan.data.start) { } else if (lastScan.data.start) {
this.dd.content.push({ this.dd.content.push({
text: `Policy monitoring scan is currently in progress for this agent (started on ${lastScan.data.start}).`, text: `Policy monitoring scan is currently in progress for this agent (started on ${
lastScan.data.start
}).`,
style: 'standard' style: 'standard'
}); });
} else { } else {
@ -1164,11 +1168,15 @@ export class WazuhReportingCtrl {
if (lastScan && lastScan.data) { if (lastScan && lastScan.data) {
if (lastScan.data.start && lastScan.data.end) { if (lastScan.data.start && lastScan.data.end) {
this.dd.content.push({ this.dd.content.push({
text: `Last file integrity monitoring scan was executed from ${lastScan.data.start} to ${lastScan.data.end}.` text: `Last file integrity monitoring scan was executed from ${
lastScan.data.start
} to ${lastScan.data.end}.`
}); });
} else if (lastScan.data.start) { } else if (lastScan.data.start) {
this.dd.content.push({ this.dd.content.push({
text: `File integrity monitoring scan is currently in progress for this agent (started on ${lastScan.data.start}).` text: `File integrity monitoring scan is currently in progress for this agent (started on ${
lastScan.data.start
}).`
}); });
} else { } else {
this.dd.content.push({ this.dd.content.push({

View File

@ -260,7 +260,9 @@ export function Initialize(server) {
reindexResult.length === 2 && reindexResult.length === 2 &&
log( log(
'initialize:init', 'initialize:init',
`${reindexResult[0].value} (${reindexResult[0].result}) / ${reindexResult[1].value} (${reindexResult[1].result})`, `${reindexResult[0].value} (${reindexResult[0].result}) / ${
reindexResult[1].value
} (${reindexResult[1].result})`,
'debug' 'debug'
); );
} catch (error) { } catch (error) {
@ -340,7 +342,9 @@ export function Initialize(server) {
await wzWrapper.getTemplateByName('wazuh-kibana'); await wzWrapper.getTemplateByName('wazuh-kibana');
log( log(
'initialize:checkKibanaStatus', 'initialize:checkKibanaStatus',
`No need to create the ${wzWrapper.WZ_KIBANA_INDEX} template, already exists.`, `No need to create the ${
wzWrapper.WZ_KIBANA_INDEX
} template, already exists.`,
'debug' 'debug'
); );
await createEmptyKibanaIndex(); await createEmptyKibanaIndex();

View File

@ -98,7 +98,9 @@ export class Monitoring {
!this.quiet && !this.quiet &&
log( log(
'monitoring:configuration', 'monitoring:configuration',
`wazuh.monitoring.pattern: ${this.index_pattern} (index prefix: ${this.index_prefix})`, `wazuh.monitoring.pattern: ${this.index_pattern} (index prefix: ${
this.index_prefix
})`,
'debug' 'debug'
); );
} catch (error) { } catch (error) {
@ -265,7 +267,9 @@ export class Monitoring {
}; };
log( log(
'monitoring:loadCredentials', 'monitoring:loadCredentials',
`Calling checkAndSaveStatus for API: ${apiEntry.url}:${apiEntry.port}`, `Calling checkAndSaveStatus for API: ${apiEntry.url}:${
apiEntry.port
}`,
'debug' 'debug'
); );
await this.checkAndSaveStatus(apiEntry); await this.checkAndSaveStatus(apiEntry);