mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: deployment overview
This commit is contained in:
@@ -340,5 +340,5 @@ export enum Submit {
|
||||
SiteConnectRepo = 'submit_site_connect_repo',
|
||||
SiteRedeploy = 'submit_site_redeploy',
|
||||
SiteDisconnectRepo = 'submit_site_disconnect_repo',
|
||||
SitePromoteDeployment = 'submit_site_promote_deployment'
|
||||
SiteActivateDeployment = 'submit_site_activate_deployment'
|
||||
}
|
||||
|
||||
+8
-8
@@ -12,32 +12,32 @@
|
||||
export let siteId: string;
|
||||
let error: string;
|
||||
|
||||
async function promote() {
|
||||
async function activate() {
|
||||
try {
|
||||
await sdk.forProject.sites.updateDeploymentBuild(siteId, selectedDeploymentId);
|
||||
await sdk.forProject.sites.updateDeployment(siteId, selectedDeploymentId);
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `Deployment has been promoted`
|
||||
message: `Deployment has been activated`
|
||||
});
|
||||
trackEvent(Submit.SitePromoteDeployment);
|
||||
trackEvent(Submit.SiteActivateDeployment);
|
||||
|
||||
invalidate(Dependencies.SITE);
|
||||
invalidate(Dependencies.DEPLOYMENTS);
|
||||
show = false;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.SitePromoteDeployment);
|
||||
trackError(e, Submit.SiteActivateDeployment);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal title="Promote deployment" bind:show bind:error onSubmit={promote}>
|
||||
<Modal title="Activate deployment" bind:show bind:error onSubmit={activate}>
|
||||
<p class="text">
|
||||
Are you sure you want to promote this deployment? This might affect your production code.
|
||||
Are you sure you want to activate this deployment? This might affect your production code.
|
||||
</p>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit>Promote</Button>
|
||||
<Button submit>Activate</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -10,7 +10,9 @@
|
||||
Badge,
|
||||
HiddenText,
|
||||
ActionMenu,
|
||||
Accordion
|
||||
Accordion,
|
||||
Tooltip,
|
||||
Button as PinkButton
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import {
|
||||
IconDotsHorizontal,
|
||||
@@ -166,7 +168,16 @@
|
||||
<!-- TODO: fix max width -->
|
||||
<div style="max-width: 20rem">
|
||||
{#if variable.secret}
|
||||
<Badge content="Secret" variant="secondary" />
|
||||
<Tooltip maxWidth="26rem">
|
||||
<Badge
|
||||
content="Secret"
|
||||
variant="secondary"
|
||||
size="s" />
|
||||
<svelte:fragment slot="tooltip">
|
||||
This value is secret, you cannot see its
|
||||
value.
|
||||
</svelte:fragment>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<HiddenText
|
||||
isVisible={false}
|
||||
@@ -177,19 +188,22 @@
|
||||
<Table.Cell>
|
||||
<div style="margin-inline-start: auto">
|
||||
<Popover placement="bottom-end" let:toggle>
|
||||
<Button
|
||||
text
|
||||
<PinkButton.Button
|
||||
icon
|
||||
variant="text"
|
||||
size="s"
|
||||
aria-label="More options"
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
toggle(e);
|
||||
}}>
|
||||
<Icon size="s" icon={IconDotsHorizontal} />
|
||||
</Button>
|
||||
<Icon icon={IconDotsHorizontal} size="s" />
|
||||
</PinkButton.Button>
|
||||
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Button
|
||||
trailingIcon={IconPencil}
|
||||
leadingIcon={IconPencil}
|
||||
on:click={() => {
|
||||
showEditorModal = true;
|
||||
}}>
|
||||
@@ -197,7 +211,7 @@
|
||||
</ActionMenu.Item.Button>
|
||||
{#if !variable?.secret}
|
||||
<ActionMenu.Item.Button
|
||||
trailingIcon={IconEyeOff}
|
||||
leadingIcon={IconEyeOff}
|
||||
on:click={() => {
|
||||
currentVariable = variable;
|
||||
showSecretModal = true;
|
||||
@@ -206,7 +220,8 @@
|
||||
</ActionMenu.Item.Button>
|
||||
{/if}
|
||||
<ActionMenu.Item.Button
|
||||
trailingIcon={IconTrash}
|
||||
status="danger"
|
||||
leadingIcon={IconTrash}
|
||||
on:click={() => {
|
||||
showImportModal = true;
|
||||
}}>
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
IconXCircle
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { columns } from './store';
|
||||
import ActivateDeploymentModal from '../../activateDeploymentModal.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
let showDelete = false;
|
||||
// let showActivate = false;
|
||||
let showActivate = false;
|
||||
let showRedeploy = false;
|
||||
let showCancel = false;
|
||||
|
||||
@@ -139,7 +140,7 @@
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
selectedDeployment = deployment;
|
||||
// showActivate = true;
|
||||
showActivate = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
Activate
|
||||
@@ -182,10 +183,16 @@
|
||||
|
||||
{#if selectedDeployment}
|
||||
<Delete {selectedDeployment} bind:showDelete />
|
||||
<!-- <Activate {selectedDeployment} bind:showActivate on:activated={handleActivate} /> -->
|
||||
|
||||
<Cancel {selectedDeployment} bind:showCancel />
|
||||
<RedeployModal
|
||||
selectedDeploymentId={selectedDeployment.$id}
|
||||
bind:show={showRedeploy}
|
||||
site={data.site} />
|
||||
{/if}
|
||||
{#if selectedDeployment && showActivate}
|
||||
<ActivateDeploymentModal
|
||||
siteId={data.site.$id}
|
||||
selectedDeploymentId={selectedDeployment.$id}
|
||||
bind:show={showActivate} />
|
||||
{/if}
|
||||
|
||||
+42
-18
@@ -16,20 +16,25 @@
|
||||
import DeploymentCreatedBy from '../(components)/deploymentCreatedBy.svelte';
|
||||
import DeploymentSource from '../(components)/deploymentSource.svelte';
|
||||
import Id from '$lib/components/id.svelte';
|
||||
import { IconDotsHorizontal, IconGlobeAlt, IconRefresh } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
IconDotsHorizontal,
|
||||
IconGlobeAlt,
|
||||
IconRefresh,
|
||||
IconXCircle
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import RedeployModal from '../redeployModal.svelte';
|
||||
import PromoteModal from '../promoteModal.svelte';
|
||||
import { Card } from '$lib/components';
|
||||
import ActivateDeploymentModal from '../activateDeploymentModal.svelte';
|
||||
import CancelDeploymentModal from './deployments/cancelDeploymentModal.svelte';
|
||||
|
||||
export let site: Models.Site;
|
||||
export let activeDeployment: Models.Deployment;
|
||||
export let deploymentList: Models.DeploymentList = undefined;
|
||||
|
||||
let showPromote = false;
|
||||
let showActivate = false;
|
||||
let showRedeploy = false;
|
||||
let showCancel = false;
|
||||
let selectedDeployment: Models.Deployment = null;
|
||||
|
||||
$: console.log(deploymentList);
|
||||
</script>
|
||||
|
||||
{#if deploymentList.total}
|
||||
@@ -106,16 +111,31 @@
|
||||
}}>
|
||||
Redeploy
|
||||
</ActionMenu.Item.Button>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconGlobeAlt}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
selectedDeployment = deployment;
|
||||
showPromote = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
Promote
|
||||
</ActionMenu.Item.Button>
|
||||
{#if deployment?.status === 'ready' && deployment?.$id !== site.deploymentId}
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconGlobeAlt}
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
selectedDeployment = deployment;
|
||||
showActivate = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
Activate
|
||||
</ActionMenu.Item.Button>
|
||||
{/if}
|
||||
{#if deployment?.status === 'processing' || deployment?.status === 'building' || deployment.status === 'waiting'}
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconXCircle}
|
||||
status="danger"
|
||||
on:click={(e) => {
|
||||
e.preventDefault();
|
||||
selectedDeployment = deployment;
|
||||
showCancel = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
Cancel
|
||||
</ActionMenu.Item.Button>
|
||||
{/if}
|
||||
</ActionMenu.Root>
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
@@ -135,9 +155,13 @@
|
||||
<RedeployModal {site} selectedDeploymentId={selectedDeployment.$id} bind:show={showRedeploy} />
|
||||
{/if}
|
||||
|
||||
{#if selectedDeployment && showPromote}
|
||||
<PromoteModal
|
||||
{#if selectedDeployment && showActivate}
|
||||
<ActivateDeploymentModal
|
||||
siteId={site.$id}
|
||||
selectedDeploymentId={selectedDeployment.$id}
|
||||
bind:show={showPromote} />
|
||||
bind:show={showActivate} />
|
||||
{/if}
|
||||
|
||||
{#if selectedDeployment && showCancel}
|
||||
<CancelDeploymentModal {selectedDeployment} bind:showCancel />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user