mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: platform update name btn not disabling
This commit is contained in:
@@ -5,7 +5,7 @@ import { Dependencies } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends }) => {
|
||||
depends(Dependencies.PROJECT);
|
||||
depends(Dependencies.PLATFORM);
|
||||
|
||||
return {
|
||||
header: Header,
|
||||
|
||||
+16
-11
@@ -20,11 +20,8 @@
|
||||
import { project } from '../../../store';
|
||||
import { platform } from './store';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { PageData } from './$types';
|
||||
import { invalidate } from '$app/navigation';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
const types: Record<string, typeof SvelteComponent> = {
|
||||
web: Web,
|
||||
android: Android,
|
||||
@@ -41,20 +38,22 @@
|
||||
|
||||
let showDelete = false;
|
||||
let name: string = null;
|
||||
let updating = false;
|
||||
|
||||
onMount(() => {
|
||||
name ??= data.platform.name;
|
||||
name ??= $platform.name;
|
||||
});
|
||||
|
||||
const updateName = async () => {
|
||||
async function updateName() {
|
||||
updating = true;
|
||||
try {
|
||||
await sdkForConsole.projects.updatePlatform(
|
||||
$project.$id,
|
||||
data.platform.$id,
|
||||
$platform.$id,
|
||||
name,
|
||||
data.platform.key,
|
||||
data.platform.store,
|
||||
data.platform.hostname
|
||||
$platform.key,
|
||||
$platform.store,
|
||||
$platform.hostname
|
||||
);
|
||||
invalidate(Dependencies.PLATFORM);
|
||||
addNotification({
|
||||
@@ -67,7 +66,13 @@
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$: {
|
||||
// When platform name is updated, finalize the updating flow
|
||||
$platform.name;
|
||||
updating = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -87,7 +92,7 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button disabled={name === $platform.name} submit>Update</Button>
|
||||
<Button disabled={name === $platform.name || updating} submit>Update</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
let name: string = null;
|
||||
let showDelete = false;
|
||||
let updating = false;
|
||||
const endpoint = sdkForConsole.client.config.endpoint;
|
||||
const projectId = $page.params.project;
|
||||
|
||||
@@ -24,7 +25,8 @@
|
||||
name ??= $project.name;
|
||||
});
|
||||
|
||||
const updateName = async () => {
|
||||
async function updateName() {
|
||||
updating = true;
|
||||
try {
|
||||
await sdkForConsole.projects.update($project.$id, name);
|
||||
invalidate(Dependencies.PROJECT);
|
||||
@@ -39,9 +41,15 @@
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const serviceUpdate = async (service: Service) => {
|
||||
$: {
|
||||
// When project name is updated, finalize the updating flow
|
||||
$project.name;
|
||||
updating = false;
|
||||
}
|
||||
|
||||
async function serviceUpdate(service: Service) {
|
||||
try {
|
||||
await sdkForConsole.projects.updateServiceStatus(
|
||||
$project.$id,
|
||||
@@ -65,7 +73,7 @@
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$: services.load($project);
|
||||
</script>
|
||||
@@ -105,7 +113,7 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button disabled={name === $project.name} submit>Update</Button>
|
||||
<Button disabled={name === $project.name || updating} submit>Update</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user