refresh tree after adding or removing project
This commit is contained in:
parent
aff8fcd592
commit
d8ba312721
3 changed files with 14 additions and 7 deletions
|
@ -24,7 +24,7 @@ import { refreshUsersList } from "./users/refreshUsersList";
|
||||||
import { viewUserPrefs } from "./users/viewUserPrefs";
|
import { viewUserPrefs } from "./users/viewUserPrefs";
|
||||||
import { editPermission } from "./database/permissions/editPermission";
|
import { editPermission } from "./database/permissions/editPermission";
|
||||||
import { setActiveProject } from "./project/setActiveProject";
|
import { setActiveProject } from "./project/setActiveProject";
|
||||||
import { removeProject } from './project/removeProject';
|
import { removeProject } from "./project/removeProject";
|
||||||
|
|
||||||
class CommandRegistrar {
|
class CommandRegistrar {
|
||||||
constructor(private readonly context: ExtensionContext) {}
|
constructor(private readonly context: ExtensionContext) {}
|
||||||
|
@ -57,7 +57,7 @@ export function registerCommands(context: ExtensionContext): void {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** General **/
|
/** General **/
|
||||||
registerCommand("Connect", connectAppwrite);
|
registerCommand("Connect", connectAppwrite, "all");
|
||||||
|
|
||||||
/** Users **/
|
/** Users **/
|
||||||
registerCommand("openUserInConsole", openUserInConsole);
|
registerCommand("openUserInConsole", openUserInConsole);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as vscode from "vscode";
|
import * as vscode from "vscode";
|
||||||
import { getActiveProjectId, getAppwriteProjects } from '../../settings';
|
import { getActiveProjectId, getAppwriteProjects } from "../../settings";
|
||||||
import { ProjectTreeItem } from './ProjectTreeItem';
|
import { refreshTree } from "../../utils/refreshTree";
|
||||||
|
import { ProjectTreeItem } from "./ProjectTreeItem";
|
||||||
|
|
||||||
export class ProjectsTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
|
export class ProjectsTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
|
||||||
private _onDidChangeTreeData: vscode.EventEmitter<vscode.TreeItem | undefined | void> = new vscode.EventEmitter<
|
private _onDidChangeTreeData: vscode.EventEmitter<vscode.TreeItem | undefined | void> = new vscode.EventEmitter<
|
||||||
|
@ -9,7 +10,13 @@ export class ProjectsTreeItemProvider implements vscode.TreeDataProvider<vscode.
|
||||||
|
|
||||||
readonly onDidChangeTreeData: vscode.Event<vscode.TreeItem | undefined | void> = this._onDidChangeTreeData.event;
|
readonly onDidChangeTreeData: vscode.Event<vscode.TreeItem | undefined | void> = this._onDidChangeTreeData.event;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {
|
||||||
|
vscode.workspace.onDidChangeConfiguration((e) => {
|
||||||
|
if (e.affectsConfiguration("appwrite")) {
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
refresh(): void {
|
refresh(): void {
|
||||||
this._onDidChangeTreeData.fire();
|
this._onDidChangeTreeData.fire();
|
||||||
|
|
|
@ -8,8 +8,8 @@ export function refreshTree(...trees: (keyof AppwriteTree)[]): void {
|
||||||
|
|
||||||
export function refreshAllViews(): void {
|
export function refreshAllViews(): void {
|
||||||
if (ext.tree) {
|
if (ext.tree) {
|
||||||
Object.keys(ext.tree).forEach((tree) => {
|
for (const tree in ext.tree) {
|
||||||
refreshTree(tree as keyof AppwriteTree);
|
refreshTree(tree as keyof AppwriteTree);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue