Create function tags

This commit is contained in:
alexweininger 2021-05-31 00:58:19 -05:00
parent 7624a7fc77
commit 0987ae3ec5
24 changed files with 357 additions and 143 deletions

View file

@ -6,6 +6,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [Unreleased] ## [Unreleased]
## Added
- You can now easily create function tags from multiple places in the extension.
## [0.1.0] - 2021-5-29 ## [0.1.0] - 2021-5-29
## Functions! ## Functions!

View file

@ -40,245 +40,300 @@
{ {
"command": "vscode-appwrite.Connect", "command": "vscode-appwrite.Connect",
"title": "Connect to Appwrite", "title": "Connect to Appwrite",
"category": "" "category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.CreateUser", "command": "vscode-appwrite.CreateUser",
"title": "Create user", "title": "Create user",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.DeleteUser", "command": "vscode-appwrite.DeleteUser",
"title": "Delete user", "title": "Delete user",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.GetUserLogs", "command": "vscode-appwrite.GetUserLogs",
"title": "Get user logs", "title": "Get user logs",
"icon": "$(output)" "icon": "$(output)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openUserInConsole", "command": "vscode-appwrite.openUserInConsole",
"title": "View user in Appwrite console", "title": "View user in Appwrite console",
"icon": "$(link-external)" "icon": "$(link-external)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.viewUserPrefs", "command": "vscode-appwrite.viewUserPrefs",
"title": "View user preferences", "title": "View user preferences",
"icon": "$(json)" "icon": "$(json)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshEntry", "command": "vscode-appwrite.refreshEntry",
"title": "Refresh", "title": "Refresh",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.copyUserId", "command": "vscode-appwrite.copyUserId",
"title": "Copy user ID", "title": "Copy user ID",
"icon": "$(clippy)" "icon": "$(clippy)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.copyUserEmail", "command": "vscode-appwrite.copyUserEmail",
"title": "Copy user email", "title": "Copy user email",
"icon": "$(clippy)" "icon": "$(clippy)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshUsersList", "command": "vscode-appwrite.refreshUsersList",
"title": "Refresh users list", "title": "Refresh users list",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.OpenUsersDocumentation", "command": "vscode-appwrite.OpenUsersDocumentation",
"title": "Open documentation", "title": "Open documentation",
"icon": "$(book)" "icon": "$(book)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.OpenDatabaseDocumentation", "command": "vscode-appwrite.OpenDatabaseDocumentation",
"title": "Open documentation", "title": "Open documentation",
"icon": "$(book)" "icon": "$(book)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.viewDocumentAsJson", "command": "vscode-appwrite.viewDocumentAsJson",
"title": "View as JSON" "title": "View as JSON",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.viewCollectionAsJson", "command": "vscode-appwrite.viewCollectionAsJson",
"title": "View collection as JSON" "title": "View collection as JSON",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshCollection", "command": "vscode-appwrite.refreshCollection",
"title": "Refresh", "title": "Refresh",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.createRule", "command": "vscode-appwrite.createRule",
"title": "Create collection rule", "title": "Create collection rule",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.removeRule", "command": "vscode-appwrite.removeRule",
"title": "Remove collection rule" "title": "Remove collection rule",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deleteDocument", "command": "vscode-appwrite.deleteDocument",
"title": "Delete document" "title": "Delete document",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deleteCollection", "command": "vscode-appwrite.deleteCollection",
"title": "Delete collection" "title": "Delete collection",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshCollectionsList", "command": "vscode-appwrite.refreshCollectionsList",
"title": "Refresh", "title": "Refresh",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.createCollection", "command": "vscode-appwrite.createCollection",
"title": "Create collection", "title": "Create collection",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.createPermission", "command": "vscode-appwrite.createPermission",
"title": "Create permission", "title": "Create permission",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deletePermission", "command": "vscode-appwrite.deletePermission",
"title": "Delete permission", "title": "Delete permission",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.editPermission", "command": "vscode-appwrite.editPermission",
"title": "Edit permission", "title": "Edit permission",
"icon": "$(edit)" "icon": "$(edit)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshHealth", "command": "vscode-appwrite.refreshHealth",
"title": "Refresh health", "title": "Refresh health",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openHealthDocumentation", "command": "vscode-appwrite.openHealthDocumentation",
"title": "Open health documentation", "title": "Open health documentation",
"icon": "$(book)" "icon": "$(book)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshStorage", "command": "vscode-appwrite.refreshStorage",
"title": "Refresh storage", "title": "Refresh storage",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openStorageDocumentation", "command": "vscode-appwrite.openStorageDocumentation",
"title": "Open storage documentation", "title": "Open storage documentation",
"icon": "$(book)" "icon": "$(book)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.addProject", "command": "vscode-appwrite.addProject",
"title": "Add Appwrite project", "title": "Add Appwrite project",
"icon": "$(plus)" "icon": "$(plus)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.setActiveProject", "command": "vscode-appwrite.setActiveProject",
"title": "Set as active" "title": "Set as active",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshProjects", "command": "vscode-appwrite.refreshProjects",
"title": "Refresh projects", "title": "Refresh projects",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.refreshFunctions", "command": "vscode-appwrite.refreshFunctions",
"title": "Refresh functions", "title": "Refresh functions",
"icon": "$(refresh)" "icon": "$(refresh)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.removeProject", "command": "vscode-appwrite.removeProject",
"title": "Remove project", "title": "Remove project",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.CreateTag", "command": "vscode-appwrite.CreateTag",
"title": "Create function tag", "title": "Create function tag",
"icon": "$(cloud-upload)" "icon": "$(cloud-upload)",
"shortTitle": "Create function tag",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deleteTag", "command": "vscode-appwrite.deleteTag",
"title": "Delete tag", "title": "Delete tag",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.CreateExecution", "command": "vscode-appwrite.CreateExecution",
"title": "Execute" "title": "Execute",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.activateTag", "command": "vscode-appwrite.activateTag",
"title": "Activate" "title": "Activate",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.editValue", "command": "vscode-appwrite.editValue",
"title": "Edit", "title": "Edit",
"icon": "$(edit)" "icon": "$(edit)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deleteFunction", "command": "vscode-appwrite.deleteFunction",
"title": "Delete", "title": "Delete",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openFunctionsDocumentation", "command": "vscode-appwrite.openFunctionsDocumentation",
"title": "Open functions documentation", "title": "Open functions documentation",
"icon": "$(book)" "icon": "$(book)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.createFunction", "command": "vscode-appwrite.createFunction",
"title": "Create function", "title": "Create function",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.createFunctionVar", "command": "vscode-appwrite.createFunctionVar",
"title": "Create variable", "title": "Create variable",
"icon": "$(add)" "icon": "$(add)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.deleteFunctionVar", "command": "vscode-appwrite.deleteFunctionVar",
"title": "Delete variable", "title": "Delete variable",
"icon": "$(trash)" "icon": "$(trash)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.viewExecutionOutput", "command": "vscode-appwrite.viewExecutionOutput",
"title": "View execution stdout", "title": "View execution stdout",
"enablement": "viewItem =~ /^((execution|execution_outputOnly))$/" "enablement": "viewItem =~ /^((execution|execution_outputOnly))$/",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.viewExecutionErrors", "command": "vscode-appwrite.viewExecutionErrors",
"title": "View execution stderr", "title": "View execution stderr",
"enablement": "viewItem =~ /^((execution|execution_errorOnly))$/" "enablement": "viewItem =~ /^((execution|execution_errorOnly))$/",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.copyExecutionOutput", "command": "vscode-appwrite.copyExecutionOutput",
"title": "Copy execution stdout", "title": "Copy execution stdout",
"enablement": "viewItem =~ /^((execution|execution_outputOnly))$/" "enablement": "viewItem =~ /^((execution|execution_outputOnly))$/",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.copyExecutionErrors", "command": "vscode-appwrite.copyExecutionErrors",
"title": "Copy execution stderr", "title": "Copy execution stderr",
"enablement": "viewItem =~ /^((execution|execution_errorOnly))$/" "enablement": "viewItem =~ /^((execution|execution_errorOnly))$/",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openExecutionsInBrowser", "command": "vscode-appwrite.openExecutionsInBrowser",
"title": "View executions in browser", "title": "View executions in browser",
"enablement": "viewItem =~ /^(executions)$/", "enablement": "viewItem =~ /^(executions)$/",
"icon": "$(link-external)" "icon": "$(link-external)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openFunctionTagsInBrowser", "command": "vscode-appwrite.openFunctionTagsInBrowser",
"title": "Open function tags in browser", "title": "Open function tags in browser",
"icon": "$(link-external)" "icon": "$(link-external)",
"category": "Appwrite"
}, },
{ {
"command": "vscode-appwrite.openFunctionSettingsInBrowser", "command": "vscode-appwrite.openFunctionSettingsInBrowser",
"title": "Open function settings in browser", "title": "Open function settings in browser",
"icon": "$(link-external)" "icon": "$(link-external)",
"category": "Appwrite"
},
{
"command": "vscode-appwrite.viewMore",
"title": "View more",
"category": "Appwrite"
} }
], ],
"views": { "views": {
@ -570,6 +625,9 @@
} }
], ],
"commandPalette": [ "commandPalette": [
{
"command": "vscode-appwrite.CreateTag"
},
{ {
"command": "vscode-appwrite.Connect" "command": "vscode-appwrite.Connect"
}, },

View file

@ -1,4 +1,4 @@
import { Client, Execution, ExecutionList, FunctionsClient, Tag, TagList, Vars } from "../appwrite"; import { Client, Execution, ExecutionList, FunctionsClient, FunctionsList, Tag, TagList, Vars } from "../appwrite";
import { AppwriteSDK } from '../constants'; import { AppwriteSDK } from '../constants';
import AppwriteCall from '../utils/AppwriteCall'; import AppwriteCall from '../utils/AppwriteCall';
import { ReadStream } from 'node:fs'; import { ReadStream } from 'node:fs';
@ -13,7 +13,7 @@ export class Functions {
public async create(name: string, execute: string[], env: string, vars?: Vars, events?: string[], schedule?: string, timeout?: number): Promise<any> { public async create(name: string, execute: string[], env: string, vars?: Vars, events?: string[], schedule?: string, timeout?: number): Promise<any> {
return await AppwriteCall(this.functions.create(name, execute, env, vars, events, schedule, timeout)); return await AppwriteCall(this.functions.create(name, execute, env, vars, events, schedule, timeout));
} }
public async list(search?: string, offset?: number, limit?: number, orderType?: 'ASC' | 'DESC'): Promise<any> { public async list(search?: string, offset?: number, limit?: number, orderType?: 'ASC' | 'DESC'): Promise<FunctionsList | undefined> {
return await AppwriteCall(this.functions.list(search, offset, limit, orderType)); return await AppwriteCall(this.functions.list(search, offset, limit, orderType));
} }
public async get(functionId: string): Promise<any> { public async get(functionId: string): Promise<any> {
@ -44,7 +44,7 @@ export class Functions {
return await AppwriteCall(this.functions.createExecution(functionId, data)); return await AppwriteCall(this.functions.createExecution(functionId, data));
} }
public async listExecutions(functionId: string, search?: string, limit?: number, offset?: number, orderType?: 'ASC' | 'DESC'): Promise<ExecutionList | undefined> { public async listExecutions(functionId: string, search?: string, limit?: number, offset?: number, orderType?: 'ASC' | 'DESC'): Promise<ExecutionList | undefined> {
return await AppwriteCall(this.functions.listExecutions(functionId, search, offset, limit, orderType)); return await AppwriteCall(this.functions.listExecutions(functionId, search, limit, offset, orderType));
} }
public async getExecution(functionId: string, executionId: string): Promise<Execution | undefined> { public async getExecution(functionId: string, executionId: string): Promise<Execution | undefined> {
return await AppwriteCall(this.functions.getExecution(functionId, executionId)); return await AppwriteCall(this.functions.getExecution(functionId, executionId));

View file

@ -0,0 +1,5 @@
import { AppwriteTreeItemBase } from '../../ui/AppwriteTreeItemBase';
export async function viewMore(treeItem: AppwriteTreeItemBase<any>): Promise<void> {
await treeItem.viewMore();
}

View file

@ -1,7 +1,8 @@
import { Tag } from '../../appwrite';
import { functionsClient } from '../../client'; import { functionsClient } from '../../client';
import { TagTreeItem } from '../../tree/functions/tags/TagTreeItem'; import { TagTreeItem } from '../../tree/functions/tags/TagTreeItem';
export async function activateTag(tagItem: TagTreeItem): Promise<void> { export async function activateTag(tagItem: TagTreeItem | Tag): Promise<void> {
const tag = tagItem.tag; const tag = tagItem instanceof TagTreeItem ? tagItem.tag : tagItem;
await functionsClient?.updateTag(tag.functionId, tag.$id); await functionsClient?.updateTag(tag.functionId, tag.$id);
} }

View file

@ -15,6 +15,7 @@ export async function createExecution(functionTreeItem: FunctionTreeItem): Promi
export async function executeFunction(functionId: string): Promise<void> { export async function executeFunction(functionId: string): Promise<void> {
ext.outputChannel.appendLog(`Creating execution for function with ID: ${functionId}`); ext.outputChannel.appendLog(`Creating execution for function with ID: ${functionId}`);
let execution = await functionsClient?.createExecution(functionId); let execution = await functionsClient?.createExecution(functionId);
ext.outputChannel.appendLog(JSON.stringify(execution, null, 2));
await ext.tree?.functions?.refresh(); await ext.tree?.functions?.refresh();
if (execution === undefined) { if (execution === undefined) {
@ -22,6 +23,7 @@ export async function executeFunction(functionId: string): Promise<void> {
} }
execution = await waitForExecution(execution); execution = await waitForExecution(execution);
ext.tree?.functions?.refresh();
if (execution === undefined) { if (execution === undefined) {
return; return;
@ -41,12 +43,11 @@ export async function executeFunction(functionId: string): Promise<void> {
} }
async function waitForExecution(execution: Execution | undefined): Promise<Execution | undefined> { async function waitForExecution(execution: Execution | undefined): Promise<Execution | undefined> {
ext.outputChannel.appendLog("Waiting for execution...");
if (execution === undefined) { if (execution === undefined) {
return; return;
} }
if (execution.status === "processing" || execution.status === "waiting") { if (execution.status === "processing" || execution.status === "waiting") {
await sleep(2000); await sleep(5000);
ext.outputChannel.appendLog("Execution still ..."); ext.outputChannel.appendLog("Execution still ...");
return await waitForExecution(await functionsClient?.getExecution(execution.functionId, execution.$id)); return await waitForExecution(await functionsClient?.getExecution(execution.functionId, execution.$id));

View file

@ -1,41 +1,122 @@
import { ProgressLocation, Uri, window, workspace } from "vscode"; import { ProgressLocation, QuickPickItem, Uri, window, workspace } from "vscode";
import { functionsClient } from "../../client"; import { functionsClient } from "../../client";
import { getTarReadStream } from "../../utils/tar"; import { getTarReadStream } from "../../utils/tar";
import { ext } from "../../extensionVariables"; import { ext } from "../../extensionVariables";
import * as fs from "fs"; import * as fs from "fs";
import { TagsTreeItem } from "../../tree/functions/tags/TagsTreeItem"; import { TagsTreeItem } from "../../tree/functions/tags/TagsTreeItem";
import { selectWorkspaceFolder } from "../../utils/workspace"; import { selectWorkspaceFolder } from "../../utils/workspace";
import { ProgressMessage } from '../../utils/types'; import { ProgressMessage } from "../../utils/types";
import { Tag } from '../../appwrite'; import { Tag } from "../../appwrite";
import { activateTag } from "./activateTag";
export async function createTag(item: TagsTreeItem | Uri): Promise<void> { export async function createTag(item?: TagsTreeItem | Uri): Promise<void> {
if (item instanceof Uri) { if (item instanceof Uri) {
const tag = await window.withProgress({ location: ProgressLocation.Notification, title: "Creating tag..." }, async (progress, _token) => { const functions = await functionsClient?.list();
return await createTagFromUri(item, progress); if (functions === undefined) {
});
if (tag) {
await window.showInformationMessage(`Successfully created tag with size ${tag.size}B.`, "Execution function", "View in console");
return; return;
} }
const pick = await window.showQuickPick(
functions.functions.map<QuickPickItem>(
(func): QuickPickItem => ({ label: func.name, description: func.env, detail: func.$id })
),
{ placeHolder: "Select a function to create tag" }
);
if (pick === undefined || pick.detail === undefined) {
return;
}
const tags = await functionsClient?.listTags(pick.detail);
let value;
if (tags && tags.tags.length > 0) {
value = tags.tags[tags.tags.length - 1].command;
}
const command = await window.showInputBox({ value, prompt: "Command to run your code" });
if (command === undefined) {
return;
}
const tag = await window.withProgress(
{ location: ProgressLocation.Notification, title: "Creating tag..." },
async (progress, _token) => {
if (pick.detail === undefined) {
return;
}
return await createTagFromUri(pick.detail, command, item, progress);
}
);
if (tag) {
await tagNotification(tag);
}
return; return;
} }
if (item instanceof TagsTreeItem) { if (item instanceof TagsTreeItem) {
const func = item.parent.func;
const folder = await selectWorkspaceFolder("Select folder of your function code."); const folder = await selectWorkspaceFolder("Select folder of your function code.");
console.log(folder); if (folder === undefined || folder === "") {
const tag = await window.withProgress({ location: ProgressLocation.Notification, title: "Creating tag..." }, async (progress, _token) => { return;
return await createTagFromUri(Uri.parse(folder), progress); }
}); const tags = await functionsClient?.listTags(func.$id);
let value;
if (tags && tags.tags.length > 0) {
value = tags.tags[tags.tags.length - 1].command;
}
const command = await window.showInputBox({ value, prompt: "Command to run your code" });
if (command === undefined) {
return;
}
const tag = await window.withProgress(
{ location: ProgressLocation.Notification, title: "Creating tag..." },
async (progress, _token) => {
return await createTagFromUri(func.$id, command, Uri.parse(folder), progress);
}
);
if (tag) { if (tag) {
await window.showInformationMessage(`Successfully created tag with size ${tag.size}B.`); await tagNotification(tag);
return;
}
}
if (item === undefined) {
const functions = await functionsClient?.list();
if (functions === undefined) {
return;
}
const pick = await window.showQuickPick(
functions.functions.map<QuickPickItem>(
(func): QuickPickItem => ({ label: func.name, description: func.env, detail: func.$id })
),
{ placeHolder: "Select a function to create tag" }
);
if (pick === undefined || pick.detail === undefined) {
return;
}
const funcId = pick.detail;
const folder = await selectWorkspaceFolder("Select folder of your function code.");
const tags = await functionsClient?.listTags(funcId);
let value;
if (tags && tags.tags.length > 0) {
value = tags.tags[tags.tags.length - 1].command;
}
const command = await window.showInputBox({ value, prompt: "Command to run your code" });
if (command === undefined) {
return;
}
const tag = await window.withProgress(
{ location: ProgressLocation.Notification, title: "Creating tag..." },
async (progress, _token) => {
return await createTagFromUri(funcId, command, Uri.parse(folder), progress);
}
);
if (tag) {
await tagNotification(tag);
return; return;
} }
} }
} }
async function createTagFromUri(uri: Uri, progress: ProgressMessage): Promise<Tag | undefined> { async function createTagFromUri(functionId: string, command: string, uri: Uri, progress: ProgressMessage): Promise<Tag | undefined> {
progress.report({ message: "Creating tarball", increment: 10 }); progress.report({ message: "Creating tarball", increment: 10 });
if (functionsClient === undefined) { if (functionsClient === undefined) {
@ -58,8 +139,26 @@ async function createTagFromUri(uri: Uri, progress: ProgressMessage): Promise<Ta
await workspace.fs.readFile(Uri.file(tarFilePath)); await workspace.fs.readFile(Uri.file(tarFilePath));
progress.report({ message: "Uploading tag", increment: 60 }); progress.report({ message: "Uploading tag", increment: 60 });
try { try {
return await functionsClient.createTag("60b1836a8e5d9", "python ./hello.py", fs.createReadStream(tarFilePath)); return await functionsClient.createTag(functionId, command, fs.createReadStream(tarFilePath));
} catch (e) { } catch (e) {
ext.outputChannel.appendLog("Creating tag error: " + e); ext.outputChannel.appendLog("Creating tag error: " + e);
} }
} }
async function tagNotification(tag: Tag): Promise<void> {
ext.tree?.functions?.refresh();
if (tag) {
const action = await window.showInformationMessage(
`Successfully created tag with size ${tag.size}B.`,
"Activate tag",
"View in console"
);
if (action === "Activate tag") {
await activateTag(tag);
}
if (action === "View in console") {
//
}
return;
}
}

View file

@ -7,11 +7,13 @@ export async function viewExecutionOutput(executionItem: ExecutionTreeItem | Exe
return; return;
} }
let execution = executionItem as Execution; let execution = executionItem as Execution;
if (executionItem instanceof ExecutionTreeItem) { if (executionItem instanceof ExecutionTreeItem) {
execution = executionItem.execution; execution = executionItem.execution;
} }
console.log(execution.dateCreated);
await openReadOnlyContent({ label: `Execution stdout`, fullId: `${execution.$id}-output.txt` }, execution.stdout, '.txt'); await openReadOnlyContent({ label: `Execution stdout`, fullId: `${execution.$id}-output.txt` }, execution.stdout, '.txt');
} }

View file

@ -42,6 +42,8 @@ import { openExecutionsInBrowser } from './functions/openExecutionsInBrowser';
import { openFunctionSettingsInBrowser } from './functions/openFunctionSettingsInBrowser'; import { openFunctionSettingsInBrowser } from './functions/openFunctionSettingsInBrowser';
import { openFunctionTagsInBrowser } from './functions/openFunctionTagsInBrowser'; import { openFunctionTagsInBrowser } from './functions/openFunctionTagsInBrowser';
import { viewMore } from './common/viewMore';
class CommandRegistrar { class CommandRegistrar {
constructor(private readonly context: ExtensionContext) {} constructor(private readonly context: ExtensionContext) {}
@ -74,6 +76,7 @@ export function registerCommands(context: ExtensionContext): void {
/** Common **/ /** Common **/
registerCommand("editValue", editValue); registerCommand("editValue", editValue);
registerCommand("viewMore", viewMore);
/** General **/ /** General **/
registerCommand("Connect", connectAppwrite, "all"); registerCommand("Connect", connectAppwrite, "all");

View file

@ -1,13 +1,13 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Collection } from "../../appwrite"; import { Collection } from "../../appwrite";
import { databaseClient } from "../../client"; import { databaseClient } from "../../client";
import { AwTreeItem } from "../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../ui/AppwriteTreeItemBase";
import { DatabaseTreeItemProvider } from "./DatabaseTreeItemProvider"; import { DatabaseTreeItemProvider } from "./DatabaseTreeItemProvider";
import { DocumentsTreeItem } from "./DocumentsTreeItem"; import { DocumentsTreeItem } from "./DocumentsTreeItem";
import { PermissionsTreeItem } from "./settings/PermissionsTreeItem"; import { PermissionsTreeItem } from "./settings/PermissionsTreeItem";
import { RulesTreeItem } from "./settings/RulesTreeItem"; import { RulesTreeItem } from "./settings/RulesTreeItem";
export class CollectionTreeItem extends AwTreeItem { export class CollectionTreeItem extends AppwriteTreeItemBase {
constructor(public collection: Collection, public readonly provider: DatabaseTreeItemProvider) { constructor(public collection: Collection, public readonly provider: DatabaseTreeItemProvider) {
super(undefined, collection.name); super(undefined, collection.name);
} }

View file

@ -5,7 +5,7 @@ import { Collection, CollectionsList } from "../../appwrite";
import { CollectionTreeItem } from "./CollectionTreeItem"; import { CollectionTreeItem } from "./CollectionTreeItem";
import { AppwriteSDK } from "../../constants"; import { AppwriteSDK } from "../../constants";
import { ext } from '../../extensionVariables'; import { ext } from '../../extensionVariables';
import { AwParentTreeItem } from '../common/AwParentTreeItem'; import { AppwriteTreeItemBase } from '../../ui/AppwriteTreeItemBase';
export class DatabaseTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> { export class DatabaseTreeItemProvider 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<
@ -33,8 +33,8 @@ export class DatabaseTreeItemProvider implements vscode.TreeDataProvider<vscode.
return Promise.resolve([]); return Promise.resolve([]);
} }
if (parent instanceof AwParentTreeItem) { if (parent instanceof AppwriteTreeItemBase) {
return parent.getChildrenInternal() ?? []; return await parent.getChildren?.() ?? [];
} }
const databaseSdk = new AppwriteSDK.Database(client); const databaseSdk = new AppwriteSDK.Database(client);

View file

@ -3,12 +3,12 @@ import { DocumentsList } from "../../appwrite";
import { client } from "../../client"; import { client } from "../../client";
import { AppwriteSDK } from "../../constants"; import { AppwriteSDK } from "../../constants";
import { ext } from "../../extensionVariables"; import { ext } from "../../extensionVariables";
import { AwTreeItem } from "../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../ui/AppwriteTreeItemBase";
import AppwriteCall from "../../utils/AppwriteCall"; import AppwriteCall from "../../utils/AppwriteCall";
import { CollectionTreeItem } from "./CollectionTreeItem"; import { CollectionTreeItem } from "./CollectionTreeItem";
import { DocumentTreeItem } from "./DocumentTreeItem"; import { DocumentTreeItem } from "./DocumentTreeItem";
export class DocumentsTreeItem extends AwTreeItem<CollectionTreeItem> { export class DocumentsTreeItem extends AppwriteTreeItemBase<CollectionTreeItem> {
constructor(parent: CollectionTreeItem) { constructor(parent: CollectionTreeItem) {
super(parent, "Documents"); super(parent, "Documents");
} }

View file

@ -1,11 +1,11 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Permissions } from "../../../appwrite"; import { Permissions } from "../../../appwrite";
import { AwTreeItem } from "../../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../../ui/AppwriteTreeItemBase";
import { CollapsableTreeItem } from "../../CollapsableTreeItem"; import { CollapsableTreeItem } from "../../CollapsableTreeItem";
import { CollectionTreeItem } from "../CollectionTreeItem"; import { CollectionTreeItem } from "../CollectionTreeItem";
import { PermissionTreeItem } from "./PermissionTreeItem"; import { PermissionTreeItem } from "./PermissionTreeItem";
export class PermissionsTreeItem extends AwTreeItem<CollectionTreeItem> { export class PermissionsTreeItem extends AppwriteTreeItemBase<CollectionTreeItem> {
public readonly permissions: Permissions; public readonly permissions: Permissions;
constructor(parent: CollectionTreeItem) { constructor(parent: CollectionTreeItem) {

View file

@ -1,11 +1,11 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Rule } from "../../../appwrite"; import { Rule } from "../../../appwrite";
import { AwTreeItem } from "../../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../../ui/AppwriteTreeItemBase";
import { CommandTreeItem } from "../../CommandTreeItem"; import { CommandTreeItem } from "../../CommandTreeItem";
import { CollectionTreeItem } from "../CollectionTreeItem"; import { CollectionTreeItem } from "../CollectionTreeItem";
import { RuleTreeItem } from "./RuleTreeItem"; import { RuleTreeItem } from "./RuleTreeItem";
export class RulesTreeItem extends AwTreeItem<CollectionTreeItem> { export class RulesTreeItem extends AppwriteTreeItemBase<CollectionTreeItem> {
public readonly rules: Rule[]; public readonly rules: Rule[];
constructor(parent: CollectionTreeItem) { constructor(parent: CollectionTreeItem) {

View file

@ -1,13 +1,13 @@
import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Function } from "../../appwrite"; import { Function } from "../../appwrite";
import { AwTreeItem } from "../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../ui/AppwriteTreeItemBase";
import { msToDate } from '../../utils/date'; import { msToDate } from '../../utils/date';
import { ExecutionsTreeItem } from './executions/ExecutionsTreeItem'; import { ExecutionsTreeItem } from './executions/ExecutionsTreeItem';
import { FunctionsTreeItemProvider } from './FunctionsTreeItemProvider'; import { FunctionsTreeItemProvider } from './FunctionsTreeItemProvider';
import { FunctionSettingsTreeItem } from './settings/FunctionSettingsTreeItem'; import { FunctionSettingsTreeItem } from './settings/FunctionSettingsTreeItem';
import { TagsTreeItem } from './tags/TagsTreeItem'; import { TagsTreeItem } from './tags/TagsTreeItem';
export class FunctionTreeItem extends AwTreeItem { export class FunctionTreeItem extends AppwriteTreeItemBase {
constructor(public func: Function, public readonly provider: FunctionsTreeItemProvider) { constructor(public func: Function, public readonly provider: FunctionsTreeItemProvider) {
super(undefined, func.name); super(undefined, func.name);
this.tooltip = new MarkdownString(`ID: ${func.$id} \nLast updated: ${msToDate(func.dateUpdated)} \nCreated: ${msToDate(func.dateCreated)}`); this.tooltip = new MarkdownString(`ID: ${func.$id} \nLast updated: ${msToDate(func.dateUpdated)} \nCreated: ${msToDate(func.dateCreated)}`);

View file

@ -2,11 +2,10 @@ import * as vscode from "vscode";
import { client } from "../../client"; import { client } from "../../client";
import { Function, FunctionsList } from "../../appwrite"; import { Function, FunctionsList } from "../../appwrite";
import { AppwriteSDK } from "../../constants"; import { AppwriteSDK } from "../../constants";
import { AwTreeItem } from "../common/AwTreeItem"; import { AppwriteTreeItemBase } from "../../ui/AppwriteTreeItemBase";
import { ext } from "../../extensionVariables"; import { ext } from "../../extensionVariables";
import { EventEmitter, TreeItem } from "vscode"; import { EventEmitter, TreeItem } from "vscode";
import { FunctionTreeItem } from "./FunctionTreeItem"; import { FunctionTreeItem } from "./FunctionTreeItem";
import { AwParentTreeItem } from '../common/AwParentTreeItem';
export class FunctionsTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> { export class FunctionsTreeItemProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
private _onDidChangeTreeData: EventEmitter<TreeItem | undefined | void> = new EventEmitter<TreeItem | undefined | void>(); private _onDidChangeTreeData: EventEmitter<TreeItem | undefined | void> = new EventEmitter<TreeItem | undefined | void>();
@ -26,7 +25,7 @@ export class FunctionsTreeItemProvider implements vscode.TreeDataProvider<vscode
return element; return element;
} }
async getChildren(parent?: AwTreeItem | TreeItem): Promise<vscode.TreeItem[]> { async getChildren(parent?: AppwriteTreeItemBase | TreeItem): Promise<vscode.TreeItem[]> {
if (client === undefined) { if (client === undefined) {
return Promise.resolve([]); return Promise.resolve([]);
} }
@ -44,8 +43,8 @@ export class FunctionsTreeItemProvider implements vscode.TreeDataProvider<vscode
return [{ label: "No functions found" }]; return [{ label: "No functions found" }];
} }
if (parent instanceof AwParentTreeItem) { if (parent instanceof AppwriteTreeItemBase) {
return parent.getChildren(); return await parent.getChildren?.() ?? [];
} }
return []; return [];

View file

@ -1,9 +1,6 @@
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem } from "vscode"; import { MarkdownString, ThemeColor, ThemeIcon, TreeItem } from "vscode";
import { Execution, ExecutionStatus } from "../../../appwrite"; import { Execution, ExecutionStatus } from "../../../appwrite";
import { functionsClient } from "../../../client";
import { ext } from "../../../extensionVariables";
import { msToDate } from "../../../utils/date"; import { msToDate } from "../../../utils/date";
import { sleep } from '../../../utils/sleep';
import { ExecutionsTreeItem } from "./ExecutionsTreeItem"; import { ExecutionsTreeItem } from "./ExecutionsTreeItem";
const executionStatusIcons: Record<ExecutionStatus, ThemeIcon> = { const executionStatusIcons: Record<ExecutionStatus, ThemeIcon> = {
@ -26,33 +23,33 @@ export class ExecutionTreeItem extends TreeItem {
this.description = execution.trigger; this.description = execution.trigger;
this.contextValue = this.getContextValue(execution); this.contextValue = this.getContextValue(execution);
this.isAutoRefreshing = execution.status === "processing" || execution.status === "waiting"; this.isAutoRefreshing = execution.status === "processing" || execution.status === "waiting";
if (this.isAutoRefreshing) { // if (this.isAutoRefreshing) {
this.autoRefresh(); // this.autoRefresh();
} // }
} }
async autoRefresh(): Promise<void> { // async autoRefresh(): Promise<void> {
if (!this.isAutoRefreshing) { // if (!this.isAutoRefreshing && this.refreshCount < 5) {
return; // return;
} // }
this.refreshCount++; // this.refreshCount++;
ext.outputChannel.appendLog("Refreshing execution."); // ext.outputChannel.appendLog("Refreshing execution.");
const execution = await functionsClient?.getExecution(this.parent.parent.func.$id, this.execution.$id); // const execution = await functionsClient?.getExecution(this.parent.parent.func.$id, this.execution.$id);
if (!execution) { // if (!execution) {
ext.outputChannel.appendLog("Execution is undefined"); // ext.outputChannel.appendLog("Execution is undefined");
this.isAutoRefreshing = false; // this.isAutoRefreshing = false;
return; // return;
} // }
this.execution = execution; // this.execution = execution;
this.contextValue = this.getContextValue(execution); // this.contextValue = this.getContextValue(execution);
this.iconPath = executionStatusIcons[execution.status]; // this.iconPath = executionStatusIcons[execution.status];
this.label = this.getLabel(execution); // this.label = this.getLabel(execution);
this.isAutoRefreshing = execution.status === "processing" || execution.status === "waiting"; // this.isAutoRefreshing = execution.status === "processing" || execution.status === "waiting";
ext.tree?.functions?.refreshChild(this); // ext.tree?.functions?.refreshChild(this);
await sleep(1000); // await sleep(1000);
this.autoRefresh(); // this.autoRefresh();
} // }
getLabel(execution: Execution): string { getLabel(execution: Execution): string {
if (execution.status === "completed" || execution.status === "failed") { if (execution.status === "completed" || execution.status === "failed") {

View file

@ -1,26 +1,47 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { Command, ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Execution, ExecutionList } from '../../../appwrite'; import { Execution, ExecutionList } from "../../../appwrite";
import { functionsClient } from "../../../client"; import { functionsClient } from "../../../client";
import { AwTreeItem } from '../../common/AwTreeItem'; import { ExecutionTreeItem } from "./ExecutionTreeItem";
import { ExecutionTreeItem } from './ExecutionTreeItem'; import { FunctionTreeItem } from "../FunctionTreeItem";
import { FunctionTreeItem } from '../FunctionTreeItem'; import { ext } from "../../../extensionVariables";
import { ext } from '../../../extensionVariables'; import { AppwriteTreeItemBase } from "../../../ui/AppwriteTreeItemBase";
const executionsToShow = 10; export class ExecutionsTreeItem extends AppwriteTreeItemBase<FunctionTreeItem> {
export class ExecutionsTreeItem extends AwTreeItem<FunctionTreeItem> {
constructor(public readonly parent: FunctionTreeItem) { constructor(public readonly parent: FunctionTreeItem) {
super(parent, "Executions"); super(parent, "Executions");
} }
private executionsToShow = 10;
public async getChildren(): Promise<TreeItem[]> { public async getChildren(): Promise<TreeItem[]> {
if (!functionsClient) { if (!functionsClient) {
return []; return [];
} }
const executions: ExecutionList | undefined = await functionsClient.listExecutions(this.parent.func.$id, undefined, executionsToShow, undefined, 'DESC'); const executions: ExecutionList | undefined = await functionsClient.listExecutions(
const children = executions?.executions.map((execution: Execution) => new ExecutionTreeItem(this, execution)) ?? [new TreeItem('No exeuctions.')]; this.parent.func.$id,
undefined,
this.executionsToShow,
undefined,
"DESC"
);
const children = executions?.executions.map((execution: Execution) => new ExecutionTreeItem(this, execution)) ?? [
new TreeItem("No executions."),
];
if (children.length === 0) {
children.push(new TreeItem("No executions."));
}
ext.outputChannel.appendLog(`Found ${executions?.sum} executions`); ext.outputChannel.appendLog(`Found ${executions?.sum} executions`);
children.push(new TreeItem('View more')); if (executions?.sum ?? (0 > this.executionsToShow && this.executionsToShow !== 100)) {
const viewMoreItem: TreeItem = {
command: {
command: "vscode-appwrite.viewMore",
arguments: [this],
title: "View more",
},
label: "View more...",
};
children.push(viewMoreItem);
}
return children; return children;
} }
@ -29,4 +50,12 @@ export class ExecutionsTreeItem extends AwTreeItem<FunctionTreeItem> {
contextValue = "executions"; contextValue = "executions";
iconPath = new ThemeIcon("history"); iconPath = new ThemeIcon("history");
async viewMore(): Promise<void> {
this.executionsToShow += 10;
if (this.executionsToShow > 100) {
this.executionsToShow = 100;
}
ext.tree?.functions?.refreshChild(this);
}
} }

View file

@ -1,7 +1,7 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { Function } from "../../../appwrite"; import { Function } from "../../../appwrite";
import { functionsClient } from "../../../client"; import { functionsClient } from "../../../client";
import { AwTreeItem } from "../../common/AwTreeItem"; import { AppwriteTreeItemBase } from '../../../ui/AppwriteTreeItemBase';
import { ChildTreeItem } from "../../ChildTreeItem"; import { ChildTreeItem } from "../../ChildTreeItem";
import { FunctionTreeItem } from "../FunctionTreeItem"; import { FunctionTreeItem } from "../FunctionTreeItem";
import { EventsTreeItem } from "./EventsTreeItem"; import { EventsTreeItem } from "./EventsTreeItem";
@ -10,7 +10,7 @@ import { ScheduleTreeItem } from "./ScheduleTreeItem";
import { TimeoutTreeItem } from "./TimeoutTreeItem"; import { TimeoutTreeItem } from "./TimeoutTreeItem";
import { VarsTreeItem } from "./VarsTreeItem"; import { VarsTreeItem } from "./VarsTreeItem";
export class FunctionSettingsTreeItem extends AwTreeItem<FunctionTreeItem> { export class FunctionSettingsTreeItem extends AppwriteTreeItemBase<FunctionTreeItem> {
public readonly func: Function; public readonly func: Function;
constructor(public readonly parent: FunctionTreeItem) { constructor(public readonly parent: FunctionTreeItem) {

View file

@ -1,10 +1,10 @@
import { TreeItem, TreeItemCollapsibleState } from "vscode"; import { TreeItem, TreeItemCollapsibleState } from "vscode";
import { Vars } from "../../../appwrite"; import { Vars } from "../../../appwrite";
import { AwTreeItem } from "../../common/AwTreeItem"; import { AppwriteTreeItemBase } from '../../../ui/AppwriteTreeItemBase';
import { FunctionSettingsTreeItem } from "./FunctionSettingsTreeItem"; import { FunctionSettingsTreeItem } from "./FunctionSettingsTreeItem";
import { VarTreeItem } from "./VarTreeItem"; import { VarTreeItem } from "./VarTreeItem";
export class VarsTreeItem extends AwTreeItem<FunctionSettingsTreeItem> { export class VarsTreeItem extends AppwriteTreeItemBase<FunctionSettingsTreeItem> {
public readonly vars: Vars; public readonly vars: Vars;
constructor(parent: FunctionSettingsTreeItem) { constructor(parent: FunctionSettingsTreeItem) {

View file

@ -10,7 +10,7 @@ export class TagTreeItem extends TreeItem {
const active = func.tag === tag.$id; const active = func.tag === tag.$id;
this.label = `${msToDate(tag.dateCreated)}${active ? ' (Active)' : ''}`; this.label = `${msToDate(tag.dateCreated)}${active ? ' (Active)' : ''}`;
this.description = tag.$id; this.description = tag.$id;
this.iconPath = new ThemeIcon(active ? 'circle-filled' : 'circle-outline'); this.iconPath = new ThemeIcon(active ? 'circle-large-filled' : 'circle-large-outline');
this.contextValue = `tag${active ? '_active' : ''}`; this.contextValue = `tag${active ? '_active' : ''}`;
this.tooltip = new MarkdownString(`ID: ${tag.$id} \nCreated: ${msToDate(tag.dateCreated)} \nCommand: ${tag.command} \nSize: ${tag.size}B`); this.tooltip = new MarkdownString(`ID: ${tag.$id} \nCreated: ${msToDate(tag.dateCreated)} \nCommand: ${tag.command} \nSize: ${tag.size}B`);
} }

View file

@ -1,11 +1,10 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { functionsClient } from "../../../client"; import { functionsClient } from "../../../client";
import { AwParentTreeItem } from '../../common/AwParentTreeItem'; import { AppwriteTreeItemBase } from '../../../ui/AppwriteTreeItemBase';
import { AwTreeItem } from '../../common/AwTreeItem';
import { FunctionTreeItem } from '../FunctionTreeItem'; import { FunctionTreeItem } from '../FunctionTreeItem';
import { TagTreeItem } from './TagTreeItem'; import { TagTreeItem } from './TagTreeItem';
export class TagsTreeItem extends AwParentTreeItem { export class TagsTreeItem extends AppwriteTreeItemBase<FunctionTreeItem> {
constructor(public readonly parent: FunctionTreeItem) { constructor(public readonly parent: FunctionTreeItem) {
super(parent, "Tags"); super(parent, "Tags");
} }
@ -15,7 +14,22 @@ export class TagsTreeItem extends AwParentTreeItem {
return []; return [];
} }
const tags = await functionsClient.listTags(this.parent.func.$id); const tags = await functionsClient.listTags(this.parent.func.$id);
return tags?.tags.sort((a, b) => b.dateCreated - a.dateCreated).map((tag) => new TagTreeItem(this, tag)) ?? [new TreeItem('No tags.')]; const children = tags?.tags.sort((a, b) => b.dateCreated - a.dateCreated).map((tag) => new TagTreeItem(this, tag)) ?? [new TreeItem('No tags.')];
if (children.length === 0) {
const noTagsItem: TreeItem = {
command: {
command: "vscode-appwrite.CreateTag",
title: "Create tag",
arguments: [this],
tooltip: "Create a tag"
},
label: "Create a tag",
iconPath: new ThemeIcon("cloud-upload"),
};
children.push(noTagsItem);
}
return children;
} }
collapsibleState = TreeItemCollapsibleState.Collapsed; collapsibleState = TreeItemCollapsibleState.Collapsed;

View file

@ -7,4 +7,7 @@ export abstract class AppwriteTreeItemBase<Parent = void> extends TreeItem {
abstract getChildren?(): Promise<TreeItem[]>; abstract getChildren?(): Promise<TreeItem[]>;
viewMore(): Promise<void> {
return Promise.resolve();
}
} }

View file

@ -5,5 +5,5 @@ dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
export function msToDate(ms: number): string { export function msToDate(ms: number): string {
return dayjs(ms * 1000).tz("America/Chicago").format("LTS"); return dayjs(ms * 1000).tz(dayjs.tz.guess()).format("LTS");
} }