@contrail/cli
Advanced tools
Comparing version 1.0.42 to 1.0.43
@@ -6,1 +6,2 @@ export declare function createWorkflowTemplateDefinition(object: any): Promise<any>; | ||
}): Promise<any>; | ||
export declare function deleteWorkflowTemplateDefinition(templateId: string): Promise<any>; |
@@ -15,1 +15,7 @@ import { Entities } from '@contrail/sdk'; | ||
} | ||
export async function deleteWorkflowTemplateDefinition(templateId) { | ||
return await new Entities().delete({ | ||
entityName: 'event-workflow-template-definition', | ||
id: templateId, | ||
}); | ||
} |
@@ -5,3 +5,3 @@ import inquirer from 'inquirer'; | ||
import { createWorkflowTemplate } from '../api/event-workflow-templates'; | ||
import { createWorkflowTemplateDefinition, updateWorkflowTemplateDefinition as apiUpdateWorkflowTemplateDefinition } from '../api/event-workflow-template-definition'; | ||
import { createWorkflowTemplateDefinition, deleteWorkflowTemplateDefinition, updateWorkflowTemplateDefinition as apiUpdateWorkflowTemplateDefinition } from '../api/event-workflow-template-definition'; | ||
import { getActionDeclarationIdentifier, getActionsForApp } from '../apps/deploy-app/actions-deployer'; | ||
@@ -15,3 +15,3 @@ export class WorkflowTemplateDefinitionDeployer { | ||
} | ||
let answers = await inquirer.prompt([{ | ||
const answers = await inquirer.prompt([{ | ||
type: 'list', | ||
@@ -27,16 +27,13 @@ name: 'appIdentifier', | ||
} | ||
answers = await inquirer.prompt([{ | ||
type: 'confirm', | ||
name: 'shouldInstall', | ||
message: 'Confirmation: would you like to install these workflows? (yes)', | ||
default: true, | ||
}]); | ||
if (!answers.shouldInstall) { | ||
console.log('%s Canceling installing workflows template definitions.', chalk.yellow.bold('WORKFLOW DEFINITION TEMPLATE')); | ||
return; | ||
} | ||
await this.installWorkflowTemplateDefinitions(workflowTemplateDefinitions); | ||
} | ||
async installWorkflowTemplateDefinitions(workflowTemplateDefinitions) { | ||
const answers = await inquirer.prompt([{ | ||
let answers = await inquirer.prompt([{ | ||
type: 'checkbox', | ||
name: 'workflowTemplateDefinitionsToInstall', | ||
message: 'Which workflow templates would you like to install?', | ||
choices: workflowTemplateDefinitions.map(x => { return { value: x.identifier, name: x.name }; }), | ||
}]); | ||
const workflowTemplateDefinitionsToInstall = workflowTemplateDefinitions.filter(x => answers.workflowTemplateDefinitionsToInstall.includes(x.identifier)); | ||
answers = await inquirer.prompt([{ | ||
type: 'confirm', | ||
@@ -48,3 +45,3 @@ name: 'makeActive', | ||
const makeActive = answers.makeActive; | ||
for (const definition of workflowTemplateDefinitions) { | ||
for (const definition of workflowTemplateDefinitionsToInstall) { | ||
const newObject = { | ||
@@ -88,2 +85,8 @@ name: definition.name, | ||
} | ||
// remove old templates that were removed by the app publisher | ||
const localIdentifiers = localWorkflows.map(x => this.getWorkflowDeclarationIdentifier(x, app)); | ||
const workflowTemplateDefinitionsToDelete = existingWorkflows.filter(x => !localIdentifiers.includes(x.identifier)); | ||
for (const templateToDelete of workflowTemplateDefinitionsToDelete) { | ||
await deleteWorkflowTemplateDefinition(templateToDelete.id); | ||
} | ||
} | ||
@@ -90,0 +93,0 @@ } |
export declare function deleteWorkflowTemplates(): Promise<void>; | ||
export declare function localDeleteWorkflowTemplate(): Promise<void>; | ||
export declare function localDeployWorkflowTemplate(): Promise<void>; | ||
export declare function listWorkflowTemplate(): Promise<any>; | ||
export declare function listWorkflowTemplate(): Promise<void>; |
export declare class WorkflowTemplateDeployer { | ||
deleteWorkflowTemplates(): Promise<void>; | ||
listExistingWorkflowTemplates(): Promise<any>; | ||
listExistingWorkflowTemplates(): Promise<void>; | ||
} |
@@ -22,5 +22,6 @@ import chalk from 'chalk'; | ||
const templates = await getExistingWorkflowTemplates(); | ||
console.log(templates); | ||
return templates; | ||
console.log('(Date Created) (active) workflow name'); | ||
console.log('------------------------'); | ||
console.log(chalk.green.bold(templates.map(x => `(${x.createdOn}) (${x.isActive ? 'active' : 'inactive'}) ${x.name} `).join('\n'))); | ||
} | ||
} |
{ | ||
"name": "@contrail/cli", | ||
"version": "1.0.42", | ||
"version": "1.0.43", | ||
"description": "VibeIQ's Contrail Platform CLI.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -16,2 +16,9 @@ import { Entities } from '@contrail/sdk'; | ||
}); | ||
} | ||
export async function deleteWorkflowTemplateDefinition(templateId: string) { | ||
return await new Entities().delete({ | ||
entityName: 'event-workflow-template-definition', | ||
id: templateId, | ||
}); | ||
} |
@@ -6,3 +6,3 @@ import inquirer from 'inquirer'; | ||
import { createWorkflowTemplate } from '../api/event-workflow-templates'; | ||
import { createWorkflowTemplateDefinition, updateWorkflowTemplateDefinition as apiUpdateWorkflowTemplateDefinition } from '../api/event-workflow-template-definition'; | ||
import { createWorkflowTemplateDefinition, deleteWorkflowTemplateDefinition, updateWorkflowTemplateDefinition as apiUpdateWorkflowTemplateDefinition } from '../api/event-workflow-template-definition'; | ||
import { getActionDeclarationIdentifier, getActionsForApp } from '../apps/deploy-app/actions-deployer'; | ||
@@ -19,3 +19,3 @@ | ||
let answers = await inquirer.prompt([{ | ||
const answers = await inquirer.prompt([{ | ||
type: 'list', | ||
@@ -31,14 +31,2 @@ name: 'appIdentifier', | ||
} | ||
answers = await inquirer.prompt([{ | ||
type: 'confirm', | ||
name: 'shouldInstall', | ||
message: 'Confirmation: would you like to install these workflows? (yes)', | ||
default: true, | ||
}]); | ||
if (!answers.shouldInstall) { | ||
console.log('%s Canceling installing workflows template definitions.', chalk.yellow.bold('WORKFLOW DEFINITION TEMPLATE')); | ||
return; | ||
} | ||
await this.installWorkflowTemplateDefinitions(workflowTemplateDefinitions); | ||
@@ -48,4 +36,11 @@ } | ||
async installWorkflowTemplateDefinitions(workflowTemplateDefinitions: WorkflowTemplate[]) { | ||
let answers = await inquirer.prompt([{ | ||
type: 'checkbox', | ||
name: 'workflowTemplateDefinitionsToInstall', | ||
message: 'Which workflow templates would you like to install?', | ||
choices: workflowTemplateDefinitions.map(x => {return {value: x.identifier, name: x.name};}), | ||
}]); | ||
const answers = await inquirer.prompt([{ | ||
const workflowTemplateDefinitionsToInstall = workflowTemplateDefinitions.filter(x => answers.workflowTemplateDefinitionsToInstall.includes(x.identifier)); | ||
answers = await inquirer.prompt([{ | ||
type: 'confirm', | ||
@@ -57,3 +52,3 @@ name: 'makeActive', | ||
const makeActive = answers.makeActive; | ||
for (const definition of workflowTemplateDefinitions) { | ||
for (const definition of workflowTemplateDefinitionsToInstall) { | ||
const newObject: WorkflowTemplate = { | ||
@@ -108,2 +103,9 @@ name: definition.name, | ||
} | ||
// remove old templates that were removed by the app publisher | ||
const localIdentifiers = localWorkflows.map(x=> this.getWorkflowDeclarationIdentifier(x, app)); | ||
const workflowTemplateDefinitionsToDelete = existingWorkflows.filter(x=> !localIdentifiers.includes(x.identifier)); | ||
for(const templateToDelete of workflowTemplateDefinitionsToDelete) { | ||
await deleteWorkflowTemplateDefinition(templateToDelete.id); | ||
} | ||
} | ||
@@ -110,0 +112,0 @@ } |
@@ -26,5 +26,6 @@ import chalk from 'chalk'; | ||
const templates = await getExistingWorkflowTemplates(); | ||
console.log(templates); | ||
return templates; | ||
console.log('(Date Created) (active) workflow name'); | ||
console.log('------------------------'); | ||
console.log(chalk.green.bold(templates.map(x => `(${x.createdOn}) (${x.isActive? 'active': 'inactive'}) ${x.name} `).join('\n'))); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
306580
132
6877
21