Skip to content

Commit

Permalink
wis2box-webapp dataset editor: auto-lowercase centre-id
Browse files Browse the repository at this point in the history
  • Loading branch information
pjjin-design committed Nov 21, 2024
1 parent a0b3d61 commit ce3507b
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions src/components/DatasetEditorForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<v-row>
<v-col cols="12">
<v-combobox v-model="model.identification.centreID" :items="centreList"
label="Centre ID" :rules="[rules.centreID]" variant="outlined"></v-combobox>
label="Centre ID" :rules="[rules.centreID]" variant="outlined"
@update:modelValue="convertToLowercase"></v-combobox>
</v-col>
</v-row>
<v-select v-model="selectedTemplate" :items="templateFiles" item-title="label" return-object
Expand Down Expand Up @@ -82,8 +83,9 @@
</v-card-text>
<v-container>
<v-text-field label="wis2box auth token for 'processes/wis2box'" v-model="token" rows="1"
:append-icon="showToken ? 'mdi-eye' : 'mdi-eye-off'" :type="showToken ? 'text' : 'password'" autocomplete="one-time-code"
@click:append="showToken = !showToken" :rules="[rules.token]" variant="outlined">
:append-icon="showToken ? 'mdi-eye' : 'mdi-eye-off'" :type="showToken ? 'text' : 'password'"
autocomplete="one-time-code" @click:append="showToken = !showToken" :rules="[rules.token]"
variant="outlined">
</v-text-field>
</v-container>
<v-card-actions>
Expand Down Expand Up @@ -115,14 +117,12 @@
<v-row dense>
<v-col cols="11">
<v-text-field label="Identifier" type="string"
v-model="model.identification.identifier"
readonly variant="outlined">
v-model="model.identification.identifier" readonly variant="outlined">
</v-text-field>
</v-col>
<v-col cols="1">
<v-btn icon @click="copyIdentifier"
aria-label="Copy Identifier">
<v-icon>mdi-content-copy</v-icon>
<v-col cols="1">
<v-btn icon @click="copyIdentifier" aria-label="Copy Identifier">
<v-icon>mdi-content-copy</v-icon>
</v-btn>
</v-col>
</v-row>
Expand Down Expand Up @@ -215,8 +215,7 @@
</v-col>
<v-col cols="5">
<v-select label="Unit" :items="durations" item-title="name" item-value="code"
v-model="model.extents.resolutionUnit"
variant="outlined" clearable></v-select>
v-model="model.extents.resolutionUnit" variant="outlined" clearable></v-select>
</v-col>
</v-row>
</v-col>
Expand Down Expand Up @@ -396,8 +395,9 @@
</v-card-title>
<v-card-text>
<v-text-field label="wis2box auth token for 'processes/wis2box'" v-model="token" rows="1"
:append-icon="showToken ? 'mdi-eye' : 'mdi-eye-off'" :type="showToken ? 'text' : 'password'" autocomplete="one-time-code"
@click:append="showToken = !showToken" :rules="[rules.token]" variant="outlined">
:append-icon="showToken ? 'mdi-eye' : 'mdi-eye-off'" :type="showToken ? 'text' : 'password'"
autocomplete="one-time-code" @click:append="showToken = !showToken" :rules="[rules.token]"
variant="outlined">
</v-text-field>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -508,7 +508,8 @@
<br>
<p><b>End Date:</b> The date in UTC when the dataset ends.</p>
<br>
<p><b>Temporal Resolution (optional):</b> The smallest increment of time that is represented in the
<p><b>Temporal Resolution (optional):</b> The smallest increment of time that is represented in
the
dataset.
</p>
<p>This is split into two parts, the <b>value</b> (e.g. 1) and the <b>unit</b> (e.g.
Expand Down Expand Up @@ -650,7 +651,8 @@
{{ message }}
</v-card-text>
<v-card-actions>
<v-btn block variant="flat" @click="resetMessage('validation')" :color="formValidated ? '#64BF40' : 'error'">
<v-btn block variant="flat" @click="resetMessage('validation')"
:color="formValidated ? '#64BF40' : 'error'">
OK
</v-btn>
</v-card-actions>
Expand Down Expand Up @@ -722,7 +724,8 @@
<v-col cols="8">
<!-- Disable this if editing an existing plugin -->
<v-select label="Plugin Name" v-model="pluginName" :items="pluginList"
item-title="title" item-value="id" variant="outlined" :disabled="!pluginIsNew"></v-select>
item-title="title" item-value="id" variant="outlined"
:disabled="!pluginIsNew"></v-select>
</v-col>
<v-col cols="4">
<v-text-field label="File Extension" v-model="pluginFileExtension"
Expand Down Expand Up @@ -958,6 +961,11 @@ export default defineComponent({
return items.value.includes(model.value.identification.identifier) && !isNew.value;
})
// transfer to lowercase in realtime
const convertToLowercase = (value) => {
model.value.identification.centreID = value.toLowerCase();
};
// Has the user filled the dialog window?
const initialDialogFilled = computed(() => {
return model.value.identification.centreID && selectedTemplate.value;
Expand Down Expand Up @@ -1240,7 +1248,7 @@ export default defineComponent({
// Properties information
formModel.identification.title = schema.properties.title;
formModel.identification.description = schema.properties.description;
formModel.identification.language = {code: schema.properties.language};
formModel.identification.language = { code: schema.properties.language };
formModel.identification.keywords = schema.properties.keywords;
// Themes - hardcoded for now
Expand Down Expand Up @@ -1801,7 +1809,7 @@ export default defineComponent({
schemaModel.properties.identifier = form.identification.identifier;
schemaModel.properties.title = form.identification.title;
schemaModel.properties.description = form.identification.description;
schemaModel.properties.language = {code: null};
schemaModel.properties.language = { code: null };
schemaModel.properties.keywords = form.identification.keywords;
// Themes
const concepts = form.identification.concepts.map(item => ({ id: item, title: getTitleOf(item) }));
Expand Down Expand Up @@ -2186,6 +2194,7 @@ export default defineComponent({
templateFiles,
datasetIsBeingUpdated,
openRemoveConfirmationDialog,
convertToLowercase,
initialDialogFilled,
filteredCountryCodeList,
selectedTemplate,
Expand Down

0 comments on commit ce3507b

Please sign in to comment.