mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 15:45:34 +08:00
Merge pull request #8604 from aignatov-bio/ai-sci-12045-add-validation-for-step-results-linking
Add front end validation for step results linking [SCI-12045]
This commit is contained in:
commit
f7c95ecdec
2 changed files with 17 additions and 5 deletions
|
@ -37,10 +37,10 @@
|
|||
{{ i18n.t('general.cancel') }}
|
||||
</button>
|
||||
<template v-if="results.length > 0">
|
||||
<button v-if="step.attributes.results.length == 0" type="submit" class="btn btn-primary" @click="linkResults">
|
||||
<button v-if="step.attributes.results.length == 0" type="submit" :disabled="isSameData" class="btn btn-primary" @click="linkResults">
|
||||
{{ i18n.t('protocols.steps.modals.link_results.link_results') }}
|
||||
</button>
|
||||
<button v-else type="submit" class="btn btn-primary" @click="linkResults">
|
||||
<button v-else type="submit" :disabled="isSameData" class="btn btn-primary" @click="linkResults">
|
||||
{{ i18n.t('general.save') }}
|
||||
</button>
|
||||
</template>
|
||||
|
@ -82,11 +82,13 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.selectedResults = this.step.attributes.results.map((result) => result.id);
|
||||
this.initialResults = this.step.attributes.results.map((result) => result.id);
|
||||
this.loadResults();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
results: [],
|
||||
initialResults: [],
|
||||
selectedResults: []
|
||||
};
|
||||
},
|
||||
|
@ -99,6 +101,10 @@ export default {
|
|||
},
|
||||
resultsLinkUrl() {
|
||||
return link_results_step_results_path({ format: 'json' });
|
||||
},
|
||||
isSameData() {
|
||||
return this.selectedResults.length === this.initialResults.length &&
|
||||
this.selectedResults.every((value) => this.initialResults.includes(value));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
{{ i18n.t('general.cancel') }}
|
||||
</button>
|
||||
<template v-if="steps.length > 0">
|
||||
<button v-if="result.attributes.steps.length == 0" type="submit" class="btn btn-primary" @click="linkSteps">
|
||||
<button v-if="result.attributes.steps.length == 0" type="submit" :disabled="isSameData" class="btn btn-primary" @click="linkSteps">
|
||||
{{ i18n.t('my_modules.results.modals.link_steps.link_steps') }}
|
||||
</button>
|
||||
<button v-else type="submit" class="btn btn-primary" @click="linkSteps">
|
||||
<button v-else type="submit" class="btn btn-primary" :disabled="isSameData" @click="linkSteps">
|
||||
{{ i18n.t('general.save') }}
|
||||
</button>
|
||||
</template>
|
||||
|
@ -86,12 +86,14 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.selectedSteps = this.result.attributes.steps.map((step) => step.id);
|
||||
this.initialSteps = this.result.attributes.steps.map((step) => step.id);
|
||||
this.loadSteps();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
steps: [],
|
||||
selectedSteps: []
|
||||
selectedSteps: [],
|
||||
initialSteps: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -103,6 +105,10 @@ export default {
|
|||
},
|
||||
stepsLinkUrl() {
|
||||
return link_steps_step_results_path({ format: 'json' });
|
||||
},
|
||||
isSameData() {
|
||||
return this.selectedSteps.length === this.initialSteps.length &&
|
||||
this.selectedSteps.every((value) => this.initialSteps.includes(value));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
Loading…
Add table
Reference in a new issue