Skip to content

Commit

Permalink
Fix bug for listing pipelineRun from command palette
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhirverma committed Mar 19, 2021
1 parent 1bac5ad commit 340c2e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/tekton/pipelinerun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export class PipelineRun extends TektonItem {
PipelineRun.tkn.executeInTerminal(Command.describePipelineRuns(pipelineRun.getName()));
}

static async list(pipelineRun: TektonNode): Promise<void> {
if (!pipelineRun) {
pipelineRun = await window.showQuickPick(await PipelineRun.getPipelineRunNames(), { placeHolder: 'Select Pipeline Run to list', ignoreFocusOut: true });
static async list(pipeline: TektonNode): Promise<void> {
if (!pipeline) {
pipeline = await window.showQuickPick(await PipelineRun.getPipelineNames(), { placeHolder: 'Select Pipeline Run to list', ignoreFocusOut: true });
}
if (!pipelineRun) return null;
PipelineRun.tkn.executeInTerminal(Command.listPipelineRunsInTerminal(pipelineRun.getName()));
if (!pipeline) return null;
PipelineRun.tkn.executeInTerminal(Command.listPipelineRunsInTerminal(pipeline.getName()));
}

static async logs(pipelineRun: TektonNode): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/tekton/tektonitem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { tektonFSUri } from '../util/tekton-vfs';
import { TknResourceItem } from './webviewstartpipeline';
import { telemetryLogCommand, telemetryLogError } from '../telemetry';

const errorMessage = {
export const errorMessage = {
Pipeline: 'You need at least one Pipeline available. Please create new Tekton Pipeline and try again.',
PipelineRun: 'You need at least one PipelineRun available. Please create new Tekton PipelineRun and try again.',
PipelineResource: 'You need at least one PipelineResource available. Please create new Tekton PipelineResource and try again.',
Expand Down
4 changes: 2 additions & 2 deletions test/tekton/pipelinerun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as sinon from 'sinon';
import { TknImpl, Command, ContextType } from '../../src/tkn';
import { PipelineRun } from '../../src/tekton/pipelinerun';
import { TestItem } from './testTektonitem';
import { TektonItem } from '../../src/tekton/tektonitem';
import { errorMessage, TektonItem } from '../../src/tekton/tektonitem';
import * as logInEditor from '../../src/util/log-in-editor';

const expect = chai.expect;
Expand Down Expand Up @@ -66,7 +66,7 @@ suite('Tekton/PipelineRun', () => {
try {
await PipelineRun.list(null);
} catch (err) {
expect(err.message).equals('You need at least one PipelineRun available. Please create new Tekton PipelineRun and try again.');
expect(err.message).equals(errorMessage.Pipeline);
return;
}
});
Expand Down

0 comments on commit 340c2e2

Please sign in to comment.