Skip to content

Commit

Permalink
Added a "lead" on a change to keep track of who is currently in charg…
Browse files Browse the repository at this point in the history
…e of managing the change.
  • Loading branch information
amyjko committed Jul 28, 2024
1 parent 4e8251a commit d01dda0
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Dates should be in`YYYY-MM-DD` format and versions are in [semantic versioning](

### Added

- Added a "lead" on a change to keep track of who is currently in charge of managing the change.

### Fixed

- Disabled keyboard shortcuts on how view to avoid conflicting with text editing shortcuts.
Expand Down
10 changes: 9 additions & 1 deletion src/database/OrganizationsDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,18 @@ class OrganizationsDB {
.single();
}

async updateChangeVisibility(how: ChangeRow, vis: string) {
async updateChangeVisibility(change: ChangeRow, vis: string) {
const { error } = await this.supabase
.from('suggestions')
.update({ visibility: vis })
.eq('id', change.id);
return error;
}

async updateChangeLead(how: ChangeRow, lead: string | null) {
const { error } = await this.supabase
.from('suggestions')
.update({ lead: lead })
.eq('id', how.id);
return error;
}
Expand Down
10 changes: 10 additions & 0 deletions src/database/database.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ export type Database = {
comments: string[]
description: string
id: string
lead: string | null
orgid: string
processes: string[]
proposal: string
Expand All @@ -467,6 +468,7 @@ export type Database = {
comments?: string[]
description?: string
id?: string
lead?: string | null
orgid: string
processes?: string[]
proposal?: string
Expand All @@ -483,6 +485,7 @@ export type Database = {
comments?: string[]
description?: string
id?: string
lead?: string | null
orgid?: string
processes?: string[]
proposal?: string
Expand All @@ -495,6 +498,13 @@ export type Database = {
who?: string
}
Relationships: [
{
foreignKeyName: "suggestions_lead_fkey"
columns: ["lead"]
isOneToOne: false
referencedRelation: "people"
referencedColumns: ["id"]
},
{
foreignKeyName: "suggestions_orgid_fkey"
columns: ["orgid"]
Expand Down
21 changes: 21 additions & 0 deletions src/lib/ChangeView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@
/>.</Paragraph
>

<Paragraph>
{#if editable}<Select
tip="Choose who is leading this change"
selection={change.lead ?? undefined}
options={[
{ value: undefined, label: '' },
...$org.getProfiles().map((person) => {
return { value: person.id, label: person.name };
})
]}
change={(person) => {
queryOrError(
errors,
$db.updateChangeLead(change, person ?? null),
"Couldn't update change processes."
);
}}
/>{:else if change.lead}<PersonLink profile={$org.getProfileWithID(change.lead)} />{:else}No one{/if}
is in currently leading this change project.</Paragraph
>

<Header>Problem</Header>

<MarkupView
Expand Down
8 changes: 6 additions & 2 deletions src/lib/Changes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Table>
<thead>
<tr>
<th>reporter</th>
<th>lead</th>
<th>title</th>
<th>status</th>
</tr>
Expand All @@ -27,7 +27,11 @@
.sort((a, b) => timestampToDate(a.when).getTime() - timestampToDate(b.when).getTime())
.sort((a, b) => Levels[a.status] - Levels[b.status]) as change}
<tr>
<td><PersonLink profile={$org.getProfileWithPersonID(change.who)} /></td>
<td
>{#if change.lead}<PersonLink
profile={$org.getProfileWithID(change.lead)}
/>{:else}&mdash;{/if}</td
>
<td><ChangeLink id={change.id} /></td><td><Status status={change.status} /></td>
</tr>
{/each}
Expand Down
3 changes: 0 additions & 3 deletions src/lib/Status.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import { getOrg } from './contexts';
export let status: string;
const org = getOrg();
</script>

<span class="status {status}" title={status}
Expand All @@ -14,7 +12,6 @@
.status {
text-transform: none;
display: inline-block;
align-self: flex-start;
font-size: var(--small-size);
padding-left: var(--padding);
padding-right: var(--padding);
Expand Down
10 changes: 9 additions & 1 deletion src/lib/Title.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<EditableText text={title} {edit} />
</h1>
</div>
<slot />
<div class="metadata"><slot /></div>
</div>
</div>

Expand Down Expand Up @@ -81,6 +81,14 @@
word-break: break-word;
}
.metadata {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: var(--spacing);
align-items: center;
}
.kind {
color: var(--chrome);
text-transform: uppercase;
Expand Down
2 changes: 2 additions & 0 deletions supabase/migrations/20240728220921_add_change_lead.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add a 'paths' colunm to the 'orgs' table that is an array of vanity paths for URLs
ALTER TABLE suggestions ADD COLUMN "lead" uuid references profiles(id) on delete set null;

0 comments on commit d01dda0

Please sign in to comment.