diff --git a/web/package.json b/web/package.json index e1acc2556..d6b97acc8 100644 --- a/web/package.json +++ b/web/package.json @@ -31,7 +31,10 @@ "pinia": "2.0.0", "vue": "v3.2.20", "vue-i18n": "9", - "vue-router": "4.0.10" + "vue-router": "4.0.10", + "xterm": "4.17.0", + "xterm-addon-fit": "0.5.0", + "xterm-addon-web-links": "0.5.1" }, "devDependencies": { "@iconify/json": "1.1.421", diff --git a/web/src/assets/locales/en.json b/web/src/assets/locales/en.json index 260dea266..46d94c38f 100644 --- a/web/src/assets/locales/en.json +++ b/web/src/assets/locales/en.json @@ -165,12 +165,14 @@ "created": "Created", "tasks": "Tasks", "config": "Config", - "files": "Changed files ({0})", + "files": "Changed files ({files})", "no_files": "No files have been changed.", "execution_error": "Execution error", "no_pipelines": "No pipelines have been started yet.", "step_not_started": "This step hasn't started yet.", - "pipelines_for": "Pipelines for branch \"{0}\"", + "pipelines_for": "Pipelines for branch \"{branch}\"", + "exit_code": "exit code {exitCode}", + "loading": "Loading ...", "actions": { "cancel": "Cancel", diff --git a/web/src/components/repo/build/BuildLog.vue b/web/src/components/repo/build/BuildLog.vue index 18f7394c0..e9ec308db 100644 --- a/web/src/components/repo/build/BuildLog.vue +++ b/web/src/components/repo/build/BuildLog.vue @@ -1,5 +1,5 @@ diff --git a/web/src/components/repo/build/BuildProcList.vue b/web/src/components/repo/build/BuildProcList.vue index 3f53f2278..c8b46d936 100644 --- a/web/src/components/repo/build/BuildProcList.vue +++ b/web/src/components/repo/build/BuildProcList.vue @@ -1,6 +1,19 @@ - + {{ build.commit.slice(0, 10) }} @@ -40,7 +53,9 @@
- {{ proc.name }} +
+ {{ proc.name }} +
diff --git a/web/src/compositions/useBuildProc.ts b/web/src/compositions/useBuildProc.ts deleted file mode 100644 index 3e4920200..000000000 --- a/web/src/compositions/useBuildProc.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ref } from 'vue'; - -import { BuildLog, BuildProc } from '~/lib/api/types'; -import { isProcFinished, isProcRunning } from '~/utils/helpers'; - -import useApiClient from './useApiClient'; - -const apiClient = useApiClient(); - -export default () => { - const logs = ref(); - const proc = ref(); - let stream: EventSource | undefined; - - function onLogsUpdate(data: BuildLog) { - if (data.proc === proc.value?.name) { - logs.value = [...(logs.value || []), data]; - } - } - - function unload() { - if (stream) { - stream.close(); - } - } - - async function load(owner: string, repo: string, build: number, _proc: BuildProc) { - unload(); - - proc.value = _proc; - logs.value = []; - - // we do not have logs for skipped jobs - if (_proc.state === 'skipped' || _proc.state === 'killed') { - return; - } - - if (_proc.error) { - logs.value = undefined; - } else if (isProcFinished(_proc)) { - logs.value = await apiClient.getLogs(owner, repo, build, _proc.pid); - } else if (isProcRunning(_proc)) { - // load stream of parent process (which receives all child processes logs) - stream = apiClient.streamLogs(owner, repo, build, _proc.ppid, onLogsUpdate); - } - } - - return { logs, load, unload }; -}; diff --git a/web/src/views/repo/RepoBranch.vue b/web/src/views/repo/RepoBranch.vue index d75058355..520df24d1 100644 --- a/web/src/views/repo/RepoBranch.vue +++ b/web/src/views/repo/RepoBranch.vue @@ -1,6 +1,6 @@ diff --git a/web/src/views/repo/build/Build.vue b/web/src/views/repo/build/Build.vue index ac5bc661b..ba13acd5d 100644 --- a/web/src/views/repo/build/Build.vue +++ b/web/src/views/repo/build/Build.vue @@ -1,12 +1,12 @@