system-dashboard-frontend 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-dashboard-frontend",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,39 +1,34 @@
1
1
  <script>
2
- import { onMount } from "svelte";
3
2
  import { ObjectLink } from "svelte-guard-history-router";
3
+ import { sortable, sorter, filter, keyPrefixStore } from "svelte-common";
4
4
 
5
5
  export let router;
6
6
 
7
7
  const route = router.route;
8
- const units = $route.value;
9
-
10
- let unitFilter;
11
-
12
- onMount(() => {
13
- unitFilter = router.searchParams.get("unit");
14
- });
15
-
16
- $: {
17
- if (unitFilter && unitFilter.length > 0) {
18
- router.push(router.path.replace(/\?.*/, "") + "?unit=" + unitFilter);
19
- }
20
- }
8
+ const sortBy = keyPrefixStore(router.searchParamStore, "sort.");
9
+ const filterBy = keyPrefixStore(router.searchParamStore, "filter.");
21
10
  </script>
22
11
 
23
- <input id="unit.filter" placeholder="Unit" bind:value={unitFilter} />
24
-
25
12
  <table class="bordered striped hoverable">
26
13
  <thead>
27
14
  <tr>
28
- <th aria-sort="none">Unit</th>
29
- <th aria-sort="none">Load</th>
30
- <th aria-sort="none">Active</th>
31
- <th aria-sort="none">Sub</th>
32
- <th>Description</th>
15
+ <th id="unit" use:sortable={sortBy}
16
+ >Unit<input
17
+ id="filter-unit"
18
+ bind:value={$filterBy.unit}
19
+ placeholder="filter unit"
20
+ /></th
21
+ >
22
+ <th id="load" use:sortable={sortBy}>Load</th>
23
+ <th id="active" use:sortable={sortBy}>Active</th>
24
+ <th id="sub" use:sortable={sortBy}>Sub</th>
25
+ <th id="description" use:sortable={sortBy}>Description</th>
33
26
  </tr>
34
27
  </thead>
35
28
  <tbody>
36
- {#each units as unit}
29
+ {#each route.value
30
+ .filter(filter($filterBy))
31
+ .sort(sorter($sortBy)) as unit, i}
37
32
  <tr>
38
33
  <td>
39
34
  <ObjectLink object={unit} />