fix errors

This commit is contained in:
Vyacheslav.Sviridov
2022-10-19 21:05:53 +06:00
parent d85f4da9b2
commit 6fda38692d
8 changed files with 24 additions and 20 deletions

View File

@@ -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)
}