-
Notifications
You must be signed in to change notification settings - Fork 36
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
webview to start pipeline #323
Conversation
Codecov Report
@@ Coverage Diff @@
## master #323 +/- ##
==========================================
- Coverage 74.16% 72.61% -1.56%
==========================================
Files 45 47 +2
Lines 3399 3484 +85
Branches 632 644 +12
==========================================
+ Hits 2521 2530 +9
- Misses 878 954 +76
Continue to review full report at Codecov.
|
a6b5a6c
to
7897813
Compare
@evidolob and @siamaksade webview for starting pipeline. |
9a8363f
to
61492a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some vulnerabilities in packages that you add:
=== npm audit security report ===
┌──────────────────────────────────────────────────────────────────────────────┐
│ Manual Review │
│ Some vulnerabilities require your attention to resolve │
│ │
│ Visit https://go.npm.me/audit-guide for additional guidance │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Cross-Site Scripting │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ jquery │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=3.5.0 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @patternfly/react-catalog-view-extension │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ @patternfly/react-catalog-view-extension > patternfly > │
│ │ jquery │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1518 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Cross-Site Scripting │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ bootstrap-select │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=1.13.6 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @patternfly/react-catalog-view-extension │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ @patternfly/react-catalog-view-extension > patternfly > │
│ │ bootstrap-select │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1522 │
└───────────────┴──────────────────────────────────────────────────────────────┘
Can you fix them?
Also as I say in comment you should add comment for all copied files with link where you take them.
"Title": "Start Pipeline", | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Enable/disable to Start Pipeline in webView" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable/disable to Start Pipeline in webView
Is not clear as for me,
maybe Enable WebView Wizard to Start Pipeline
is better.
As for me Enable/disable
is very confusing.
static async start(pipeline: TektonNode): Promise<string> { | ||
if (Pipeline.checkWebViewStartPipeline()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe having separate command for webview wizard will be better? @siamaksade ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think enabling webview from setting would be better.
@@ -33,7 +46,7 @@ export class Pipeline extends TektonItem { | |||
const pipelineTrigger = data.map<Trigger>(value => ({ | |||
name: value.metadata.name, | |||
resources: value.spec.resources, | |||
params: value.spec.params ? value.spec.params : undefined, | |||
parameters: value.spec.params ? value.spec.params : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there you can use value.spec.params ?? undefined
see nullish-coalescing But in this case is no sense to do that check.
} | ||
|
||
|
||
export const pipelineData = async (name: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can define function instead of exporting constant, which you assign lambda, or you have particular reason to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason for using lambda. I will use function here.
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
*-----------------------------------------------------------------------------------------------*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that copied file, you need to add comment from which repository you copied all this files.
localResourceRoots: [localResourceRoot], | ||
retainContextWhenHidden: true | ||
}); | ||
panel.iconPath = vscode.Uri.file(path.join(PipelineViewLoader.extensionPath, 'images/tekton.svg')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work for windows, this line should be panel.iconPath = vscode.Uri.file(path.join(PipelineViewLoader.extensionPath, 'images','tekton.svg'));
panel.webview.html = PipelineViewLoader.getWebviewContent(PipelineViewLoader.extensionPath, context); | ||
panel.webview.onDidReceiveMessage(async (event) => { | ||
if (event.action === 'cancel') { | ||
await commands.executeCommand('workbench.action.closeActiveEditor'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use panel.webview.dispose()
instead of calling 'commands.executeCommand('workbench.action.closeActiveEditor');' command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dispose
function does not exist on type Webview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it exists on WebviewPanel
await commands.executeCommand('workbench.action.closeActiveEditor'); | ||
} | ||
if (event.action === 'start') { | ||
await commands.executeCommand('workbench.action.closeActiveEditor'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same there
path.join(reactAppRootOnDisk, 'pipelineView.js'), | ||
); | ||
const reactAppUri = reactAppPathOnDisk.with({ scheme: 'vscode-resource' }); | ||
const htmlString: Buffer = fs.readFileSync(path.join(reactAppRootOnDisk, 'index.html')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should mostly never use synchronous node API, please use readFile
instead of readFileSync
@siamaksade For start @sudhirverma just copy code from dev-console, so basically we embed part of the dev-console UI. You propose to implement own version of wizard, base on UI mockup for dev-console? To be honest I'm not very happy with that copied code, especially with it dependencies, compiled single JS file for that wizard is 24Mb, where all archive for So I'm definitely +1 to implement own, but we need to figure out how we can share that new implementation with dev-console team. And we need to be carefully about dependencies what we use in it. |
"webpack-cli": "^3.3.11" | ||
}, | ||
"dependencies": { | ||
"@kubernetes/client-node": "^0.10.2", | ||
"@patternfly/patternfly": "2.71.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All dependencies that we use in any webview should be moved to devDependencies
as we compiled them it webpack bundle, and we do not need to distribute them inside vsix
package
@evidolob I don't think we should sacrifice the UX for the sake of sharing code with dev console. If sharing code with dev console saves time, sure. If adds overhead, not sure what the value is. |
Closing this PR as we are implementing a new wizard according to vscode. |
Fix: #310
Starting Pipeline with git resource and image resource
Starting Pipeline with workspace