Skip to content

Commit

Permalink
Fixed #305: Don't allow score set range edits after publication
Browse files Browse the repository at this point in the history
  • Loading branch information
bencap committed Oct 16, 2024
1 parent 5ae613c commit fa78e7e
Showing 1 changed file with 77 additions and 75 deletions.
152 changes: 77 additions & 75 deletions src/components/screens/ScoreSetEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,90 +270,92 @@
</div>
</template>
</Card>
<div v-if="scoreRanges">
<Card>
<template #title>Score ranges
<Button icon="pi pi-times" severity="danger" aria-label="Delete all ranges" rounded text style="float:right;" @click="removeScoreRanges()"/>
</template>
<template #content>
<Card>
<template #title>Wild Type Score</template>
<template #content>
<div style="padding-top: 1%;">
<span class="p-float-label">
<InputNumber v-model="scoreRanges.wtScore" :aria-labelledby="$scopedId('input-wtScore')" style="width:100%;" :minFractionDigits="1" :maxFractionDigits="10" />
<label :for="$scopedId('input-wtScore')"> Wild Type Score </label>
</span>
<span v-if="validationErrors[`scoreRanges.wtScore`]" class="mave-field-error">{{ validationErrors[`scoreRanges.wtScore`] }}</span>
</div>
</template>
</Card>
<div v-for="(scoreRange, scoreIdx) of scoreRanges.ranges" :key="scoreIdx" class="mavedb-score-range-container">
<div v-if="itemStatus == 'NotLoaded' || this.item.private">
<div v-if="scoreRanges">
<Card>
<template #title>Score ranges
<Button icon="pi pi-times" severity="danger" aria-label="Delete all ranges" rounded text style="float:right;" @click="removeScoreRanges()"/>
</template>
<template #content>
<Card>
<template #title>Range {{ scoreIdx+1 }}:
<Button icon="pi pi-times" severity="danger" aria-label="Delete range" rounded text style="float:right;" @click="removeScoreRange(scoreIdx)"/>
</template>
<template #title>Wild Type Score</template>
<template #content>
<div style="padding-top: 1%;">
<span class="p-float-label">
<InputNumber v-model="scoreRanges.wtScore" :aria-labelledby="$scopedId('input-wtScore')" style="width:100%;" :minFractionDigits="1" :maxFractionDigits="10" />
<label :for="$scopedId('input-wtScore')"> Wild Type Score </label>
</span>
<span v-if="validationErrors[`scoreRanges.wtScore`]" class="mave-field-error">{{ validationErrors[`scoreRanges.wtScore`] }}</span>
</div>
</template>
</Card>
<div v-for="(scoreRange, scoreIdx) of scoreRanges.ranges" :key="scoreIdx" class="mavedb-score-range-container">
<Card>
<template #title>Range {{ scoreIdx+1 }}:
<Button icon="pi pi-times" severity="danger" aria-label="Delete range" rounded text style="float:right;" @click="removeScoreRange(scoreIdx)"/>
</template>
<template #content>
<div style="padding-top: 1%;">
<InputGroup>
<span class="p-float-label" style="width:75%;">
<InputText v-model="scoreRange.label" style="width:75%;" :aria-labelledby="$scopedId(`input-scoreRangeLabel-${scoreIdx}`)"></InputText>
<label :for="$scopedId(`input-scoreRangeLabel-${scoreIdx}`)">Label</label>
</span>
<span class="p-float-label" style="width:25%;">
<Dropdown v-model="scoreRange.classification" :options="rangeClassifications" style="width:25%;" :aria-labelledby="$scopedId(`input-scoreRangeClassification-${scoreIdx}`)"/>
<label :for="$scopedId(`input-scoreRangeClassification-${scoreIdx}`)">Classification</label>
</span>
</InputGroup>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.label`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.label`] }}</span>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.classification`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.classification`] }}</span>
</div>
<div style="padding-top: 2%;">
<span class="p-float-label">
<Textarea v-model="scoreRange.description" style="width:100%;" :aria-labelledby="$scopedId(`input-scoreRangeDescription-${scoreIdx}`)"/>
<label :for="$scopedId(`input-scoreRangeDescription-${scoreIdx}`)">Description (optional)</label>
</span>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.description`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.description`] }}</span>
</div>
<div>
<InputGroup>
<span class="p-float-label" style="width:75%;">
<InputText v-model="scoreRange.label" style="width:75%;" :aria-labelledby="$scopedId(`input-scoreRangeLabel-${scoreIdx}`)"></InputText>
<label :for="$scopedId(`input-scoreRangeLabel-${scoreIdx}`)">Label</label>
<span class=p-float-label>
<InputText v-model="scoreRange.range[0]" :aria-labelledby="$scopedId(`input-scoreRangeLower-${scoreIdx}`)" :disabled="scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity"/>
<label :for="$scopedId(`input-scoreRangeLower-${scoreIdx}`)"> {{ scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity ? "-infinity" : "Lower Bound" }} </label>
</span>
<span class="p-float-label" style="width:25%;">
<Dropdown v-model="scoreRange.classification" :options="rangeClassifications" style="width:25%;" :aria-labelledby="$scopedId(`input-scoreRangeClassification-${scoreIdx}`)"/>
<label :for="$scopedId(`input-scoreRangeClassification-${scoreIdx}`)">Classification</label>
<InputGroupAddon>to</InputGroupAddon>
<span class=p-float-label>
<InputText v-model="scoreRange.range[1]" :aria-labelledby="$scopedId(`input-scoreRangeUpper-${scoreIdx}`)" :disabled="scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity"/>
<label :for="$scopedId(`input-scoreRangeUpper-${scoreIdx}`)"> {{ scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity ? "infinity" : "Upper Bound" }} </label>
</span>
</InputGroup>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.label`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.label`] }}</span>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.classification`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.classification`] }}</span>
</div>
<div style="padding-top: 2%;">
<span class="p-float-label">
<Textarea v-model="scoreRange.description" style="width:100%;" :aria-labelledby="$scopedId(`input-scoreRangeDescription-${scoreIdx}`)"/>
<label :for="$scopedId(`input-scoreRangeDescription-${scoreIdx}`)">Description (optional)</label>
</span>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.description`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.description`] }}</span>
</div>
<div>
<InputGroup>
<span class=p-float-label>
<InputText v-model="scoreRange.range[0]" :aria-labelledby="$scopedId(`input-scoreRangeLower-${scoreIdx}`)" :disabled="scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity"/>
<label :for="$scopedId(`input-scoreRangeLower-${scoreIdx}`)"> {{ scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity ? "-infinity" : "Lower Bound" }} </label>
</div>
<div>
<span>
<Checkbox v-model="scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity" :binary="true" inputId="lowerBound" name="lower" @change="boundaryLimitUpdated(scoreIdx, 'lower')"/>
<label for="lowerBound" class="ml-2"> No lower bound </label>
</span>
<InputGroupAddon>to</InputGroupAddon>
<span class=p-float-label>
<InputText v-model="scoreRange.range[1]" :aria-labelledby="$scopedId(`input-scoreRangeUpper-${scoreIdx}`)" :disabled="scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity"/>
<label :for="$scopedId(`input-scoreRangeUpper-${scoreIdx}`)"> {{ scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity ? "infinity" : "Upper Bound" }} </label>
<span style="float:right;">
<label for="upperBound" class="ml-2"> No upper bound </label>
<Checkbox v-model="scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity" :binary="true" inputId="upperBound" name="upper" @change="boundaryLimitUpdated(scoreIdx, 'upper')"/>
</span>
</InputGroup>
</div>
<div>
<span>
<Checkbox v-model="scoreRangeBoundaryHelper[scoreIdx].lowerBoundIsInfinity" :binary="true" inputId="lowerBound" name="lower" @change="boundaryLimitUpdated(scoreIdx, 'lower')"/>
<label for="lowerBound" class="ml-2"> No lower bound </label>
</span>
<span style="float:right;">
<label for="upperBound" class="ml-2"> No upper bound </label>
<Checkbox v-model="scoreRangeBoundaryHelper[scoreIdx].upperBoundIsInfinity" :binary="true" inputId="upperBound" name="upper" @change="boundaryLimitUpdated(scoreIdx, 'upper')"/>
</span>
</div>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.range`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.range`] }}</span>
</template>
</Card>
</div>
<div class="field" style="align-items: center; justify-content: center; display: flex">
<Button label="Add new score range" icon="pi pi-plus" aria-label="Add range" outlined raised text @click="addScoreRange()"/>
</div>
</template>
</Card>
</div>
<div v-else>
<Card>
<template #title>Add Score Ranges
<Button icon="pi pi-plus" aria-label="Add score ranges" rounded text style="float:right;" @click="addScoreRanges()"/>
</template>
</Card>
</div>
<span v-if="validationErrors[`scoreRanges.ranges.${scoreIdx}.range`]" class="mave-field-error">{{ validationErrors[`scoreRanges.ranges.${scoreIdx}.range`] }}</span>
</template>
</Card>
</div>
<div class="field" style="align-items: center; justify-content: center; display: flex">
<Button label="Add new score range" icon="pi pi-plus" aria-label="Add range" outlined raised text @click="addScoreRange()"/>
</div>
</template>
</Card>
</div>
<div v-else>
<Card>
<template #title>Add Score Ranges
<Button icon="pi pi-plus" aria-label="Add score ranges" rounded text style="float:right;" @click="addScoreRanges()"/>
</template>
</Card>
</div>
</div>
</div>

Expand Down

0 comments on commit fa78e7e

Please # to comment.