mirror of
https://github.com/vvsviridov/enm-cli.git
synced 2025-11-03 05:33:39 +00:00
fix errors
This commit is contained in:
@@ -120,7 +120,7 @@ async function deleteNode() {
|
|||||||
url: `${this.appUrl}/projects/${this.projectId}/nodes/${this.nodeId}`,
|
url: `${this.appUrl}/projects/${this.projectId}/nodes/${this.nodeId}`,
|
||||||
}
|
}
|
||||||
const { statusText } = await this.httpClient.request(axiosConfig)
|
const { statusText } = await this.httpClient.request(axiosConfig)
|
||||||
console.log(chalk.bgGreen(`Resuming ${statusText}`))
|
console.log(chalk.bgGreen(`Deleting ${statusText}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ async function configurationsNode() {
|
|||||||
data: formData
|
data: formData
|
||||||
}
|
}
|
||||||
const { statusText } = await this.httpClient.request(axiosConfig)
|
const { statusText } = await this.httpClient.request(axiosConfig)
|
||||||
console.log(chalk.bgGreen(`Resuming ${statusText}`))
|
console.log(chalk.bgGreen(`Uploading configuration ${statusText}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ async function newProject() {
|
|||||||
const { data: { id } } = await this.httpClient.request(axiosConfig)
|
const { data: { id } } = await this.httpClient.request(axiosConfig)
|
||||||
console.log(chalk.bgGreen(`Project ${id} created!`))
|
console.log(chalk.bgGreen(`Project ${id} created!`))
|
||||||
this.projectId = id
|
this.projectId = id
|
||||||
await this.getProjectData(id)
|
await this.getProjectData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class BulkImport extends ENM {
|
|||||||
this.operationsOffset = 0
|
this.operationsOffset = 0
|
||||||
this.operationsLimit = 50
|
this.operationsLimit = 50
|
||||||
this.operationsLinks = null
|
this.operationsLinks = null
|
||||||
|
this.failures = false
|
||||||
this.prompt = ''
|
this.prompt = ''
|
||||||
this.help = 'No results...'
|
this.help = 'No results...'
|
||||||
}
|
}
|
||||||
@@ -90,7 +91,7 @@ class BulkImport extends ENM {
|
|||||||
await unsync.call(this)
|
await unsync.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
async my(){
|
async my() {
|
||||||
this.onlyMy = !this.onlyMy
|
this.onlyMy = !this.onlyMy
|
||||||
console.log(chalk.yellowBright(`Show ${this.onlyMy ? 'only my' : 'all'} jobs❗`))
|
console.log(chalk.yellowBright(`Show ${this.onlyMy ? 'only my' : 'all'} jobs❗`))
|
||||||
this.jobsOffset = 0
|
this.jobsOffset = 0
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ async function handleCommand(bulk, command) {
|
|||||||
break
|
break
|
||||||
case '_operations':
|
case '_operations':
|
||||||
case '_failures':
|
case '_failures':
|
||||||
await bulk.getOperations(command === 'failures')
|
await bulk.getOperations(command === '_failures')
|
||||||
break
|
break
|
||||||
case '_my':
|
case '_my':
|
||||||
await bulk.my()
|
await bulk.my()
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const FormData = require('form-data')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const { logJob } = require('../../../util/logJob')
|
const { logJob } = require('../../../util/logJob')
|
||||||
const logError = require('../../../util/logError')
|
|
||||||
|
|
||||||
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
|
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
|
||||||
inquirer.registerPrompt("date", require("inquirer-date-prompt"))
|
inquirer.registerPrompt("date", require("inquirer-date-prompt"))
|
||||||
@@ -22,7 +21,7 @@ const jobCommandsHelp = [
|
|||||||
'[execute] - Starts job execution.',
|
'[execute] - Starts job execution.',
|
||||||
'[unschedule] - Cancels job scheduling.',
|
'[unschedule] - Cancels job scheduling.',
|
||||||
'[operations] - Lists job operation',
|
'[operations] - Lists job operation',
|
||||||
'[failures] - Lists job operation',
|
'[failures] - Lists job failures',
|
||||||
'[export] - Exports operations to CSV file.',
|
'[export] - Exports operations to CSV file.',
|
||||||
'[revoke] - Creates XML file for undoing job.',
|
'[revoke] - Creates XML file for undoing job.',
|
||||||
'[files] - Add file to job.',
|
'[files] - Add file to job.',
|
||||||
@@ -60,7 +59,7 @@ async function deleteJob() {
|
|||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
if (!confirm) return
|
if (!confirm) return
|
||||||
const axiosConfig = {
|
const axiosConfig = {
|
||||||
text: `Deleting job ${this.jobId}...`,
|
text: `Deleting job ${this.jobId}...`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
@@ -121,7 +120,8 @@ async function files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function invocation(flow) {
|
async function invocation(command) {
|
||||||
|
const flow = command.replace(/_/, '')
|
||||||
if (!this.jobId) {
|
if (!this.jobId) {
|
||||||
throw new Error('Job Is not Selected❗')
|
throw new Error('Job Is not Selected❗')
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ async function invocation(flow) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flow === 'execute'){
|
if (flow === 'execute') {
|
||||||
const { scheduleTime } = await inquirer.prompt([
|
const { scheduleTime } = await inquirer.prompt([
|
||||||
{
|
{
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
@@ -175,7 +175,7 @@ async function unschedule() {
|
|||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
if (!confirm) return
|
if (!confirm) return
|
||||||
const axiosConfig = {
|
const axiosConfig = {
|
||||||
text: `Unschedule job ${this.jobId}...`,
|
text: `Unschedule job ${this.jobId}...`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
@@ -225,7 +225,7 @@ async function exportJob() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
timerId = setTimeout(request, 5000)
|
timerId = setTimeout(request, 5000)
|
||||||
}, 5000)
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ async function revoke() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
timerId = setTimeout(request, 5000)
|
timerId = setTimeout(request, 5000)
|
||||||
}, 5000)
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,8 @@ function setJobsPagination(href) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function pageJobs(page) {
|
async function pageJobs(command) {
|
||||||
|
const page = command.replace(/_/, '')
|
||||||
if (!this.jobsLinks[page]) {
|
if (!this.jobsLinks[page]) {
|
||||||
throw new Error(`No ${page} jobs❗`)
|
throw new Error(`No ${page} jobs❗`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,15 @@ function operationStatus(type, status) {
|
|||||||
case 'INVALID':
|
case 'INVALID':
|
||||||
case 'EXECUTION_ERROR':
|
case 'EXECUTION_ERROR':
|
||||||
return chalk.red(`❌ ${type}`)
|
return chalk.red(`❌ ${type}`)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return chalk.yellow(`🔎 ${type}`)
|
return chalk.yellow(`🔎 ${type}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function getOperations(failures=false) {
|
async function getOperations(failures = false) {
|
||||||
|
this.failures = failures
|
||||||
const params = new URLSearchParams()
|
const params = new URLSearchParams()
|
||||||
params.append('offset', this.operationsOffset)
|
params.append('offset', this.operationsOffset)
|
||||||
params.append('limit', this.operationsLimit)
|
params.append('limit', this.operationsLimit)
|
||||||
@@ -33,7 +34,7 @@ async function getOperations(failures=false) {
|
|||||||
params.append('expand', 'persistentCurrentAttributes')
|
params.append('expand', 'persistentCurrentAttributes')
|
||||||
params.append('expand', 'failures')
|
params.append('expand', 'failures')
|
||||||
params.append('expand', 'warnings')
|
params.append('expand', 'warnings')
|
||||||
if (failures) {
|
if (this.failures) {
|
||||||
params.append('status', 'invalid')
|
params.append('status', 'invalid')
|
||||||
params.append('status', 'execution-error')
|
params.append('status', 'execution-error')
|
||||||
}
|
}
|
||||||
@@ -71,12 +72,13 @@ function setOperationsPagination(href) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function pageOperations(page) {
|
async function pageOperations(command) {
|
||||||
|
const page = command.replace(/_/, '')
|
||||||
if (!this.operationsLinks[page]) {
|
if (!this.operationsLinks[page]) {
|
||||||
throw new Error(`No ${page} jobs❗`)
|
throw new Error(`No ${page} jobs❗`)
|
||||||
}
|
}
|
||||||
setOperationsPagination.call(this, this.operationsLinks[page].href)
|
setOperationsPagination.call(this, this.operationsLinks[page].href)
|
||||||
await this.getOperations()
|
await this.getOperations(this.failures)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "enm-cli",
|
"name": "enm-cli",
|
||||||
"version": "1.0.5b",
|
"version": "1.0.5c",
|
||||||
"description": "This is a cli application for Ericsson Network Manager (ENM)",
|
"description": "This is a cli application for Ericsson Network Manager (ENM)",
|
||||||
"bin": "./bin/enm-cli.js",
|
"bin": "./bin/enm-cli.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user