Fixed runner import getting triggered with invalid information

ref #107
This commit is contained in:
Nicolai Ort 2021-03-25 17:46:14 +01:00
parent ef49e507c1
commit ddd9c396b6

View File

@ -19,6 +19,7 @@
export let current_runners;
export let import_modal_open;
$: 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();
function cancelModal() {
json_output = [];
@ -44,7 +45,10 @@
groups = groups.concat(orgs);
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
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);
});
@ -190,13 +194,13 @@
</script>
{#if import_modal_open}
<div
class="fixed z-10 inset-0 overflow-y-auto"
use:focusTrap
use:clickOutside
on:click_outside={() => {
<div
class="fixed z-10 inset-0 overflow-y-auto"
use:focusTrap
use:clickOutside
on:click_outside={() => {
cancelModal();
}}>
}}>
<div
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">
@ -349,6 +353,8 @@
</table>
</div>
<button
disabled={!importButtonEnabled}
class:opacity-50={!importButtonEnabled}
on:click={importAction}
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">