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

Fix/code style and use === not == #3

Merged
merged 1 commit into from
Jan 10, 2017
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
74 changes: 37 additions & 37 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,47 @@ import {getSubmissionALL, getSubmissionByJobName} from './src/submission/get'
import {startJob, stopJob, getJobStatus} from './src/submission/status'

export {
// version
getVersion,
// version
getVersion,

// authorization
createRole,
deleteRole,
getRole,
// authorization
createRole,
deleteRole,
getRole,

// connecttor
getConnectorAll,
getConnectorByConnectorName,
// connecttor
getConnectorAll,
getConnectorByConnectorName,

// driver
getDriverAll,
// driver
getDriverAll,

// job
createJob,
deleteJob,
deleteJobAll,
getJobAll,
getJobByConnectorName,
getJobByJobName,
updateJob,
updateJobEnable,
updateJobDisable,
// job
createJob,
deleteJob,
deleteJobAll,
getJobAll,
getJobByConnectorName,
getJobByJobName,
updateJob,
updateJobEnable,
updateJobDisable,

// link
createLink,
deleteLink,
deleteLinkAll,
getLinkAll,
getLinkByConnectorName,
getLinkByLinkName,
updateLink,
updateEnable,
updateDisable,
// link
createLink,
deleteLink,
deleteLinkAll,
getLinkAll,
getLinkByConnectorName,
getLinkByLinkName,
updateLink,
updateEnable,
updateDisable,

// submission
getSubmissionALL,
getSubmissionByJobName,
startJob,
stopJob,
getJobStatus
// submission
getSubmissionALL,
getSubmissionByJobName,
startJob,
stopJob,
getJobStatus
}
20 changes: 10 additions & 10 deletions src/connecttor/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import {setGetConnectorOptions} from './setOptions'
export function getConnectorAll () {
const options = setGetConnectorOptions('all')
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}
export function getConnectorByConnectorName (connectorName) {
const options = setGetConnectorOptions('subName', connectorName)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}
4 changes: 2 additions & 2 deletions src/connecttor/setOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import {setGetOptions} from '../utils/setRequestOptions'

export function setGetConnectorOptions (tag = 'all', connectorName = null) {
if (tag == 'all') {
if (tag === 'all') {
return setGetOptions(tag, 'v1/connector')
} else if (tag == 'subName') {
} else if (tag === 'subName') {
return setGetOptions(tag, 'v1/connector', connectorName)
}
}
10 changes: 5 additions & 5 deletions src/driver/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const r = require('request-promise')
export function getDriverAll () {
const options = setGetJobOptions('all')
return r(options)
.then(function (repos) {
return repos['links']
})
.catch(function (err) {
})
.then(function (repos) {
return repos['links']
})
.catch(function (err) {
})
}
2 changes: 1 addition & 1 deletion src/driver/setOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {setGetOptions} from '../utils/setRequestOptions'
const driverUri = 'v1/driver'

export function setGetJobOptions (tag = 'all') {
if (tag == 'all') {
if (tag === 'all') {
return setGetOptions(tag, driverUri)
}
}
8 changes: 4 additions & 4 deletions src/job/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const r = require('request-promise')
// }

export function createJob (jobName, fromLinkConf, toLinkConf) {
// TODO
// TODO
const options = setCreateOrUpdateJobOptions(jobName, fromLinkConf, toLinkConf)
console.log(options['body']['jobs'])
return r(options)
.then(function (repos) {
return repos
})
.then(function (repos) {
return repos
})
}
10 changes: 5 additions & 5 deletions src/job/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const r = require('request-promise')
export function deleteJob (jobName) {
const options = setDeleteJobOptions(jobName)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}

export async function deleteJobAll () {
Expand Down
30 changes: 15 additions & 15 deletions src/job/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ const r = require('request-promise')
export function getJobAll () {
const options = setGetJobOptions('all')
return r(options)
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {

})
})
}

