Skip to content

Commit

Permalink
Process filtering.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Aug 2, 2024
1 parent 39c3bba commit d063baa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Dates should be in`YYYY-MM-DD` format and versions are in [semantic versioning](
- Link email addresses in markup.
- Role filtering.
- Change filtering.
- Process filtering.

### Fixed

Expand Down
6 changes: 6 additions & 0 deletions src/routes/org/[orgid]/processes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
const db = getDB();
const errors = getErrors();
let filter = '';
$: lowerFilter = filter.toLocaleLowerCase().trim();
$: personRoles = $user ? $organization.getPersonRoles($user.id) : [];
function getRolesByAccountability(processes: ProcessRow[]): RoleRow[] {
Expand Down Expand Up @@ -117,6 +120,8 @@
</FormDialog>
{/if}

<Field label="Filter" bind:text={filter} />

{#each Array.from(new Set($organization
.getProcesses()
.map((process) => process.concern))) as concern}
Expand All @@ -125,6 +130,7 @@
{@const processes = $organization
.getProcesses()
.filter((p) => p.concern === concern)
.filter((p) => lowerFilter.length === 0 || p.title.toLowerCase().includes(lowerFilter))
.sort((a, b) => {
const howA = $organization.getHow(a.id);
const howB = $organization.getHow(b.id);
Expand Down

0 comments on commit d063baa

Please sign in to comment.