|
| 1 | +<script lang="ts"> |
| 2 | + import { page } from '$app/stores'; |
| 3 | +
|
| 4 | + import Link from '$lib/holocene/link.svelte'; |
| 5 | + import { translate } from '$lib/i18n/translate'; |
| 6 | + import type { ConfigurableTableHeader } from '$lib/stores/configurable-table-columns'; |
| 7 | + import { relativeTime, timeFormat } from '$lib/stores/time-format'; |
| 8 | + import type { WorkerDeploymentSummary } from '$lib/types/deployments'; |
| 9 | + import { formatDate } from '$lib/utilities/format-date'; |
| 10 | + import { |
| 11 | + routeForWorkerDeployment, |
| 12 | + routeForWorkflowsWithQuery, |
| 13 | + } from '$lib/utilities/route-for'; |
| 14 | +
|
| 15 | + import DeploymentStatus from './deployment-status.svelte'; |
| 16 | +
|
| 17 | + export let deployment: WorkerDeploymentSummary; |
| 18 | + export let columns: ConfigurableTableHeader[]; |
| 19 | +</script> |
| 20 | + |
| 21 | +<tr> |
| 22 | + {#each columns as { label } (label)} |
| 23 | + {#if label === translate('deployments.name')} |
| 24 | + <td class="p-2 text-left" |
| 25 | + ><Link |
| 26 | + href={routeForWorkerDeployment({ |
| 27 | + namespace: $page.params.namespace, |
| 28 | + deployment: deployment.name, |
| 29 | + })}>{deployment.name}</Link |
| 30 | + ></td |
| 31 | + > |
| 32 | + {:else if label === translate('deployments.deployment-version')} |
| 33 | + <td class="whitespace-pre-line break-words p-2 text-left"> |
| 34 | + <div class="flex flex-col gap-1"> |
| 35 | + {#if deployment.routingConfig.rampingVersion} |
| 36 | + <DeploymentStatus |
| 37 | + status="Ramping" |
| 38 | + version={deployment.routingConfig.rampingVersion} |
| 39 | + label={translate('deployments.ramping-percentage', { |
| 40 | + percentage: deployment.routingConfig.rampingVersionPercentage, |
| 41 | + })} |
| 42 | + /> |
| 43 | + {/if} |
| 44 | + <DeploymentStatus |
| 45 | + status="Current" |
| 46 | + version={deployment.routingConfig.currentVersion} |
| 47 | + label={translate('deployments.current')} |
| 48 | + /> |
| 49 | + </div> |
| 50 | + </td> |
| 51 | + {:else if label === translate('deployments.deployed')} |
| 52 | + <td class="truncate p-2 text-left"> |
| 53 | + <div class="flex flex-col gap-1"> |
| 54 | + {#if deployment.routingConfig.rampingVersionChangedTime} |
| 55 | + <p> |
| 56 | + {formatDate( |
| 57 | + deployment.routingConfig.rampingVersionChangedTime, |
| 58 | + $timeFormat, |
| 59 | + { |
| 60 | + relative: $relativeTime, |
| 61 | + }, |
| 62 | + )} |
| 63 | + </p> |
| 64 | + {/if} |
| 65 | + <p> |
| 66 | + {formatDate(deployment.createTime, $timeFormat, { |
| 67 | + relative: $relativeTime, |
| 68 | + })} |
| 69 | + </p> |
| 70 | + </div> |
| 71 | + </td> |
| 72 | + {:else if label === translate('deployments.workflows')} |
| 73 | + <td class="truncate p-2 text-center" |
| 74 | + ><p> |
| 75 | + <Link |
| 76 | + icon="external-link" |
| 77 | + href={routeForWorkflowsWithQuery({ |
| 78 | + namespace: $page.params.namespace, |
| 79 | + query: `TemporalWorkerDeployment="${deployment.name}"`, |
| 80 | + })} |
| 81 | + /> |
| 82 | + </p></td |
| 83 | + > |
| 84 | + {/if} |
| 85 | + {/each} |
| 86 | +</tr> |
0 commit comments