export function getJobByJobName (jobName) {
const options = setGetJobOptions('subName', jobName)
return r(options)
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {

})
})
}

export function getJobByConnectorName () {
const options = setGetJobOptions('cname', connectorName)
return r(options)
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {
.then(function (repos) {
return repos['jobs']
})
.catch(function (err) {

})
})
}
22 changes: 11 additions & 11 deletions src/job/setOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ import {setMysqlConfig, setHdfsConfig} from './setTemplate'
const jobUri = 'v1/job'

export function setGetJobOptions (tag, jobOrConnectorName = null) {
if (tag == 'all') {
if (tag === 'all') {
return setGetOptions(tag, jobUri)
} else if (tag == 'jobName') {
} else if (tag === 'jobName') {
return setGetOptions(tag, jobUri, jobOrConnectorName)
} else if (tag == 'cname') {
} else if (tag === 'cname') {
return setGetOptions('cname', jobUri, jobOrConnectorName)
}
}

export function setCreateOrUpdateJobOptions (jobName, fromLinkConf, toLinkConf) {
// TODO
// from
// TODO
// from
let fromConfigValues
if (fromLinkConf['type'] == 'mysql') {
if (fromLinkConf['type'] === 'mysql') {
fromConfigValues = setMysqlConfig(fromLinkConf)
fromLinkConf['connectorName'] = 'generic-jdbc-connector'
} else if (fromLinkConf['type'] == 'hdfs') {
} else if (fromLinkConf['type'] === 'hdfs') {
fromConfigValues = setHdfsConfig(fromLinkConf)
fromLinkConf['connectorName'] = 'hdfs-connector'
} else {
throw Error()
}

// to
// to
let toConfigValues
if (toLinkConf['type'] == 'mysql') {
if (toLinkConf['type'] === 'mysql') {
toConfigValues = setMysqlConfig(toLinkConf)
toLinkConf['connectorName'] = 'generic-jdbc-connector'
} else if (toLinkConf['type'] == 'hdfs') {
} else if (toLinkConf['type'] === 'hdfs') {
toConfigValues = setHdfsConfig(toLinkConf)
toLinkConf['connectorName'] = 'hdfs-connector'
} else {
Expand Down Expand Up @@ -118,7 +118,7 @@ export function setDeleteJobOptions (jobName) {
}

export function setUpdateJobOptions (tag, jobName) {
if (tag == 'enable' || tag == 'disable') {
if (tag === 'enable' || tag === 'disable') {
return setPutOptions('enable', jobUri, jobName)
}
}
28 changes: 14 additions & 14 deletions src/job/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ import {setUpdateJobOptions, setCreateOrUpdateJobOptions} from './setOptions'
const r = require('request-promise')

export function updateJob (jobName, fromLinkConf, toLinkConf) {
// TODO
// TODO
const options = setCreateOrUpdateJobOptions(jobName, fromLinkConf, toLinkConf)
console.log(options['body']['jobs'])
return r(options)
.then(function (repos) {
return repos
})
.then(function (repos) {
return repos
})
}

export function updateJobEnable (jobName) {
const options = setUpdateJobOptions('enable', jobName)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}

export function updateJobDisable (jobName) {
const options = setUpdateJobOptions('disable', jobName)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}
12 changes: 6 additions & 6 deletions src/link/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const r = require('request-promise')
// }

export function createLink (linkName, param) {
// TODO 各种参数
// TODO 各种参数
const options = setCreateLinkOptions(linkName, param)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
.then(function (repos) {
return repos
})
.catch(function (err) {

})
})
}
10 changes: 5 additions & 5 deletions src/link/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const r = require('request-promise')
export function deleteLink (linkName) {
const options = setDeleteLinkOptions(linkName)
return r(options)
.then(function (repos) {
return repos
})
.catch(function (err) {
})
.then(function (repos) {
return repos
})
.catch(function (err) {
})
}

export async function deleteLinkAll () {
Expand Down
Loading