@antelopejs/dms-antelope-cloud 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +448 -0
- package/dist/cloud-status.d.ts +13 -0
- package/dist/cloud-status.js +77 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +104 -0
- package/dist/configured.d.ts +16 -0
- package/dist/configured.js +26 -0
- package/dist/connection/actions.d.ts +40 -0
- package/dist/connection/actions.js +120 -0
- package/dist/connection/announce.d.ts +8 -0
- package/dist/connection/announce.js +20 -0
- package/dist/connection/cloud.d.ts +60 -0
- package/dist/connection/cloud.js +87 -0
- package/dist/connection/content.d.ts +70 -0
- package/dist/connection/content.js +462 -0
- package/dist/connection/current.d.ts +26 -0
- package/dist/connection/current.js +28 -0
- package/dist/connection/device-flow.d.ts +16 -0
- package/dist/connection/device-flow.js +146 -0
- package/dist/connection/refusals.d.ts +51 -0
- package/dist/connection/refusals.js +85 -0
- package/dist/connection/repository.d.ts +28 -0
- package/dist/connection/repository.js +69 -0
- package/dist/connection/seal.d.ts +22 -0
- package/dist/connection/seal.js +47 -0
- package/dist/connection/store.d.ts +294 -0
- package/dist/connection/store.js +165 -0
- package/dist/connection/view.d.ts +39 -0
- package/dist/connection/view.js +39 -0
- package/dist/dashboard/actions.d.ts +40 -0
- package/dist/dashboard/actions.js +115 -0
- package/dist/dashboard/dockerfile.d.ts +34 -0
- package/dist/dashboard/dockerfile.js +71 -0
- package/dist/dashboard/service.d.ts +61 -0
- package/dist/dashboard/service.js +137 -0
- package/dist/dashboard/variables.d.ts +30 -0
- package/dist/dashboard/variables.js +34 -0
- package/dist/deployments/build-log.d.ts +39 -0
- package/dist/deployments/build-log.js +57 -0
- package/dist/deployments/cloud-steps.d.ts +77 -0
- package/dist/deployments/cloud-steps.js +132 -0
- package/dist/deployments/content.d.ts +61 -0
- package/dist/deployments/content.js +268 -0
- package/dist/deployments/deployment.d.ts +96 -0
- package/dist/deployments/deployment.js +3 -0
- package/dist/deployments/follow.d.ts +18 -0
- package/dist/deployments/follow.js +112 -0
- package/dist/deployments/ledger.d.ts +23 -0
- package/dist/deployments/ledger.js +359 -0
- package/dist/deployments/lifecycle.d.ts +123 -0
- package/dist/deployments/lifecycle.js +146 -0
- package/dist/deployments/live.d.ts +28 -0
- package/dist/deployments/live.js +54 -0
- package/dist/deployments/publish-read.d.ts +20 -0
- package/dist/deployments/publish-read.js +24 -0
- package/dist/deployments/refusals.d.ts +13 -0
- package/dist/deployments/refusals.js +35 -0
- package/dist/environments/actions.d.ts +86 -0
- package/dist/environments/actions.js +210 -0
- package/dist/environments/address.d.ts +60 -0
- package/dist/environments/address.js +149 -0
- package/dist/environments/content.d.ts +97 -0
- package/dist/environments/content.js +275 -0
- package/dist/environments/follower.d.ts +32 -0
- package/dist/environments/follower.js +114 -0
- package/dist/environments/pipeline.d.ts +58 -0
- package/dist/environments/pipeline.js +76 -0
- package/dist/environments/publish-targets.d.ts +18 -0
- package/dist/environments/publish-targets.js +55 -0
- package/dist/environments/roles.d.ts +73 -0
- package/dist/environments/roles.js +97 -0
- package/dist/frontend-module.d.ts +12 -0
- package/dist/frontend-module.js +25 -0
- package/dist/git/changed-files.d.ts +30 -0
- package/dist/git/changed-files.js +107 -0
- package/dist/git/changes.d.ts +89 -0
- package/dist/git/changes.js +162 -0
- package/dist/git/command.d.ts +51 -0
- package/dist/git/command.js +231 -0
- package/dist/git/promotion.d.ts +23 -0
- package/dist/git/promotion.js +46 -0
- package/dist/git/publish-input.d.ts +42 -0
- package/dist/git/publish-input.js +62 -0
- package/dist/git/publish-job.d.ts +82 -0
- package/dist/git/publish-job.js +99 -0
- package/dist/git/publish-steps.d.ts +90 -0
- package/dist/git/publish-steps.js +205 -0
- package/dist/git/publisher.d.ts +23 -0
- package/dist/git/publisher.js +206 -0
- package/dist/git/refs.d.ts +99 -0
- package/dist/git/refs.js +178 -0
- package/dist/git/refusal.d.ts +49 -0
- package/dist/git/refusal.js +70 -0
- package/dist/git/repository.d.ts +101 -0
- package/dist/git/repository.js +273 -0
- package/dist/git/versions.d.ts +99 -0
- package/dist/git/versions.js +174 -0
- package/dist/git/write-lock.d.ts +19 -0
- package/dist/git/write-lock.js +49 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +59 -0
- package/dist/lifecycle.d.ts +8 -0
- package/dist/lifecycle.js +78 -0
- package/dist/logs/relay.d.ts +25 -0
- package/dist/logs/relay.js +138 -0
- package/dist/null-prototype.d.ts +7 -0
- package/dist/null-prototype.js +3 -0
- package/dist/overview/content.d.ts +40 -0
- package/dist/overview/content.js +172 -0
- package/dist/pages/changes.d.ts +32 -0
- package/dist/pages/changes.js +141 -0
- package/dist/pages/connection.d.ts +43 -0
- package/dist/pages/connection.js +295 -0
- package/dist/pages/deployment.d.ts +67 -0
- package/dist/pages/deployment.js +261 -0
- package/dist/pages/deployments.d.ts +46 -0
- package/dist/pages/deployments.js +266 -0
- package/dist/pages/environments.d.ts +34 -0
- package/dist/pages/environments.js +368 -0
- package/dist/pages/logs.d.ts +46 -0
- package/dist/pages/logs.js +140 -0
- package/dist/pages/navigation.d.ts +61 -0
- package/dist/pages/navigation.js +107 -0
- package/dist/pages/overview.d.ts +35 -0
- package/dist/pages/overview.js +201 -0
- package/dist/pages/project-guard.d.ts +32 -0
- package/dist/pages/project-guard.js +99 -0
- package/dist/pages/query.d.ts +6 -0
- package/dist/pages/query.js +14 -0
- package/dist/pages/resources.d.ts +37 -0
- package/dist/pages/resources.js +211 -0
- package/dist/pages/setup.d.ts +40 -0
- package/dist/pages/setup.js +271 -0
- package/dist/pages/slugs.d.ts +15 -0
- package/dist/pages/slugs.js +28 -0
- package/dist/pages/variables.d.ts +43 -0
- package/dist/pages/variables.js +327 -0
- package/dist/pages/version.d.ts +26 -0
- package/dist/pages/version.js +214 -0
- package/dist/pages/versions.d.ts +20 -0
- package/dist/pages/versions.js +115 -0
- package/dist/resources/apply.d.ts +15 -0
- package/dist/resources/apply.js +127 -0
- package/dist/resources/cards.d.ts +41 -0
- package/dist/resources/cards.js +211 -0
- package/dist/resources/connect.d.ts +66 -0
- package/dist/resources/connect.js +78 -0
- package/dist/resources/content.d.ts +26 -0
- package/dist/resources/content.js +158 -0
- package/dist/resources/format.d.ts +10 -0
- package/dist/resources/format.js +30 -0
- package/dist/resources/guard.d.ts +23 -0
- package/dist/resources/guard.js +60 -0
- package/dist/resources/modules.d.ts +23 -0
- package/dist/resources/modules.js +39 -0
- package/dist/resources/plan.d.ts +8 -0
- package/dist/resources/plan.js +93 -0
- package/dist/resources/read.d.ts +54 -0
- package/dist/resources/read.js +69 -0
- package/dist/resources/refusals.d.ts +15 -0
- package/dist/resources/refusals.js +33 -0
- package/dist/resources/routes.d.ts +32 -0
- package/dist/resources/routes.js +53 -0
- package/dist/setup/actions.d.ts +79 -0
- package/dist/setup/actions.js +188 -0
- package/dist/setup/apply.d.ts +37 -0
- package/dist/setup/apply.js +172 -0
- package/dist/setup/content.d.ts +50 -0
- package/dist/setup/content.js +440 -0
- package/dist/setup/rollout.d.ts +119 -0
- package/dist/setup/rollout.js +227 -0
- package/dist/setup/steps.d.ts +93 -0
- package/dist/setup/steps.js +95 -0
- package/dist/setup/storage.d.ts +29 -0
- package/dist/setup/storage.js +78 -0
- package/dist/setup/store.d.ts +214 -0
- package/dist/setup/store.js +174 -0
- package/dist/setup/volume.d.ts +31 -0
- package/dist/setup/volume.js +52 -0
- package/dist/slug.d.ts +7 -0
- package/dist/slug.js +26 -0
- package/dist/variables/actions.d.ts +76 -0
- package/dist/variables/actions.js +185 -0
- package/dist/variables/content.d.ts +69 -0
- package/dist/variables/content.js +310 -0
- package/dist/variables/decide.d.ts +27 -0
- package/dist/variables/decide.js +155 -0
- package/dist/variables/decided-dialog.d.ts +11 -0
- package/dist/variables/decided-dialog.js +129 -0
- package/dist/variables/decided.d.ts +80 -0
- package/dist/variables/decided.js +240 -0
- package/dist/variables/dialogs.d.ts +8 -0
- package/dist/variables/dialogs.js +219 -0
- package/dist/variables/model.d.ts +106 -0
- package/dist/variables/model.js +156 -0
- package/dist/variables/project-config.d.ts +117 -0
- package/dist/variables/project-config.js +248 -0
- package/dist/variables/read.d.ts +33 -0
- package/dist/variables/read.js +118 -0
- package/dist/web-url.d.ts +9 -0
- package/dist/web-url.js +19 -0
- package/frontend-vue/app/components/BuildLog.vue +99 -0
- package/frontend-vue/app/components/ChangedFiles.vue +165 -0
- package/frontend-vue/app/components/DashboardEnvironments.vue +102 -0
- package/frontend-vue/app/components/LogLine.vue +33 -0
- package/frontend-vue/app/components/LogViewer.vue +314 -0
- package/frontend-vue/app/components/PublishChipIcon.vue +39 -0
- package/frontend-vue/app/components/PublishForm.vue +505 -0
- package/frontend-vue/app/components/PublishPopover.vue +90 -0
- package/frontend-vue/app/components/PublishRoute.vue +222 -0
- package/frontend-vue/app/composables/usePublishSummary.ts +80 -0
- package/frontend-vue/app/plugins/publish-chip.client.ts +44 -0
- package/frontend-vue/app/types/publishing.ts +154 -0
- package/frontend-vue/app/utils/build-log.ts +96 -0
- package/frontend-vue/app/utils/changed-files.ts +142 -0
- package/frontend-vue/app/utils/log-line.ts +15 -0
- package/frontend-vue/app/utils/log-stream.ts +361 -0
- package/frontend-vue/app/utils/publish-state.ts +299 -0
- package/frontend-vue/dms.frontend.ts +27 -0
- package/frontend-vue/i18n/locales/antelope-cloud-en-GB.json +110 -0
- package/frontend-vue/package.json +38 -0
- package/frontend-vue/pnpm-lock.yaml +2697 -0
- package/package.json +115 -4
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import type {
|
|
4
|
+
PublishJob,
|
|
5
|
+
PublishStep,
|
|
6
|
+
PublishSteps,
|
|
7
|
+
StepState,
|
|
8
|
+
} from '../types/publishing'
|
|
9
|
+
import {
|
|
10
|
+
type CloudStepView,
|
|
11
|
+
cloudStepViews,
|
|
12
|
+
failureTitle,
|
|
13
|
+
isSavedLocally,
|
|
14
|
+
logStep,
|
|
15
|
+
reachedRefs,
|
|
16
|
+
STATE_ICONS,
|
|
17
|
+
STEP_ICONS,
|
|
18
|
+
} from '../utils/publish-state'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The route of one publish: the four git steps with their live state, the four
|
|
22
|
+
* AntelopeJS Cloud steps as `cloud` reports them, the failure when there is
|
|
23
|
+
* one, and the log of the step at work, scrolled within a box of about twelve
|
|
24
|
+
* lines. It draws the `job` and `cloud` it is given and reads nothing.
|
|
25
|
+
*/
|
|
26
|
+
const props = defineProps<{ job: PublishJob; cloud: PublishSteps | null }>()
|
|
27
|
+
|
|
28
|
+
const cloudSteps = computed(() => cloudStepViews(props.job, props.cloud))
|
|
29
|
+
const cloudFailure = computed(() =>
|
|
30
|
+
props.cloud?.state === 'following' && props.cloud.failure
|
|
31
|
+
? { ...props.cloud.failure, url: props.cloud.deploymentUrl }
|
|
32
|
+
: null,
|
|
33
|
+
)
|
|
34
|
+
const log = computed(() => logStep(props.job))
|
|
35
|
+
const reached = computed(() => reachedRefs(props.job))
|
|
36
|
+
const isFailed = computed(
|
|
37
|
+
() => props.job.status === 'failed' && props.job.failure !== null,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
function markIcon(state: StepState, idle: string): string {
|
|
41
|
+
return state === 'todo' || state === 'running' ? idle : STATE_ICONS[state]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function stepIcon(step: PublishStep): string {
|
|
45
|
+
return markIcon(step.state, STEP_ICONS[step.id])
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function cloudIcon(step: CloudStepView): string {
|
|
49
|
+
return markIcon(step.state, step.icon)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const STEP_TONES: Record<StepState, string> = {
|
|
53
|
+
todo: 'opacity-60',
|
|
54
|
+
running: 'border-primary/40 ring-primary/20 ring-2',
|
|
55
|
+
done: '',
|
|
56
|
+
skipped: 'opacity-80',
|
|
57
|
+
failed: 'border-error/40 bg-error/10',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const MARK_TONES: Record<StepState, string> = {
|
|
61
|
+
todo: 'text-muted',
|
|
62
|
+
running: 'text-primary border-primary/40',
|
|
63
|
+
done: 'text-primary bg-primary/10 border-primary/40',
|
|
64
|
+
skipped: 'text-muted',
|
|
65
|
+
failed: 'text-error bg-error/10 border-error/40',
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<div class="flex min-w-0 flex-col gap-3 text-sm">
|
|
71
|
+
<div class="flex flex-col gap-2">
|
|
72
|
+
<span class="text-muted flex items-center gap-1.5 text-xs font-medium">
|
|
73
|
+
<UIcon name="i-ph-git-branch-light" class="size-3.5" />
|
|
74
|
+
In your repository
|
|
75
|
+
</span>
|
|
76
|
+
<ol class="m-0 grid list-none grid-cols-2 gap-2 p-0">
|
|
77
|
+
<li
|
|
78
|
+
v-for="step in props.job.steps"
|
|
79
|
+
:key="step.id"
|
|
80
|
+
class="border-default bg-default flex min-w-0 items-start gap-2 rounded-md border p-2.5"
|
|
81
|
+
:class="STEP_TONES[step.state]"
|
|
82
|
+
:data-testid="`route-step-${step.id}`"
|
|
83
|
+
:data-state="step.state"
|
|
84
|
+
>
|
|
85
|
+
<span
|
|
86
|
+
class="grid size-[22px] shrink-0 place-items-center rounded-full border text-xs"
|
|
87
|
+
:class="MARK_TONES[step.state]"
|
|
88
|
+
>
|
|
89
|
+
<UIcon
|
|
90
|
+
v-if="step.state === 'running'"
|
|
91
|
+
name="i-ph-circle-notch"
|
|
92
|
+
class="size-3.5 animate-spin"
|
|
93
|
+
data-testid="route-spinner"
|
|
94
|
+
/>
|
|
95
|
+
<UIcon v-else :name="stepIcon(step)" class="size-3.5" />
|
|
96
|
+
</span>
|
|
97
|
+
<span class="min-w-0 text-[12.5px] leading-tight">
|
|
98
|
+
<b class="text-highlighted block truncate font-semibold">
|
|
99
|
+
{{ step.title }}
|
|
100
|
+
</b>
|
|
101
|
+
<small
|
|
102
|
+
class="text-dimmed mt-0.5 block truncate font-mono text-[10.5px]"
|
|
103
|
+
>
|
|
104
|
+
{{ step.detail }}
|
|
105
|
+
</small>
|
|
106
|
+
</span>
|
|
107
|
+
</li>
|
|
108
|
+
</ol>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="flex flex-col gap-2" data-testid="route-cloud-group">
|
|
112
|
+
<span class="text-muted flex items-center gap-1.5 text-xs font-medium">
|
|
113
|
+
<UIcon name="i-ph-cloud-light" class="size-3.5" />
|
|
114
|
+
On AntelopeJS Cloud
|
|
115
|
+
</span>
|
|
116
|
+
<ol class="m-0 grid list-none grid-cols-2 gap-2 p-0">
|
|
117
|
+
<li
|
|
118
|
+
v-for="step in cloudSteps"
|
|
119
|
+
:key="step.id"
|
|
120
|
+
class="border-default bg-default flex min-w-0 items-start gap-2 rounded-md border p-2.5"
|
|
121
|
+
:class="STEP_TONES[step.state]"
|
|
122
|
+
:data-testid="`route-cloud-${step.id}`"
|
|
123
|
+
:data-state="step.state"
|
|
124
|
+
>
|
|
125
|
+
<span
|
|
126
|
+
class="grid size-[22px] shrink-0 place-items-center rounded-full border text-xs"
|
|
127
|
+
:class="MARK_TONES[step.state]"
|
|
128
|
+
>
|
|
129
|
+
<UIcon
|
|
130
|
+
v-if="step.state === 'running'"
|
|
131
|
+
name="i-ph-circle-notch"
|
|
132
|
+
class="size-3.5 animate-spin"
|
|
133
|
+
data-testid="route-cloud-spinner"
|
|
134
|
+
/>
|
|
135
|
+
<UIcon v-else :name="cloudIcon(step)" class="size-3.5" />
|
|
136
|
+
</span>
|
|
137
|
+
<span class="min-w-0 text-[12.5px] leading-tight">
|
|
138
|
+
<b class="text-highlighted block truncate font-semibold">
|
|
139
|
+
{{ step.title }}
|
|
140
|
+
</b>
|
|
141
|
+
<small class="text-dimmed mt-0.5 block truncate text-[10.5px]">
|
|
142
|
+
{{ step.detail }}
|
|
143
|
+
</small>
|
|
144
|
+
</span>
|
|
145
|
+
</li>
|
|
146
|
+
</ol>
|
|
147
|
+
<p
|
|
148
|
+
v-if="props.cloud?.state === 'unavailable'"
|
|
149
|
+
class="text-muted m-0 text-xs"
|
|
150
|
+
data-testid="route-cloud-unavailable"
|
|
151
|
+
>
|
|
152
|
+
{{ props.cloud.message }}
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<UAlert
|
|
157
|
+
v-if="cloudFailure"
|
|
158
|
+
color="error"
|
|
159
|
+
variant="subtle"
|
|
160
|
+
icon="i-ph-warning-circle-light"
|
|
161
|
+
:title="cloudFailure.title"
|
|
162
|
+
data-testid="route-cloud-failure"
|
|
163
|
+
>
|
|
164
|
+
<template #description>
|
|
165
|
+
<p class="m-0">{{ cloudFailure.visitors }}</p>
|
|
166
|
+
<DmsLink
|
|
167
|
+
:to="cloudFailure.url"
|
|
168
|
+
class="text-primary mt-1 inline-flex items-center gap-1 text-[12.5px] font-medium"
|
|
169
|
+
data-testid="route-cloud-deployment"
|
|
170
|
+
>
|
|
171
|
+
View deployment
|
|
172
|
+
<UIcon name="i-ph-arrow-right-light" class="size-3.5" />
|
|
173
|
+
</DmsLink>
|
|
174
|
+
<DmsLink
|
|
175
|
+
v-if="cloudFailure.buildLogUrl"
|
|
176
|
+
:to="cloudFailure.buildLogUrl"
|
|
177
|
+
class="text-primary mt-1 ml-4 inline-flex items-center gap-1 text-[12.5px] font-medium"
|
|
178
|
+
data-testid="route-cloud-build-log"
|
|
179
|
+
>
|
|
180
|
+
Build log
|
|
181
|
+
<UIcon name="i-ph-terminal-window" class="size-3.5" />
|
|
182
|
+
</DmsLink>
|
|
183
|
+
</template>
|
|
184
|
+
</UAlert>
|
|
185
|
+
|
|
186
|
+
<UAlert
|
|
187
|
+
v-if="isFailed && props.job.failure"
|
|
188
|
+
color="error"
|
|
189
|
+
variant="subtle"
|
|
190
|
+
icon="i-ph-warning-circle-light"
|
|
191
|
+
:title="failureTitle(props.job)"
|
|
192
|
+
data-testid="route-failure"
|
|
193
|
+
>
|
|
194
|
+
<template #description>
|
|
195
|
+
<p class="m-0">{{ props.job.failure.message }}</p>
|
|
196
|
+
<ul
|
|
197
|
+
v-if="reached.length > 0"
|
|
198
|
+
class="m-0 mt-1 list-none p-0"
|
|
199
|
+
data-testid="route-reached"
|
|
200
|
+
>
|
|
201
|
+
<li v-for="ref in reached" :key="ref" class="font-mono text-xs">
|
|
202
|
+
{{ ref }}
|
|
203
|
+
</li>
|
|
204
|
+
</ul>
|
|
205
|
+
<p
|
|
206
|
+
v-if="isSavedLocally(props.job)"
|
|
207
|
+
class="m-0 mt-1"
|
|
208
|
+
data-testid="route-saved-locally"
|
|
209
|
+
>
|
|
210
|
+
Your version is saved locally
|
|
211
|
+
</p>
|
|
212
|
+
</template>
|
|
213
|
+
</UAlert>
|
|
214
|
+
|
|
215
|
+
<pre
|
|
216
|
+
v-if="log && log.log"
|
|
217
|
+
class="border-default bg-elevated text-toned m-0 max-h-60 max-w-full min-w-0 overflow-auto rounded-md border px-3 py-2.5 font-mono text-[11.5px] leading-relaxed whitespace-pre"
|
|
218
|
+
:class="{ 'border-error/40 text-error': isFailed }"
|
|
219
|
+
data-testid="route-log"
|
|
220
|
+
>{{ log.log }}</pre>
|
|
221
|
+
</div>
|
|
222
|
+
</template>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { computed, type ComputedRef, type Ref } from 'vue'
|
|
2
|
+
import type { ChangesSummary, ChipState } from '../types/publishing'
|
|
3
|
+
import {
|
|
4
|
+
chipState,
|
|
5
|
+
errorStatus,
|
|
6
|
+
HIDING_STATUSES,
|
|
7
|
+
IDLE_POLL_MS,
|
|
8
|
+
isRepositoryUnusable,
|
|
9
|
+
RUNNING_POLL_MS,
|
|
10
|
+
SUMMARY_ROUTE,
|
|
11
|
+
} from '../utils/publish-state'
|
|
12
|
+
|
|
13
|
+
const SUMMARY_KEY = 'antelope-cloud:publish-summary'
|
|
14
|
+
const SIGNED_OUT_POLL_MS = 5_000
|
|
15
|
+
const REFUSED_POLL_MS = 60_000
|
|
16
|
+
|
|
17
|
+
/** What `usePublishSummary` hands to the chip and its popover. */
|
|
18
|
+
export interface PublishSummary {
|
|
19
|
+
summary: Readonly<Ref<ChangesSummary | null | undefined>>
|
|
20
|
+
error: Readonly<Ref<unknown>>
|
|
21
|
+
/** Whether the owner has nothing to see: refused, or the repository cannot publish. */
|
|
22
|
+
isHidden: ComputedRef<boolean>
|
|
23
|
+
state: ComputedRef<ChipState>
|
|
24
|
+
count: ComputedRef<number>
|
|
25
|
+
refresh: () => Promise<void>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How long to wait before reading the summary again: 750 ms while a publish job
|
|
30
|
+
* runs, 15 s otherwise, 5 s while signed out so the chip shows soon after a
|
|
31
|
+
* sign-in, and 60 s for a user the route refuses.
|
|
32
|
+
*/
|
|
33
|
+
export function nextPollDelay(
|
|
34
|
+
summary: ChangesSummary | null | undefined,
|
|
35
|
+
error: unknown,
|
|
36
|
+
): number {
|
|
37
|
+
const status = errorStatus(error)
|
|
38
|
+
if (status === 401) return SIGNED_OUT_POLL_MS
|
|
39
|
+
if (status !== undefined && HIDING_STATUSES.has(status))
|
|
40
|
+
return REFUSED_POLL_MS
|
|
41
|
+
return summary?.job?.status === 'running' ? RUNNING_POLL_MS : IDLE_POLL_MS
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The changes summary, shared by every caller through one key. The publish
|
|
46
|
+
* chip plugin reads it again on the delay {@link nextPollDelay} gives. A 401,
|
|
47
|
+
* 403 or 404 answer hides the chip.
|
|
48
|
+
*/
|
|
49
|
+
export function usePublishSummary(): PublishSummary {
|
|
50
|
+
const { data, error, refresh } = useApiData<ChangesSummary | null>(
|
|
51
|
+
SUMMARY_ROUTE,
|
|
52
|
+
{
|
|
53
|
+
key: SUMMARY_KEY,
|
|
54
|
+
server: false,
|
|
55
|
+
lazy: true,
|
|
56
|
+
default: () => null,
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
const isRefused = computed(() => {
|
|
61
|
+
const status = errorStatus(error.value)
|
|
62
|
+
return status !== undefined && HIDING_STATUSES.has(status)
|
|
63
|
+
})
|
|
64
|
+
const isHidden = computed(
|
|
65
|
+
() => isRefused.value || !data.value || isRepositoryUnusable(data.value),
|
|
66
|
+
)
|
|
67
|
+
const state = computed<ChipState>(() =>
|
|
68
|
+
data.value ? chipState(data.value) : 'published',
|
|
69
|
+
)
|
|
70
|
+
const count = computed(() => data.value?.files.length ?? 0)
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
summary: data,
|
|
74
|
+
error,
|
|
75
|
+
isHidden,
|
|
76
|
+
state,
|
|
77
|
+
count,
|
|
78
|
+
refresh: () => refresh(),
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineDmsPlugin } from '#dms/frontend-module'
|
|
2
|
+
import {
|
|
3
|
+
nextPollDelay,
|
|
4
|
+
usePublishSummary,
|
|
5
|
+
} from '../composables/usePublishSummary'
|
|
6
|
+
|
|
7
|
+
const PUBLISH_ACTION_ID = 'antelope-cloud-publish'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Puts the publish chip in the dashboard header and the popover behind it in a
|
|
11
|
+
* side panel. The chip shows once the summary route answers for the signed-in
|
|
12
|
+
* user, and goes away for a user it refuses. The plugin keeps the summary
|
|
13
|
+
* fresh for the whole app, skipping reads while the tab is hidden.
|
|
14
|
+
*/
|
|
15
|
+
export default defineDmsPlugin(() => {
|
|
16
|
+
const { summary, error, isHidden, refresh } = usePublishSummary()
|
|
17
|
+
|
|
18
|
+
const poll = (): void => {
|
|
19
|
+
setTimeout(
|
|
20
|
+
async () => {
|
|
21
|
+
if (document.visibilityState !== 'hidden') await refresh()
|
|
22
|
+
poll()
|
|
23
|
+
},
|
|
24
|
+
nextPollDelay(summary.value, error.value),
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
poll()
|
|
28
|
+
|
|
29
|
+
registerSidePanel({
|
|
30
|
+
id: PUBLISH_ACTION_ID,
|
|
31
|
+
component: 'AntelopeCloudPublishPopover',
|
|
32
|
+
ariaLabel: 'Publish',
|
|
33
|
+
defaultWidth: 380,
|
|
34
|
+
})
|
|
35
|
+
registerHeaderAction({
|
|
36
|
+
id: PUBLISH_ACTION_ID,
|
|
37
|
+
icon: 'i-ph-rocket-launch-light',
|
|
38
|
+
iconComponent: 'AntelopeCloudPublishChipIcon',
|
|
39
|
+
label: 'Publish',
|
|
40
|
+
sidePanelId: PUBLISH_ACTION_ID,
|
|
41
|
+
order: 50,
|
|
42
|
+
isVisible: () => !isHidden.value,
|
|
43
|
+
})
|
|
44
|
+
})
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/** What a changed file did, as the changes summary reports it. */
|
|
2
|
+
export type ChangeKind = 'added' | 'modified' | 'deleted'
|
|
3
|
+
|
|
4
|
+
/** A file of the working copy that differs from the last published version. */
|
|
5
|
+
export interface ChangedFile {
|
|
6
|
+
kind: ChangeKind
|
|
7
|
+
path: string
|
|
8
|
+
additions: number | null
|
|
9
|
+
deletions: number | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** A reason the changes page or a publish request refuses to go on. */
|
|
13
|
+
export interface Refusal {
|
|
14
|
+
code: string
|
|
15
|
+
message: string
|
|
16
|
+
field?: string
|
|
17
|
+
branch?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A branch a version can be published to. */
|
|
21
|
+
export interface PublishEnvironment {
|
|
22
|
+
name: string
|
|
23
|
+
branch: string
|
|
24
|
+
commit: string | null
|
|
25
|
+
version: number | null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The four git steps of a publish, in order. */
|
|
29
|
+
export type StepId = 'commit' | 'tag' | 'move' | 'push'
|
|
30
|
+
|
|
31
|
+
export type StepState = 'todo' | 'running' | 'done' | 'skipped' | 'failed'
|
|
32
|
+
|
|
33
|
+
export interface PublishStep {
|
|
34
|
+
id: StepId
|
|
35
|
+
state: StepState
|
|
36
|
+
title: string
|
|
37
|
+
detail: string
|
|
38
|
+
log: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** After a failed push: whether origin holds the SHA of one pushed ref. */
|
|
42
|
+
interface OriginRef {
|
|
43
|
+
ref: string
|
|
44
|
+
reached: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PublishFailure {
|
|
48
|
+
step: StepId
|
|
49
|
+
message: string
|
|
50
|
+
origin: OriginRef[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface VersionRef {
|
|
54
|
+
number: number
|
|
55
|
+
tag: string
|
|
56
|
+
name: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface PublishJob {
|
|
60
|
+
id: string
|
|
61
|
+
status: 'running' | 'succeeded' | 'failed'
|
|
62
|
+
version: VersionRef
|
|
63
|
+
environment: string
|
|
64
|
+
steps: PublishStep[]
|
|
65
|
+
failure: PublishFailure | null
|
|
66
|
+
/** The commit the publish pushes, known once the commit step ended. */
|
|
67
|
+
commit: string | null
|
|
68
|
+
startedAt: string
|
|
69
|
+
finishedAt: string | null
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ChangesSummary {
|
|
73
|
+
ready: boolean
|
|
74
|
+
refusal: Refusal | null
|
|
75
|
+
branch: string | null
|
|
76
|
+
/** The latest version origin holds. */
|
|
77
|
+
since: VersionRef | null
|
|
78
|
+
/** The latest version made here after `since` whose tag origin does not hold. */
|
|
79
|
+
pending: VersionRef | null
|
|
80
|
+
files: ChangedFile[]
|
|
81
|
+
totals: { files: number; additions: number; deletions: number }
|
|
82
|
+
nextVersion: { number: number; tag: string }
|
|
83
|
+
environments: PublishEnvironment[]
|
|
84
|
+
job: PublishJob | null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The body the publish route accepts; a retry needs no message. */
|
|
88
|
+
export interface PublishInput {
|
|
89
|
+
message?: string
|
|
90
|
+
versionName?: string
|
|
91
|
+
releaseNotes?: string
|
|
92
|
+
environment: string
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The state the navbar chip draws. */
|
|
96
|
+
export type ChipState = 'pending' | 'publishing' | 'published' | 'failed'
|
|
97
|
+
|
|
98
|
+
/** The four AntelopeJS Cloud steps of a publish, after the git steps. */
|
|
99
|
+
export type CloudStepId = 'provision' | 'build' | 'health' | 'switch'
|
|
100
|
+
|
|
101
|
+
interface CloudStep {
|
|
102
|
+
id: CloudStepId
|
|
103
|
+
status: StepState
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The Cloud steps of one publish, as the Deployments page's
|
|
108
|
+
* `publish-steps` route answers them.
|
|
109
|
+
*/
|
|
110
|
+
export type PublishSteps =
|
|
111
|
+
| {
|
|
112
|
+
state: 'unavailable'
|
|
113
|
+
reason: 'not_connected' | 'no_project' | 'untracked' | 'unreachable'
|
|
114
|
+
message: string
|
|
115
|
+
}
|
|
116
|
+
| { state: 'waiting'; steps: CloudStep[] }
|
|
117
|
+
| {
|
|
118
|
+
state: 'following'
|
|
119
|
+
deploymentId: string
|
|
120
|
+
deploymentUrl: string
|
|
121
|
+
steps: CloudStep[]
|
|
122
|
+
outcome: 'running' | 'live' | 'failed'
|
|
123
|
+
failure: {
|
|
124
|
+
title: string
|
|
125
|
+
visitors: string
|
|
126
|
+
/** Opens the failed build's log on the deployment's page; null when no build failed. */
|
|
127
|
+
buildLogUrl: string | null
|
|
128
|
+
} | null
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** What the next version adds to an environment, as the Resources page's `publish-note` route answers it. */
|
|
132
|
+
export interface PublishNote {
|
|
133
|
+
tone?: string
|
|
134
|
+
title?: string
|
|
135
|
+
description?: string
|
|
136
|
+
icon?: string
|
|
137
|
+
actions?: { label: string; to?: string }[]
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** One environment and what it serves, for the "What's live" widget. */
|
|
141
|
+
export interface EnvironmentLive {
|
|
142
|
+
id: string
|
|
143
|
+
name: string
|
|
144
|
+
label: string
|
|
145
|
+
version: string | null
|
|
146
|
+
state: 'live' | 'building' | 'sleeping' | 'failed' | 'waiting' | 'unknown'
|
|
147
|
+
url: string | null
|
|
148
|
+
logsUrl: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** What the "What's live" widget's route answers. */
|
|
152
|
+
export type EnvironmentsLive =
|
|
153
|
+
| { state: 'unavailable'; message: string }
|
|
154
|
+
| { state: 'ok'; environments: EnvironmentLive[] }
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { LogLineView } from './log-line'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What the Deployment page's `build-log` route answers: the end of the
|
|
5
|
+
* failed build's log, or why there is none to show.
|
|
6
|
+
*/
|
|
7
|
+
export type BuildLogAnswer =
|
|
8
|
+
| {
|
|
9
|
+
readonly state: 'lines'
|
|
10
|
+
readonly lines: readonly LogLineView[]
|
|
11
|
+
/** The read reached its bound: the log may hold older lines. */
|
|
12
|
+
readonly truncated: boolean
|
|
13
|
+
}
|
|
14
|
+
| { readonly state: 'none' | 'gone' | 'unreachable' }
|
|
15
|
+
|
|
16
|
+
/** What the viewer says above the lines, or in place of them. */
|
|
17
|
+
export interface BuildLogNotice {
|
|
18
|
+
readonly color: 'info' | 'warning' | 'neutral'
|
|
19
|
+
readonly icon: string
|
|
20
|
+
readonly title: string
|
|
21
|
+
readonly description: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const UNREACHABLE: BuildLogNotice = {
|
|
25
|
+
color: 'warning',
|
|
26
|
+
icon: 'i-ph-plugs',
|
|
27
|
+
title: 'AntelopeJS Cloud did not answer',
|
|
28
|
+
description: 'The build log could not be read. Reload to try again.',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const NOTICES: Readonly<
|
|
32
|
+
Record<Exclude<BuildLogAnswer['state'], 'lines'>, BuildLogNotice>
|
|
33
|
+
> = {
|
|
34
|
+
none: {
|
|
35
|
+
color: 'neutral',
|
|
36
|
+
icon: 'i-ph-check-circle',
|
|
37
|
+
title: 'No build of this deployment failed',
|
|
38
|
+
description: 'There is no failed build whose log to show.',
|
|
39
|
+
},
|
|
40
|
+
gone: {
|
|
41
|
+
color: 'neutral',
|
|
42
|
+
icon: 'i-ph-cloud-slash',
|
|
43
|
+
title: 'This build log is no longer available',
|
|
44
|
+
description:
|
|
45
|
+
'AntelopeJS Cloud no longer serves it: the service that ran the build was removed.',
|
|
46
|
+
},
|
|
47
|
+
unreachable: UNREACHABLE,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const NO_LINES: BuildLogNotice = {
|
|
51
|
+
color: 'neutral',
|
|
52
|
+
icon: 'i-ph-file-dashed',
|
|
53
|
+
title: 'AntelopeJS Cloud holds no line of this build log',
|
|
54
|
+
description: 'It keeps the logs of a build for a limited time.',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const OLDER_LINES: BuildLogNotice = {
|
|
58
|
+
color: 'info',
|
|
59
|
+
icon: 'i-ph-arrow-line-up',
|
|
60
|
+
title: 'Only the end of the log is shown',
|
|
61
|
+
description:
|
|
62
|
+
'The build wrote more lines before these. The failure is usually among the last ones.',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the page's query asks for the build log: every `key=value` of
|
|
67
|
+
* `openQuery` is in it.
|
|
68
|
+
*/
|
|
69
|
+
export function isOpenedBy(
|
|
70
|
+
query: Readonly<Record<string, unknown>>,
|
|
71
|
+
openQuery: string,
|
|
72
|
+
): boolean {
|
|
73
|
+
const wanted = [...new URLSearchParams(openQuery)]
|
|
74
|
+
return (
|
|
75
|
+
wanted.length > 0 &&
|
|
76
|
+
wanted.every(
|
|
77
|
+
([key, value]) => Object.hasOwn(query, key) && query[key] === value,
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* What the viewer says for an answer: nothing for a whole log, that older
|
|
84
|
+
* lines exist, that no line is kept, or why there is no log to show. A read
|
|
85
|
+
* that failed says the Cloud did not answer; one still running says nothing.
|
|
86
|
+
*/
|
|
87
|
+
export function noticeOf(
|
|
88
|
+
answer: BuildLogAnswer | null,
|
|
89
|
+
failed: boolean,
|
|
90
|
+
): BuildLogNotice | null {
|
|
91
|
+
if (failed) return UNREACHABLE
|
|
92
|
+
if (answer === null) return null
|
|
93
|
+
if (answer.state !== 'lines') return NOTICES[answer.state]
|
|
94
|
+
if (answer.lines.length === 0) return NO_LINES
|
|
95
|
+
return answer.truncated ? OLDER_LINES : null
|
|
96
|
+
}
|