Open tag in browser after creation

This commit is contained in:
alexweininger 2021-06-03 23:01:51 -07:00
parent 095483ef9d
commit 1ed67e7c10
2 changed files with 10 additions and 4 deletions

View file

@ -8,6 +8,8 @@ import { selectWorkspaceFolder } from "../../utils/workspace";
import { ProgressMessage } from "../../utils/types";
import { Tag } from "../../appwrite";
import { activateTag } from "./activateTag";
import { sleep } from '../../utils/sleep';
import { openFunctionTagsInBrowser } from './openFunctionTagsInBrowser';
export async function createTag(item?: TagsTreeItem | Uri): Promise<void> {
if (item instanceof Uri) {
@ -136,7 +138,8 @@ async function createTagFromUri(functionId: string, command: string, uri: Uri, p
return;
}
// somehow makes the upload work
await workspace.fs.readFile(Uri.file(tarFilePath));
// await workspace.fs.readFile(Uri.file(tarFilePath));
await sleep(1000);
progress.report({ message: "Uploading tag", increment: 60 });
try {
return await functionsClient.createTag(functionId, command, fs.createReadStream(tarFilePath));
@ -158,6 +161,7 @@ async function tagNotification(tag: Tag): Promise<void> {
}
if (action === "View in console") {
//
await openFunctionTagsInBrowser(tag.functionId);
}
return;
}

View file

@ -3,11 +3,13 @@ import { ExecutionsTreeItem } from '../../tree/functions/executions/ExecutionsTr
import { openUrl } from '../../utils/openUrl';
import { getConsoleUrlFromEndpoint } from '../users/openUserInConsole';
export async function openFunctionTagsInBrowser(treeItem: ExecutionsTreeItem): Promise<void> {
const func = treeItem.parent.func;
export async function openFunctionTagsInBrowser(treeItem: ExecutionsTreeItem | string): Promise<void> {
const funcId = treeItem instanceof ExecutionsTreeItem ? treeItem.parent.func.$id : treeItem;
const consoleUrl = getConsoleUrlFromEndpoint(clientConfig.endpoint);
// https://console.streamlux.com/console/functions/function?id=60b1836a8e5d9&project=605ce39a30c01
const url = `${consoleUrl}/functions/function?id=${func.$id}&project=${clientConfig.projectId}`;
const url = `${consoleUrl}/functions/function?id=${funcId}&project=${clientConfig.projectId}`;
openUrl(url);
}