Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean code #615

Merged
merged 2 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"jquery" : true
},
"parserOptions": {
"ecmaVersion": 7,
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"parser": "babel-eslint",
"parser": "esprima",
"rules": {
"node/exports-style": [
"error",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
define(['../module'], function (module) {
define(['../module'], function(module) {
'use strict'

module.config([
'$stateProvider',
'BASE_URL',
function ($stateProvider, BASE_URL) {
function($stateProvider, BASE_URL) {
$stateProvider

// agents
Expand Down Expand Up @@ -40,14 +40,14 @@ define(['../module'], function (module) {
select: 'version'
}),
responseStatus &&
responseStatus.data &&
responseStatus.data.data &&
responseStatus.data.data.enabled === 'yes' &&
responseStatus.data.data.running === 'yes'
responseStatus.data &&
responseStatus.data.data &&
responseStatus.data.data.enabled === 'yes' &&
responseStatus.data.data.running === 'yes'
? $requestService.apiReq('/agents/stats/distinct', {
fields: 'node_name',
select: 'node_name'
})
fields: 'node_name',
select: 'node_name'
})
: Promise.resolve(false),
$requestService.apiReq('/agents/groups', {})
])
Expand Down Expand Up @@ -184,7 +184,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -250,7 +252,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -297,7 +301,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -338,7 +344,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -379,7 +387,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -420,7 +430,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -461,7 +473,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -527,7 +541,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -572,7 +588,10 @@ define(['../module'], function (module) {
async ($requestService, $state) => {
try {
const gdprTabs = []
const data = await $requestService.httpReq('GET', '/api/gdpr?requirement=all')
const data = await $requestService.httpReq(
'GET',
'/api/gdpr?requirement=all'
)
if (!data) return []
for (const key in data.data) {
gdprTabs.push({ title: key, content: data.data[key] })
Expand All @@ -585,7 +604,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -626,7 +647,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -690,7 +713,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -735,7 +760,10 @@ define(['../module'], function (module) {
async ($requestService, $state) => {
try {
const pciTabs = []
const data = await $requestService.httpReq('GET', '/api/pci?requirement=all')
const data = await $requestService.httpReq(
'GET',
'/api/pci?requirement=all'
)
if (!data) return []
for (const key in data.data) {
pciTabs.push({ title: key, content: data.data[key] })
Expand All @@ -748,7 +776,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -789,7 +819,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down Expand Up @@ -830,7 +862,9 @@ define(['../module'], function (module) {
],
reportingEnabled: [
'$currentDataService',
async $currentDataService => { return await $currentDataService.getReportingStatus() }
async $currentDataService => {
return await $currentDataService.getReportingStatus()
}
]
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
define(['../module'], function (module) {
define(['../module'], function(module) {
'use strict'

module.config([
'$stateProvider',
'BASE_URL',
function ($stateProvider, BASE_URL) {
function($stateProvider, BASE_URL) {
$stateProvider
// Manager
.state('manager', {
Expand Down Expand Up @@ -130,7 +130,6 @@ define(['../module'], function (module) {
}
}
]

}
})
// Manager - Decoders
Expand Down Expand Up @@ -246,14 +245,20 @@ define(['../module'], function (module) {
'$state',
async ($cdbEditor, $stateParams, $state) => {
try {
const result = await $cdbEditor.getConfiguration($stateParams.name, $stateParams.path)
return { file: $stateParams.name, path: $stateParams.path, content: result }
const result = await $cdbEditor.getConfiguration(
$stateParams.name,
$stateParams.path
)
return {
file: $stateParams.name,
path: $stateParams.path,
content: result
}
} catch (error) {
$state.go('settings.api')
}
}
]

}
})

Expand Down Expand Up @@ -330,10 +335,20 @@ define(['../module'], function (module) {
async ($requestService, $state) => {
try {
const info = {}
const clusterStatus = await $requestService.apiReq('/cluster/status')
if (clusterStatus.data.data.enabled === 'yes' && clusterStatus.data.data.running === 'yes') {
const nodesList = await $requestService.apiReq('/cluster/nodes')
Object.assign(info, { clusterEnabled: true, nodes: nodesList })
const clusterStatus = await $requestService.apiReq(
'/cluster/status'
)
if (
clusterStatus.data.data.enabled === 'yes' &&
clusterStatus.data.data.running === 'yes'
) {
const nodesList = await $requestService.apiReq(
'/cluster/nodes'
)
Object.assign(info, {
clusterEnabled: true,
nodes: nodesList
})
} else {
Object.assign(info, { clusterEnabled: false })
}
Expand Down
Loading