Fixed runner import getting triggered with invalid information
ref #107
This commit is contained in:
parent
ef49e507c1
commit
ddd9c396b6
@ -19,6 +19,7 @@
|
|||||||
export let current_runners;
|
export let current_runners;
|
||||||
export let import_modal_open;
|
export let import_modal_open;
|
||||||
$: searchvalue = "";
|
$: searchvalue = "";
|
||||||
|
$: importButtonEnabled = recent_processed && (!(selected_org_or_team == "" || selected_org_or_team == null) || !(passed_org?.id == null || passed_org?.id == 0) || !(passed_team?.id == null || passed_team?.id == 0))
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
function cancelModal() {
|
function cancelModal() {
|
||||||
json_output = [];
|
json_output = [];
|
||||||
@ -44,7 +45,10 @@
|
|||||||
groups = groups.concat(orgs);
|
groups = groups.concat(orgs);
|
||||||
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
|
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
|
||||||
const teams = val.map((r) => {
|
const teams = val.map((r) => {
|
||||||
return { label: `${r.parentGroup.name} > ${r.name}`, value: `TEAM_${r.id}` };
|
return {
|
||||||
|
label: `${r.parentGroup.name} > ${r.name}`,
|
||||||
|
value: `TEAM_${r.id}`,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
groups = groups.concat(teams);
|
groups = groups.concat(teams);
|
||||||
});
|
});
|
||||||
@ -190,86 +194,86 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if import_modal_open}
|
{#if import_modal_open}
|
||||||
<div
|
<div
|
||||||
class="fixed z-10 inset-0 overflow-y-auto"
|
class="fixed z-10 inset-0 overflow-y-auto"
|
||||||
use:focusTrap
|
use:focusTrap
|
||||||
use:clickOutside
|
use:clickOutside
|
||||||
on:click_outside={() => {
|
on:click_outside={() => {
|
||||||
cancelModal();
|
cancelModal();
|
||||||
}}>
|
}}>
|
||||||
<div
|
<div
|
||||||
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
||||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||||
<div
|
|
||||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
|
||||||
data-id="modal_backdrop" />
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
|
||||||
aria-hidden="true">​</span>
|
|
||||||
<div
|
<div
|
||||||
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-max sm:w-full"
|
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||||
role="dialog"
|
data-id="modal_backdrop" />
|
||||||
aria-modal="true"
|
</div>
|
||||||
aria-labelledby="modal-headline">
|
<span
|
||||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||||
<div class="sm:flex sm:items-start">
|
aria-hidden="true">​</span>
|
||||||
<div
|
<div
|
||||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-max sm:w-full"
|
||||||
<svg
|
role="dialog"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
aria-modal="true"
|
||||||
viewBox="0 0 24 24"
|
aria-labelledby="modal-headline">
|
||||||
class="h-6 w-6 text-blue-600"
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||||
fill="currentColor"
|
<div class="sm:flex sm:items-start">
|
||||||
width="24"
|
<div
|
||||||
height="24"><path fill="none" d="M0 0h24v24H0z" />
|
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
||||||
<path
|
<svg
|
||||||
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" /></svg>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
</div>
|
viewBox="0 0 24 24"
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:ml-2 sm:text-left w-full">
|
class="h-6 w-6 text-blue-600"
|
||||||
<h3 class="text-lg leading-6 font-bold mt-2 text-gray-900">
|
fill="currentColor"
|
||||||
{$_('runner-import')}
|
width="24"
|
||||||
</h3>
|
height="24"><path fill="none" d="M0 0h24v24H0z" />
|
||||||
</div>
|
<path
|
||||||
</div>
|
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" /></svg>
|
||||||
<div class="mt-5 text-center sm:mt-0 sm:ml-2 sm:text-left w-full">
|
</div>
|
||||||
{#if json_output.length === 0}
|
<div class="mt-3 text-center sm:mt-0 sm:ml-2 sm:text-left w-full">
|
||||||
<div class="mt-2 mb-6">
|
<h3 class="text-lg leading-6 font-bold mt-2 text-gray-900">
|
||||||
<p class="text-sm text-gray-500">
|
{$_('runner-import')}
|
||||||
{$_('please-provide-the-required-csv-xlsx-file')}
|
</h3>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-hidden relative mt-4 mb-4">
|
<div class="mt-5 text-center sm:mt-0 sm:ml-2 sm:text-left w-full">
|
||||||
<input
|
{#if json_output.length === 0}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
<div class="mt-2 mb-6">
|
||||||
bind:files
|
<p class="text-sm text-gray-500">
|
||||||
type="file" />
|
{$_('please-provide-the-required-csv-xlsx-file')}
|
||||||
</div>
|
</p>
|
||||||
{/if}
|
</div>
|
||||||
{#if json_output.length > 0}
|
<div class="overflow-hidden relative mt-4 mb-4">
|
||||||
{#if opened_from === 'OrgOverview'}
|
<input
|
||||||
<p>{$_('import__target-organization')}</p>
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||||
|
bind:files
|
||||||
|
type="file" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if json_output.length > 0}
|
||||||
|
{#if opened_from === 'OrgOverview'}
|
||||||
|
<p>{$_('import__target-organization')}</p>
|
||||||
<select
|
<select
|
||||||
name="team"
|
name="team"
|
||||||
bind:value={selected_org}
|
bind:value={selected_org}
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2">
|
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2">
|
||||||
{#each passed_orgs as o}
|
{#each passed_orgs as o}
|
||||||
<option value={o.id}>{o.name}</option>
|
<option value={o.id}>{o.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
<p>{$_('bitte-bestaetige-diese-laeufer-fuer-den-import')}</p>
|
<p>{$_('bitte-bestaetige-diese-laeufer-fuer-den-import')}</p>
|
||||||
{/if}
|
{/if}
|
||||||
{#if opened_from === 'RunnerOverview'}
|
{#if opened_from === 'RunnerOverview'}
|
||||||
<p>{$_('group')}</p>
|
<p>{$_('group')}</p>
|
||||||
<Select
|
<Select
|
||||||
containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2"
|
containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2"
|
||||||
itemFilter={(label, filterText, option) => label
|
itemFilter={(label, filterText, option) => label
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(
|
.includes(
|
||||||
filterText.toLowerCase()
|
filterText.toLowerCase()
|
||||||
) || option.id.value
|
) || option.id.value
|
||||||
.toString()
|
.toString()
|
||||||
.startsWith(filterText.toLowerCase())}
|
.startsWith(filterText.toLowerCase())}
|
||||||
items={groups}
|
items={groups}
|
||||||
showChevron={true}
|
showChevron={true}
|
||||||
placeholder={$_('search-for-an-organization-or-team-by-name-or-id')}
|
placeholder={$_('search-for-an-organization-or-team-by-name-or-id')}
|
||||||
@ -278,15 +282,15 @@
|
|||||||
selected_org_or_team = selectedValue.detail.value;
|
selected_org_or_team = selectedValue.detail.value;
|
||||||
}}
|
}}
|
||||||
on:clear={() => (selected_org_or_team = null)} />
|
on:clear={() => (selected_org_or_team = null)} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if opened_from === 'OrgDetail'}
|
{#if opened_from === 'OrgDetail'}
|
||||||
<p>
|
<p>
|
||||||
{$_('runnerimport_verify_runners_org', {
|
{$_('runnerimport_verify_runners_org', {
|
||||||
values: { org_name: passed_org.name },
|
values: { org_name: passed_org.name },
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
bind:value={searchvalue}
|
bind:value={searchvalue}
|
||||||
placeholder={$_('datatable.search')}
|
placeholder={$_('datatable.search')}
|
||||||
@ -349,6 +353,8 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
disabled={!importButtonEnabled}
|
||||||
|
class:opacity-50={!importButtonEnabled}
|
||||||
on:click={importAction}
|
on:click={importAction}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user