@antelopejs/dms-antelope-cloud 0.0.0-stage → 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 +447 -2
- 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 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import type { EnvironmentsLive } from '../types/publishing'
|
|
4
|
+
import { LIVE_BADGES, LIVE_POLL_MS } from '../utils/publish-state'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* "What's live": one column per environment of the AntelopeJS Cloud project,
|
|
8
|
+
* with the version it serves, its state and its address, read from
|
|
9
|
+
* `fetchUrl` on mount and every 15 s while the page shows, and a link to
|
|
10
|
+
* `deploymentsUrl`. Any DMS dashboard page can place it.
|
|
11
|
+
*/
|
|
12
|
+
const props = defineProps<{ fetchUrl: string; deploymentsUrl: string }>()
|
|
13
|
+
|
|
14
|
+
const { data, error } = useApiData<EnvironmentsLive | null>(
|
|
15
|
+
() => props.fetchUrl,
|
|
16
|
+
{ default: () => null, server: false, refreshInterval: LIVE_POLL_MS },
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const environments = computed(() =>
|
|
20
|
+
data.value?.state === 'ok' ? data.value.environments : [],
|
|
21
|
+
)
|
|
22
|
+
const message = computed(() => {
|
|
23
|
+
if (error.value) return 'What each environment serves could not be read.'
|
|
24
|
+
if (data.value?.state === 'unavailable') return data.value.message
|
|
25
|
+
if (data.value?.state === 'ok' && environments.value.length === 0)
|
|
26
|
+
return 'This AntelopeJS Cloud project has no environment yet.'
|
|
27
|
+
return null
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<section
|
|
33
|
+
class="border-default bg-default flex min-w-0 flex-col gap-3 rounded-lg border p-4 text-sm"
|
|
34
|
+
data-testid="whats-live"
|
|
35
|
+
>
|
|
36
|
+
<header class="flex items-center gap-2">
|
|
37
|
+
<UIcon name="i-ph-rocket-launch-light" class="text-primary size-4" />
|
|
38
|
+
<span class="text-highlighted text-xs font-semibold uppercase">
|
|
39
|
+
What’s live
|
|
40
|
+
</span>
|
|
41
|
+
<DmsLink
|
|
42
|
+
:to="props.deploymentsUrl"
|
|
43
|
+
class="text-primary ml-auto inline-flex items-center gap-1 text-[12.5px] font-medium"
|
|
44
|
+
data-testid="whats-live-deployments"
|
|
45
|
+
>
|
|
46
|
+
Open Deployments
|
|
47
|
+
<UIcon name="i-ph-arrow-right-light" class="size-3.5" />
|
|
48
|
+
</DmsLink>
|
|
49
|
+
</header>
|
|
50
|
+
<p v-if="message" class="text-muted m-0" data-testid="whats-live-empty">
|
|
51
|
+
{{ message }}
|
|
52
|
+
</p>
|
|
53
|
+
<ul
|
|
54
|
+
v-else
|
|
55
|
+
class="m-0 grid list-none gap-3 p-0"
|
|
56
|
+
:style="{
|
|
57
|
+
gridTemplateColumns: `repeat(${Math.max(environments.length, 1)}, minmax(0, 1fr))`,
|
|
58
|
+
}"
|
|
59
|
+
>
|
|
60
|
+
<li
|
|
61
|
+
v-for="environment in environments"
|
|
62
|
+
:key="environment.id"
|
|
63
|
+
class="flex min-w-0 flex-col gap-1"
|
|
64
|
+
:data-testid="`whats-live-${environment.name}`"
|
|
65
|
+
>
|
|
66
|
+
<span class="text-muted text-xs font-medium">
|
|
67
|
+
{{ environment.label }}
|
|
68
|
+
</span>
|
|
69
|
+
<b
|
|
70
|
+
v-if="environment.version"
|
|
71
|
+
class="text-highlighted font-mono text-base"
|
|
72
|
+
data-testid="whats-live-version"
|
|
73
|
+
>
|
|
74
|
+
{{ environment.version }}
|
|
75
|
+
</b>
|
|
76
|
+
<span v-else class="text-muted" data-testid="whats-live-version">
|
|
77
|
+
Nothing live yet
|
|
78
|
+
</span>
|
|
79
|
+
<span class="flex min-w-0 items-center gap-2">
|
|
80
|
+
<UBadge
|
|
81
|
+
:color="LIVE_BADGES[environment.state].color"
|
|
82
|
+
variant="subtle"
|
|
83
|
+
size="sm"
|
|
84
|
+
:label="LIVE_BADGES[environment.state].label"
|
|
85
|
+
data-testid="whats-live-state"
|
|
86
|
+
/>
|
|
87
|
+
<a
|
|
88
|
+
v-if="environment.url"
|
|
89
|
+
:href="environment.url"
|
|
90
|
+
target="_blank"
|
|
91
|
+
rel="noopener"
|
|
92
|
+
class="text-muted min-w-0 truncate text-xs"
|
|
93
|
+
data-testid="whats-live-url"
|
|
94
|
+
>
|
|
95
|
+
{{ environment.url.replace(/^https?:\/\//, '') }}
|
|
96
|
+
</a>
|
|
97
|
+
<span v-else class="text-dimmed text-xs">No public address</span>
|
|
98
|
+
</span>
|
|
99
|
+
</li>
|
|
100
|
+
</ul>
|
|
101
|
+
</section>
|
|
102
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { LOG_TIME, type LogLineView } from '../utils/log-line'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One log line of a list: its time, its level in the colour of its
|
|
6
|
+
* severity, the instance that wrote it when one is known, and its message.
|
|
7
|
+
* It is the row of the Logs page and of a build's log.
|
|
8
|
+
*/
|
|
9
|
+
defineProps<{ line: LogLineView }>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<li class="flex gap-3 py-0.5" data-testid="log-line" :data-level="line.level">
|
|
14
|
+
<time class="text-dimmed shrink-0" :datetime="line.at">
|
|
15
|
+
{{ LOG_TIME.format(new Date(line.at)) }}
|
|
16
|
+
</time>
|
|
17
|
+
<span
|
|
18
|
+
class="w-12 shrink-0 uppercase"
|
|
19
|
+
:class="{
|
|
20
|
+
'text-error': line.level === 'error' || line.level === 'fatal',
|
|
21
|
+
'text-warning': line.level === 'warn' || line.level === 'warning',
|
|
22
|
+
}"
|
|
23
|
+
>
|
|
24
|
+
{{ line.level }}
|
|
25
|
+
</span>
|
|
26
|
+
<span v-if="line.instance" class="text-muted shrink-0">
|
|
27
|
+
{{ line.instance }}
|
|
28
|
+
</span>
|
|
29
|
+
<span class="text-highlighted min-w-0 break-words">
|
|
30
|
+
{{ line.message }}
|
|
31
|
+
</span>
|
|
32
|
+
</li>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
nextTick,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
onMounted,
|
|
7
|
+
ref,
|
|
8
|
+
shallowRef,
|
|
9
|
+
watch,
|
|
10
|
+
} from 'vue'
|
|
11
|
+
import {
|
|
12
|
+
followLogs,
|
|
13
|
+
INITIAL_LOG_STATE,
|
|
14
|
+
type LevelFilter,
|
|
15
|
+
type LogAction,
|
|
16
|
+
reduceLog,
|
|
17
|
+
visibleLines,
|
|
18
|
+
} from '../utils/log-stream'
|
|
19
|
+
import { LOG_TIME as TIME } from '../utils/log-line'
|
|
20
|
+
import LogLine from './LogLine.vue'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The app logs of one service of an environment, streamed live from the
|
|
24
|
+
* page's relay: an environment switch, a service switch when the
|
|
25
|
+
* environment runs more than one, a search, a level filter and Follow, which
|
|
26
|
+
* keeps the newest line in view. `?environment=` and `?service=` pick the
|
|
27
|
+
* source on arrival. Above the lines it says when the environment sleeps,
|
|
28
|
+
* when the stream dropped and is resuming, and why it closed; below them,
|
|
29
|
+
* that nothing matches the filters.
|
|
30
|
+
*/
|
|
31
|
+
const props = defineProps<{
|
|
32
|
+
/** Answers the environments and services the viewer may stream. */
|
|
33
|
+
sourcesUrl: string
|
|
34
|
+
/** The relay's SSE route; the viewer adds `environment` and `service`. */
|
|
35
|
+
streamUrl: string
|
|
36
|
+
}>()
|
|
37
|
+
|
|
38
|
+
interface Source {
|
|
39
|
+
readonly id: string
|
|
40
|
+
readonly name: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface LogSources {
|
|
44
|
+
readonly environments: readonly (Source & {
|
|
45
|
+
readonly services: readonly Source[]
|
|
46
|
+
})[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface Notice {
|
|
50
|
+
readonly color: 'info' | 'warning' | 'error' | 'neutral'
|
|
51
|
+
readonly icon: string
|
|
52
|
+
readonly title: string
|
|
53
|
+
readonly description: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const LEVELS: readonly { readonly id: LevelFilter; readonly label: string }[] =
|
|
57
|
+
[
|
|
58
|
+
{ id: 'all', label: 'All' },
|
|
59
|
+
{ id: 'warn', label: 'Warn+' },
|
|
60
|
+
{ id: 'error', label: 'Error' },
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
const { data: sources } = useApiData<LogSources>(() => props.sourcesUrl)
|
|
64
|
+
const route = useDmsRoute()
|
|
65
|
+
const baseUrl = useDmsRuntimeConfig().public.dms.baseURL
|
|
66
|
+
|
|
67
|
+
const chosenEnvironment = ref<string | null>(route.query.environment ?? null)
|
|
68
|
+
const chosenService = ref<string | null>(route.query.service ?? null)
|
|
69
|
+
const state = shallowRef(INITIAL_LOG_STATE)
|
|
70
|
+
const follow = ref(true)
|
|
71
|
+
const list = ref<HTMLElement | null>(null)
|
|
72
|
+
let stop: (() => void) | null = null
|
|
73
|
+
|
|
74
|
+
const environments = computed(() => sources.value?.environments ?? [])
|
|
75
|
+
const environment = computed(
|
|
76
|
+
() =>
|
|
77
|
+
environments.value.find(({ id }) => id === chosenEnvironment.value) ??
|
|
78
|
+
environments.value[0] ??
|
|
79
|
+
null,
|
|
80
|
+
)
|
|
81
|
+
const services = computed(() => environment.value?.services ?? [])
|
|
82
|
+
const service = computed(
|
|
83
|
+
() =>
|
|
84
|
+
services.value.find(({ id }) => id === chosenService.value) ??
|
|
85
|
+
services.value[0] ??
|
|
86
|
+
null,
|
|
87
|
+
)
|
|
88
|
+
const shown = computed(() => visibleLines(state.value))
|
|
89
|
+
const levelLabel = computed(
|
|
90
|
+
() => LEVELS.find(({ id }) => id === state.value.level)?.label ?? 'All',
|
|
91
|
+
)
|
|
92
|
+
const search = computed({
|
|
93
|
+
get: () => state.value.search,
|
|
94
|
+
set: (value: string) => dispatch({ type: 'filter', search: value }),
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const notice = computed<Notice | null>(() => {
|
|
98
|
+
const connection = state.value.connection
|
|
99
|
+
const environmentName = environment.value?.name ?? 'This environment'
|
|
100
|
+
if (connection.kind === 'sleeping') {
|
|
101
|
+
return {
|
|
102
|
+
color: 'info',
|
|
103
|
+
icon: 'i-ph-moon',
|
|
104
|
+
title: `${environmentName} is sleeping`,
|
|
105
|
+
description:
|
|
106
|
+
'Its replicas are scaled to zero. Logs resume when someone opens it.',
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (connection.kind === 'reconnecting') {
|
|
110
|
+
return {
|
|
111
|
+
color: 'warning',
|
|
112
|
+
icon: 'i-ph-plugs',
|
|
113
|
+
title: 'Reconnecting…',
|
|
114
|
+
description: `Stream dropped at ${TIME.format(connection.droppedAt)}. Missed lines will be replayed.`,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (connection.kind === 'busy') {
|
|
118
|
+
return {
|
|
119
|
+
color: 'warning',
|
|
120
|
+
icon: 'i-ph-hourglass',
|
|
121
|
+
title: 'Every log stream of this workspace is taken',
|
|
122
|
+
description: `Trying again at ${TIME.format(connection.retryAt)}.`,
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return connection.kind === 'closed' ? closedNotice(connection.reason) : null
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
function closedNotice(reason: 'not-deployed' | 'ended' | 'refused'): Notice {
|
|
129
|
+
if (reason === 'not-deployed') {
|
|
130
|
+
return {
|
|
131
|
+
color: 'neutral',
|
|
132
|
+
icon: 'i-ph-cloud-slash',
|
|
133
|
+
title: `${service.value?.name ?? 'This service'} runs no deployment yet`,
|
|
134
|
+
description: 'Its logs show once a deployment of it goes live.',
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (reason === 'ended') {
|
|
138
|
+
return {
|
|
139
|
+
color: 'neutral',
|
|
140
|
+
icon: 'i-ph-stop-circle',
|
|
141
|
+
title: 'The log stream ended',
|
|
142
|
+
description: 'Reload the page to read the latest lines.',
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
color: 'error',
|
|
147
|
+
icon: 'i-ph-prohibit',
|
|
148
|
+
title: 'AntelopeJS Cloud refused this stream',
|
|
149
|
+
description: 'Check the sign-in on the Connection page.',
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function dispatch(action: LogAction): void {
|
|
154
|
+
state.value = reduceLog(state.value, action)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function chooseEnvironment(id: string): void {
|
|
158
|
+
chosenEnvironment.value = id
|
|
159
|
+
chosenService.value = null
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function wait(ms: number): Promise<void> {
|
|
163
|
+
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function start(): void {
|
|
167
|
+
stop?.()
|
|
168
|
+
stop = null
|
|
169
|
+
dispatch({ type: 'source-changed' })
|
|
170
|
+
if (!environment.value || !service.value) return
|
|
171
|
+
const query = new URLSearchParams({
|
|
172
|
+
environment: environment.value.id,
|
|
173
|
+
service: service.value.id,
|
|
174
|
+
})
|
|
175
|
+
stop = followLogs({
|
|
176
|
+
url: `${baseUrl}${props.streamUrl}?${query.toString()}`,
|
|
177
|
+
open: openSseStream,
|
|
178
|
+
dispatch,
|
|
179
|
+
cursor: () => state.value.cursor,
|
|
180
|
+
wait,
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
onMounted(() => {
|
|
185
|
+
watch([() => environment.value?.id, () => service.value?.id], start, {
|
|
186
|
+
immediate: true,
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
onBeforeUnmount(() => stop?.())
|
|
191
|
+
|
|
192
|
+
watch(
|
|
193
|
+
() => state.value.lines,
|
|
194
|
+
async () => {
|
|
195
|
+
if (!follow.value) return
|
|
196
|
+
await nextTick()
|
|
197
|
+
if (list.value) list.value.scrollTop = list.value.scrollHeight
|
|
198
|
+
},
|
|
199
|
+
)
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<template>
|
|
203
|
+
<div class="flex min-w-0 flex-col gap-3 text-sm" data-testid="log-viewer">
|
|
204
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
205
|
+
<div role="group" aria-label="Environment" class="flex gap-1">
|
|
206
|
+
<UButton
|
|
207
|
+
v-for="one in environments"
|
|
208
|
+
:key="one.id"
|
|
209
|
+
:label="one.name"
|
|
210
|
+
size="sm"
|
|
211
|
+
:variant="one.id === environment?.id ? 'soft' : 'ghost'"
|
|
212
|
+
:aria-pressed="one.id === environment?.id"
|
|
213
|
+
@click="chooseEnvironment(one.id)"
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
<div
|
|
217
|
+
v-if="services.length > 1"
|
|
218
|
+
role="group"
|
|
219
|
+
aria-label="Service"
|
|
220
|
+
class="flex gap-1"
|
|
221
|
+
data-testid="log-services"
|
|
222
|
+
>
|
|
223
|
+
<UButton
|
|
224
|
+
v-for="one in services"
|
|
225
|
+
:key="one.id"
|
|
226
|
+
:label="one.name"
|
|
227
|
+
size="sm"
|
|
228
|
+
:variant="one.id === service?.id ? 'soft' : 'ghost'"
|
|
229
|
+
:aria-pressed="one.id === service?.id"
|
|
230
|
+
@click="chosenService = one.id"
|
|
231
|
+
/>
|
|
232
|
+
</div>
|
|
233
|
+
<UInput
|
|
234
|
+
v-model="search"
|
|
235
|
+
class="min-w-48 flex-1"
|
|
236
|
+
size="sm"
|
|
237
|
+
icon="i-ph-magnifying-glass"
|
|
238
|
+
placeholder="Search lines"
|
|
239
|
+
aria-label="Search lines"
|
|
240
|
+
/>
|
|
241
|
+
<div role="group" aria-label="Level" class="flex gap-1">
|
|
242
|
+
<UButton
|
|
243
|
+
v-for="one in LEVELS"
|
|
244
|
+
:key="one.id"
|
|
245
|
+
:label="one.label"
|
|
246
|
+
size="sm"
|
|
247
|
+
:variant="one.id === state.level ? 'soft' : 'ghost'"
|
|
248
|
+
:aria-pressed="one.id === state.level"
|
|
249
|
+
@click="dispatch({ type: 'filter', level: one.id })"
|
|
250
|
+
/>
|
|
251
|
+
</div>
|
|
252
|
+
<UButton
|
|
253
|
+
label="Follow"
|
|
254
|
+
size="sm"
|
|
255
|
+
icon="i-ph-arrow-line-down"
|
|
256
|
+
:variant="follow ? 'soft' : 'ghost'"
|
|
257
|
+
:aria-pressed="follow"
|
|
258
|
+
@click="follow = !follow"
|
|
259
|
+
/>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<UAlert
|
|
263
|
+
v-if="notice"
|
|
264
|
+
:color="notice.color"
|
|
265
|
+
variant="subtle"
|
|
266
|
+
:icon="notice.icon"
|
|
267
|
+
:title="notice.title"
|
|
268
|
+
:description="notice.description"
|
|
269
|
+
data-testid="log-notice"
|
|
270
|
+
/>
|
|
271
|
+
|
|
272
|
+
<ol
|
|
273
|
+
ref="list"
|
|
274
|
+
class="border-default bg-elevated m-0 max-h-[60vh] min-h-40 list-none overflow-auto rounded-md border p-2 font-mono text-xs"
|
|
275
|
+
aria-label="Log lines"
|
|
276
|
+
>
|
|
277
|
+
<LogLine v-for="line in shown.lines" :key="line.cursor" :line="line" />
|
|
278
|
+
<li
|
|
279
|
+
v-if="shown.empty === 'no-lines'"
|
|
280
|
+
class="text-muted p-4 text-center font-sans"
|
|
281
|
+
data-testid="log-waiting"
|
|
282
|
+
>
|
|
283
|
+
Waiting for the first line…
|
|
284
|
+
</li>
|
|
285
|
+
<li
|
|
286
|
+
v-else-if="shown.empty === 'no-match'"
|
|
287
|
+
class="flex flex-col items-center gap-2 p-4 font-sans"
|
|
288
|
+
data-testid="log-no-match"
|
|
289
|
+
>
|
|
290
|
+
<span class="text-muted">
|
|
291
|
+
No lines match "{{ state.search }}" at {{ levelLabel }}.
|
|
292
|
+
</span>
|
|
293
|
+
<UButton
|
|
294
|
+
label="Clear filters"
|
|
295
|
+
size="sm"
|
|
296
|
+
variant="outline"
|
|
297
|
+
@click="dispatch({ type: 'clear-filters' })"
|
|
298
|
+
/>
|
|
299
|
+
</li>
|
|
300
|
+
</ol>
|
|
301
|
+
|
|
302
|
+
<p class="text-dimmed m-0 flex items-center gap-2 text-xs">
|
|
303
|
+
<span
|
|
304
|
+
v-if="state.connection.kind === 'live'"
|
|
305
|
+
class="text-success flex items-center gap-1"
|
|
306
|
+
data-testid="log-live"
|
|
307
|
+
>
|
|
308
|
+
<UIcon name="i-ph-circle-fill" class="size-2" />
|
|
309
|
+
Live
|
|
310
|
+
</span>
|
|
311
|
+
Resumes where it left off if the connection drops.
|
|
312
|
+
</p>
|
|
313
|
+
</div>
|
|
314
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { usePublishSummary } from '../composables/usePublishSummary'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The icon of the navbar publish chip: a rocket with the state of the publish
|
|
6
|
+
* in its corner. Pending changes draw a warning count, a running publish an
|
|
7
|
+
* accent spinner, a published project a success dot and a failed publish an
|
|
8
|
+
* error dot.
|
|
9
|
+
*/
|
|
10
|
+
const { state, count } = usePublishSummary()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<span
|
|
15
|
+
class="relative inline-flex items-center justify-center"
|
|
16
|
+
:data-state="state"
|
|
17
|
+
>
|
|
18
|
+
<UIcon name="i-ph-rocket-launch-light" class="size-full" />
|
|
19
|
+
<span
|
|
20
|
+
v-if="state === 'pending'"
|
|
21
|
+
class="bg-warning text-inverted absolute -top-1.5 -right-2 grid h-3.5 min-w-3.5 place-items-center rounded-full px-1 font-mono text-[9px] leading-none font-bold"
|
|
22
|
+
data-testid="chip-count"
|
|
23
|
+
>
|
|
24
|
+
{{ count }}
|
|
25
|
+
</span>
|
|
26
|
+
<UIcon
|
|
27
|
+
v-else-if="state === 'publishing'"
|
|
28
|
+
name="i-ph-circle-notch"
|
|
29
|
+
class="text-primary absolute -top-1 -right-1.5 size-3 animate-spin"
|
|
30
|
+
data-testid="chip-spinner"
|
|
31
|
+
/>
|
|
32
|
+
<span
|
|
33
|
+
v-else
|
|
34
|
+
class="ring-default absolute -top-0.5 -right-0.5 size-2 rounded-full ring-2"
|
|
35
|
+
:class="state === 'failed' ? 'bg-error' : 'bg-success'"
|
|
36
|
+
:data-testid="`chip-dot-${state}`"
|
|
37
|
+
/>
|
|
38
|
+
</span>
|
|
39
|
+
</template>
|