@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,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseProjectConfig = parseProjectConfig;
|
|
4
|
+
exports.feedsOf = feedsOf;
|
|
5
|
+
exports.moduleKeysOf = moduleKeysOf;
|
|
6
|
+
exports.apiHttpPort = apiHttpPort;
|
|
7
|
+
exports.hardcodedSecrets = hardcodedSecrets;
|
|
8
|
+
exports.loadFileConfig = loadFileConfig;
|
|
9
|
+
exports.readProjectConfig = readProjectConfig;
|
|
10
|
+
const node_child_process_1 = require("node:child_process");
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const runtime_1 = require("@antelopejs/interface-core/runtime");
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
const model_1 = require("./model");
|
|
16
|
+
const configNodeSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
17
|
+
zod_1.z.string().transform((text) => ({ kind: "text", text })),
|
|
18
|
+
zod_1.z.number().transform((value) => ({ kind: "number", value })),
|
|
19
|
+
zod_1.z
|
|
20
|
+
.union([zod_1.z.array(configNodeSchema), zod_1.z.record(configNodeSchema)])
|
|
21
|
+
.transform((branch) => ({
|
|
22
|
+
kind: "branch",
|
|
23
|
+
entries: Object.entries(branch),
|
|
24
|
+
})),
|
|
25
|
+
zod_1.z.unknown().transform(() => ({ kind: "other" })),
|
|
26
|
+
]));
|
|
27
|
+
const moduleSchema = zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
config: configNodeSchema,
|
|
30
|
+
source: zod_1.z.object({ package: zod_1.z.string().optional() }).optional(),
|
|
31
|
+
})
|
|
32
|
+
.transform(({ config, source }) => ({
|
|
33
|
+
config,
|
|
34
|
+
package: source?.package ?? null,
|
|
35
|
+
}));
|
|
36
|
+
const projectConfigSchema = zod_1.z.object({
|
|
37
|
+
modules: zod_1.z.record(moduleSchema),
|
|
38
|
+
envOverrides: zod_1.z
|
|
39
|
+
.record(zod_1.z.union([zod_1.z.string().transform((path) => [path]), zod_1.z.array(zod_1.z.string())]))
|
|
40
|
+
.default({}),
|
|
41
|
+
});
|
|
42
|
+
const CONFIG_VAR_TEMPLATE = /\$\{@[^}]+\}/;
|
|
43
|
+
const NO_CONFIG = { modules: {}, envOverrides: {} };
|
|
44
|
+
const CACHE_MS = 30_000;
|
|
45
|
+
const SECRET_NAMES = [
|
|
46
|
+
/(secret|password|passwd|api_?key|private_?key|token)$/i,
|
|
47
|
+
/^secret/i,
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Reads a project config as `ConfigLoader` loads it, `{ modules, envOverrides }`;
|
|
51
|
+
* one it cannot read is a config without modules nor `envOverrides`.
|
|
52
|
+
*/
|
|
53
|
+
function parseProjectConfig(config) {
|
|
54
|
+
return projectConfigSchema.catch(NO_CONFIG).parse(config);
|
|
55
|
+
}
|
|
56
|
+
function feedsOf(envOverrides) {
|
|
57
|
+
return new Map(Object.entries(envOverrides));
|
|
58
|
+
}
|
|
59
|
+
const API_PACKAGE = "@antelopejs/api";
|
|
60
|
+
const HTTP = "http";
|
|
61
|
+
function childOf(node, key) {
|
|
62
|
+
if (node?.kind !== "branch")
|
|
63
|
+
return undefined;
|
|
64
|
+
return node.entries.find(([name]) => name === key)?.[1];
|
|
65
|
+
}
|
|
66
|
+
function httpPortOf(server) {
|
|
67
|
+
const protocol = childOf(server, "protocol");
|
|
68
|
+
const port = childOf(server, "port");
|
|
69
|
+
const isHttp = protocol?.kind === "text" && protocol.text === HTTP;
|
|
70
|
+
return isHttp && port?.kind === "number" ? port.value : null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The keys of the modules a config loads from the npm package `name`, in the
|
|
74
|
+
* order the file lists them.
|
|
75
|
+
*/
|
|
76
|
+
function moduleKeysOf(config, name) {
|
|
77
|
+
return Object.entries(config.modules).flatMap(([key, module]) => module.package === name ? [key] : []);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The port the project's API answers on: the first `http` server of its
|
|
81
|
+
* `@antelopejs/api` module, as `servers: [{ protocol: "http", port }]`
|
|
82
|
+
* declares it. `null` when the config loads no such module, the module opens
|
|
83
|
+
* no `http` server, or its port is not a number written in the file.
|
|
84
|
+
*/
|
|
85
|
+
function apiHttpPort(config) {
|
|
86
|
+
for (const key of moduleKeysOf(config, API_PACKAGE)) {
|
|
87
|
+
const servers = childOf(config.modules[key]?.config, "servers");
|
|
88
|
+
if (servers?.kind !== "branch")
|
|
89
|
+
continue;
|
|
90
|
+
for (const [, server] of servers.entries) {
|
|
91
|
+
const port = httpPortOf(server);
|
|
92
|
+
if (port !== null)
|
|
93
|
+
return port;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
function upperSnake(name) {
|
|
99
|
+
return name
|
|
100
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
101
|
+
.replace(/[^A-Za-z0-9]+/g, "_")
|
|
102
|
+
.replace(/^_|_$/g, "")
|
|
103
|
+
.toUpperCase();
|
|
104
|
+
}
|
|
105
|
+
function textLeaves(node, path, key) {
|
|
106
|
+
if (node.kind === "branch") {
|
|
107
|
+
return node.entries.flatMap(([child, item]) => textLeaves(item, `${path}.${child}`, child));
|
|
108
|
+
}
|
|
109
|
+
return node.kind === "text" ? [{ path, key, text: node.text }] : [];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The secrets the config file sets for every environment at once: a module
|
|
113
|
+
* config leaf named like a secret, holding a non-empty string that is not a
|
|
114
|
+
* `${@module.KEY}` template, whose path no valid `envOverrides` name feeds. A
|
|
115
|
+
* finding names the path only, never the value.
|
|
116
|
+
*
|
|
117
|
+
* @param config The config as {@link loadFileConfig} reads it, with no
|
|
118
|
+
* environment, so a value read from an environment variable is absent.
|
|
119
|
+
*/
|
|
120
|
+
function hardcodedSecrets(config) {
|
|
121
|
+
const overridden = new Set(Object.entries(config.envOverrides)
|
|
122
|
+
.filter(([name]) => model_1.variableKeySchema.safeParse(name).success)
|
|
123
|
+
.flatMap(([, paths]) => paths));
|
|
124
|
+
return Object.entries(config.modules).flatMap(([name, module]) => textLeaves(module.config, `modules.${name}.config`, "config")
|
|
125
|
+
.filter(({ path, key, text }) => text !== "" &&
|
|
126
|
+
!CONFIG_VAR_TEMPLATE.test(text) &&
|
|
127
|
+
SECRET_NAMES.some((pattern) => pattern.test(key)) &&
|
|
128
|
+
!overridden.has(path))
|
|
129
|
+
.map(({ path, key }) => ({
|
|
130
|
+
path,
|
|
131
|
+
variable: upperSnake(`${name}_${key}`),
|
|
132
|
+
})));
|
|
133
|
+
}
|
|
134
|
+
const READ_TIMEOUT_MS = 15_000;
|
|
135
|
+
const READER = `
|
|
136
|
+
const [corePath, projectPath] = process.argv.slice(1);
|
|
137
|
+
const { access, readdir, readFile, stat } = require("node:fs/promises");
|
|
138
|
+
const refuse = () => Promise.reject(new Error("read only"));
|
|
139
|
+
const seen = Object.assign(Object.create(null), { JITI_FS_CACHE: "false" });
|
|
140
|
+
process.env = new Proxy({}, {
|
|
141
|
+
get: (_target, name) => seen[name],
|
|
142
|
+
set: () => true,
|
|
143
|
+
has: (_target, name) => name in seen,
|
|
144
|
+
deleteProperty: () => true,
|
|
145
|
+
defineProperty: () => true,
|
|
146
|
+
ownKeys: () => [],
|
|
147
|
+
getOwnPropertyDescriptor: () => undefined,
|
|
148
|
+
});
|
|
149
|
+
const files = {
|
|
150
|
+
readFile: (path) => readFile(path),
|
|
151
|
+
readFileString: (path, encoding = "utf8") => readFile(path, encoding),
|
|
152
|
+
readdir, stat, access,
|
|
153
|
+
exists: (path) => access(path).then(() => true, () => false),
|
|
154
|
+
writeFile: refuse, mkdir: refuse, rm: refuse, copyFile: refuse, rename: refuse,
|
|
155
|
+
};
|
|
156
|
+
process.on("disconnect", () => process.exit(1));
|
|
157
|
+
setTimeout(() => process.exit(1), ${READ_TIMEOUT_MS});
|
|
158
|
+
const asText = (_key, value) =>
|
|
159
|
+
typeof value === "bigint" ? value.toString() : value;
|
|
160
|
+
const { ConfigLoader } = require(corePath);
|
|
161
|
+
new ConfigLoader(files)
|
|
162
|
+
.load(projectPath, undefined, undefined, () => undefined)
|
|
163
|
+
.then((config) =>
|
|
164
|
+
process.send(JSON.stringify(config, asText), () => process.exit(0)),
|
|
165
|
+
)
|
|
166
|
+
.catch(() => process.exit(1));
|
|
167
|
+
`;
|
|
168
|
+
const loadedMessageSchema = zod_1.z
|
|
169
|
+
.string()
|
|
170
|
+
.transform((text, context) => {
|
|
171
|
+
try {
|
|
172
|
+
return parseProjectConfig(JSON.parse(text));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
context.addIssue({ code: zod_1.z.ZodIssueCode.custom });
|
|
176
|
+
return zod_1.z.NEVER;
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
.catch(NO_CONFIG);
|
|
180
|
+
/**
|
|
181
|
+
* Loads the project config in a child process that sees no environment
|
|
182
|
+
* variable: a value the file reads from one, or from a `.env` file, is
|
|
183
|
+
* absent, so every value left was written in the file. Nothing the config
|
|
184
|
+
* prints is read. Resolves to a config without modules nor `envOverrides`
|
|
185
|
+
* when the file is missing, throws, needs an environment variable to load,
|
|
186
|
+
* or takes longer than 15 s; the child is then killed, and it exits on its
|
|
187
|
+
* own once this process is gone.
|
|
188
|
+
*
|
|
189
|
+
* The one variable the child does see is `JITI_FS_CACHE=false`. Without it
|
|
190
|
+
* the config loader of core 1.23 keeps a transpiled copy of the file under
|
|
191
|
+
* the temporary directory, which the missing environment turns into an
|
|
192
|
+
* `undefined` folder of the project on Windows. The child writes nothing.
|
|
193
|
+
*/
|
|
194
|
+
function loadFileConfig(projectPath) {
|
|
195
|
+
return new Promise((resolve) => {
|
|
196
|
+
const child = (0, node_child_process_1.spawn)(process.execPath, ["-e", READER, require.resolve("@antelopejs/core"), projectPath], {
|
|
197
|
+
env: {},
|
|
198
|
+
stdio: ["ignore", "ignore", "ignore", "ipc"],
|
|
199
|
+
timeout: READ_TIMEOUT_MS,
|
|
200
|
+
killSignal: "SIGKILL",
|
|
201
|
+
});
|
|
202
|
+
const settle = (config) => {
|
|
203
|
+
resolve(config);
|
|
204
|
+
child.kill("SIGKILL");
|
|
205
|
+
};
|
|
206
|
+
child.once("message", (message) => settle(loadedMessageSchema.parse(message)));
|
|
207
|
+
child.once("error", () => settle(NO_CONFIG));
|
|
208
|
+
child.once("exit", () => settle(NO_CONFIG));
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
const CONFIG_FILE = "antelope.config.ts";
|
|
212
|
+
const NO_FILE = "none";
|
|
213
|
+
/** What tells one state of the project's config file from another: when it was written, and its size. */
|
|
214
|
+
async function fileStamp(projectPath) {
|
|
215
|
+
try {
|
|
216
|
+
const { mtimeMs, size } = await (0, promises_1.stat)((0, node_path_1.join)(projectPath, CONFIG_FILE));
|
|
217
|
+
return `${mtimeMs}:${size}`;
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return NO_FILE;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
let cached;
|
|
224
|
+
async function readRunningProjectConfig() {
|
|
225
|
+
const { projectPath } = await (0, runtime_1.GetRuntimeInfo)();
|
|
226
|
+
const stamp = await fileStamp(projectPath);
|
|
227
|
+
const now = Date.now();
|
|
228
|
+
if (!cached || cached.stamp !== stamp || now - cached.at >= CACHE_MS) {
|
|
229
|
+
cached = { at: now, stamp, config: loadFileConfig(projectPath) };
|
|
230
|
+
}
|
|
231
|
+
return cached.config;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The running project's config as {@link loadFileConfig} reads it, read
|
|
235
|
+
* again once its file was written since the last read, so a page shows and a
|
|
236
|
+
* write acts on the file as it is, and after 30 s in any case, for what the
|
|
237
|
+
* file loads from elsewhere. A missing or unreadable file reads as a config
|
|
238
|
+
* without modules nor `envOverrides`.
|
|
239
|
+
*/
|
|
240
|
+
async function readProjectConfig() {
|
|
241
|
+
try {
|
|
242
|
+
return await readRunningProjectConfig();
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return NO_CONFIG;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=project-config.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CloudRead } from "../connection/cloud";
|
|
2
|
+
import type { CurrentConnection } from "../connection/current";
|
|
3
|
+
import { type DecidedPlan } from "./decided";
|
|
4
|
+
import { type CloudEnvironment, type VariableRow } from "./model";
|
|
5
|
+
/** What AntelopeJS Cloud can decide for an environment of the project. */
|
|
6
|
+
export interface EnvironmentDecided {
|
|
7
|
+
readonly environmentId: string;
|
|
8
|
+
readonly environmentName: string;
|
|
9
|
+
readonly plan: DecidedPlan;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* What the Variables page can show: why it shows nothing (`disconnected`, no
|
|
13
|
+
* project chosen, a cloud failure), or the project's environments, their
|
|
14
|
+
* rows, and what AntelopeJS Cloud can decide for each.
|
|
15
|
+
*/
|
|
16
|
+
export type VariablesRead = {
|
|
17
|
+
readonly kind: "disconnected";
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "no_project";
|
|
20
|
+
} | Exclude<CloudRead<never>, {
|
|
21
|
+
kind: "ok";
|
|
22
|
+
}> | {
|
|
23
|
+
readonly kind: "ok";
|
|
24
|
+
readonly environments: readonly CloudEnvironment[];
|
|
25
|
+
readonly rows: readonly VariableRow[];
|
|
26
|
+
readonly decided: readonly EnvironmentDecided[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reads the variables of the tenant's project, what each service of its
|
|
30
|
+
* environments is, and what AntelopeJS Cloud can decide for each
|
|
31
|
+
* environment from the running project's config.
|
|
32
|
+
*/
|
|
33
|
+
export declare function readVariables(stored: CurrentConnection | undefined): Promise<VariablesRead>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readVariables = readVariables;
|
|
4
|
+
const cloud_sdk_1 = require("@antelopejs/cloud-sdk");
|
|
5
|
+
const cloud_1 = require("../connection/cloud");
|
|
6
|
+
const dockerfile_1 = require("../dashboard/dockerfile");
|
|
7
|
+
const roles_1 = require("../environments/roles");
|
|
8
|
+
const storage_1 = require("../setup/storage");
|
|
9
|
+
const connect_1 = require("../resources/connect");
|
|
10
|
+
const decided_1 = require("./decided");
|
|
11
|
+
const model_1 = require("./model");
|
|
12
|
+
const project_config_1 = require("./project-config");
|
|
13
|
+
const HTTP_UNAUTHORIZED = 401;
|
|
14
|
+
const HTTP_SERVER_ERROR = 500;
|
|
15
|
+
/**
|
|
16
|
+
* Where the app mounts its volume: `null` for no app, no volume, or settings
|
|
17
|
+
* AntelopeJS Cloud refuses to read, so the folder is left to the person.
|
|
18
|
+
*
|
|
19
|
+
* @throws The `CloudApiError` of a read answered with a refused token or a
|
|
20
|
+
* server error
|
|
21
|
+
*/
|
|
22
|
+
async function volumeOf(api, serviceId) {
|
|
23
|
+
if (serviceId === null)
|
|
24
|
+
return null;
|
|
25
|
+
try {
|
|
26
|
+
const [volume] = (await api.serviceSettings(serviceId)).volumes;
|
|
27
|
+
return volume?.mountPath ?? null;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const isRefused = error instanceof cloud_sdk_1.CloudApiError &&
|
|
31
|
+
error.status !== HTTP_UNAUTHORIZED &&
|
|
32
|
+
error.status < HTTP_SERVER_ERROR;
|
|
33
|
+
if (!isRefused)
|
|
34
|
+
throw error;
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads an environment for the page.
|
|
40
|
+
*
|
|
41
|
+
* @param readsVolume Whether the project keeps files on its app's disk, so
|
|
42
|
+
* that the volume of the app is read
|
|
43
|
+
*/
|
|
44
|
+
async function listEnvironment(api, projectId, { id, name, services }, readsVolume) {
|
|
45
|
+
const [{ variables }, { resources }] = await Promise.all([
|
|
46
|
+
api.listVariables(projectId, id),
|
|
47
|
+
api.environmentResources(projectId, id),
|
|
48
|
+
]);
|
|
49
|
+
const roles = await (0, roles_1.rolesAmong)(api, services, new Set(resources.map(({ serviceId }) => serviceId)));
|
|
50
|
+
return {
|
|
51
|
+
environment: {
|
|
52
|
+
id,
|
|
53
|
+
name,
|
|
54
|
+
services: services.map((service) => ({
|
|
55
|
+
id: service.id,
|
|
56
|
+
name: service.name,
|
|
57
|
+
})),
|
|
58
|
+
},
|
|
59
|
+
variables,
|
|
60
|
+
roles,
|
|
61
|
+
resources,
|
|
62
|
+
appVolume: readsVolume ? await volumeOf(api, (0, roles_1.appOf)(roles)) : null,
|
|
63
|
+
addresses: new Map(services.flatMap(({ id: serviceId, primaryHost }) => primaryHost ? [[serviceId, `https://${primaryHost}`]] : [])),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function serviceOf({ environment, addresses }, id) {
|
|
67
|
+
const service = environment.services.find((one) => one.id === id);
|
|
68
|
+
return service
|
|
69
|
+
? { ...service, address: addresses.get(service.id) ?? null }
|
|
70
|
+
: null;
|
|
71
|
+
}
|
|
72
|
+
function factsOf(listed, config, expectsDashboard) {
|
|
73
|
+
const { apps, dashboard } = listed.roles;
|
|
74
|
+
const { resources, variables } = listed;
|
|
75
|
+
const { missing } = (0, connect_1.plannedConnections)({ resources, serviceIds: apps, variables }, config);
|
|
76
|
+
return {
|
|
77
|
+
app: apps.length === 1 ? serviceOf(listed, apps[0]) : null,
|
|
78
|
+
dashboard: serviceOf(listed, dashboard),
|
|
79
|
+
expectsDashboard,
|
|
80
|
+
appVolume: listed.appVolume,
|
|
81
|
+
held: new Set(variables.map(({ serviceId, key }) => `${serviceId} ${key}`)),
|
|
82
|
+
followable: new Set(missing.map(({ serviceId, variable }) => `${serviceId} ${variable}`)),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Reads the variables of the tenant's project, what each service of its
|
|
87
|
+
* environments is, and what AntelopeJS Cloud can decide for each
|
|
88
|
+
* environment from the running project's config.
|
|
89
|
+
*/
|
|
90
|
+
async function readVariables(stored) {
|
|
91
|
+
if (stored?.state !== "connected")
|
|
92
|
+
return { kind: "disconnected" };
|
|
93
|
+
const { projectId } = stored;
|
|
94
|
+
if (projectId === null)
|
|
95
|
+
return { kind: "no_project" };
|
|
96
|
+
const config = await (0, project_config_1.readProjectConfig)();
|
|
97
|
+
const readsVolume = (0, storage_1.appStorageOf)(config).kind === "local_disk";
|
|
98
|
+
const [listed, build] = await Promise.all([
|
|
99
|
+
(0, cloud_1.readCloud)(stored, async (api) => {
|
|
100
|
+
const { environments } = await api.readProject(projectId);
|
|
101
|
+
return Promise.all(environments.map((environment) => listEnvironment(api, projectId, environment, readsVolume)));
|
|
102
|
+
}),
|
|
103
|
+
(0, dockerfile_1.readDashboardBuild)(),
|
|
104
|
+
]);
|
|
105
|
+
if (listed.kind !== "ok")
|
|
106
|
+
return listed;
|
|
107
|
+
return {
|
|
108
|
+
kind: "ok",
|
|
109
|
+
environments: listed.value.map(({ environment }) => environment),
|
|
110
|
+
rows: (0, model_1.deriveRows)(listed.value, (0, project_config_1.feedsOf)(config.envOverrides)),
|
|
111
|
+
decided: listed.value.map((one) => ({
|
|
112
|
+
environmentId: one.environment.id,
|
|
113
|
+
environmentName: one.environment.name,
|
|
114
|
+
plan: (0, decided_1.planDecided)(factsOf(one, config, build !== null), config),
|
|
115
|
+
})),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An address AntelopeJS Cloud gave, when it is one a link may open: an
|
|
3
|
+
* absolute http or https URL. Anything else, a `javascript:` address
|
|
4
|
+
* included, is no link.
|
|
5
|
+
*
|
|
6
|
+
* @param address The address as AntelopeJS Cloud answered it
|
|
7
|
+
* @returns The address unchanged, or `null`
|
|
8
|
+
*/
|
|
9
|
+
export declare function webUrl(address: string | null | undefined): string | null;
|
package/dist/web-url.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webUrl = webUrl;
|
|
4
|
+
const WEB_PROTOCOLS = new Set(["http:", "https:"]);
|
|
5
|
+
/**
|
|
6
|
+
* An address AntelopeJS Cloud gave, when it is one a link may open: an
|
|
7
|
+
* absolute http or https URL. Anything else, a `javascript:` address
|
|
8
|
+
* included, is no link.
|
|
9
|
+
*
|
|
10
|
+
* @param address The address as AntelopeJS Cloud answered it
|
|
11
|
+
* @returns The address unchanged, or `null`
|
|
12
|
+
*/
|
|
13
|
+
function webUrl(address) {
|
|
14
|
+
if (!address)
|
|
15
|
+
return null;
|
|
16
|
+
const parsed = URL.parse(address);
|
|
17
|
+
return parsed && WEB_PROTOCOLS.has(parsed.protocol) ? address : null;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=web-url.js.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
3
|
+
import { useDmsRoute } from '#dms/frontend-module'
|
|
4
|
+
import { type BuildLogAnswer, isOpenedBy, noticeOf } from '../utils/build-log'
|
|
5
|
+
import { fillPageParams, matchRouteParams } from '../utils/changed-files'
|
|
6
|
+
import LogLine from './LogLine.vue'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The end of the log of a deployment's failed build, in the rows of the
|
|
10
|
+
* Logs page. It shows and reads nothing until the page's query holds
|
|
11
|
+
* `openQuery`, which the failure banner's "Build log" link sets; then it
|
|
12
|
+
* reads `fetchUrl` once, with the newest line in view, and again only on
|
|
13
|
+
* Reload. `{{params.X}}` tokens of `fetchUrl` take the parameters of the
|
|
14
|
+
* page path, matched against `routePattern`. Above the lines it says when
|
|
15
|
+
* older ones are left out; in place of them, that the Cloud keeps none, that
|
|
16
|
+
* the log is gone, or that the Cloud did not answer.
|
|
17
|
+
*/
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
fetchUrl: string
|
|
20
|
+
routePattern: string
|
|
21
|
+
/** The `key=value` of the page's query that opens the log. */
|
|
22
|
+
openQuery: string
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const route = useDmsRoute(props.routePattern)
|
|
26
|
+
const isOpen = computed(() => isOpenedBy(route.query, props.openQuery))
|
|
27
|
+
const url = computed(() => {
|
|
28
|
+
if (!isOpen.value) return null
|
|
29
|
+
const params = matchRouteParams(props.routePattern, route.path)
|
|
30
|
+
return params ? fillPageParams(props.fetchUrl, params) : null
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const { data, error, pending, refresh } = useApiData<BuildLogAnswer | null>(
|
|
34
|
+
() => url.value,
|
|
35
|
+
{ server: false, lazy: true, refreshOnPageRefresh: false },
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const list = ref<HTMLElement | null>(null)
|
|
39
|
+
const lines = computed(() =>
|
|
40
|
+
data.value?.state === 'lines' ? data.value.lines : [],
|
|
41
|
+
)
|
|
42
|
+
const notice = computed(() =>
|
|
43
|
+
noticeOf(data.value ?? null, Boolean(error.value)),
|
|
44
|
+
)
|
|
45
|
+
const isReading = computed(() => Boolean(pending.value))
|
|
46
|
+
|
|
47
|
+
watch(lines, async () => {
|
|
48
|
+
await nextTick()
|
|
49
|
+
if (list.value) list.value.scrollTop = list.value.scrollHeight
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<section
|
|
55
|
+
v-if="isOpen"
|
|
56
|
+
class="flex min-w-0 flex-col gap-3 text-sm"
|
|
57
|
+
aria-label="Build log"
|
|
58
|
+
data-testid="build-log"
|
|
59
|
+
>
|
|
60
|
+
<div class="flex items-center justify-between gap-2">
|
|
61
|
+
<h3 class="text-highlighted m-0 text-sm font-semibold">Build log</h3>
|
|
62
|
+
<UButton
|
|
63
|
+
label="Reload"
|
|
64
|
+
size="sm"
|
|
65
|
+
variant="ghost"
|
|
66
|
+
icon="i-ph-arrow-clockwise"
|
|
67
|
+
:loading="isReading"
|
|
68
|
+
data-testid="build-log-reload"
|
|
69
|
+
@click="refresh()"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<UAlert
|
|
74
|
+
v-if="notice"
|
|
75
|
+
:color="notice.color"
|
|
76
|
+
variant="subtle"
|
|
77
|
+
:icon="notice.icon"
|
|
78
|
+
:title="notice.title"
|
|
79
|
+
:description="notice.description"
|
|
80
|
+
data-testid="build-log-notice"
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<ol
|
|
84
|
+
v-if="lines.length > 0"
|
|
85
|
+
ref="list"
|
|
86
|
+
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"
|
|
87
|
+
aria-label="Build log lines"
|
|
88
|
+
>
|
|
89
|
+
<LogLine v-for="(line, index) in lines" :key="index" :line="line" />
|
|
90
|
+
</ol>
|
|
91
|
+
<p
|
|
92
|
+
v-else-if="isReading && !notice"
|
|
93
|
+
class="text-muted m-0"
|
|
94
|
+
data-testid="build-log-reading"
|
|
95
|
+
>
|
|
96
|
+
Reading the build log…
|
|
97
|
+
</p>
|
|
98
|
+
</section>
|
|
99
|
+
</template>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useDmsRoute } from '#dms/frontend-module'
|
|
4
|
+
import type { ChangedFile } from '../types/publishing'
|
|
5
|
+
import {
|
|
6
|
+
groupChangedFiles,
|
|
7
|
+
fillPageParams,
|
|
8
|
+
matchRouteParams,
|
|
9
|
+
KIND_PRESENTATION,
|
|
10
|
+
readFilesField,
|
|
11
|
+
splitPath,
|
|
12
|
+
sumLines,
|
|
13
|
+
} from '../utils/changed-files'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The files of the working copy that the last published version does not have,
|
|
17
|
+
* grouped as Added, Modified and Deleted. It reads `fetchUrl` and takes the
|
|
18
|
+
* array at `field`, or shows the `files` it is given without any request.
|
|
19
|
+
* `{{params.X}}` tokens of `fetchUrl` take the parameters of the page path,
|
|
20
|
+
* matched against `routePattern`, the page's own slug pattern. The path is
|
|
21
|
+
* read rather than `route.params`, which another caller of `useDmsRoute`
|
|
22
|
+
* without a pattern empties.
|
|
23
|
+
*/
|
|
24
|
+
const props = withDefaults(
|
|
25
|
+
defineProps<{
|
|
26
|
+
fetchUrl?: string
|
|
27
|
+
field?: string
|
|
28
|
+
limit?: number
|
|
29
|
+
reviewHref?: string
|
|
30
|
+
routePattern?: string
|
|
31
|
+
files?: ChangedFile[]
|
|
32
|
+
}>(),
|
|
33
|
+
{
|
|
34
|
+
fetchUrl: undefined,
|
|
35
|
+
field: 'files',
|
|
36
|
+
limit: undefined,
|
|
37
|
+
reviewHref: undefined,
|
|
38
|
+
routePattern: undefined,
|
|
39
|
+
files: undefined,
|
|
40
|
+
},
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const route = props.routePattern ? useDmsRoute(props.routePattern) : null
|
|
44
|
+
const url = computed(() => {
|
|
45
|
+
if (props.files || !props.fetchUrl) return null
|
|
46
|
+
if (!route || !props.routePattern) return props.fetchUrl
|
|
47
|
+
const params = matchRouteParams(props.routePattern, route.path)
|
|
48
|
+
return params ? fillPageParams(props.fetchUrl, params) : null
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const { data, error } = useApiData<unknown>(() => url.value, {
|
|
52
|
+
server: false,
|
|
53
|
+
lazy: true,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const allFiles = computed<ChangedFile[]>(
|
|
57
|
+
() => props.files ?? readFilesField(data.value, props.field),
|
|
58
|
+
)
|
|
59
|
+
const groups = computed(() => groupChangedFiles(allFiles.value, props.limit))
|
|
60
|
+
const hiddenCount = computed(() =>
|
|
61
|
+
props.limit === undefined
|
|
62
|
+
? 0
|
|
63
|
+
: Math.max(0, allFiles.value.length - props.limit),
|
|
64
|
+
)
|
|
65
|
+
const lines = computed(() => sumLines(allFiles.value))
|
|
66
|
+
const isLoaded = computed(
|
|
67
|
+
() => props.files !== undefined || data.value !== undefined,
|
|
68
|
+
)
|
|
69
|
+
const fileCountLabel = computed(
|
|
70
|
+
() =>
|
|
71
|
+
`${allFiles.value.length} ${allFiles.value.length === 1 ? 'file' : 'files'}`,
|
|
72
|
+
)
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<div class="flex min-w-0 flex-col gap-3 text-sm">
|
|
77
|
+
<p v-if="error && !props.files" class="text-error" role="alert">
|
|
78
|
+
Could not load the changed files.
|
|
79
|
+
</p>
|
|
80
|
+
<div
|
|
81
|
+
v-else-if="isLoaded && allFiles.length === 0"
|
|
82
|
+
class="text-muted flex items-center gap-2"
|
|
83
|
+
data-testid="changed-files-empty"
|
|
84
|
+
>
|
|
85
|
+
<UIcon
|
|
86
|
+
name="i-ph-check-circle-light"
|
|
87
|
+
class="text-success size-4 shrink-0"
|
|
88
|
+
/>
|
|
89
|
+
<span>Everything is published</span>
|
|
90
|
+
</div>
|
|
91
|
+
<template v-else-if="isLoaded">
|
|
92
|
+
<div class="flex items-center gap-2" data-testid="changed-files-header">
|
|
93
|
+
<UIcon
|
|
94
|
+
name="i-ph-file-code-light"
|
|
95
|
+
class="text-warning size-4 shrink-0"
|
|
96
|
+
/>
|
|
97
|
+
<b class="text-highlighted font-semibold">{{ fileCountLabel }}</b>
|
|
98
|
+
<span
|
|
99
|
+
class="ml-auto flex shrink-0 gap-2 font-mono text-[11.5px] font-semibold"
|
|
100
|
+
>
|
|
101
|
+
<span class="text-success">+{{ lines.additions }}</span>
|
|
102
|
+
<span class="text-error">−{{ lines.deletions }}</span>
|
|
103
|
+
</span>
|
|
104
|
+
</div>
|
|
105
|
+
<section
|
|
106
|
+
v-for="group in groups"
|
|
107
|
+
:key="group.kind"
|
|
108
|
+
:data-testid="`changed-files-group-${group.kind}`"
|
|
109
|
+
>
|
|
110
|
+
<h4 class="text-muted mb-1 flex items-center gap-2 text-xs font-medium">
|
|
111
|
+
{{ KIND_PRESENTATION[group.kind].title }}
|
|
112
|
+
<UBadge
|
|
113
|
+
color="neutral"
|
|
114
|
+
variant="subtle"
|
|
115
|
+
size="sm"
|
|
116
|
+
:label="String(group.files.length)"
|
|
117
|
+
/>
|
|
118
|
+
</h4>
|
|
119
|
+
<ul class="m-0 list-none p-0">
|
|
120
|
+
<li
|
|
121
|
+
v-for="file in group.files"
|
|
122
|
+
:key="`${file.kind}:${file.path}`"
|
|
123
|
+
class="border-default flex h-[30px] min-w-0 items-center gap-2.5 not-first:border-t"
|
|
124
|
+
>
|
|
125
|
+
<span
|
|
126
|
+
class="grid size-[18px] shrink-0 place-items-center rounded font-mono text-[10px] font-bold ring-1 ring-inset"
|
|
127
|
+
:class="KIND_PRESENTATION[file.kind].badge"
|
|
128
|
+
:title="KIND_PRESENTATION[file.kind].title"
|
|
129
|
+
>
|
|
130
|
+
{{ KIND_PRESENTATION[file.kind].letter }}
|
|
131
|
+
</span>
|
|
132
|
+
<span
|
|
133
|
+
class="text-highlighted min-w-0 truncate font-mono text-[12.5px] font-medium"
|
|
134
|
+
>
|
|
135
|
+
<span class="text-dimmed">{{ splitPath(file.path).dir }}</span>
|
|
136
|
+
{{ splitPath(file.path).base }}
|
|
137
|
+
</span>
|
|
138
|
+
<span
|
|
139
|
+
v-if="file.additions === null || file.deletions === null"
|
|
140
|
+
class="text-dimmed ml-auto shrink-0 font-mono text-[11.5px]"
|
|
141
|
+
>
|
|
142
|
+
binary
|
|
143
|
+
</span>
|
|
144
|
+
<span
|
|
145
|
+
v-else
|
|
146
|
+
class="ml-auto flex shrink-0 gap-2 font-mono text-[11.5px] font-semibold"
|
|
147
|
+
>
|
|
148
|
+
<span class="text-success">+{{ file.additions }}</span>
|
|
149
|
+
<span class="text-error">−{{ file.deletions }}</span>
|
|
150
|
+
</span>
|
|
151
|
+
</li>
|
|
152
|
+
</ul>
|
|
153
|
+
</section>
|
|
154
|
+
<DmsLink
|
|
155
|
+
v-if="hiddenCount > 0 && props.reviewHref"
|
|
156
|
+
:to="props.reviewHref"
|
|
157
|
+
class="text-primary inline-flex items-center gap-1 text-[12.5px] font-medium"
|
|
158
|
+
data-testid="changed-files-more"
|
|
159
|
+
>
|
|
160
|
+
{{ hiddenCount }} more {{ hiddenCount === 1 ? 'file' : 'files' }}
|
|
161
|
+
<UIcon name="i-ph-arrow-right-light" class="size-3.5" />
|
|
162
|
+
</DmsLink>
|
|
163
|
+
</template>
|
|
164
|
+
</div>
|
|
165
|
+
</template>
|