-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from appwrite/feat-transfer-project-team
Transfer Project to Another Team for appwrite 1.4.x
- Loading branch information
Showing
3 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/routes/console/project-[project]/settings/transferProject.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { base } from '$app/paths'; | ||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; | ||
import { Modal } from '$lib/components'; | ||
import { Button } from '$lib/elements/forms'; | ||
import { addNotification } from '$lib/stores/notifications'; | ||
import { sdk } from '$lib/stores/sdk'; | ||
import { project } from '../store'; | ||
export let show = false; | ||
export let teamName; | ||
export let teamId; | ||
const handleTransfer = async () => { | ||
try { | ||
await sdk.forConsole.client.call( | ||
'PATCH', | ||
new URL( | ||
sdk.forConsole.client.config.endpoint + '/projects/' + $project.$id + '/team' | ||
), | ||
{ | ||
'content-type': 'application/json' | ||
}, | ||
{ | ||
teamId: teamId | ||
} | ||
); | ||
// await sdk.forConsole.projects.update($project.$id, password); | ||
show = false; | ||
addNotification({ | ||
type: 'success', | ||
message: `${$project.name} has been transfered to ${teamName}` | ||
}); | ||
trackEvent(Submit.ProjectUpdateTeam); | ||
await goto(`${base}/console/organization-${teamId}`); | ||
} catch (error) { | ||
addNotification({ | ||
type: 'error', | ||
message: error.message | ||
}); | ||
trackError(error, Submit.ProjectUpdateTeam); | ||
} | ||
}; | ||
</script> | ||
|
||
<Modal bind:show onSubmit={handleTransfer} headerDivider={false}> | ||
<svelte:fragment slot="header">Transfer project</svelte:fragment> | ||
<p>Are you sure you want to transfer <b>{$project.name}</b> to <b>{teamName}</b>?</p> | ||
<p> | ||
Members who are not part of the destination organization must be invited to gain access to | ||
this project. | ||
</p> | ||
|
||
<svelte:fragment slot="footer"> | ||
<Button text on:click={() => (show = false)}>Cancel</Button> | ||
<Button secondary submit>Transfer</Button> | ||
</svelte:fragment> | ||
</Modal> |
5c97d4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
console-cloud – ./
console-cloud-appwrite.vercel.app
console-cloud-git-main-appwrite.vercel.app
console-cloud.vercel.app
5c97d4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
console – ./
brand-new-console.torsten.appwrite.org
console-git-main-appwrite.vercel.app
console-appwrite.vercel.app
svelte-console.vercel.app
demo.appwriters.com