-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start building UI for default retro and poker settings
- Loading branch information
1 parent
669efc6
commit 0f2a70f
Showing
5 changed files
with
297 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<script lang="ts"> | ||
import Table from '../table/Table.svelte'; | ||
import TableNav from '../table/TableNav.svelte'; | ||
import HeadCol from '../table/HeadCol.svelte'; | ||
import RowCol from '../table/RowCol.svelte'; | ||
import TableRow from '../table/TableRow.svelte'; | ||
import TableContainer from '../table/TableContainer.svelte'; | ||
import { validateUserIsAdmin } from '../../validationUtils'; | ||
import { user } from '../../stores'; | ||
export let xfetch; | ||
export let notifications; | ||
export let eventTag; | ||
export let organizationId; | ||
export let teamId; | ||
export let departmentId; | ||
export let apiPrefix = '/api'; | ||
export let isEntityAdmin = false; | ||
$: isAdmin = validateUserIsAdmin($user); | ||
let defaultSettings = { | ||
id: '', | ||
autoFinishVoting: false, | ||
pointAverageRounding: 0, | ||
hideVoterIdentity: false, | ||
estimationScaleId: '', | ||
joinCode: '', | ||
facilitatorCode: '', | ||
}; | ||
let showCreateDefaultSettings = false; | ||
let showUpdateDefaultSettings = false; | ||
function toggleCreateDefaultSettings() { | ||
showCreateDefaultSettings = !showCreateDefaultSettings; | ||
} | ||
function toggleUpdateDefaultSettings() { | ||
showUpdateDefaultSettings = !showUpdateDefaultSettings; | ||
} | ||
async function getDefaultSettings() { | ||
const response = await xfetch(`${apiPrefix}/poker-settings`); | ||
if (response.ok) { | ||
defaultSettings = await response.json(); | ||
} else { | ||
notifications.error('Failed to get default poker settings'); | ||
} | ||
} | ||
getDefaultSettings(); | ||
</script> | ||
|
||
<div class="w-full"> | ||
<TableContainer> | ||
<TableNav | ||
title="Default Poker Settings" | ||
createBtnEnabled="{isAdmin || isEntityAdmin}" | ||
createBtnText="{defaultSettings.id !== '' | ||
? 'Update' | ||
: 'Create'} Default Settings" | ||
createButtonHandler="{defaultSettings.id !== '' | ||
? toggleUpdateDefaultSettings | ||
: toggleCreateDefaultSettings}" | ||
createBtnTestId="poker-settings-{defaultSettings.id !== '' | ||
? 'update' | ||
: 'create'}-btn" | ||
/> | ||
<Table> | ||
<tr slot="header"> | ||
<HeadCol>AutoFinishVoting</HeadCol> | ||
<HeadCol>PointAverageRounding</HeadCol> | ||
<HeadCol>HideVoterIdentity</HeadCol> | ||
<HeadCol>Estimation Scale ID</HeadCol> | ||
<HeadCol>Join Code</HeadCol> | ||
<HeadCol>Facilitator Code</HeadCol> | ||
</tr> | ||
<tbody slot="body"> | ||
{#if defaultSettings.id !== ''} | ||
<TableRow> | ||
<RowCol> | ||
{defaultSettings.autoFinishVoting ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.pointAverageRounding} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.hideVoterIdentity ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.estimationScaleId} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.joinCode} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.facilitatorCode} | ||
</RowCol> | ||
</TableRow> | ||
{/if} | ||
</tbody> | ||
</Table> | ||
</TableContainer> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<script lang="ts"> | ||
import Table from '../table/Table.svelte'; | ||
import TableNav from '../table/TableNav.svelte'; | ||
import HeadCol from '../table/HeadCol.svelte'; | ||
import RowCol from '../table/RowCol.svelte'; | ||
import TableRow from '../table/TableRow.svelte'; | ||
import TableContainer from '../table/TableContainer.svelte'; | ||
import { validateUserIsAdmin } from '../../validationUtils'; | ||
import { user } from '../../stores'; | ||
export let xfetch; | ||
export let notifications; | ||
export let eventTag; | ||
export let organizationId; | ||
export let teamId; | ||
export let departmentId; | ||
export let apiPrefix = '/api'; | ||
export let isEntityAdmin = false; | ||
$: isAdmin = validateUserIsAdmin($user); | ||
let defaultSettings = { | ||
id: '', | ||
maxVotes: false, | ||
allowMultipleVotes: 0, | ||
brainstormVisibility: false, | ||
phaseTimeLimit: 0, | ||
phaseAutoAdvance: false, | ||
allowCumulativeVoting: false, | ||
templateId: '', | ||
joinCode: '', | ||
facilitatorCode: '', | ||
}; | ||
let showCreateDefaultSettings = false; | ||
let showUpdateDefaultSettings = false; | ||
function toggleCreateDefaultSettings() { | ||
showCreateDefaultSettings = !showCreateDefaultSettings; | ||
} | ||
function toggleUpdateDefaultSettings() { | ||
showUpdateDefaultSettings = !showUpdateDefaultSettings; | ||
} | ||
async function getDefaultSettings() { | ||
const response = await xfetch(`${apiPrefix}/retro-settings`); | ||
if (response.ok) { | ||
defaultSettings = await response.json(); | ||
} else { | ||
notifications.error('Failed to get default retro settings'); | ||
} | ||
} | ||
getDefaultSettings(); | ||
</script> | ||
|
||
<div class="w-full"> | ||
<TableContainer> | ||
<TableNav | ||
title="Default Retrospective Settings" | ||
createBtnEnabled="{isAdmin || isEntityAdmin}" | ||
createBtnText="{defaultSettings.id !== '' | ||
? 'Update' | ||
: 'Create'} Default Settings" | ||
createButtonHandler="{defaultSettings.id !== '' | ||
? toggleUpdateDefaultSettings | ||
: toggleCreateDefaultSettings}" | ||
createBtnTestId="retro-settings-{defaultSettings.id !== '' | ||
? 'update' | ||
: 'create'}-btn" | ||
/> | ||
<Table> | ||
<tr slot="header"> | ||
<HeadCol>AllowMultipleVotes</HeadCol> | ||
<HeadCol>BrainstormVisibility</HeadCol> | ||
<HeadCol>PhaseTimeLimit</HeadCol> | ||
<HeadCol>PhaseAutoAdvance</HeadCol> | ||
<HeadCol>AllowCumulativeVoting</HeadCol> | ||
<HeadCol>TemplateId</HeadCol> | ||
<HeadCol>Join Code</HeadCol> | ||
<HeadCol>Facilitator Code</HeadCol> | ||
</tr> | ||
<tbody slot="body"> | ||
{#if defaultSettings.id !== ''} | ||
<TableRow> | ||
<RowCol> | ||
{defaultSettings.allowMultipleVotes ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.brainstormVisibility ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.phaseTimeLimit} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.phaseAutoAdvance ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.allowCumulativeVoting ? 'Yes' : 'No'} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.templateId} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.joinCode} | ||
</RowCol> | ||
<RowCol> | ||
{defaultSettings.facilitatorCode} | ||
</RowCol> | ||
</TableRow> | ||
{/if} | ||
</tbody> | ||
</Table> | ||
</TableContainer> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters