Skip to content

Commit a55afd7

Browse files
committed
Added last used timestamp filter to task-group admin page
1 parent 4950c41 commit a55afd7

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Displayed `timestamp_last_used` property in task-group info modal (\#643);
1111
* Viewer paths page improvements (\#643);
1212
* Added manage buttons on admin task-groups page (\#643);
13+
* Added last used timestamp filter to task-group admin page (\#643);
1314

1415
# 1.10.1
1516

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default defineConfig({
107107

108108
webServer: [
109109
{
110-
command: './tests/start-test-server.sh 2.9.0a4',
110+
command: './tests/start-test-server.sh 2.9.0a5',
111111
port: 8000,
112112
waitForPort: true,
113113
stdout: 'pipe',

src/routes/v2/admin/task-groups/+page.svelte

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { page } from '$app/stores';
3+
import { getTimestamp } from '$lib/common/component_utilities';
34
import { displayStandardErrorAlert, getAlertErrorFromResponse } from '$lib/common/errors';
45
import BooleanIcon from '$lib/components/common/BooleanIcon.svelte';
56
import ConfirmActionButton from '$lib/components/common/ConfirmActionButton.svelte';
@@ -21,6 +22,10 @@
2122
let privateGroup = null;
2223
/** @type {boolean|null} */
2324
let active = null;
25+
let lastUsedDateMin;
26+
let lastUsedTimeMin = '';
27+
let lastUsedDateMax = '';
28+
let lastUsedTimeMax = '';
2429
2530
let searched = false;
2631
let searching = false;
@@ -65,6 +70,14 @@
6570
if (active !== null) {
6671
url.searchParams.append('active', active.toString());
6772
}
73+
const lasUsedTimestampMin = getTimestamp(lastUsedDateMin, lastUsedTimeMin);
74+
if (lasUsedTimestampMin) {
75+
url.searchParams.append('timestamp_last_used_min', lasUsedTimestampMin);
76+
}
77+
const lasUsedTimestampMax = getTimestamp(lastUsedDateMax, lastUsedTimeMax);
78+
if (lasUsedTimestampMax) {
79+
url.searchParams.append('timestamp_last_used_max', lasUsedTimestampMax);
80+
}
6881
const response = await fetch(url);
6982
if (!response.ok) {
7083
searchErrorAlert = displayStandardErrorAlert(
@@ -88,6 +101,10 @@
88101
user_group_id = '';
89102
pkg_name = '';
90103
origin = '';
104+
lastUsedDateMin = '';
105+
lastUsedTimeMin = '';
106+
lastUsedDateMax = '';
107+
lastUsedTimeMax = '';
91108
privateGroup = null;
92109
active = null;
93110
searched = false;
@@ -237,6 +254,48 @@
237254
</div>
238255
</div>
239256
</div>
257+
258+
<div class="row mt-3">
259+
<div class="col-md-3 col-lg-2 mt-2">Last used</div>
260+
<div class="col-md-9 col-lg-10">
261+
<div class="row row-cols-md-auto">
262+
<div class="col-12 mt-1">
263+
<div class="input-group">
264+
<div class="input-group-text">Min</div>
265+
<input
266+
type="date"
267+
class="form-control"
268+
bind:value={lastUsedDateMin}
269+
id="last_used_date_min"
270+
/>
271+
<input
272+
type="time"
273+
class="form-control"
274+
bind:value={lastUsedTimeMin}
275+
id="last_used_time_min"
276+
/>
277+
</div>
278+
</div>
279+
<div class="col-12 mt-1">
280+
<div class="input-group">
281+
<div class="input-group-text">Max</div>
282+
<input
283+
type="date"
284+
class="form-control"
285+
bind:value={lastUsedDateMax}
286+
id="last_used_date_max"
287+
/>
288+
<input
289+
type="time"
290+
class="form-control"
291+
bind:value={lastUsedTimeMax}
292+
id="last_used_time_max"
293+
/>
294+
</div>
295+
</div>
296+
</div>
297+
</div>
298+
</div>
240299
</div>
241300
</div>
242301
@@ -405,4 +464,8 @@
405464
.row-grey {
406465
background-color: #f2f2f2;
407466
}
467+
468+
input[type='date'] {
469+
min-width: 190px;
470+
}
408471
</style>

tests/v2/admin_task_groups.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,20 @@ test('Task groups admin page [v2]', async ({ page, workflow }) => {
6565
await waitModalClosed(page);
6666
await expect(page.getByText('The query returned 0 matching results')).toBeVisible();
6767
});
68+
69+
await test.step('Search by date', async () => {
70+
await page.getByText('Reset').click();
71+
await expect(page.getByText('The query returned 0 matching results')).not.toBeVisible();
72+
await page.locator('#last_used_date_min').fill('2020-01-01');
73+
await page.locator('#last_used_time_min').fill('10:00');
74+
await page.locator('#last_used_date_max').fill('2020-01-03');
75+
await page.locator('#last_used_time_max').fill('23:00');
76+
await page.getByRole('button', { name: 'Search task groups' }).click();
77+
await expect(page.getByText('The query returned 0 matching results')).toBeVisible();
78+
await page.getByText('Reset').click();
79+
await expect(page.locator('#last_used_date_min')).toHaveValue('');
80+
await expect(page.locator('#last_used_time_min')).toHaveValue('');
81+
await expect(page.locator('#last_used_date_max')).toHaveValue('');
82+
await expect(page.locator('#last_used_time_max')).toHaveValue('');
83+
});
6884
});

0 commit comments

Comments
 (0)