|
3 | 3 | import { page } from '$app/stores';
|
4 | 4 | import { PendingValue, graphql } from '$houdini';
|
5 | 5 | import Card from '$lib/Card.svelte';
|
| 6 | + import GraphErrors from '$lib/GraphErrors.svelte'; |
6 | 7 | import Time from '$lib/Time.svelte';
|
7 | 8 | import { Alert, Button, CopyButton, Loader, Modal, Skeleton } from '@nais/ds-svelte-community';
|
8 | 9 | import {
|
|
11 | 12 | EyeIcon,
|
12 | 13 | EyeSlashIcon
|
13 | 14 | } from '@nais/ds-svelte-community/icons';
|
| 15 | + import { slide } from 'svelte/transition'; |
14 | 16 | import type { PageData } from './$houdini';
|
15 | 17 | import EditText from './EditText.svelte';
|
16 | 18 |
|
|
103 | 105 | const [, projectId, , location, , repository] = repo.split('/');
|
104 | 106 | return `${location}-docker.pkg.dev/${projectId}/${repository}`;
|
105 | 107 | };
|
| 108 | +
|
| 109 | + const synchronizeTeam = graphql(` |
| 110 | + mutation SynchronizeTeam($slug: Slug!) { |
| 111 | + synchronizeTeam(slug: $slug) { |
| 112 | + correlationID |
| 113 | + } |
| 114 | + } |
| 115 | + `); |
| 116 | +
|
| 117 | + let synchronizeClicked = false; |
106 | 118 | </script>
|
107 | 119 |
|
108 | 120 | {#if $TeamSettings.errors}
|
|
232 | 244 | {/if}
|
233 | 245 | </Card>
|
234 | 246 | <Card columns={6}>
|
235 |
| - <h3>Managed resources</h3> |
| 247 | + <h3 class="with_button"> |
| 248 | + Managed resources |
| 249 | + <Button |
| 250 | + size="xsmall" |
| 251 | + variant="secondary" |
| 252 | + loading={$synchronizeTeam.fetching} |
| 253 | + on:click={async () => { |
| 254 | + await synchronizeTeam.mutate({ slug: team }); |
| 255 | + synchronizeClicked = true; |
| 256 | + }} |
| 257 | + > |
| 258 | + Synchronize team |
| 259 | + </Button> |
| 260 | + </h3> |
| 261 | + {#if $synchronizeTeam.errors} |
| 262 | + <GraphErrors errors={$synchronizeTeam.errors} dismissable={true} /> |
| 263 | + {:else if synchronizeClicked} |
| 264 | + <div transition:slide={{ duration: 200 }}> |
| 265 | + <Alert variant="success" size="small"> |
| 266 | + Synchronization started, team resources will soon be updated. |
| 267 | + <Button size="xsmall" variant="tertiary" on:click={() => (synchronizeClicked = false)}> |
| 268 | + Dismiss |
| 269 | + </Button> |
| 270 | + </Alert> |
| 271 | + </div> |
| 272 | + {/if} |
236 | 273 | {#if teamSettings.id === PendingValue}
|
237 | 274 | <Loader />
|
238 | 275 | {:else}
|
|
412 | 449 | flex-direction: row;
|
413 | 450 | gap: 0.5rem;
|
414 | 451 | }
|
| 452 | +
|
| 453 | + h3.with_button { |
| 454 | + display: flex; |
| 455 | + justify-content: space-between; |
| 456 | + align-items: center; |
| 457 | + } |
415 | 458 | </style>
|
0 commit comments