-
Notifications
You must be signed in to change notification settings - Fork 226
Handle viewLoaded message
#1574
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
Changes from all commits
76a00e5
866b137
99d2df2
627bb59
60faed1
2ae9514
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,11 @@ import { FromVariantAnalysisMessage, ToVariantAnalysisMessage } from '../pure/in | |
| import { assertNever } from '../pure/helpers-pure'; | ||
| import { | ||
| VariantAnalysis, | ||
| VariantAnalysisQueryLanguage, | ||
| VariantAnalysisRepoStatus, | ||
| VariantAnalysisScannedRepositoryResult, | ||
| VariantAnalysisScannedRepositoryState, | ||
| VariantAnalysisStatus | ||
| } from './shared/variant-analysis'; | ||
| import { VariantAnalysisViewInterface, VariantAnalysisViewManager } from './variant-analysis-view-manager'; | ||
| import { showAndLogWarningMessage } from '../helpers'; | ||
|
|
||
| export class VariantAnalysisView extends AbstractWebview<ToVariantAnalysisMessage, FromVariantAnalysisMessage> implements VariantAnalysisViewInterface { | ||
| public static readonly viewType = 'codeQL.variantAnalysis'; | ||
|
|
@@ -82,14 +80,7 @@ export class VariantAnalysisView extends AbstractWebview<ToVariantAnalysisMessag | |
| protected async onMessage(msg: FromVariantAnalysisMessage): Promise<void> { | ||
| switch (msg.t) { | ||
| case 'viewLoaded': | ||
| this.onWebViewLoaded(); | ||
|
|
||
| void logger.log('Variant analysis view loaded'); | ||
|
|
||
| await this.postMessage({ | ||
| t: 'setVariantAnalysis', | ||
| variantAnalysis: this.getVariantAnalysis(), | ||
| }); | ||
| await this.onWebViewLoaded(); | ||
|
|
||
| break; | ||
| case 'stopVariantAnalysis': | ||
|
|
@@ -103,152 +94,21 @@ export class VariantAnalysisView extends AbstractWebview<ToVariantAnalysisMessag | |
| } | ||
| } | ||
|
|
||
| private getVariantAnalysis(): VariantAnalysis { | ||
| return { | ||
| id: this.variantAnalysisId, | ||
| controllerRepoId: 1, | ||
| actionsWorkflowRunId: 789263, | ||
| query: { | ||
| name: 'Example query', | ||
| filePath: 'example.ql', | ||
| language: VariantAnalysisQueryLanguage.Javascript, | ||
| }, | ||
| databases: {}, | ||
| status: VariantAnalysisStatus.InProgress, | ||
| scannedRepos: [ | ||
| { | ||
| repository: { | ||
| id: 1, | ||
| fullName: 'octodemo/hello-world-1', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 2, | ||
| fullName: 'octodemo/hello-world-2', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 3, | ||
| fullName: 'octodemo/hello-world-3', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 4, | ||
| fullName: 'octodemo/hello-world-4', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 5, | ||
| fullName: 'octodemo/hello-world-5', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 6, | ||
| fullName: 'octodemo/hello-world-6', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 7, | ||
| fullName: 'octodemo/hello-world-7', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 8, | ||
| fullName: 'octodemo/hello-world-8', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 9, | ||
| fullName: 'octodemo/hello-world-9', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| { | ||
| repository: { | ||
| id: 10, | ||
| fullName: 'octodemo/hello-world-10', | ||
| private: false, | ||
| }, | ||
| analysisStatus: VariantAnalysisRepoStatus.Pending, | ||
| }, | ||
| ], | ||
| skippedRepos: { | ||
| notFoundRepos: { | ||
| repositoryCount: 2, | ||
| repositories: [ | ||
| { | ||
| fullName: 'octodemo/hello-globe' | ||
| }, | ||
| { | ||
| fullName: 'octodemo/hello-planet' | ||
| } | ||
| ] | ||
| }, | ||
| noCodeqlDbRepos: { | ||
| repositoryCount: 4, | ||
| repositories: [ | ||
| { | ||
| id: 100, | ||
| fullName: 'octodemo/no-db-1' | ||
| }, | ||
| { | ||
| id: 101, | ||
| fullName: 'octodemo/no-db-2' | ||
| }, | ||
| { | ||
| id: 102, | ||
| fullName: 'octodemo/no-db-3' | ||
| }, | ||
| { | ||
| id: 103, | ||
| fullName: 'octodemo/no-db-4' | ||
| } | ||
| ] | ||
| }, | ||
| overLimitRepos: { | ||
| repositoryCount: 1, | ||
| repositories: [ | ||
| { | ||
| id: 201, | ||
| fullName: 'octodemo/over-limit-1' | ||
| } | ||
| ] | ||
| }, | ||
| accessMismatchRepos: { | ||
| repositoryCount: 1, | ||
| repositories: [ | ||
| { | ||
| id: 205, | ||
| fullName: 'octodemo/private' | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| }; | ||
| protected async onWebViewLoaded() { | ||
| super.onWebViewLoaded(); | ||
|
|
||
| void logger.log('Variant analysis view loaded'); | ||
|
|
||
| const variantAnalysis = await this.manager.getVariantAnalysis(this.variantAnalysisId); | ||
|
|
||
| if (!variantAnalysis) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we show a notification to the user to tell them something went wrong?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that would indeed be useful, I'll add a |
||
| void showAndLogWarningMessage('Unable to load variant analysis'); | ||
| return; | ||
| } | ||
|
|
||
| await this.postMessage({ | ||
| t: 'setVariantAnalysis', | ||
| variantAnalysis, | ||
| }); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.