fix: Build log

This commit is contained in:
Andras Bacsai 2022-04-03 23:34:17 +02:00
parent 03e7af12be
commit 8232a7468b
3 changed files with 9 additions and 6 deletions

View File

@ -37,3 +37,9 @@ export function dashify(str: string, options?: any): string {
.replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
.toLowerCase();
}
export function changeQueryParams(buildId) {
const queryParams = new URLSearchParams(window.location.search);
queryParams.set('buildId', buildId);
return history.pushState(null, null, '?' + queryParams.toString());
}

View File

@ -88,7 +88,6 @@
try {
const { buildId } = await post(`/applications/${id}/deploy.json`, { ...application });
toast.push('Deployment queued.');
console.log($page.url);
if ($page.url.pathname.startsWith(`/applications/${id}/logs/build`)) {
return window.location.assign(`/applications/${id}/logs/build?buildId=${buildId}`);
} else {

View File

@ -21,7 +21,7 @@
<script lang="ts">
import { page } from '$app/stores';
import { dateOptions, getDomain } from '$lib/components/common';
import { changeQueryParams, dateOptions, getDomain } from '$lib/components/common';
import BuildLog from './_BuildLog.svelte';
import { get } from '$lib/api';
@ -79,11 +79,9 @@
noMoreBuilds = true;
}
}
async function loadBuild(build) {
function loadBuild(build) {
buildId = build;
const queryParams = new URLSearchParams(window.location.search);
queryParams.set('buildId', buildId);
return history.pushState(null, null, '?' + queryParams.toString());
return changeQueryParams(buildId);
}
</script>