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