Rename 'open database' button and only show if source available (#2945)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
- Add support for the `telemetry.telemetryLevel` setting. For more information, see the [telemetry documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/about-telemetry-in-codeql-for-visual-studio-code). [#2824](https://github.com/github/vscode-codeql/pull/2824).
|
||||
- Fix syntax highlighting directly after import statements with instantiation arguments. [#2792](https://github.com/github/vscode-codeql/pull/2792)
|
||||
- The `debug.saveBeforeStart` setting is now respected when running variant analyses. [#2950](https://github.com/github/vscode-codeql/pull/2950)
|
||||
- The 'open database' button of the model editor was renamed to 'open source'. Also, it's now only available if the source archive is available as a workspace folder. [#2945](https://github.com/github/vscode-codeql/pull/2945)
|
||||
|
||||
## 1.9.1 - 29 September 2023
|
||||
|
||||
|
||||
@@ -167,6 +167,15 @@ export class DatabaseItemImpl implements DatabaseItem {
|
||||
return encodeArchiveBasePath(sourceArchive.fsPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the database's source archive is in the workspace.
|
||||
*/
|
||||
public hasSourceArchiveInExplorer(): boolean {
|
||||
return (vscode.workspace.workspaceFolders || []).some((folder) =>
|
||||
this.belongsToSourceArchiveExplorerUri(folder.uri),
|
||||
);
|
||||
}
|
||||
|
||||
public verifyZippedSources(): string | undefined {
|
||||
const sourceArchive = this.sourceArchive;
|
||||
if (sourceArchive === undefined) {
|
||||
|
||||
@@ -56,6 +56,11 @@ export interface DatabaseItem {
|
||||
*/
|
||||
getSourceArchiveExplorerUri(): vscode.Uri;
|
||||
|
||||
/**
|
||||
* Returns true if the database's source archive is in the workspace.
|
||||
*/
|
||||
hasSourceArchiveInExplorer(): boolean;
|
||||
|
||||
/**
|
||||
* Holds if `uri` belongs to this database's source archive.
|
||||
*/
|
||||
|
||||
@@ -362,6 +362,9 @@ export class ModelEditorView extends AbstractWebview<
|
||||
const showLlmButton =
|
||||
this.databaseItem.language === "java" && this.modelConfig.llmGeneration;
|
||||
|
||||
const sourceArchiveAvailable =
|
||||
this.databaseItem.hasSourceArchiveInExplorer();
|
||||
|
||||
await this.postMessage({
|
||||
t: "setModelEditorViewState",
|
||||
viewState: {
|
||||
@@ -370,6 +373,7 @@ export class ModelEditorView extends AbstractWebview<
|
||||
showLlmButton,
|
||||
showMultipleModels: this.modelConfig.showMultipleModels,
|
||||
mode: this.mode,
|
||||
sourceArchiveAvailable,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface ModelEditorViewState {
|
||||
showLlmButton: boolean;
|
||||
showMultipleModels: boolean;
|
||||
mode: Mode;
|
||||
sourceArchiveAvailable: boolean;
|
||||
}
|
||||
|
||||
export interface MethodModelingPanelViewState {
|
||||
|
||||
@@ -226,6 +226,7 @@ LibraryRow.args = {
|
||||
showLlmButton: true,
|
||||
showMultipleModels: true,
|
||||
mode: Mode.Application,
|
||||
sourceArchiveAvailable: true,
|
||||
},
|
||||
hideModeledMethods: false,
|
||||
};
|
||||
|
||||
@@ -75,6 +75,7 @@ const viewState: ModelEditorViewState = {
|
||||
showLlmButton: true,
|
||||
showMultipleModels: true,
|
||||
mode: Mode.Application,
|
||||
sourceArchiveAvailable: true,
|
||||
};
|
||||
|
||||
export const Unmodeled = Template.bind({});
|
||||
|
||||
@@ -32,6 +32,7 @@ ModelEditor.args = {
|
||||
showLlmButton: true,
|
||||
showMultipleModels: true,
|
||||
mode: Mode.Application,
|
||||
sourceArchiveAvailable: true,
|
||||
},
|
||||
initialMethods: [
|
||||
{
|
||||
|
||||
@@ -282,10 +282,12 @@ export function ModelEditor({
|
||||
<>{viewState.extensionPack.name}</>
|
||||
</HeaderRow>
|
||||
<HeaderRow>
|
||||
<LinkIconButton onClick={onOpenDatabaseClick}>
|
||||
<span slot="start" className="codicon codicon-package"></span>
|
||||
Open database
|
||||
</LinkIconButton>
|
||||
{viewState.sourceArchiveAvailable && (
|
||||
<LinkIconButton onClick={onOpenDatabaseClick}>
|
||||
<span slot="start" className="codicon codicon-package"></span>
|
||||
Open source
|
||||
</LinkIconButton>
|
||||
)}
|
||||
<LinkIconButton onClick={onOpenExtensionPackClick}>
|
||||
<span slot="start" className="codicon codicon-package"></span>
|
||||
Open extension pack
|
||||
|
||||
@@ -22,6 +22,7 @@ describe(LibraryRow.name, () => {
|
||||
showLlmButton: false,
|
||||
showMultipleModels: false,
|
||||
extensionPack: createMockExtensionPack(),
|
||||
sourceArchiveAvailable: true,
|
||||
};
|
||||
|
||||
const render = (props: Partial<LibraryRowProps> = {}) =>
|
||||
|
||||
@@ -39,6 +39,7 @@ describe(MethodRow.name, () => {
|
||||
showLlmButton: false,
|
||||
showMultipleModels: false,
|
||||
extensionPack: createMockExtensionPack(),
|
||||
sourceArchiveAvailable: true,
|
||||
};
|
||||
|
||||
const render = (props: Partial<MethodRowProps> = {}) =>
|
||||
|
||||
@@ -49,6 +49,7 @@ describe(ModeledMethodDataGrid.name, () => {
|
||||
showLlmButton: false,
|
||||
showMultipleModels: false,
|
||||
extensionPack: createMockExtensionPack(),
|
||||
sourceArchiveAvailable: true,
|
||||
};
|
||||
|
||||
const render = (props: Partial<ModeledMethodDataGridProps> = {}) =>
|
||||
|
||||
@@ -50,6 +50,7 @@ describe(ModeledMethodsList.name, () => {
|
||||
showLlmButton: false,
|
||||
showMultipleModels: false,
|
||||
extensionPack: createMockExtensionPack(),
|
||||
sourceArchiveAvailable: true,
|
||||
};
|
||||
|
||||
const render = (props: Partial<ModeledMethodsListProps> = {}) =>
|
||||
|
||||
Reference in New Issue
Block a user