mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: download deployment
This commit is contained in:
@@ -98,8 +98,6 @@
|
||||
function toggleMobileModal() {
|
||||
showFiltersMobile = !showFiltersMobile;
|
||||
}
|
||||
|
||||
$: console.log(selectedColumn, operatorKey, value, arrayValues);
|
||||
</script>
|
||||
|
||||
<div class="is-not-mobile">
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { Client } from '@appwrite.io/console';
|
||||
|
||||
export class Func {
|
||||
client: Client;
|
||||
|
||||
constructor(client: Client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
async downloadDeployment(functionId: string, deploymentId: string): Promise<string> {
|
||||
const path = `/functions/${functionId}/deployments/${deploymentId}/download`;
|
||||
const params = {
|
||||
functionId,
|
||||
deploymentId
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
'GET',
|
||||
uri,
|
||||
{
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
params
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '@appwrite.io/console';
|
||||
import { Billing } from '../sdk/billing';
|
||||
import { Sources } from '$lib/sdk/sources';
|
||||
import { Func } from '$lib/sdk/functions';
|
||||
|
||||
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
|
||||
|
||||
@@ -74,7 +75,8 @@ export const sdk = {
|
||||
console: new Console(clientConsole),
|
||||
assistant: new Assistant(clientConsole),
|
||||
billing: new Billing(clientConsole),
|
||||
sources: new Sources(clientConsole)
|
||||
sources: new Sources(clientConsole),
|
||||
func: new Func(clientConsole)
|
||||
},
|
||||
get forProject() {
|
||||
const projectId = getProjectId();
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
numbers.splice(index, 1);
|
||||
numbers = numbers;
|
||||
}
|
||||
|
||||
$: console.log(numbers, initialNumbers);
|
||||
</script>
|
||||
|
||||
<Form onSubmit={updateMockNumbers}>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import Cancel from './cancel.svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
export let columns: Column[];
|
||||
export let data: PageData;
|
||||
@@ -41,6 +42,13 @@
|
||||
function handleActivate() {
|
||||
invalidate(Dependencies.DEPLOYMENTS);
|
||||
}
|
||||
|
||||
async function getDownload(deploymentId: string) {
|
||||
return (
|
||||
(await sdk.forConsole.func.downloadDeployment($func.$id, deploymentId)).toString() +
|
||||
'&mode=admin'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<TableScroll>
|
||||
@@ -139,6 +147,15 @@
|
||||
href={`/console/project-${$page.params.project}/functions/function-${$page.params.function}/deployment-${deployment.$id}`}>
|
||||
Logs
|
||||
</DropListLink>
|
||||
{#if deployment.status === 'ready'}
|
||||
{#await getDownload(deployment.$id)}
|
||||
<DropListItem icon="terminal">Download</DropListItem>
|
||||
{:then href}
|
||||
<DropListLink icon="terminal" external {href}>
|
||||
Download
|
||||
</DropListLink>
|
||||
{/await}
|
||||
{/if}
|
||||
{#if deployment.status === 'processing' || deployment.status === 'building'}
|
||||
<DropListItem
|
||||
icon="x-circle"
|
||||
|
||||
Reference in New Issue
Block a user