From cf9244730df55edbb1b4d208aeb5ec45101ac6e3 Mon Sep 17 00:00:00 2001 From: ziv-codefresh <32479607+ziv-codefresh@users.noreply.github.com> Date: Tue, 9 Jan 2018 14:30:40 +0200 Subject: [PATCH] get_pipelineid_from_workflow (#87) --- lib/interface/cli/commands/root/get.cmd.js | 4 ++-- lib/interface/cli/helpers/general.js | 2 +- lib/logic/api/workflow.js | 3 ++- lib/logic/entities/Workflow.js | 15 +++++++++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/interface/cli/commands/root/get.cmd.js b/lib/interface/cli/commands/root/get.cmd.js index 497bcb347..0c1dd3e97 100644 --- a/lib/interface/cli/commands/root/get.cmd.js +++ b/lib/interface/cli/commands/root/get.cmd.js @@ -34,12 +34,12 @@ const get = new Command({ default: false, group: 'general', }) - .option('watch_interval', { + .option('watch-interval', { describe: 'Interval time at watching mode (in seconds)', default: DEFAULTS.WATCH_INTERVAL_MS / 1000, group: 'general', }) - .coerce('watch_interval', (watchInterval) => { + .coerce('watch-interval', (watchInterval) => { return Math.max(watchInterval * 1000, DEFAULTS.WATCH_INTERVAL_MS); }); diff --git a/lib/interface/cli/helpers/general.js b/lib/interface/cli/helpers/general.js index d26f7fc76..5f6eebf25 100644 --- a/lib/interface/cli/helpers/general.js +++ b/lib/interface/cli/helpers/general.js @@ -37,7 +37,7 @@ const wrapHandler = (handler) => { throw err; } } - await Promise.delay(argv.watch_interval); + await Promise.delay(argv['watch-interval']); } } catch (err) { diff --git a/lib/logic/api/workflow.js b/lib/logic/api/workflow.js index 5ac62629e..1c1e5f8e3 100644 --- a/lib/logic/api/workflow.js +++ b/lib/logic/api/workflow.js @@ -18,11 +18,12 @@ const _extractFieldsForWorkflowEntity = (workflow) => { finished: `${finished.format('YYYY-MM-DD, hh:mm:ss')}`, totalTime, status: workflow.status, - pipeline: workflow.serviceName, + 'pipeline-name': workflow.serviceName, repository: `${workflow.repoOwner}/${workflow.repoName}`, branch: workflow.branchName, trigger: workflow.trigger, progress: workflow.progress, + 'pipeline-Id': workflow.serviceId, }; }; diff --git a/lib/logic/entities/Workflow.js b/lib/logic/entities/Workflow.js index 66db312d5..2f3e57848 100644 --- a/lib/logic/entities/Workflow.js +++ b/lib/logic/entities/Workflow.js @@ -5,8 +5,19 @@ class Workflow extends Entity { super(); this.entityType = 'workflow'; this.info = data; - this.defaultColumns = ['id', 'pipeline', 'status', 'created', 'finished', 'totalTime', 'trigger', 'repository', 'branch']; - this.wideColumns = this.defaultColumns.concat([]); + this.defaultColumns = ['id', 'pipeline-name', 'status', 'created', 'finished', 'totalTime', 'trigger', 'repository', 'branch']; + this.wideColumns = [ + 'id', + 'pipeline-name', + 'pipeline-Id', + 'status', + 'created', + 'finished', + 'totalTime', + 'trigger', + 'repository', + 'branch', + ]; } getStatus() {