Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug for listing pipelineRun from command palette #529

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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