Skip to content

Commit a1030e8

Browse files
committed
Hided unsupported buttons from admin jobs table
1 parent 4fa7bd8 commit a1030e8

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/lib/components/jobs/JobInfoModal.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import StatusBadge from '$lib/components/jobs/StatusBadge.svelte';
33
import { displayStandardErrorAlert } from '$lib/common/errors';
4+
import { page } from '$app/stores';
45
import Modal from '../common/Modal.svelte';
56
67
/** @type {{id: number, name: string}[]} */
@@ -73,9 +74,11 @@
7374
<Modal id="workflowJobInfoModal" bind:this={modal} size="lg">
7475
<svelte:fragment slot="header">
7576
<h1 class="h5 modal-title flex-grow-1">Workflow Job #{workflowJobId}</h1>
76-
<button class="btn btn-light me-3" on:click={fetchJob}>
77-
<i class="bi-arrow-clockwise" />
78-
</button>
77+
{#if job && job.user_email === $page.data.userInfo.email && job.project_id !== null}
78+
<button class="btn btn-light me-3" on:click={fetchJob}>
79+
<i class="bi-arrow-clockwise" />
80+
</button>
81+
{/if}
7982
</svelte:fragment>
8083
<svelte:fragment slot="body">
8184
<div class="row mb-3">

src/lib/components/jobs/JobsList.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
export let columnsToHide = [];
1717
/** @type {boolean} */
1818
export let showFilters = true;
19+
/** @type {boolean} */
20+
export let hideCancelJobButton = false;
1921
2022
/** @type {JobInfoModal} */
2123
let jobInfoModal;
@@ -288,7 +290,7 @@
288290
<i class="bi-list-columns-reverse" />
289291
Logs
290292
</button>
291-
{#if row.project_id !== null}
293+
{#if row.project_id !== null && row.user_email === $page.data.userInfo.email}
292294
<a
293295
class="btn btn-light"
294296
href={`/api/v1/project/${row.project_id}/job/${row.id}/download`}
@@ -298,7 +300,7 @@
298300
</a>
299301
{/if}
300302
{/if}
301-
{#if row.status === 'running'}
303+
{#if row.status === 'running' && !hideCancelJobButton}
302304
<button class="btn btn-danger" on:click={() => handleJobCancel(row)}>
303305
<i class="bi-x-circle" /> Cancel
304306
</button>

src/routes/admin/jobs/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@
359359
<div id="searchError" class="mt-3" />
360360
361361
<div class:d-none={!searched}>
362-
<JobsList {jobUpdater} bind:this={jobsListComponent} showFilters={false}>
362+
<JobsList {jobUpdater} bind:this={jobsListComponent} showFilters={false} hideCancelJobButton={true}>
363363
<svelte:fragment slot="buttons">
364364
<button class="btn btn-outline-secondary" on:click={downloadCSV}>
365365
<i class="bi-download" /> Download CSV

0 commit comments

Comments
 (0)