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 { editPermission } from "./database/permissions/editPermission";
|
||||
import { setActiveProject } from "./project/setActiveProject";
|
||||
import { removeProject } from './project/removeProject';
|
||||
import { removeProject } from "./project/removeProject";
|
||||
|
||||
class CommandRegistrar {
|
||||
constructor(private readonly context: ExtensionContext) {}
|
||||
|
@ -57,7 +57,7 @@ export function registerCommands(context: ExtensionContext): void {
|
|||
};
|
||||
|
||||
/** General **/
|
||||
registerCommand("Connect", connectAppwrite);
|
||||
registerCommand("Connect", connectAppwrite, "all");
|
||||
|
||||
/** Users **/
|
||||
registerCommand("openUserInConsole", openUserInConsole);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as vscode from "vscode";
|
||||
import { getActiveProjectId, getAppwriteProjects } from '../../settings';
|
||||
import { ProjectTreeItem } from './ProjectTreeItem';
|
||||
import { getActiveProjectId, getAppwriteProjects } from "../../settings";
|
||||
import { refreshTree } from "../../utils/refreshTree";
|
||||
import { ProjectTreeItem } from "./ProjectTreeItem";
|
||||
|
||||
export class ProjectsTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
|
||||
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;
|
||||
|
||||
constructor() {}
|
||||
constructor() {
|
||||
vscode.workspace.onDidChangeConfiguration((e) => {
|
||||
if (e.affectsConfiguration("appwrite")) {
|
||||
this.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
refresh(): void {
|
||||
this._onDidChangeTreeData.fire();
|
||||
|
|
|
@ -8,8 +8,8 @@ export function refreshTree(...trees: (keyof AppwriteTree)[]): void {
|
|||
|
||||
export function refreshAllViews(): void {
|
||||
if (ext.tree) {
|
||||
Object.keys(ext.tree).forEach((tree) => {
|
||||
for (const tree in ext.tree) {
|
||||
refreshTree(tree as keyof AppwriteTree);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue