fix: public gh repo reload compose
This commit is contained in:
@@ -351,7 +351,7 @@
|
|||||||
}
|
}
|
||||||
async function reloadCompose() {
|
async function reloadCompose() {
|
||||||
if (loading.reloadCompose) return;
|
if (loading.reloadCompose) return;
|
||||||
if (!$appSession.tokens.github) {
|
if (!$appSession.tokens.github && !isPublicRepository) {
|
||||||
const { token } = await get(`/applications/${id}/configuration/githubToken`);
|
const { token } = await get(`/applications/${id}/configuration/githubToken`);
|
||||||
$appSession.tokens.github = token;
|
$appSession.tokens.github = token;
|
||||||
}
|
}
|
||||||
@@ -385,7 +385,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (application.gitSource.type === 'gitlab') {
|
if (application.gitSource.type === 'gitlab') {
|
||||||
if (!$appSession.tokens.gitlab) {
|
if (!$appSession.tokens.gitlab && !isPublicRepository) {
|
||||||
await getGitlabToken();
|
await getGitlabToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if repositories.length === 0 && loading.repositories === false}
|
{#if repositories.length === 0 && loading.repositories === false}
|
||||||
<div class="flex-col text-center">
|
<div class="flex-col text-center">
|
||||||
<div class="pb-4">{$t('application.configuration.no_repositories_configured')}</div>
|
<div class="pb-4">{$t('application.configuration.no_repositories_configured')}</div>
|
||||||
@@ -134,8 +135,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<form on:submit|preventDefault={handleSubmit} class="px-10">
|
<form on:submit|preventDefault={handleSubmit} class="px-10">
|
||||||
<div class="flex lg:flex-row flex-col lg:space-y-0 space-y-2 space-x-0 lg:space-x-2 items-center lg:justify-center">
|
<div
|
||||||
<div class="custom-select-wrapper w-full"><label for="repository" class="pb-1">Repository</label>
|
class="flex lg:flex-row flex-col lg:space-y-0 space-y-2 space-x-0 lg:space-x-2 items-center lg:justify-center"
|
||||||
|
>
|
||||||
|
<div class="custom-select-wrapper w-full">
|
||||||
|
<label for="repository" class="pb-1">Repository</label>
|
||||||
<Select
|
<Select
|
||||||
placeholder={loading.repositories
|
placeholder={loading.repositories
|
||||||
? $t('application.configuration.loading_repositories')
|
? $t('application.configuration.loading_repositories')
|
||||||
@@ -150,7 +154,8 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<input class="hidden" bind:value={selected.projectId} name="projectId" />
|
<input class="hidden" bind:value={selected.projectId} name="projectId" />
|
||||||
<div class="custom-select-wrapper w-full"><label for="repository" class="pb-1">Branch</label>
|
<div class="custom-select-wrapper w-full">
|
||||||
|
<label for="repository" class="pb-1">Branch</label>
|
||||||
<Select
|
<Select
|
||||||
placeholder={loading.branches
|
placeholder={loading.branches
|
||||||
? $t('application.configuration.loading_branches')
|
? $t('application.configuration.loading_branches')
|
||||||
@@ -165,12 +170,10 @@
|
|||||||
isDisabled={loading.branches || !selected.repository}
|
isDisabled={loading.branches || !selected.repository}
|
||||||
isClearable={false}
|
isClearable={false}
|
||||||
/>
|
/>
|
||||||
</div></div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="pt-5 flex-col flex justify-center items-center space-y-4">
|
<div class="pt-5 flex-col flex justify-center items-center space-y-4">
|
||||||
<button
|
<button class="btn btn-wide btn-primary" type="submit" disabled={!showSave}
|
||||||
class="btn btn-wide btn-primary"
|
|
||||||
type="submit"
|
|
||||||
disabled={!showSave}
|
|
||||||
>{$t('forms.save')}</button
|
>{$t('forms.save')}</button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -366,7 +366,7 @@
|
|||||||
async function reloadCompose() {
|
async function reloadCompose() {
|
||||||
if (loading.reloadCompose) return;
|
if (loading.reloadCompose) return;
|
||||||
loading.reloadCompose = true;
|
loading.reloadCompose = true;
|
||||||
if (!$appSession.tokens.github) {
|
if (!$appSession.tokens.github && !isPublicRepository) {
|
||||||
const { token } = await get(`/applications/${id}/configuration/githubToken`);
|
const { token } = await get(`/applications/${id}/configuration/githubToken`);
|
||||||
$appSession.tokens.github = token;
|
$appSession.tokens.github = token;
|
||||||
}
|
}
|
||||||
@@ -409,9 +409,9 @@
|
|||||||
|
|
||||||
// If the file is in a subdirectory, lastIndex will be > 0
|
// If the file is in a subdirectory, lastIndex will be > 0
|
||||||
// Otherwise it will be -1 and path will be an empty string
|
// Otherwise it will be -1 and path will be an empty string
|
||||||
const lastIndex = composeLocation.lastIndexOf('/') + 1
|
const lastIndex = composeLocation.lastIndexOf('/') + 1;
|
||||||
const path = composeLocation.substring(0, lastIndex)
|
const path = composeLocation.substring(0, lastIndex);
|
||||||
const fileName = composeLocation.substring(lastIndex)
|
const fileName = composeLocation.substring(lastIndex);
|
||||||
|
|
||||||
const headers = isPublicRepository
|
const headers = isPublicRepository
|
||||||
? {}
|
? {}
|
||||||
@@ -425,8 +425,7 @@
|
|||||||
...headers
|
...headers
|
||||||
});
|
});
|
||||||
const dockerComposeFileYml = files.find(
|
const dockerComposeFileYml = files.find(
|
||||||
(file: { name: string; type: string }) =>
|
(file: { name: string; type: string }) => file.name === fileName && file.type === 'blob'
|
||||||
file.name === fileName && file.type === 'blob'
|
|
||||||
);
|
);
|
||||||
const id = dockerComposeFileYml.id;
|
const id = dockerComposeFileYml.id;
|
||||||
|
|
||||||
@@ -506,7 +505,14 @@
|
|||||||
<div class="grid grid-flow-row gap-2 px-4">
|
<div class="grid grid-flow-row gap-2 px-4">
|
||||||
<div class="mt-2 grid grid-cols-2 items-center">
|
<div class="mt-2 grid grid-cols-2 items-center">
|
||||||
<label for="name">{$t('forms.name')}</label>
|
<label for="name">{$t('forms.name')}</label>
|
||||||
<input name="name" id="name" class="w-full" bind:value={application.name} disabled={!$appSession.isAdmin} required />
|
<input
|
||||||
|
name="name"
|
||||||
|
id="name"
|
||||||
|
class="w-full"
|
||||||
|
bind:value={application.name}
|
||||||
|
disabled={!$appSession.isAdmin}
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if !isSimpleDockerfile}
|
{#if !isSimpleDockerfile}
|
||||||
<div class="grid grid-cols-2 items-center">
|
<div class="grid grid-cols-2 items-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user