From 8214a1acfb90ebc2092d7870b44716e1116509b8 Mon Sep 17 00:00:00 2001 From: HongKee Moon <moon@mpi-cbg.de> Date: Mon, 20 Jun 2022 16:10:12 +0200 Subject: [PATCH] lint:fixed --- web/src/components/CMS/DriverCriterion.vue | 147 ++++---- .../components/CMS/ExperimentalEvidence.vue | 155 ++++---- .../components/CMS/ProteinFunctionalType.vue | 122 ++++--- web/src/components/CMS/addDeleteMarker.vue | 229 ++++++------ web/src/components/CMS/addDeletePubmed.vue | 339 ++++++++++-------- web/src/components/CMS/evidenceStarRating.vue | 73 ++-- .../components/CMS/updateFunctionalType.vue | 116 +++--- web/src/components/CondensateDetailPage.vue | 321 +++++++++-------- 8 files changed, 839 insertions(+), 663 deletions(-) diff --git a/web/src/components/CMS/DriverCriterion.vue b/web/src/components/CMS/DriverCriterion.vue index d1d1527..1e56012 100644 --- a/web/src/components/CMS/DriverCriterion.vue +++ b/web/src/components/CMS/DriverCriterion.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -59,7 +68,10 @@ </option> </select> - <p v-if="!addDriverCriterion.isValid" class="text-red-500 mt-2"> + <p + v-if="!addDriverCriterion.isValid" + class="text-red-500 mt-2" + > {{ driverCriterionMsg }} </p> </div> @@ -106,7 +118,7 @@ type="radio" :value="item" @blur="clearValidity('deleteDriverCriterion')" - /> + > <div class="flex items-center"> <label :for="index"> @@ -123,7 +135,10 @@ {{ driverCriterionMsg }} </p> </div> - <div class="w-full" :class="{ invalid: !comment.isValid }"> + <div + class="w-full" + :class="{ invalid: !comment.isValid }" + > <textarea v-if="(!data && mode === 'Add') || data" v-model.trim="comment.value" @@ -150,10 +165,16 @@ @blur="clearValidity('comment')" /> - <p v-if="!comment.isValid" class="text-red-500"> + <p + v-if="!comment.isValid" + class="text-red-500" + > Reason must not be empty or less than 50 characters. </p> - <p v-if="serverError" class="text-danger font-bold"> + <p + v-if="serverError" + class="text-danger font-bold" + > {{ errMessage }} </p> </div> @@ -203,51 +224,51 @@ </template> <script> -const _ = require("lodash"); -let host = require("../js/const").apiHost; -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; +const _ = require('lodash'); +let host = require('../js/const').apiHost; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; export default { components: { BaseSpinner, BaseToaster }, - props: ["data", "uniprotId", "canonicalId", "mode"], + props: ['data', 'uniprotId', 'canonicalId', 'mode'], data() { return { isLoading: false, toasterIsOpen: false, formIsValid: true, addDriverCriterion: { - value: "Select", + value: 'Select', isValid: true, }, deleteDriverCriterion: { - value: "", + value: '', isValid: true, }, comment: { - value: "", + value: '', isValid: true, }, driverCriterionData: [ - { id: "1", type: "Select", displayValue: "Select" }, - { id: "2", type: "self_ps", displayValue: "Self-PS" }, - { id: "3", type: "induces_assembly", displayValue: "Induces Assembly" }, + { id: '1', type: 'Select', displayValue: 'Select' }, + { id: '2', type: 'self_ps', displayValue: 'Self-PS' }, + { id: '3', type: 'induces_assembly', displayValue: 'Induces Assembly' }, { - id: "4", - type: "essential_for_integrity", - displayValue: "Essential For Integrity", + id: '4', + type: 'essential_for_integrity', + displayValue: 'Essential For Integrity', }, ], - driverCriterionMsg: "", + driverCriterionMsg: '', serverError: false, - errMessage: "", + errMessage: '', }; }, computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, @@ -263,19 +284,19 @@ export default { this.toasterIsOpen = false; }, close() { - this.$emit("closeProteinDriverCriterion"); + this.$emit('closeProteinDriverCriterion'); }, clearValidity(input) { this[input].isValid = true; }, validateForm() { this.formIsValid = true; - if (this.mode === "Add") { + if (this.mode === 'Add') { if ( - this.addDriverCriterion.value === "" || - this.addDriverCriterion.value === "Select" + this.addDriverCriterion.value === '' || + this.addDriverCriterion.value === 'Select' ) { - this.driverCriterionMsg = "Please select an Driver Criterion value!"; + this.driverCriterionMsg = 'Please select an Driver Criterion value!'; this.addDriverCriterion.isValid = false; this.formIsValid = false; } @@ -295,17 +316,17 @@ export default { this.formIsValid = false; } } else { - if (this.deleteDriverCriterion.value === "") { + if (this.deleteDriverCriterion.value === '') { this.driverCriterionMsg = - "Please select an Experimental evidence value to remove!"; + 'Please select an Experimental evidence value to remove!'; this.deleteDriverCriterion.isValid = false; this.formIsValid = false; } } if ( - (this.comment.value === "" || this.comment.value.length < 50) && - this.role !== "Maintainer" + (this.comment.value === '' || this.comment.value.length < 50) && + this.role !== 'Maintainer' ) { this.comment.isValid = false; this.formIsValid = false; @@ -318,58 +339,58 @@ export default { } if (this.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; let data; let entityId = `${this.canonicalId}==${this.uniprotId}`; - if (this.mode === "Add") { - if (this.role === "Maintainer") { + if (this.mode === 'Add') { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "driver_criterion", + ChangeOperation: 'add', + Attribute: 'driver_criterion', SubmissionComments: this.comment.value ? this.comment.value - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.addDriverCriterion.value, - Status: "accepted", + Status: 'accepted', }; } else { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "driver_criterion", + ChangeOperation: 'add', + Attribute: 'driver_criterion', SubmissionComments: this.comment.value, Value: this.addDriverCriterion.value, - Status: "requested", + Status: 'requested', }; } } else { - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "driver_criterion", + ChangeOperation: 'remove', + Attribute: 'driver_criterion', SubmissionComments: this.comment.value ? this.comment.value - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.deleteDriverCriterion.value, - Status: "accepted", + Status: 'accepted', }; } else { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "driver_criterion", + ChangeOperation: 'remove', + Attribute: 'driver_criterion', SubmissionComments: this.comment.value, Value: this.deleteDriverCriterion.value, - Status: "requested", + Status: 'requested', }; } } @@ -387,12 +408,12 @@ export default { ); this.isLoading = false; this.toasterIsOpen = true; - this.addDriverCriterion.value = "Select"; - this.deleteDriverCriterion.value = ""; - this.comment.value = ""; + this.addDriverCriterion.value = 'Select'; + this.deleteDriverCriterion.value = ''; + this.comment.value = ''; this.serverError = false; - this.errMessage = ""; - this.$emit("update-key"); + this.errMessage = ''; + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -401,7 +422,7 @@ export default { this.isLoading = false; this.serverError = true; this.errMessage = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, }, diff --git a/web/src/components/CMS/ExperimentalEvidence.vue b/web/src/components/CMS/ExperimentalEvidence.vue index 6903f78..bfc7697 100644 --- a/web/src/components/CMS/ExperimentalEvidence.vue +++ b/web/src/components/CMS/ExperimentalEvidence.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -73,7 +82,10 @@ </option> </select> - <p v-if="!experimentalEvidance.isValid" class="text-red-500 mt-2"> + <p + v-if="!experimentalEvidance.isValid" + class="text-red-500 mt-2" + > {{ experimentalEvidanceMsg }} </p> </div> @@ -121,7 +133,7 @@ type="radio" :value="item" @blur="clearValidity('deleteExperimentalEvidance')" - /> + > <div class="flex items-center"> <label :for="index"> @@ -138,7 +150,10 @@ {{ experimentalEvidanceMsg }} </p> </div> - <div class="w-full" :class="{ invalid: !comment.isValid }"> + <div + class="w-full" + :class="{ invalid: !comment.isValid }" + > <textarea v-if="(!data && mode === 'Add') || data" v-model.trim="comment.value" @@ -165,10 +180,16 @@ @blur="clearValidity('comment')" /> - <p v-if="!comment.isValid" class="text-red-500"> + <p + v-if="!comment.isValid" + class="text-red-500" + > Reason must not be empty or less than 50 characters. </p> - <p v-if="serverError" class="text-danger font-bold"> + <p + v-if="serverError" + class="text-danger font-bold" + > {{ errMessage }} </p> </div> @@ -218,55 +239,55 @@ </template> <script> -let host = require("../js/const").apiHost; -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; -import _ from "lodash"; +let host = require('../js/const').apiHost; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; +import _ from 'lodash'; export default { components: { BaseSpinner, BaseToaster }, - props: ["data", "uniprotId", "canonicalId", "mode"], + props: ['data', 'uniprotId', 'canonicalId', 'mode'], data() { return { isLoading: false, toasterIsOpen: false, formIsValid: true, experimentalEvidance: { - value: "Select", + value: 'Select', isValid: true, }, deleteExperimentalEvidance: { - value: "", + value: '', isValid: true, }, comment: { - value: "", + value: '', isValid: true, }, proteinExpEvidenceData: [ - { id: "1", type: "Select", displayData: "Select" }, - { id: "2", type: "in_vitro", displayData: "In Vitro" }, - { id: "3", type: "in_vivo", displayData: "In Vivo" }, - { id: "4", type: "in_cellulo", displayData: "In Cellulo" }, + { id: '1', type: 'Select', displayData: 'Select' }, + { id: '2', type: 'in_vitro', displayData: 'In Vitro' }, + { id: '3', type: 'in_vivo', displayData: 'In Vivo' }, + { id: '4', type: 'in_cellulo', displayData: 'In Cellulo' }, { - id: "5", - type: "mass_spectrometry", - displayData: "Mass Spectrometry", + id: '5', + type: 'mass_spectrometry', + displayData: 'Mass Spectrometry', }, - { id: "6", type: "colocalization", displayData: "Colocalization" }, - { id: "7", type: "frap", displayData: "FRAP" }, - { id: "8", type: "others", displayData: "Others" }, + { id: '6', type: 'colocalization', displayData: 'Colocalization' }, + { id: '7', type: 'frap', displayData: 'FRAP' }, + { id: '8', type: 'others', displayData: 'Others' }, ], - experimentalEvidanceMsg: "", + experimentalEvidanceMsg: '', serverError: false, - errMessage: "", + errMessage: '', }; }, computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, @@ -282,20 +303,20 @@ export default { this.toasterIsOpen = false; }, close() { - this.$emit("closeProteinExpEvidence"); + this.$emit('closeProteinExpEvidence'); }, clearValidity(input) { this[input].isValid = true; }, validateForm() { this.formIsValid = true; - if (this.mode === "Add") { + if (this.mode === 'Add') { if ( - this.experimentalEvidance.value === "" || - this.experimentalEvidance.value === "Select" + this.experimentalEvidance.value === '' || + this.experimentalEvidance.value === 'Select' ) { this.experimentalEvidanceMsg = - "Please select an Experimental evidence value!"; + 'Please select an Experimental evidence value!'; this.experimentalEvidance.isValid = false; this.formIsValid = false; } @@ -315,17 +336,17 @@ export default { this.formIsValid = false; } } else { - if (this.deleteExperimentalEvidance.value === "") { + if (this.deleteExperimentalEvidance.value === '') { this.experimentalEvidanceMsg = - "Please select an Experimental evidence value to remove!"; + 'Please select an Experimental evidence value to remove!'; this.deleteExperimentalEvidance.isValid = false; this.formIsValid = false; } } if ( - (this.comment.value === "" || this.comment.value.length < 50) && - this.role !== "Maintainer" + (this.comment.value === '' || this.comment.value.length < 50) && + this.role !== 'Maintainer' ) { this.comment.isValid = false; this.formIsValid = false; @@ -338,58 +359,58 @@ export default { } if (this.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; let data; let entityId = `${this.canonicalId}==${this.uniprotId}`; - if (this.mode === "Add") { - if (this.role === "Maintainer") { + if (this.mode === 'Add') { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "exp_evidence", + ChangeOperation: 'add', + Attribute: 'exp_evidence', SubmissionComments: this.comment.value ? this.comment.value - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.experimentalEvidance.value, - Status: "accepted", + Status: 'accepted', }; } else { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "exp_evidence", + ChangeOperation: 'add', + Attribute: 'exp_evidence', SubmissionComments: this.comment.value, Value: this.experimentalEvidance.value, - Status: "requested", + Status: 'requested', }; } } else { - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "exp_evidence", + ChangeOperation: 'remove', + Attribute: 'exp_evidence', SubmissionComments: this.comment.value ? this.comment.value - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.deleteExperimentalEvidance.value, - Status: "accepted", + Status: 'accepted', }; } else { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "exp_evidence", + ChangeOperation: 'remove', + Attribute: 'exp_evidence', SubmissionComments: this.comment.value, Value: this.deleteExperimentalEvidance.value, - Status: "requested", + Status: 'requested', }; } } @@ -407,12 +428,12 @@ export default { ); this.isLoading = false; this.toasterIsOpen = true; - this.experimentalEvidance.value = "Select"; - this.deleteExperimentalEvidance.value = ""; - this.comment.value = ""; + this.experimentalEvidance.value = 'Select'; + this.deleteExperimentalEvidance.value = ''; + this.comment.value = ''; this.serverError = false; - this.errMessage = ""; - this.$emit("update-key"); + this.errMessage = ''; + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -421,7 +442,7 @@ export default { this.isLoading = false; this.serverError = true; this.errMessage = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, }, diff --git a/web/src/components/CMS/ProteinFunctionalType.vue b/web/src/components/CMS/ProteinFunctionalType.vue index 693f137..994901b 100644 --- a/web/src/components/CMS/ProteinFunctionalType.vue +++ b/web/src/components/CMS/ProteinFunctionalType.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -25,7 +34,10 @@ </div> <div class="form-group"> <div class="flex flex-col space-y-4 px-8"> - <div class="w-full" :class="{ invalid: !functionalType.isValid }"> + <div + class="w-full" + :class="{ invalid: !functionalType.isValid }" + > <h1 class=" text-left @@ -53,12 +65,18 @@ </option> </select> - <p v-if="!functionalType.isValid" class="text-red-500 mt-2"> + <p + v-if="!functionalType.isValid" + class="text-red-500 mt-2" + > {{ functionalTypeMsg }} </p> </div> - <div class="w-full" :class="{ invalid: !comment.isValid }"> + <div + class="w-full" + :class="{ invalid: !comment.isValid }" + > <textarea v-model.trim="comment.value" :class=" @@ -89,10 +107,16 @@ @blur="clearValidity('comment')" /> - <p v-if="!comment.isValid" class="text-red-500"> + <p + v-if="!comment.isValid" + class="text-red-500" + > Reason must not be empty or less than 50 characters. </p> - <p v-if="serverError" class="text-danger font-bold"> + <p + v-if="serverError" + class="text-danger font-bold" + > {{ errMessage }} </p> </div> @@ -141,38 +165,38 @@ </template> <script> -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; -const _ = require("lodash"); -let host = require("../js/const").apiHost; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; +const _ = require('lodash'); +let host = require('../js/const').apiHost; export default { components: { BaseSpinner, BaseToaster }, - props: ["proteinFunctionalType", "uniprotId", "canonicalId"], + props: ['proteinFunctionalType', 'uniprotId', 'canonicalId'], data() { return { - isDev: process.env.NODE_ENV === "development", + isDev: process.env.NODE_ENV === 'development', formIsValid: true, functionalType: { value: this.proteinFunctionalType ? this.proteinFunctionalType - : "Select", + : 'Select', isValid: true, }, functionalOptions: [ - { id: "1", type: "Select" }, - { id: "2", type: "client" }, - { id: "3", type: "driver" }, - { id: "4", type: "regulator" }, + { id: '1', type: 'Select' }, + { id: '2', type: 'client' }, + { id: '3', type: 'driver' }, + { id: '4', type: 'regulator' }, ], comment: { - value: "", + value: '', isValid: true, }, - functionalTypeMsg: "", + functionalTypeMsg: '', error: false, - errMsg: "", + errMsg: '', serverError: false, - errMessage: "", + errMessage: '', isLoading: false, toasterIsOpen: false, }; @@ -180,10 +204,10 @@ export default { computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, methods: { @@ -198,7 +222,7 @@ export default { this.toasterIsOpen = false; }, close() { - this.$emit("closeToggleProteinFunctionalType"); + this.$emit('closeToggleProteinFunctionalType'); }, selectValue() {}, clearValidity(input) { @@ -207,10 +231,10 @@ export default { validateForm() { this.formIsValid = true; if ( - this.functionalType.value === "" || - this.functionalType.value === "Select" + this.functionalType.value === '' || + this.functionalType.value === 'Select' ) { - this.functionalTypeMsg = "Please select a funtional type!"; + this.functionalTypeMsg = 'Please select a funtional type!'; this.functionalType.isValid = false; this.formIsValid = false; } @@ -222,8 +246,8 @@ export default { this.formIsValid = false; } if ( - (this.comment.value === "" || this.comment.value.length < 50) && - this.role !== "Maintainer" + (this.comment.value === '' || this.comment.value.length < 50) && + this.role !== 'Maintainer' ) { this.comment.isValid = false; this.formIsValid = false; @@ -236,38 +260,38 @@ export default { } if (this.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; let data; let entityId = `${this.canonicalId}==${this.uniprotId}`; - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "update", - Attribute: "functional_type", + ChangeOperation: 'update', + Attribute: 'functional_type', SubmissionComments: this.comment.value ? this.comment.value - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.functionalType.value, - Status: "accepted", + Status: 'accepted', }; } else { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "update", - Attribute: "functional_type", + ChangeOperation: 'update', + Attribute: 'functional_type', SubmissionComments: this.comment.value, Value: this.functionalType.value, - Status: "requested", + Status: 'requested', }; } this.isValid = true; - this.error = ""; + this.error = ''; this.isLoading = true; try { @@ -283,14 +307,14 @@ export default { this.isLoading = false; this.toasterIsOpen = true; this.functionalType.value = !this.proteinFunctionalType - ? "Select" + ? 'Select' : this.proteinFunctionalType; - this.comment.value = ""; + this.comment.value = ''; this.isValid = true; - this.error = ""; + this.error = ''; this.serverError = false; - this.errMessage = ""; - this.$emit("update-key"); + this.errMessage = ''; + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -299,7 +323,7 @@ export default { this.isLoading = false; this.serverError = true; this.errMessage = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, }, diff --git a/web/src/components/CMS/addDeleteMarker.vue b/web/src/components/CMS/addDeleteMarker.vue index 0148ccb..76910fc 100644 --- a/web/src/components/CMS/addDeleteMarker.vue +++ b/web/src/components/CMS/addDeleteMarker.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -26,10 +35,14 @@ <div v-if="isLoading"> <base-spinner /> </div> - <div v-if="markerData" class="form-group"> - <label class="control-label col-sm-2" for="actionType" - >Select Action</label - > + <div + v-if="markerData" + class="form-group" + > + <label + class="control-label col-sm-2" + for="actionType" + >Select Action</label> <div class="col-sm-10"> <select id="actionType" @@ -37,7 +50,11 @@ class="form-control" @change="selectValue" > - <option v-for="item in actionOptions" :key="item" class=""> + <option + v-for="item in actionOptions" + :key="item" + class="" + > {{ item }} </option> </select> @@ -45,9 +62,10 @@ </div> <div v-if="showAddMarker || !markerData"> <div class="form-group"> - <label class="control-label col-sm-2" for="marker" - >Add a Marker</label - > + <label + class="control-label col-sm-2" + for="marker" + >Add a Marker</label> <div class="col-sm-10"> <div class="panel panel-default"> <div class="panel-body"> @@ -57,7 +75,7 @@ class="form-control" type="text" placeholder="Uniprot ID" - /> + > <div class="overflow-auto h-60"> <div v-for="(item, index) in filteredAddSearch" @@ -70,8 +88,11 @@ type="radio" :value="item" @click="selectMarker" - /> - <label class="control-label" :for="index"> + > + <label + class="control-label" + :for="index" + > {{ item }} </label> </div> @@ -87,9 +108,10 @@ </div> </div> <div class="form-group"> - <label class="control-label col-sm-2" for="markerComment" - >Reason</label - > + <label + class="control-label col-sm-2" + for="markerComment" + >Reason</label> <div class="col-sm-10"> <textarea @@ -139,7 +161,7 @@ class="form-control" type="text" placeholder="Uniprot ID" - /> + > <div class="overflow-auto h-60"> <div v-for="(item, index) in filteredDeleteSearch" @@ -152,8 +174,11 @@ type="radio" :value="item" @click="selectMarker" - /> - <label class="control-label" :for="index"> + > + <label + class="control-label" + :for="index" + > {{ item }} </label> </div> @@ -169,9 +194,10 @@ </div> </div> <div class="form-group -mt-9"> - <label class="control-label col-sm-2" for="funComment" - >Reason</label - > + <label + class="control-label col-sm-2" + for="funComment" + >Reason</label> <div class="col-sm-10"> <textarea @@ -211,7 +237,10 @@ </div> </div> </div> - <div v-if="showBtn || !markerData" class="form-group"> + <div + v-if="showBtn || !markerData" + class="form-group" + > <div class="col-sm-2" /> <div class="col-sm-10"> <p @@ -270,39 +299,39 @@ </template> <script> -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; -const _ = require("lodash"); -let host = require("../js/const").apiHost; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; +const _ = require('lodash'); +let host = require('../js/const').apiHost; export default { components: { BaseSpinner, BaseToaster }, - props: ["markerData", "condensateId", "proteins"], + props: ['markerData', 'condensateId', 'proteins'], data() { return { - isDev: process.env.NODE_ENV === "development", - comment: "", - search: "", - actionOptions: ["Add", "Delete"], - actionType: "", - marker: "", + isDev: process.env.NODE_ENV === 'development', + comment: '', + search: '', + actionOptions: ['Add', 'Delete'], + actionType: '', + marker: '', uniprotIds: [], error: false, - message: "", + message: '', showAddMarker: false, showDeleteMarker: false, showBtn: false, - commentError: "", - markerError: "", + commentError: '', + markerError: '', isLoading: false, toasterIsOpen: false, }; }, computed: { role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, filteredAddSearch() { return this.uniprotIds.filter((f) => f.includes(this.search)); @@ -328,27 +357,27 @@ export default { this.toasterIsOpen = false; }, markerValid() { - this.markerError = ""; + this.markerError = ''; }, commentValid() { - this.commentError = ""; + this.commentError = ''; }, selectValue() { - if (this.actionType === "Add") { + if (this.actionType === 'Add') { this.error = false; - this.marker = ""; - this.message = ""; - this.comment = ""; + this.marker = ''; + this.message = ''; + this.comment = ''; this.showAddMarker = true; this.showDeleteMarker = false; this.showBtn = true; - } else if (this.actionType === "Delete") { + } else if (this.actionType === 'Delete') { this.error = false; - this.marker = ""; - this.message = ""; - this.comment = ""; + this.marker = ''; + this.message = ''; + this.comment = ''; this.showDeleteMarker = true; this.showAddMarker = false; @@ -356,17 +385,17 @@ export default { } }, close() { - this.$emit("close"); + this.$emit('close'); }, validateComment() {}, selectMarker() { - this.markerError = ""; + this.markerError = ''; }, async editMarker() { const vm = this; if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; @@ -374,18 +403,18 @@ export default { // console.log(url); let data; - if (this.marker === "") { + if (this.marker === '') { this.error = true; - this.markerError = "Select a Marker."; + this.markerError = 'Select a Marker.'; return; } - if (this.actionType !== "Delete") { + if (this.actionType !== 'Delete') { if (this.markerData) { const presentUniprot = this.markerData.find((f) => f === this.marker); if (presentUniprot) { this.error = true; this.markerError = - "Selected Uniprot ID is already present. Please select another Uniprot Id to add. "; + 'Selected Uniprot ID is already present. Please select another Uniprot Id to add. '; return; } } @@ -393,33 +422,33 @@ export default { if (!this.actionType) { // console.log('True', this.role); - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "add", - Attribute: "biomarkers", + ChangeOperation: 'add', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.error = true; this.commentError = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "add", - Attribute: "biomarkers", + ChangeOperation: 'add', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } @@ -432,39 +461,39 @@ export default { // return; // } // } - } else if (this.actionType === "Add") { + } else if (this.actionType === 'Add') { // if (this.marker === "") { // this.error = true; // this.markerError = "Select a Marker."; // return; // } - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "add", - Attribute: "biomarkers", + ChangeOperation: 'add', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.error = true; this.commentError = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "add", - Attribute: "biomarkers", + ChangeOperation: 'add', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } @@ -477,39 +506,39 @@ export default { // return; // } // } - } else if (this.actionType === "Delete") { + } else if (this.actionType === 'Delete') { // if (this.marker === "") { // this.error = true; // this.markerError = "Select a Marker to delete."; // return; // } - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "remove", - Attribute: "biomarkers", + ChangeOperation: 'remove', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.error = true; this.commentError = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: this.condensateId, - ChangeOperation: "remove", - Attribute: "biomarkers", + ChangeOperation: 'remove', + Attribute: 'biomarkers', Value: this.marker, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } } @@ -528,12 +557,12 @@ export default { this.isLoading = false; this.toasterIsOpen = true; - this.comment = ""; + this.comment = ''; this.error = false; this.serverError = false; - this.marker = ""; - this.commentError = ""; - this.$emit("update-key"); + this.marker = ''; + this.commentError = ''; + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -542,7 +571,7 @@ export default { this.isLoading = false; this.error = true; this.message = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, }, diff --git a/web/src/components/CMS/addDeletePubmed.vue b/web/src/components/CMS/addDeletePubmed.vue index 8f05c35..9b44636 100644 --- a/web/src/components/CMS/addDeletePubmed.vue +++ b/web/src/components/CMS/addDeletePubmed.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -37,8 +46,7 @@ " for="pubId" > - Enter Pubmed ID to add.</label - > + Enter Pubmed ID to add.</label> <input id="pubId" @@ -47,16 +55,18 @@ type="text" placeholder="Pubmed ID" @keyup="validation" - /> - <p v-if="!isValid && error" class="text-red-600 mt-4 font-bold"> + > + <p + v-if="!isValid && error" + class="text-red-600 mt-4 font-bold" + > {{ error }} </p> <label class="text-left font-bold mb-2 text-xl sm:text-2xl" for="funComment" - >Reason</label - > + >Reason</label> <div> <textarea @@ -161,8 +171,7 @@ sm:text-2xl font-montserrat " - >Select Pubmed ID to remove.</label - > + >Select Pubmed ID to remove.</label> <div> <div v-for="(item, index) in getPubmed" @@ -175,7 +184,7 @@ type="radio" :value="item" @click="selectPubmedId" - /> + > <div class="flex items-center"> <label :for="index"> {{ item }} @@ -194,8 +203,7 @@ font-montserrat " for="funComment" - >Reason</label - > + >Reason</label> <div> <textarea @@ -224,7 +232,10 @@ placeholder="Please provide evidence/PubMed ID." @keyup="validateComment" /> - <p v-if="!isValid && error" class="text-red-600 mt-4 font-bold"> + <p + v-if="!isValid && error" + class="text-red-600 mt-4 font-bold" + > {{ error }} </p> <p @@ -293,10 +304,14 @@ </div> </div> </div> - <div v-if="mode === 'protein'" class="form-group"> - <label class="control-label col-sm-4" for="actionType" - >Select Action</label - > + <div + v-if="mode === 'protein'" + class="form-group" + > + <label + class="control-label col-sm-4" + for="actionType" + >Select Action</label> <div class="col-sm-8"> <div> <select @@ -305,7 +320,11 @@ class="form-control" @change="selectValue" > - <option v-for="item in actionOptions" :key="item" class=""> + <option + v-for="item in actionOptions" + :key="item" + class="" + > {{ item }} </option> </select> @@ -315,9 +334,10 @@ <div v-if="showAddPubmedId"> <div class="form-group"> - <label class="control-label col-sm-4" for="pubId" - >Enter pubmed ID</label - > + <label + class="control-label col-sm-4" + for="pubId" + >Enter pubmed ID</label> <div class="col-sm-8"> <input id="pubId" @@ -326,16 +346,20 @@ type="text" placeholder="Pubmed ID" @keyup="validation" - /> - <p v-if="!isValid && error" class="text-red-600 mt-4 font-bold"> + > + <p + v-if="!isValid && error" + class="text-red-600 mt-4 font-bold" + > {{ error }} </p> </div> </div> <div class="form-group"> - <label class="control-label col-sm-4" for="funComment" - >Reason</label - > + <label + class="control-label col-sm-4" + for="funComment" + >Reason</label> <div class="col-sm-8"> <textarea @@ -390,8 +414,11 @@ type="radio" :value="item" @click="selectPubmedId" - /> - <label class="control-label" :for="index"> + > + <label + class="control-label" + :for="index" + > {{ item }} </label> </div> @@ -400,9 +427,10 @@ </div> </div> <div class="form-group -mt-9"> - <label class="control-label col-sm-4" for="funComment" - >Reason</label - > + <label + class="control-label col-sm-4" + for="funComment" + >Reason</label> <div class="col-sm-8"> <textarea @@ -431,7 +459,10 @@ placeholder="Please provide evidence/PubMed ID." @keyup="validateComment" /> - <p v-if="!isValid && error" class="text-red-600 mt-4 font-bold"> + <p + v-if="!isValid && error" + class="text-red-600 mt-4 font-bold" + > {{ error }} </p> <p @@ -513,49 +544,49 @@ </template> <script> -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; //import BaseToaster from '../UI/BaseToaster.vue' -const _ = require("lodash"); -let host = require("../js/const").apiHost; +const _ = require('lodash'); +let host = require('../js/const').apiHost; export default { components: { BaseSpinner, BaseToaster }, - props: ["data", "mode", "pubmed", "uniprot", "type", "canonicalId"], + props: ['data', 'mode', 'pubmed', 'uniprot', 'type', 'canonicalId'], data() { return { - actionType: "", - pubmedId: "", - buttonText: "", + actionType: '', + pubmedId: '', + buttonText: '', showButtons: false, - actionOptions: ["Add", "Delete"], + actionOptions: ['Add', 'Delete'], showAddPubmedId: false, showDeletePubmedId: false, isValid: false, inputVal: true, - error: "", - commentError: "", - comment: "", - message: "", - pubmedIds: "", + error: '', + commentError: '', + comment: '', + message: '', + pubmedIds: '', serverError: false, whitespaceRegex: /(\s)/, - isDev: process.env.NODE_ENV === "development", + isDev: process.env.NODE_ENV === 'development', isLoading: false, toasterIsOpen: false, }; }, computed: { btnDisabled() { - if (!this.pubmedId || (!this.comment && this.role !== "Maintainer")) { + if (!this.pubmedId || (!this.comment && this.role !== 'Maintainer')) { return true; } return false; }, jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, getPubmed() { let pubIds; @@ -568,7 +599,7 @@ export default { return pubIds; }, disableButton() { - if (!this.pubmedId || (!this.comment && this.role !== "Maintainer")) { + if (!this.pubmedId || (!this.comment && this.role !== 'Maintainer')) { return true; } return false; @@ -591,8 +622,8 @@ export default { }, validateComment() { this.isValid = true; - this.error = ""; - this.message = ""; + this.error = ''; + this.message = ''; this.serverError = false; }, @@ -600,8 +631,8 @@ export default { let foundPubId; if ( - this.mode === "condensate" && - this.type === "Add" && + this.mode === 'condensate' && + this.type === 'Add' && Object.keys(data).length > 0 ) { let pubmedData; @@ -619,15 +650,15 @@ export default { } } } else if ( - this.mode === "protein" && - this.actionType === "Add" && + this.mode === 'protein' && + this.actionType === 'Add' && Object.keys(data).length > 0 ) { foundPubId = data.pubmed_ids.find((p) => p === this.pubmedId); } - this.message = ""; - if (this.pubmedId === "") { - this.error = "Pubmed Id should not be empty!"; + this.message = ''; + if (this.pubmedId === '') { + this.error = 'Pubmed Id should not be empty!'; return false; } @@ -639,13 +670,13 @@ export default { // } else if (foundPubId) { this.isValid = false; - this.commentError = ""; + this.commentError = ''; this.error = 'Given pubmed id is already present. Please add another pubmed id.'; return false; } - this.message = ""; + this.message = ''; return true; }, @@ -653,16 +684,16 @@ export default { const vm = this; if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; let data; - if (this.mode === "condensate" && this.type === "Add") { + if (this.mode === 'condensate' && this.type === 'Add') { //const foundPubId = this.pubmed.find((p) => p === this.pubmedId); - console.log("return val", this.inputValidation(this.pubmed)); + console.log('return val', this.inputValidation(this.pubmed)); let valid = this.inputValidation(this.pubmed); @@ -670,159 +701,159 @@ export default { return; } let entityId = `${this.canonicalId}==${this.uniprot}`; - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "pubmed_ids", + ChangeOperation: 'add', + Attribute: 'pubmed_ids', Value: this.pubmedId, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.isValid = false; this.commentError = - "Reason should not be empty or less than 50 character!"; + 'Reason should not be empty or less than 50 character!'; return false; } data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "add", - Attribute: "pubmed_ids", + ChangeOperation: 'add', + Attribute: 'pubmed_ids', Value: this.pubmedId, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } - } else if (this.mode === "condensate" && this.type === "Delete") { + } else if (this.mode === 'condensate' && this.type === 'Delete') { //val if (!this.inputValidation(this.pubmed)) { return; } - this.message = ""; - if (this.pubmedId === "") { + this.message = ''; + if (this.pubmedId === '') { this.isValid = false; - this.error = "Please select a pubmed id to remove!"; + this.error = 'Please select a pubmed id to remove!'; return; } let entityId = `${this.canonicalId}==${this.uniprot}`; - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "pubmed_ids", + ChangeOperation: 'remove', + Attribute: 'pubmed_ids', Value: this.pubmedId, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.isValid = false; this.commentError = - "Reason should not be empty or less than 50 character!"; + 'Reason should not be empty or less than 50 character!'; return false; } data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "remove", - Attribute: "pubmed_ids", + ChangeOperation: 'remove', + Attribute: 'pubmed_ids', Value: this.pubmedId, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } - } else if (this.mode === "protein" && this.actionType === "Add") { + } else if (this.mode === 'protein' && this.actionType === 'Add') { //val if (!this.inputValidation(this.data)) { return; } - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "add", - Attribute: "proteins", + ChangeOperation: 'add', + Attribute: 'proteins', Value: this.pubmedId, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.isValid = false; this.commentError = - "Reason should not be empty or less than 50 character!"; + 'Reason should not be empty or less than 50 character!'; return false; } data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "add", - Attribute: "proteins", + ChangeOperation: 'add', + Attribute: 'proteins', Value: this.pubmedId, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } - } else if (this.mode === "protein" && this.actionType === "Delete") { + } else if (this.mode === 'protein' && this.actionType === 'Delete') { if (!this.inputValidation(this.data)) { return; } - this.message = ""; - if (this.pubmedId === "") { + this.message = ''; + if (this.pubmedId === '') { this.isValid = false; - this.error = "Please select a pubmed id to remove!"; + this.error = 'Please select a pubmed id to remove!'; return; } - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "remove", - Attribute: "proteins", + ChangeOperation: 'remove', + Attribute: 'proteins', Value: this.pubmedId, SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.isValid = false; this.commentError = - "Reason should not be empty or less than 50 character!"; + 'Reason should not be empty or less than 50 character!'; return false; } data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "remove", - Attribute: "proteins", + ChangeOperation: 'remove', + Attribute: 'proteins', Value: this.pubmedId, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } } this.isValid = true; - this.error = ""; - this.message = ""; + this.error = ''; + this.message = ''; this.isLoading = true; this.toasterIsOpen = true; @@ -839,12 +870,12 @@ export default { this.isLoading = false; this.isValid = true; - this.comment = ""; - this.error = ""; + this.comment = ''; + this.error = ''; this.serverError = false; - this.pubmedId = ""; - this.commentError = ""; - this.$emit("update-key"); + this.pubmedId = ''; + this.commentError = ''; + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -853,58 +884,58 @@ export default { this.isLoading = false; this.serverError = true; this.message = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, selectPubmedId() { - this.error = ""; - this.serverError = ""; + this.error = ''; + this.serverError = ''; }, close() { - this.$emit("cancel"); + this.$emit('cancel'); }, closeAddPubmed() { - this.$emit("closeToggleAddPubmed"); + this.$emit('closeToggleAddPubmed'); }, closeDeletePubmed() { - this.$emit("closeToggleDeletePubmed"); + this.$emit('closeToggleDeletePubmed'); }, validation(e) { - if (this.pubmedId === "") { + if (this.pubmedId === '') { this.isValid = false; - this.error = "Pubmed Id should not be empty!"; + this.error = 'Pubmed Id should not be empty!'; return false; } if (e.keyCode === 32) { this.isValid = false; - this.error = "Pubmed Id should not have empty space!"; + this.error = 'Pubmed Id should not have empty space!'; return false; } if (this.whitespaceRegex.test(this.pubmedId)) { this.isValid = false; - this.error = "Pubmed Id should not have empty space!"; + this.error = 'Pubmed Id should not have empty space!'; return false; } this.isValid = true; - this.message = ""; - this.error = ""; + this.message = ''; + this.error = ''; return true; }, selectValue() { - if (this.actionType === "Add") { - this.error = ""; - this.commentError = ""; - this.message = ""; - this.buttonText = "Add"; - (this.pubmedId = ""), (this.isValid = true); + if (this.actionType === 'Add') { + this.error = ''; + this.commentError = ''; + this.message = ''; + this.buttonText = 'Add'; + (this.pubmedId = ''), (this.isValid = true); this.showAddPubmedId = true; this.showButtons = true; this.showDeletePubmedId = false; - } else if (this.actionType === "Delete") { - this.buttonText = "Delete"; - this.error = ""; - this.commentError = ""; - this.message = ""; + } else if (this.actionType === 'Delete') { + this.buttonText = 'Delete'; + this.error = ''; + this.commentError = ''; + this.message = ''; this.showDeletePubmedId = true; this.showButtons = true; this.showAddPubmedId = false; diff --git a/web/src/components/CMS/evidenceStarRating.vue b/web/src/components/CMS/evidenceStarRating.vue index 002b811..177598c 100644 --- a/web/src/components/CMS/evidenceStarRating.vue +++ b/web/src/components/CMS/evidenceStarRating.vue @@ -1,6 +1,9 @@ <template> <section> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -108,32 +117,32 @@ </template> <script> -const _ = require("lodash"); -let host = require("../js/const").apiHost; +const _ = require('lodash'); +let host = require('../js/const').apiHost; -import StarRating from "vue-star-rating"; -import BaseToaster from "../UI/BaseToaster.vue"; +import StarRating from 'vue-star-rating'; +import BaseToaster from '../UI/BaseToaster.vue'; export default { components: { StarRating, BaseToaster }, - props: ["rating", "uniprot", "canonicalId"], + props: ['rating', 'uniprot', 'canonicalId'], data() { return { currentRating: this.rating, - message: "", - comment: "", + message: '', + comment: '', error: false, valid: false, isLoading: false, toasterIsOpen: false, - isDev: process.env.NODE_ENV === "development", + isDev: process.env.NODE_ENV === 'development', }; }, computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, mounted() { @@ -147,15 +156,15 @@ export default { this.toasterIsOpen = false; }, close() { - this.$emit("close"); + this.$emit('close'); }, validateComment() { this.error = false; - this.message = ""; + this.message = ''; }, validateRating() { this.error = false; - this.message = ""; + this.message = ''; }, async updateEvidenceStar() { const vm = this; @@ -163,7 +172,7 @@ export default { // console.log(host) if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; @@ -175,35 +184,35 @@ export default { // console.log('true'); this.error = false; - vm.message = ""; + vm.message = ''; let data; let entityId = `${vm.canonicalId}==${vm.uniprot}`; - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "update", - Attribute: "confidence_score", + ChangeOperation: 'update', + Attribute: 'confidence_score', Value: this.currentRating.toString(), SubmissionComments: this.comment ? this.comment - : "Maintainer do not required to give reason at the moment.", - Status: "accepted", + : 'Maintainer do not required to give reason at the moment.', + Status: 'accepted', }; } else { - if (vm.comment === "" || this.comment.length < 50) { + if (vm.comment === '' || this.comment.length < 50) { this.error = true; vm.message = `The reason field should not be empty or less than 50 characters!`; return; } data = { - Entity: "condensate_protein", + Entity: 'condensate_protein', EntityId: entityId, - ChangeOperation: "update", - Attribute: "confidence_score", + ChangeOperation: 'update', + Attribute: 'confidence_score', Value: this.currentRating.toString(), SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } @@ -221,9 +230,9 @@ export default { ); this.isLoading = false; this.toasterIsOpen = true; - this.comment = ""; + this.comment = ''; this.currentRating = this.rating; - this.$emit("update-key"); + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -232,7 +241,7 @@ export default { this.isLoading = false; this.error = true; this.message = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; this.currentRating = this.rating; } }, diff --git a/web/src/components/CMS/updateFunctionalType.vue b/web/src/components/CMS/updateFunctionalType.vue index ecb2cef..f4a178f 100644 --- a/web/src/components/CMS/updateFunctionalType.vue +++ b/web/src/components/CMS/updateFunctionalType.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -25,9 +34,10 @@ <base-spinner /> </div> <div class="form-group"> - <label class="control-label col-sm-4" for="FuncType" - >Choose a functional type</label - > + <label + class="control-label col-sm-4" + for="FuncType" + >Choose a functional type</label> <div class="col-sm-8"> <div> <select @@ -52,9 +62,10 @@ </div> </div> <div class="form-group"> - <label class="control-label col-sm-4" for="funComment" - >Reason</label - > + <label + class="control-label col-sm-4" + for="funComment" + >Reason</label> <div class="col-sm-8"> <textarea @@ -84,7 +95,10 @@ @keyup="validateComment" /> - <p v-if="!isValid" class="text-danger mt-4 font-bold"> + <p + v-if="!isValid" + class="text-danger mt-4 font-bold" + > {{ error }} </p> <p @@ -144,27 +158,27 @@ </template> <script> -import BaseSpinner from "../UI/BaseSpinner.vue"; -import BaseToaster from "../UI/BaseToaster.vue"; -const _ = require("lodash"); -let host = require("../js/const").apiHost; +import BaseSpinner from '../UI/BaseSpinner.vue'; +import BaseToaster from '../UI/BaseToaster.vue'; +const _ = require('lodash'); +let host = require('../js/const').apiHost; export default { components: { BaseSpinner, BaseToaster }, - props: ["type", "data"], + props: ['type', 'data'], data() { return { - isDev: process.env.NODE_ENV === "development", + isDev: process.env.NODE_ENV === 'development', functionalOptions: [ - { id: "1", type: "client" }, - { id: "2", type: "driver" }, - { id: "3", type: "regulator" }, + { id: '1', type: 'client' }, + { id: '2', type: 'driver' }, + { id: '3', type: 'regulator' }, ], functionalType: this.data.functional_type, - error: "", + error: '', isValid: false, - message: "", + message: '', serverError: false, - comment: "", + comment: '', isLoading: false, showToast: false, toasterIsOpen: false, @@ -172,10 +186,10 @@ export default { }, computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, role: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, @@ -188,13 +202,13 @@ export default { }, validateComment() { this.isValid = true; - this.error = ""; - this.message = ""; + this.error = ''; + this.message = ''; }, selectValue() { this.isValid = true; - this.error = ""; - this.message = ""; + this.error = ''; + this.message = ''; }, async updateFuctionalType() { const vm = this; @@ -202,54 +216,54 @@ export default { // console.log(host) if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; if (!this.functionalType) { this.isValid = false; - this.message = ""; - this.error = "Select a functional type to update!"; + this.message = ''; + this.error = 'Select a functional type to update!'; return; } else if (this.data.functional_type === this.functionalType) { this.isValid = false; - this.message = ""; + this.message = ''; this.error = `The selected functional type is already ${this.functionalType}. Please select a different functional type from the list.`; return; } let data; this.isValid = true; - this.error = ""; - if (this.role === "Maintainer") { + this.error = ''; + if (this.role === 'Maintainer') { data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "update", - Attribute: "functional_type", + ChangeOperation: 'update', + Attribute: 'functional_type', SubmissionComments: this.comment ? this.comment - : "Maintainer do not need to provide a reason for such change at the moment!", + : 'Maintainer do not need to provide a reason for such change at the moment!', Value: this.functionalType, - Status: "accepted", + Status: 'accepted', }; } else { - if (this.comment === "" || this.comment.length < 50) { + if (this.comment === '' || this.comment.length < 50) { this.isValid = false; - this.message = ""; - this.error = "Reason should not be empty or less than 50 character!"; + this.message = ''; + this.error = 'Reason should not be empty or less than 50 character!'; return; } data = { - Entity: "protein", + Entity: 'protein', EntityId: this.data.uniprot_id, - ChangeOperation: "update", - Attribute: "functional_type", + ChangeOperation: 'update', + Attribute: 'functional_type', SubmissionComments: this.comment, Value: this.functionalType, - Status: "requested", + Status: 'requested', }; } this.isLoading = true; @@ -266,11 +280,11 @@ export default { this.isLoading = false; this.toasterIsOpen = true; this.functionalType = this.data.functional_type; - this.comment = ""; + this.comment = ''; this.isValid = true; - this.error = ""; + this.error = ''; this.serverError = false; - this.$emit("update-key"); + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); @@ -279,11 +293,11 @@ export default { this.isLoading = false; this.serverError = true; this.message = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, close() { - this.$emit("close"); + this.$emit('close'); }, }, }; diff --git a/web/src/components/CondensateDetailPage.vue b/web/src/components/CondensateDetailPage.vue index 17816d3..51aef82 100644 --- a/web/src/components/CondensateDetailPage.vue +++ b/web/src/components/CondensateDetailPage.vue @@ -1,6 +1,9 @@ <template> <div> - <base-toaster :open="toasterIsOpen" @close="hideDialog"> + <base-toaster + :open="toasterIsOpen" + @close="hideDialog" + > <div class="flex justify-between items-center"> <font-awesome-icon class="ml-3" @@ -9,8 +12,14 @@ /> <h4>Request submitted successfully!</h4> - <button class="btn btn-outline" @click="hideDialog"> - <font-awesome-icon icon="fa-regular fa-circle-xmark" size="2x" /> + <button + class="btn btn-outline" + @click="hideDialog" + > + <font-awesome-icon + icon="fa-regular fa-circle-xmark" + size="2x" + /> </button> </div> </base-toaster> @@ -41,7 +50,10 @@ <base-spinner /> </div> <div> - <h2 v-if="fetchError" class="text-red-500"> + <h2 + v-if="fetchError" + class="text-red-500" + > {{ fetchError }} </h2> </div> @@ -55,7 +67,7 @@ <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="rounded-lg px-5 py-4 text-center" @@ -87,8 +99,7 @@ <label for="condensateName" class="control-label col-sm-2" - >Name</label - > + >Name</label> <div class="col-sm-10"> <div class="w-1/4"> <input @@ -98,7 +109,7 @@ type="text" placeholder="Enter condensate name." @keyup="validateName" - /> + > <p v-if="nameError && nameErrMsg" class="text-red-500 mt-2 text-2xl font-bold" @@ -113,8 +124,7 @@ <label for="condensateName" class="control-label col-sm-2" - >Reason</label - > + >Reason</label> <div class="col-sm-10"> <div class="w-3/4"> <textarea @@ -197,7 +207,9 @@ </div> </form> </div> - <h4 class="round">General Information</h4> + <h4 class="round"> + General Information + </h4> <div class=" bg-white @@ -217,7 +229,9 @@ </div> </div> --> <div class="row"> - <div class="text col-sm-3 text-2xl">Species</div> + <div class="text col-sm-3 text-2xl"> + Species + </div> <div class="col-sm-9 text-2xl"> {{ response.data.species_name }} ({{ response.data.species_tax_id @@ -225,13 +239,15 @@ </div> </div> <div class="row text-2xl"> - <div class="text col-sm-3">Description</div> + <div class="text col-sm-3"> + Description + </div> <div class="col-sm-9 text-2xl"> {{ response.data.description }} <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="btn btn-primary btn-link" @@ -261,8 +277,7 @@ <label class="control-label col-sm-2" for="keyword" - >Update description</label - > + >Update description</label> <div class="col-sm-10"> <textarea id="comment" @@ -303,8 +318,7 @@ <label class="control-label col-sm-2" for="funComment" - >Reason</label - > + >Reason</label> <div class="col-sm-10"> <textarea @@ -439,7 +453,7 @@ <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="btn btn-primary btn-link" @@ -461,13 +475,17 @@ </div> <div class="row text-2xl"> - <div class="text col-sm-3">No. of Proteins</div> + <div class="text col-sm-3"> + No. of Proteins + </div> <div class="col-sm-9"> {{ response.data.protein_count }} </div> </div> <div class="row text-2xl"> - <div class="text col-sm-3 text-2xl">Evidence star</div> + <div class="text col-sm-3 text-2xl"> + Evidence star + </div> <div class="flex col-sm-9"> <star-rating :star-size="20" @@ -487,7 +505,9 @@ </div> <div v-show="response.data.experiments.length > 0"> - <h4 class="round">Experiments</h4> + <h4 class="round"> + Experiments + </h4> <div class="panel panel-default"> <table class="csi table table-hover table-responsive"> <thead> @@ -583,8 +603,8 @@ <button v-if=" getUserData !== null && - !response.data.is_experimental && - (getUserData === 'Maintainer' || + !response.data.is_experimental && + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class=" @@ -605,7 +625,10 @@ > Add a protein to this condensate </button> - <div v-if="showAddProtein" class="panel panel-default mt-4"> + <div + v-if="showAddProtein" + class="panel panel-default mt-4" + > <div class="panel-body"> <div class="container-fluid col-md-12"> <div v-if="isLoading"> @@ -617,9 +640,10 @@ @submit.prevent="addProtein(response)" > <div class="form-group"> - <label class="control-label col-sm-2" for="species" - >Add protein with uniprot ID</label - > + <label + class="control-label col-sm-2" + for="species" + >Add protein with uniprot ID</label> <div class="col-sm-4"> <input id="keyword" @@ -628,7 +652,7 @@ type="text" placeholder="Uniprot ID" @keyup="uniprotKeyup" - /> + > <p v-if="isUniProtIdError" class="text-red-600 mt-4 font-bold" @@ -638,9 +662,10 @@ </div> </div> <div class="form-group"> - <label class="control-label col-sm-2" for="keyword" - >Reason</label - > + <label + class="control-label col-sm-2" + for="keyword" + >Reason</label> <div class="col-sm-8"> <textarea id="comment" @@ -786,7 +811,9 @@ /> </div> <div class="my-14 border border-gray-300 rounded-lg p-8"> - <h4 class="round mb-8">Top Contributors</h4> + <h4 class="round mb-8"> + Top Contributors + </h4> <contributor-list-table :id="response.data.canonical_id" entity="condensate" @@ -844,26 +871,26 @@ </template> <script> -import fetchCondensate from "@/components/DDCODE/fetchCondensate.vue"; -import llpsTable from "@/components/LlpsTable.vue"; -import fetchPubMed from "@/components/DDCODE/fetchPubMed"; -import AddDeleteMarker from "./CMS/addDeleteMarker.vue"; -import BaseSpinner from "./UI/BaseSpinner.vue"; -import CondensateUpdateItemsTable from "./CondensateUpdateItemsTable.vue"; -import BaseToaster from "./UI/BaseToaster.vue"; -import StarRating from "vue-star-rating"; -import ContributorListTable from "./ContributorListTable.vue"; +import fetchCondensate from '@/components/DDCODE/fetchCondensate.vue'; +import llpsTable from '@/components/LlpsTable.vue'; +import fetchPubMed from '@/components/DDCODE/fetchPubMed'; +import AddDeleteMarker from './CMS/addDeleteMarker.vue'; +import BaseSpinner from './UI/BaseSpinner.vue'; +import CondensateUpdateItemsTable from './CondensateUpdateItemsTable.vue'; +import BaseToaster from './UI/BaseToaster.vue'; +import StarRating from 'vue-star-rating'; +import ContributorListTable from './ContributorListTable.vue'; //import FetchUserSpecificUpdateItems from './CMS/fetchUserSpecificUpdateItems.vue'; //import RequestUpdateItemTable from "./RequestUpdateItemTable.vue"; // import TheModal from './UI/TheModal.vue'; -const _ = require("lodash"); -require("./js/clipboard"); +const _ = require('lodash'); +require('./js/clipboard'); -let host = require("./js/const").apiHost; +let host = require('./js/const').apiHost; export default { - name: "CondensateDetailPage", + name: 'CondensateDetailPage', components: { fetchCondensate, llpsTable, @@ -878,39 +905,39 @@ export default { // RequestUpdateItemTable, }, - props: ["condensateId"], + props: ['condensateId'], data() { return { condensate: this.$route.params.condensate ? this.$route.params.condensate : this.condensateId, - dbNames: require("./js/const").db, - isDev: process.env.NODE_ENV === "development", + dbNames: require('./js/const').db, + isDev: process.env.NODE_ENV === 'development', showAddProtein: false, - uniprotId: "", - comment: "", - proteinComment: "", - condensateNameComment: "", - condensateNameCommentErrMsg: "", - markerComment: "", - descriptionComment: "", - description: "", - descriptionMsg: "", - condensateName: "", - descriptionErrorMsg: "", + uniprotId: '', + comment: '', + proteinComment: '', + condensateNameComment: '', + condensateNameCommentErrMsg: '', + markerComment: '', + descriptionComment: '', + description: '', + descriptionMsg: '', + condensateName: '', + descriptionErrorMsg: '', isUniProtIdError: false, isCommentError: false, isSubmitted: false, error: false, showUpdateDescription: false, showAddDeleteMarker: false, - commentErrorMsg: "", + commentErrorMsg: '', descriptionCommentErr: false, nameCommentErr: false, proteinCommentErr: false, markerCommentErr: false, - uniprotIdErrorMsg: "", - message: "", + uniprotIdErrorMsg: '', + message: '', whitespaceRegex: /(\s)/, nameError: false, toggleModel: false, @@ -922,10 +949,10 @@ export default { }, computed: { jwt: function () { - return this.$store.getters["User/jwt"]; + return this.$store.getters['User/jwt']; }, getUserData() { - const userRole = this.$store.getters["User/userRole"]; + const userRole = this.$store.getters['User/userRole']; return userRole; }, @@ -933,7 +960,7 @@ export default { methods: { validateName() { - (this.nameErrMsg = ""), (this.nameError = false); + (this.nameErrMsg = ''), (this.nameError = false); }, showDialog() { this.toasterIsOpen = true; @@ -949,83 +976,83 @@ export default { }, toggleChangeName() { this.changeName = !this.changeName; - this.condensateName = ""; + this.condensateName = ''; }, closeAddDeleteMarker() { - this.comment = ""; + this.comment = ''; this.showAddDeleteMarker = false; }, uniprotKeyup() { - this.message = ""; + this.message = ''; this.isUniProtIdError = false; }, commentKeyup() { - this.message = ""; + this.message = ''; this.descriptionCommentErr = false; this.isCommentError = false; }, descriptionKeyup() { - this.descriptionMsg = ""; - this.descriptionErrorMsg = ""; + this.descriptionMsg = ''; + this.descriptionErrorMsg = ''; }, toggleUpdateDescription(res) { this.description = res; - this.descriptionMsg = ""; - this.descriptionErrorMsg = ""; + this.descriptionMsg = ''; + this.descriptionErrorMsg = ''; this.descriptionCommentErr = false; - this.descriptionComment = ""; + this.descriptionComment = ''; this.showUpdateDescription = !this.showUpdateDescription; }, validateProteinComment() { this.proteinCommentErr = false; - this.commentErrorMsg = ""; + this.commentErrorMsg = ''; }, async changeCondensateName(response) { if (!this.condensateName) { this.nameError = true; - this.nameErrMsg = "Enter a condensate name."; + this.nameErrMsg = 'Enter a condensate name.'; return; } this.nameError = false; - this.nameErrMsg = ""; + this.nameErrMsg = ''; if (this.isDev) { - host = require("./js/const").devApiHost; + host = require('./js/const').devApiHost; } let url = `${host}/api/update-items`; let data; - if (this.getUserData === "Maintainer") { + if (this.getUserData === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "update", - Attribute: "name", + ChangeOperation: 'update', + Attribute: 'name', Value: this.condensateName, SubmissionComments: this.condensateNameComment ? this.condensateNameComment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { if ( - this.condensateNameComment === "" || + this.condensateNameComment === '' || this.condensateNameComment.length < 50 ) { this.nameCommentErr = true; this.condensateNameCommentErrMsg = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "update", - Attribute: "name", + ChangeOperation: 'update', + Attribute: 'name', Value: this.condensateName, SubmissionComments: this.condensateNameComment, - Status: "requested", + Status: 'requested', }; } this.isLoading = true; @@ -1042,9 +1069,9 @@ export default { this.isLoading = false; this.toasterIsOpen = true; this.nameCommentErr = false; - this.condensateNameCommentErrMsg = ""; - this.condensateNameComment = ""; - this.condensateName = ""; + this.condensateNameCommentErrMsg = ''; + this.condensateNameComment = ''; + this.condensateName = ''; this.updatedKey += 1; setTimeout(() => { this.toasterIsOpen = false; @@ -1054,56 +1081,56 @@ export default { this.isLoading = false; this.nameCommentErr = true; this.condensateNameCommentErrMsg = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, async updateDescription(response) { - if (this.description === "") { - this.descriptionErrorMsg = "Description should not be empty!"; + if (this.description === '') { + this.descriptionErrorMsg = 'Description should not be empty!'; return; } else if (this.description === response.data.description) { this.descriptionErrorMsg = - "You have not added any description. Please modify the existing description."; - this.descriptionMsg = ""; + 'You have not added any description. Please modify the existing description.'; + this.descriptionMsg = ''; return; } if (this.isDev) { - host = require("./js/const").devApiHost; + host = require('./js/const').devApiHost; } let url = `${host}/api/update-items`; let data; - if (this.getUserData === "Maintainer") { + if (this.getUserData === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "update", - Attribute: "description", + ChangeOperation: 'update', + Attribute: 'description', Value: this.description, SubmissionComments: this.descriptionComment ? this.descriptionComment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { if ( - this.descriptionComment === "" || + this.descriptionComment === '' || this.descriptionComment.length < 50 ) { this.descriptionCommentErr = true; this.commentErrorMsg = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "update", - Attribute: "description", + ChangeOperation: 'update', + Attribute: 'description', Value: this.description, SubmissionComments: this.descriptionComment, - Status: "requested", + Status: 'requested', }; } this.isLoading = true; @@ -1120,11 +1147,11 @@ export default { this.isLoading = false; this.toasterIsOpen = true; this.descriptionCommentErr = false; - this.descriptionComment = ""; - this.descriptionErrorMsg = ""; + this.descriptionComment = ''; + this.descriptionErrorMsg = ''; this.description = response.data.description; - this.commentErrorMsg = ""; - this.comment = ""; + this.commentErrorMsg = ''; + this.comment = ''; this.isCommentError = false; this.updatedKey += 1; setTimeout(() => { @@ -1132,27 +1159,27 @@ export default { }, 2000); } catch (e) { console.error(e); - this.descriptionMsg = ""; + this.descriptionMsg = ''; this.descriptionErrorMsg = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; } }, async addProtein(response) { - if (this.uniprotId === "") { - this.uniprotIdErrorMsg = "Uniprot ID should not be empty!"; + if (this.uniprotId === '') { + this.uniprotIdErrorMsg = 'Uniprot ID should not be empty!'; this.isUniProtIdError = true; return; } else if (this.uniprotId.length < 6) { - this.uniprotIdErrorMsg = "Uniprot ID should be minimum of 6 character."; + this.uniprotIdErrorMsg = 'Uniprot ID should be minimum of 6 character.'; this.isUniProtIdError = true; return; } else if (this.uniprotId.length > 10) { this.uniprotIdErrorMsg = - "Uniprot ID should be maximum of 10 character."; + 'Uniprot ID should be maximum of 10 character.'; this.isUniProtIdError = true; return; } else if (this.whitespaceRegex.test(this.uniprotId)) { - this.uniprotIdErrorMsg = "Uniprot ID should not have space in between."; + this.uniprotIdErrorMsg = 'Uniprot ID should not have space in between.'; this.isUniProtIdError = true; return; } @@ -1161,46 +1188,46 @@ export default { (u) => u.uniprot_id === this.uniprotId ); if (findUniprotId) { - this.message = ""; - this.uniprotIdErrorMsg = "The Uniprot ID already exists!"; + this.message = ''; + this.uniprotIdErrorMsg = 'The Uniprot ID already exists!'; this.isUniProtIdError = true; return; } this.isError = false; if (this.isDev) { - host = require("./js/const").devApiHost; + host = require('./js/const').devApiHost; } let url = `${host}/api/update-items`; let data; - if (this.getUserData === "Maintainer") { + if (this.getUserData === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "add", - Attribute: "proteins", + ChangeOperation: 'add', + Attribute: 'proteins', Value: this.uniprotId, SubmissionComments: this.proteinComment ? this.proteinComment - : "Maintainer do not need to provide a reason for such change at the moment!", - Status: "accepted", + : 'Maintainer do not need to provide a reason for such change at the moment!', + Status: 'accepted', }; } else { - if (this.proteinComment === "" || this.proteinComment.length < 50) { + if (this.proteinComment === '' || this.proteinComment.length < 50) { this.proteinCommentErr = true; this.commentErrorMsg = - "Reason should not be empty or less than 50 characters!"; + 'Reason should not be empty or less than 50 characters!'; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: response.data.canonical_id, - ChangeOperation: "add", - Attribute: "proteins", + ChangeOperation: 'add', + Attribute: 'proteins', Value: this.uniprotId, SubmissionComments: this.proteinComment, - Status: "requested", + Status: 'requested', }; } this.isLoading = true; @@ -1220,10 +1247,10 @@ export default { this.error = false; this.isSubmitted = true; - this.uniprotId = ""; - this.comment = ""; + this.uniprotId = ''; + this.comment = ''; this.proteinCommentErr = false; - this.commentErrorMsg = ""; + this.commentErrorMsg = ''; this.updatedKey += 1; setTimeout(() => { this.toasterIsOpen = false; @@ -1231,7 +1258,7 @@ export default { } catch (e) { console.error(e); this.message = - e.message || "Something went wrong, please try again later!"; + e.message || 'Something went wrong, please try again later!'; this.isSubmitted = true; this.error = true; } @@ -1293,17 +1320,17 @@ export default { (a) => `<a href='/protein/${a}' class="link" target='_blank'>${a}</a>` ) - .join(", "); - else return ""; + .join(', '); + else return ''; }, getDbNames(names) { - return _.map(names, (i) => this.dbNames[i]).join(", "); + return _.map(names, (i) => this.dbNames[i]).join(', '); }, getTitleAuthors(title, data) { - return `${title}\n\n${_.map(data, (a) => a.name).join(", ")}`; + return `${title}\n\n${_.map(data, (a) => a.name).join(', ')}`; }, tokenize(input, token) { - return input.replaceAll(token, "<br/>"); + return input.replaceAll(token, '<br/>'); }, }, }; -- GitLab