mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Implement new git abilities
This commit is contained in:
Generated
+7
-7
@@ -9,7 +9,7 @@
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@analytics/google-analytics": "^1.0.5",
|
||||
"@aw-labs/appwrite-console": "npm:matej-appwrite-console@7.1.52",
|
||||
"@aw-labs/appwrite-console": "npm:matej-appwrite-console@7.1.63",
|
||||
"@aw-labs/icons": "0.0.0-77",
|
||||
"@aw-labs/ui": "0.0.0-77",
|
||||
"@popperjs/core": "^2.11.6",
|
||||
@@ -146,9 +146,9 @@
|
||||
},
|
||||
"node_modules/@aw-labs/appwrite-console": {
|
||||
"name": "matej-appwrite-console",
|
||||
"version": "7.1.52",
|
||||
"resolved": "https://registry.npmjs.org/matej-appwrite-console/-/matej-appwrite-console-7.1.52.tgz",
|
||||
"integrity": "sha512-RuGQH8CjQVjyta9+lxidJxswRKXWYPdoJZp8SyIrXIOs4smYz39UCPpeRuW1XV9si3W2ge2Mm2Zrx/y3PunH1Q==",
|
||||
"version": "7.1.63",
|
||||
"resolved": "https://registry.npmjs.org/matej-appwrite-console/-/matej-appwrite-console-7.1.63.tgz",
|
||||
"integrity": "sha512-qdQ+mYQzr2bqpIiUc70AG/BbC8YDmpxp/Bx+VuNsOE75/aSD2dRKfMbqcLtcNY9HtnMbX4x1Bo6jmTdE00MDxw==",
|
||||
"dependencies": {
|
||||
"cross-fetch": "3.1.5",
|
||||
"isomorphic-form-data": "2.0.0"
|
||||
@@ -7741,9 +7741,9 @@
|
||||
"integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g=="
|
||||
},
|
||||
"@aw-labs/appwrite-console": {
|
||||
"version": "npm:matej-appwrite-console@7.1.52",
|
||||
"resolved": "https://registry.npmjs.org/matej-appwrite-console/-/matej-appwrite-console-7.1.52.tgz",
|
||||
"integrity": "sha512-RuGQH8CjQVjyta9+lxidJxswRKXWYPdoJZp8SyIrXIOs4smYz39UCPpeRuW1XV9si3W2ge2Mm2Zrx/y3PunH1Q==",
|
||||
"version": "npm:matej-appwrite-console@7.1.63",
|
||||
"resolved": "https://registry.npmjs.org/matej-appwrite-console/-/matej-appwrite-console-7.1.63.tgz",
|
||||
"integrity": "sha512-qdQ+mYQzr2bqpIiUc70AG/BbC8YDmpxp/Bx+VuNsOE75/aSD2dRKfMbqcLtcNY9HtnMbX4x1Bo6jmTdE00MDxw==",
|
||||
"requires": {
|
||||
"cross-fetch": "3.1.5",
|
||||
"isomorphic-form-data": "2.0.0"
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
"node": ">=16"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"dev": "vite dev --host 0.0.0.0",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"sync": "svelte-kit sync",
|
||||
@@ -21,7 +21,7 @@
|
||||
"dependencies": {
|
||||
"@analytics/google-analytics": "^1.0.5",
|
||||
"analytics": "^0.8.1",
|
||||
"@aw-labs/appwrite-console": "npm:matej-appwrite-console@7.1.52",
|
||||
"@aw-labs/appwrite-console": "npm:matej-appwrite-console@7.1.63",
|
||||
"@aw-labs/icons": "0.0.0-77",
|
||||
"@aw-labs/ui": "0.0.0-77",
|
||||
"@popperjs/core": "^2.11.6",
|
||||
|
||||
+63
-8
@@ -24,6 +24,7 @@
|
||||
import InputSwitch from '$lib/elements/forms/inputSwitch.svelte';
|
||||
import Variables from '$lib/components/environmentVariables/variables.svelte';
|
||||
import GitConnection from './gitConnection.svelte';
|
||||
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -39,6 +40,7 @@
|
||||
let entrypoint: string = null;
|
||||
let buildCommand: string = null;
|
||||
let installCommand: string = null;
|
||||
let branch: string = null;
|
||||
|
||||
let showGitConnection = false;
|
||||
|
||||
@@ -55,6 +57,7 @@
|
||||
entrypoint ??= $func.entrypoint;
|
||||
buildCommand ??= $func.buildCommand;
|
||||
installCommand ??= $func.installCommand;
|
||||
branch ??= $func.branch;
|
||||
$eventSet = new Set($func.events);
|
||||
});
|
||||
|
||||
@@ -73,7 +76,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
@@ -104,7 +108,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
@@ -135,7 +140,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
@@ -166,7 +172,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
@@ -197,7 +204,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
|
||||
@@ -229,7 +237,8 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
@@ -261,7 +270,41 @@
|
||||
buildCommand,
|
||||
installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId
|
||||
$func.repositoryId,
|
||||
$func.branch
|
||||
);
|
||||
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Deployment settings has been updated'
|
||||
});
|
||||
trackEvent('submit_function_update_deployment_settings');
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function updateBranch() {
|
||||
try {
|
||||
await sdkForProject.functions.update(
|
||||
functionId,
|
||||
$func.name,
|
||||
$func.execute,
|
||||
$func.events,
|
||||
$func.schedule,
|
||||
$func.timeout,
|
||||
$func.enabled,
|
||||
$func.logging,
|
||||
$func.entrypoint,
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
$func.vcsInstallationId,
|
||||
$func.repositoryId,
|
||||
branch
|
||||
);
|
||||
|
||||
invalidate(Dependencies.FUNCTION);
|
||||
@@ -293,6 +336,7 @@
|
||||
$func.buildCommand,
|
||||
$func.installCommand,
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
@@ -399,7 +443,18 @@
|
||||
<p>SOME TEXT</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<ul>
|
||||
<p>(Repo name, owner name, link to GitHub, ...)</p>
|
||||
<InputSelect
|
||||
options={(data?.branches?.branches ?? []).map((branch) => {
|
||||
return {
|
||||
label: branch.name,
|
||||
value: branch.name
|
||||
};
|
||||
})}
|
||||
bind:value={branch}
|
||||
id="branch"
|
||||
label="Branch" />
|
||||
|
||||
<Button on:click={() => updateBranch()}>Update</Button>
|
||||
</ul>
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
+8
-2
@@ -3,11 +3,17 @@ import { Dependencies } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, parent, depends }) => {
|
||||
await parent();
|
||||
const parentData = await parent();
|
||||
depends(Dependencies.VARIABLES);
|
||||
|
||||
return {
|
||||
variables: await sdkForProject.functions.listVariables(params.function),
|
||||
installations: await sdkForProject.vcs.listInstallations()
|
||||
installations: await sdkForProject.vcs.listInstallations(),
|
||||
branches: parentData.function.vcsInstallationId
|
||||
? await sdkForProject.vcs.listRepositoryBranches(
|
||||
parentData.function.vcsInstallationId,
|
||||
parentData.function.repositoryId
|
||||
)
|
||||
: null
|
||||
};
|
||||
};
|
||||
|
||||
+44
-5
@@ -5,13 +5,17 @@
|
||||
import { Empty, Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
export let installations: Models.InstallationList;
|
||||
export let show = false;
|
||||
const functionId = $page.params.function;
|
||||
let selectedInstallation: Models.Installation = null;
|
||||
let selectedRepository: Models.Repository = null;
|
||||
let selectedBranchName: string = null;
|
||||
let repositories: Models.RepositoryList = null;
|
||||
let branches: Models.BranchList = null;
|
||||
let error: string;
|
||||
async function selectInstallation(installation: Models.Installation) {
|
||||
try {
|
||||
@@ -26,10 +30,22 @@
|
||||
searchQuery || undefined
|
||||
);
|
||||
}
|
||||
|
||||
$: if (selectedInstallation) {
|
||||
searchRepositories(inputValue);
|
||||
}
|
||||
async function connectRepository(repository: Models.Repository) {
|
||||
|
||||
async function selectRepository(repository: Models.Repository) {
|
||||
selectedRepository = repository;
|
||||
console.log(selectedRepository);
|
||||
|
||||
branches = await sdkForProject.vcs.listRepositoryBranches(
|
||||
selectedInstallation.$id,
|
||||
repository.id
|
||||
);
|
||||
}
|
||||
|
||||
async function connectRepository() {
|
||||
try {
|
||||
await sdkForProject.functions.update(
|
||||
functionId,
|
||||
@@ -44,7 +60,8 @@
|
||||
$page.data.function.buildCommand,
|
||||
$page.data.function.installCommand,
|
||||
selectedInstallation.$id,
|
||||
`${repository.id}`
|
||||
selectedRepository.id,
|
||||
selectedBranchName
|
||||
);
|
||||
show = false;
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
@@ -55,6 +72,7 @@
|
||||
error = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
let inputValue = '';
|
||||
</script>
|
||||
|
||||
@@ -107,7 +125,7 @@
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
{:else}
|
||||
{:else if !selectedRepository}
|
||||
<p>
|
||||
2. Select repository:
|
||||
|
||||
@@ -139,8 +157,8 @@
|
||||
class="table-col"
|
||||
data-title="Enabled"
|
||||
style="--p-col-width:40">
|
||||
<Button on:click={() => connectRepository(repository)}
|
||||
>Connect</Button>
|
||||
<Button on:click={() => selectRepository(repository)}
|
||||
>Select</Button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
@@ -160,6 +178,27 @@
|
||||
</Empty>
|
||||
{/if}
|
||||
</p>
|
||||
{:else}
|
||||
<p>
|
||||
3. Select branch:
|
||||
|
||||
{#if branches === null}
|
||||
<p>Loading...</p>
|
||||
{:else}
|
||||
<InputSelect
|
||||
options={branches.branches.map((branch) => {
|
||||
return {
|
||||
label: branch.name,
|
||||
value: branch.name
|
||||
};
|
||||
})}
|
||||
bind:value={selectedBranchName}
|
||||
id="branch"
|
||||
label="Branch" />
|
||||
|
||||
<Button on:click={() => connectRepository()}>Deploy Now</Button>
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<svelte:fragment slot="footer" />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
name: 'GitHub',
|
||||
icon: 'github',
|
||||
redirect: () => {
|
||||
sdkForProject.vcs.createGitHubInstallation();
|
||||
sdkForProject.vcs.createGitHubInstallation(window.location.href);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user