Skip to content

Commit

Permalink
- ADD: Added better indication of remote vs local trials.
Browse files Browse the repository at this point in the history
- CHG: Better handling of trimmed input.
  • Loading branch information
sebastian-raubach committed Sep 20, 2024
1 parent c09e0a1 commit 67cbaf6
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 8 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ declare module 'vue' {
IBiCloudUploadFill: typeof import('~icons/bi/cloud-upload-fill')['default']
IBiCollection: typeof import('~icons/bi/collection')['default']
IBiCursorFill: typeof import('~icons/bi/cursor-fill')['default']
IBiDatabaseFill: typeof import('~icons/bi/database-fill')['default']
IBiDiamondHalf: typeof import('~icons/bi/diamond-half')['default']
IBiDot: typeof import('~icons/bi/dot')['default']
IBiDownload: typeof import('~icons/bi/download')['default']
Expand Down
15 changes: 12 additions & 3 deletions src/components/TrialCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
<IBiCloudDownloadFill class="card-corner-icon" />
</template>
</a>
<b-button v-if="trial.remoteUrl" class="button-disabled py-0" variant="info" v-b-tooltip.hover="trial.remoteUrl">
<IBiCloudPlusFill /> {{ $t('buttonTrialRemoteUrl') }}
</b-button>
<template v-if="showRemoteVsLocal">
<b-button v-if="trial.remoteUrl" class="button-disabled py-0" variant="info" v-b-tooltip.hover="trial.remoteUrl">
<IBiCloudPlusFill /> {{ $t('buttonTrialRemoteUrl') }}
</b-button>
<b-button v-else class="button-disabled py-0" variant="success">
<IBiDatabaseFill /> {{ $t('buttonTrialLocalTrial') }}
</b-button>
</template>
<TrialInformation :trial="trial" @on-share-clicked="$emit('showShareCodes')" />
<b-button v-if="selectable" :variant="selectedToEdit ? 'info' : 'secondary'" @click="selectedToEdit = !selectedToEdit">
<IBiCheckSquare v-if="selectedToEdit" /><IBiSquare v-else /> {{ selectedToEdit ? $t('buttonDeselect') : $t('buttonSelect') }}
Expand Down Expand Up @@ -68,6 +73,10 @@ export default {
selectable: {
type: Boolean,
default: false
},
showRemoteVsLocal: {
type: Boolean,
default: false
}
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TrialListGroupItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<h6 :title="trial.description" @click="trialDescriptionExpanded = !trialDescriptionExpanded" :class="trialDescriptionExpanded ? '' : 'trial-description'" v-if="trial.description">{{ trial.description }}</h6>

<div><TrialShareTypeIcon iconTag="span" :shareStatus="trial.shareStatus" :isTextCode="false" @on-share-clicked="$emit('showShareCodes')" /></div>
<div><TrialShareTypeIcon iconClass="me-1" iconTag="span" :shareStatus="trial.shareStatus" :isTextCode="false" @on-share-clicked="$emit('showShareCodes')" /></div>

<div class="d-flex flex-wrap flex-row my-2">
<div class="me-3" v-b-tooltip.hover="trial.group ? trial.group.name : $t('widgetTrialSelectorGroupUnassigned')"><IBiCollection /></div>
Expand Down
32 changes: 31 additions & 1 deletion src/components/TrialSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<b-col cols=12 sm=6 md=4 lg=3 v-for="trial in trialGroup.trials" :key="`trial-selector-${trial.localId}`" class="mb-3">
<TrialCard :trial="trial"
:selectable="multiSelectEnabled"
:showRemoteVsLocal="hasRemoteTrials"
@selected="(v) => onSelectTrialToEdit(trial, v)"
@loadTrial="loadTrial(trial)"
@handleTrialExpiration="handleTrialExpiration(trial)"
Expand Down Expand Up @@ -184,7 +185,26 @@ export default {
modalToShow: null,
sorting: {
latestUpdate: (a, b) => this.sortDescending ? (new Date(b.updatedOn) - new Date(a.updatedOn)) : (new Date(a.updatedOn) - new Date(b.updatedOn)),
name: (a, b) => this.sortDescending ? b.name.localeCompare(a.name) : a.name.localeCompare(b.name)
name: (a, b) => this.sortDescending ? b.name.localeCompare(a.name) : a.name.localeCompare(b.name),
localVsRemote: (a, b) => {
let result = 0
const aExists = a.remoteUrl !== undefined && a.remoteUrl !== null
const bExists = b.remoteUrl !== undefined && b.remoteUrl !== null
if ((!aExists && !bExists) || (aExists && bExists)) {
result = a.name.localeCompare(b.name)
} else if (!aExists) {
result = 1
} else if (!bExists) {
result = -1
}
if (this.sortDescending) {
result = -result
}
return result
}
}
}
},
Expand All @@ -209,8 +229,18 @@ export default {
}, {
text: this.$t('formSelectOptionTrialSortName'),
value: 'name'
}, {
text: this.$t('formSelectOptionTrialSortLocalRemove'),
value: 'localVsRemote'
}]
},
hasRemoteTrials: function () {
if (this.trials && this.trials.length > 0) {
return this.trials.some(t => t.remoteUrl !== undefined && t.remoteUrl !== null)
} else {
return false
}
},
sortedTrials: function () {
if (this.trials) {
const sortedAndFiltered = JSON.parse(JSON.stringify(this.trials))
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/EditPeopleModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<b-form @submit.prevent="onSubmit">
<!-- Person name -->
<b-form-group :label="$t('formLabelPersonName')" label-for="person-name" :description="$t('formDescriptionPersonName')">
<b-form-input id="person-name" v-model="name" required :state="state.name" ref="name" />
<b-form-input id="person-name" v-model.trim.lazy="name" lazy trim required :state="state.name" ref="name" />
</b-form-group>
<!-- Person email -->
<b-form-group :label="$t('formLabelPersonEmail')" label-for="person-email" :description="$t('formDescriptionPersonEmail')">
<b-form-input id="person-email" type="email" v-model="email" :state="state.email" ref="email" />
<b-form-input id="person-email" type="email" v-model.trim.lazy="email" lazy trim :state="state.email" ref="email" />
</b-form-group>
<!-- Person role -->
<b-form-group :label="$t('formLabelPersonRole')" label-for="person-role" :description="$t('formDescriptionPersonRole')">
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/changelog/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@
"type": "new",
"title": "Versuch auf anderem Server",
"text": "Erlauben des Teilens von GridScore Versuchen mit anderen, selbst-gehosteten GridScore Servern anstelle des Standardservers."
},
{
"type": "bugfix",
"title": "Führende/anhängende Leerzeichen",
"text": "Behebt einen Fehler bei dem führende oder angängende Leerzeichen in Eingabefeldern automatisch entfernt werden."
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/changelog/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@
"type": "new",
"title": "Remote trials",
"text": "Allowed sharing of GridScore trials with a remote self-hosted GridScore server instead of the default one."
},
{
"type": "bugfix",
"title": "Leading/trailing spaces",
"text": "Fixed issues with the automatic removal of leading and trailing spaces in input fields."
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"buttonShowLabels": "Beschriftung anzeigen",
"buttonEditLabels": "Beschriftung bearbeiten",
"buttonTrialRemoteUrl": "Remote-Versuch",
"buttonTrialLocalTrial": "Lokaler Versuch",
"buttonRefresh": "Neu laden",
"cellCategoryControl": "Kontrolle",
"changelogBadgeNew": "NEU",
Expand Down Expand Up @@ -336,6 +337,7 @@
"formCheckboxChartInteractDisabled": "Interaktion unterbunden",
"formSelectOptionTrialSortLastUpdate": "Letzte Aktualisierung",
"formSelectOptionTrialSortName": "Name",
"formSelectOptionTrialSortLocalRemove": "Lokaler vs Remote-Versuch",
"formDescriptionTrialSetupTrialSocialContent": "Optional kann Inhalt definiert werden der zu Fotos die auf Social-Media geteilt werden hinzugefügt wird.",
"formLabelTrialSetupTrialSocialContent": "Social-Media-Konfiguration",
"formLabelTrialSetupTrialSocialTitle": "Titel",
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/i18n/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"buttonShowLabels": "Show labels",
"buttonEditLabels": "Edit labels",
"buttonTrialRemoteUrl": "Remote trial",
"buttonTrialLocalTrial": "Local trial",
"buttonRefresh": "Refresh",
"appTitle": "GridScore NEXT",
"appTitleLegacy": "GridScore legacy",
Expand Down Expand Up @@ -339,6 +340,7 @@
"formCheckboxChartInteractDisabled": "Interaction disabled",
"formSelectOptionTrialSortLastUpdate": "Last update",
"formSelectOptionTrialSortName": "Name",
"formSelectOptionTrialSortLocalRemove": "Local vs remote trial",
"formDescriptionTrialSetupTrialSocialContent": "Optionally, define content that will be included in photos shared on social media.",
"formDescriptionTrialSetupTrialSocialContentExtended": "The parameters below are part of the <a href='https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share#parameters'>Web Share API</a>. Depending on your operating system, browser and the app that is used to share the content any or all of these may be ignored by the sharing app.",
"formLabelTrialSetupTrialSocialContent": "Social media configuration",
Expand Down
4 changes: 3 additions & 1 deletion src/views/DataEntryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ export default {
initSearch: function () {
this.searchMatches = []
const matches = getGermplasmMatches(this.trial, this.searchTerm)
const trimmed = this.searchTerm.trim()
const matches = getGermplasmMatches(this.trial, trimmed)
if (matches.length === 1) {
emitter.emit('plot-clicked', matches[0].row, matches[0].column)
Expand Down

0 comments on commit 67cbaf6

Please sign in to comment.