From 17ea99e85cad636e1f1c768773f6443d4fd69a98 Mon Sep 17 00:00:00 2001 From: HongKee Moon <moon@mpi-cbg.de> Date: Tue, 26 Apr 2022 16:58:04 +0200 Subject: [PATCH] lint:fixed --- web/src/components/CMS/DriverCriterion.vue | 149 ++++---- .../components/CMS/ExperimentalEvidence.vue | 159 ++++---- .../components/CMS/ProteinFunctionalType.vue | 122 ++++--- web/src/components/CMS/addDeletePubmed.vue | 339 +++++++++-------- web/src/components/CondensateDetailPage.vue | 344 ++++++++++-------- .../components/CondensateUpdateItemsTable.vue | 127 +++---- web/src/components/LlpsTable.vue | 256 ++++++------- web/src/components/UI/TheActionModal.vue | 39 +- web/src/components/UI/TheDeleteModal.vue | 74 ++-- web/src/components/UpdateItemTable.vue | 4 - 10 files changed, 879 insertions(+), 734 deletions(-) diff --git a/web/src/components/CMS/DriverCriterion.vue b/web/src/components/CMS/DriverCriterion.vue index 9457f2b..d3a23ad 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> @@ -96,9 +108,9 @@ Remove Driver Criterion. </h1> <div - class="flex space-x-4" v-for="(item, index) in data" :key="index" + class="flex space-x-4" > <input :id="index" @@ -106,7 +118,7 @@ type="radio" :value="item" @blur="clearValidity('deleteDriverCriterion')" - /> + > <div class="flex items-center"> <label :for="index"> @@ -123,10 +135,13 @@ {{ driverCriterionMsg }} </p> </div> - <div class="w-full" :class="{ invalid: !comment.isValid }"> + <div + class="w-full" + :class="{ invalid: !comment.isValid }" + > <textarea - v-model.trim="comment.value" v-if="(!data && mode === 'Add') || data" + v-model.trim="comment.value" class=" form-control block @@ -152,15 +167,22 @@ @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> <div class="space-x-4 w-2/3"> <button + v-if="(!data && mode === 'Add') || data" class=" text-white bg-blue-600 @@ -174,7 +196,6 @@ text-center font-bold " - v-if="(!data && mode === 'Add') || data" type="submit" > {{ mode === "Add" ? "Add" : "Remove" }} @@ -205,47 +226,47 @@ </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: "4", type: "essential_for_integrity", displayValue: "Essential For Integrity" }, + { 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' }, ], - 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']; }, }, @@ -265,19 +286,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; } @@ -297,18 +318,18 @@ 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; @@ -321,56 +342,56 @@ 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: - "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: - "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', }; } } @@ -388,12 +409,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); @@ -402,7 +423,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 e639da5..64fd1b9 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> @@ -67,11 +76,14 @@ :key="options.id" :value="options.type" > - {{options.type==='frap' ? 'FRAP' :formatValue(options.type)}} + {{ options.type==='frap' ? 'FRAP' :formatValue(options.type) }} </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> @@ -109,9 +121,9 @@ Remove Experimental Evidence. </h1> <div - class="flex space-x-4" v-for="(item, index) in data" :key="index" + class="flex space-x-4" > <input :id="index" @@ -119,7 +131,7 @@ type="radio" :value="item" @blur="clearValidity('deleteExperimentalEvidance')" - /> + > <div class="flex items-center"> <label :for="index"> @@ -136,10 +148,13 @@ {{ experimentalEvidanceMsg }} </p> </div> - <div class="w-full" :class="{ invalid: !comment.isValid }"> + <div + class="w-full" + :class="{ invalid: !comment.isValid }" + > <textarea - v-model.trim="comment.value" v-if="(!data && mode === 'Add') || data" + v-model.trim="comment.value" class=" form-control block @@ -165,15 +180,22 @@ @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> <div class="space-x-4 w-2/3"> <button + v-if="(!data && mode === 'Add') || data" class=" text-white bg-blue-600 @@ -187,7 +209,6 @@ text-center font-bold " - v-if="(!data && mode === 'Add') || data" type="submit" > {{ mode === "Add" ? "Add" : "Remove" }} @@ -219,51 +240,51 @@ <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: "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: '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: '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']; }, }, @@ -280,20 +301,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; } @@ -313,18 +334,18 @@ 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; @@ -337,56 +358,56 @@ 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: - "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: - "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', }; } } @@ -404,12 +425,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); @@ -418,7 +439,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 7d04ed6..9dbdf54 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=" @@ -91,10 +109,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> @@ -143,38 +167,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, }; @@ -182,10 +206,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: { @@ -200,7 +224,7 @@ export default { this.toasterIsOpen = false; }, close() { - this.$emit("closeToggleProteinFunctionalType"); + this.$emit('closeToggleProteinFunctionalType'); }, selectValue() {}, clearValidity(input) { @@ -209,10 +233,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,37 +260,37 @@ 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: - "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 { @@ -282,14 +306,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); @@ -298,7 +322,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/addDeletePubmed.vue b/web/src/components/CMS/addDeletePubmed.vue index a135b47..84531fb 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="role === 'Maintainer' ? 'Optional.' : 'Mandatory'" @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="role === 'Maintainer' ? 'Optional.' : 'Mandatory'" @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,50 +544,50 @@ </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; @@ -569,7 +600,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; @@ -594,18 +625,18 @@ export default { }, validateComment() { this.isValid = true; - this.error = ""; - this.message = ""; + this.error = ''; + this.message = ''; this.serverError = false; }, inputValidation(data) { let foundPubId; - if (this.mode === "condensate" && this.type === "Add") { + if (this.mode === 'condensate' && this.type === 'Add') { let pubmedData; for (let key in data) { if (key === this.uniprot) { - console.log("working in add", data[key]); + console.log('working in add', data[key]); pubmedData = data[key]; } } @@ -614,12 +645,12 @@ export default { foundPubId = item; } } - } else if (this.mode === "protein" && this.actionType === "Add") { + } else if (this.mode === 'protein' && this.actionType === 'Add') { 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; } @@ -631,13 +662,13 @@ export default { // } else if (foundPubId) { this.isValid = false; - this.commentError = ""; + this.commentError = ''; this.error = - "Given pubmed id is aready present. Please add another pubmed id."; + 'Given pubmed id is aready present. Please add another pubmed id.'; return false; } - this.message = ""; + this.message = ''; return true; }, @@ -645,7 +676,7 @@ export default { const vm = this; if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; @@ -654,9 +685,9 @@ export default { 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); @@ -664,157 +695,157 @@ 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: - "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: - "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: - "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: - "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; @@ -831,12 +862,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); @@ -845,58 +876,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/CondensateDetailPage.vue b/web/src/components/CondensateDetailPage.vue index 3af2a8d..090ab4f 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> @@ -32,7 +41,10 @@ <div class="w-5/6"> <fetch-condensate :condensate="condensate"> <template slot-scope="{ response, loading }"> - <slot :response="response" :loading="loading"> + <slot + :response="response" + :loading="loading" + > <div v-if="loading || response === null"> <base-spinner /> </div> @@ -46,7 +58,7 @@ <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="rounded-lg px-5 py-4 text-center" @@ -59,7 +71,10 @@ </button> </div> - <div v-if="changeName" class="panel panel-default"> + <div + v-if="changeName" + class="panel panel-default" + > <div class="panel-body"> <form class="form-horizontal" @@ -70,8 +85,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 @@ -81,7 +95,7 @@ type="text" placeholder="Enter condensate name." @keyup="validateName" - /> + > <p v-if="nameError && nameErrMsg" class="text-red-500 mt-2 text-2xl font-bold" @@ -96,8 +110,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 @@ -181,7 +194,9 @@ </form> </div> </div> - <h4 class="round">General Information</h4> + <h4 class="round"> + General Information + </h4> <div class="panel panel-default"> <div class="panel-body"> <div class="container-fluid col-md-12"> @@ -194,7 +209,9 @@ </div> </div> --> <div class="row"> - <div class="text col-sm-3">Species</div> + <div class="text col-sm-3"> + Species + </div> <div class="col-sm-9"> {{ response.data.species_name }} ({{ response.data.species_tax_id @@ -202,13 +219,15 @@ </div> </div> <div class="row"> - <div class="text col-sm-3">Description</div> + <div class="text col-sm-3"> + Description + </div> <div class="col-sm-9"> {{ response.data.description }} <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="btn btn-primary btn-link" @@ -238,8 +257,7 @@ <label class="control-label col-sm-2" for="keyword" - >Update description</label - > + >Update description</label> <div class="col-sm-10"> <textarea id="comment" @@ -280,8 +298,7 @@ <label class="control-label col-sm-2" for="funComment" - >Reason</label - > + >Reason</label> <div class="col-sm-10"> <textarea @@ -373,18 +390,23 @@ </div> </div> </div> - <div v-show="response.data.synonyms" class="row"> - <div class="text col-sm-3">Also Known As</div> + <div + v-show="response.data.synonyms" + class="row" + > + <div class="text col-sm-3"> + Also Known As + </div> <div class="col-sm-9"> {{ response.data.synonyms ? response.data.synonyms - .map((a) => - a - .replace("-", " ") - .replace(/\b\w/g, (l) => l.toUpperCase()) - ) - .join(", ") + .map((a) => + a + .replace("-", " ") + .replace(/\b\w/g, (l) => l.toUpperCase()) + ) + .join(", ") : "" }} </div> @@ -406,13 +428,12 @@ <span v-else v-html="getProteinLinks(response.data.biomarkers)" - > - </span> + /> <button v-if=" getUserData !== null && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class="btn btn-primary btn-link" @@ -434,13 +455,17 @@ </div> <div class="row"> - <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"> - <div class="text col-sm-3">Evidence star</div> + <div class="text col-sm-3"> + Evidence star + </div> <div class="flex col-sm-9"> <star-rating :star-size="20" @@ -460,7 +485,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> @@ -556,7 +583,7 @@ <button v-if=" getUserData !== null && !response.data.is_experimental && - (getUserData === 'Maintainer' || + (getUserData === 'Maintainer' || getUserData === 'Contributor') " class=" @@ -577,7 +604,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"> @@ -589,9 +619,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" @@ -600,7 +631,7 @@ type="text" placeholder="Uniprot ID" @keyup="uniprotKeyup" - /> + > <p v-if="isUniProtIdError" class="text-red-600 mt-4 font-bold" @@ -610,9 +641,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" @@ -718,7 +750,7 @@ response.data.protein_driver_criterion " :protein-experimental-evidence=" - response.data.protein_exp_evidence + response.data.protein_exp_evidence " :protein-functional-type=" response.data.protein_functional_type @@ -809,25 +841,25 @@ </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 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 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, @@ -841,7 +873,7 @@ export default { // RequestUpdateItemTable, }, - props: ["condensateId"], + props: ['condensateId'], data() { return { // test data @@ -866,33 +898,33 @@ export default { 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, @@ -904,10 +936,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; }, @@ -915,7 +947,7 @@ export default { methods: { validateName() { - (this.nameErrMsg = ""), (this.nameError = false); + (this.nameErrMsg = ''), (this.nameError = false); }, showDialog() { this.toasterIsOpen = true; @@ -931,82 +963,82 @@ 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: - "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; @@ -1023,9 +1055,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; @@ -1035,55 +1067,55 @@ 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: - "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; @@ -1100,11 +1132,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(() => { @@ -1112,27 +1144,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 emplty!"; + if (this.uniprotId === '') { + this.uniprotIdErrorMsg = 'Uniprot ID should not be emplty!'; 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; } @@ -1141,45 +1173,45 @@ 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: - "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; @@ -1199,10 +1231,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; @@ -1210,7 +1242,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; } @@ -1269,17 +1301,17 @@ export default { if (uniprots) return uniprots .map((a) => `<a href='/protein/${a}' 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/>'); }, }, }; diff --git a/web/src/components/CondensateUpdateItemsTable.vue b/web/src/components/CondensateUpdateItemsTable.vue index 131c13e..d190318 100644 --- a/web/src/components/CondensateUpdateItemsTable.vue +++ b/web/src/components/CondensateUpdateItemsTable.vue @@ -1,35 +1,38 @@ <template> <div> - <table :id="id" class="table table-striped table-bordered table-hover" /> + <table + :id="id" + class="table table-striped table-bordered table-hover" + /> </div> </template> <script> -const _ = require("lodash"); -let host = require("./js/const").apiHost; +const _ = require('lodash'); +let host = require('./js/const').apiHost; -const $ = (window.jQuery = require("jquery")); -require("@/components/js/datatable"); +const $ = (window.jQuery = require('jquery')); +require('@/components/js/datatable'); let table; export default { - name: "UpdateItemTable", - props: ["id", "data", "meta"], + name: 'UpdateItemTable', + props: ['id', 'data', 'meta'], data() { return { rows: [], header: [], total: 0, - 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']; }, getRole: function () { - return this.$store.getters["User/userRole"]; + return this.$store.getters['User/userRole']; }, }, mounted() { @@ -46,33 +49,33 @@ export default { const columns = [ { - title: "ID", - data: "id", + title: 'ID', + data: 'id', fnCreatedCell: (nTd, sData, oData) => { $(nTd).html(`<a href="" class="edit-link"> ${sData}</a>`); }, }, { - title: "Resource Name", - data: "attributes.Entity", + title: 'Resource Name', + data: 'attributes.Entity', }, { - title: "Resource ID", - data: "attributes.EntityId", - className: "whitespace-normal break-all", + title: 'Resource ID', + data: 'attributes.EntityId', + className: 'whitespace-normal break-all', fnCreatedCell: (nTd, sData, oData) => { - if (oData.attributes.Entity === "protein") { + if (oData.attributes.Entity === 'protein') { $(nTd).html( `<a href='/protein/${sData}' class='resource-link'> ${sData}</a>` ); - } else if (oData.attributes.Entity === "condensate") { + } else if (oData.attributes.Entity === 'condensate') { $(nTd).html( `<a href='/condensate/${sData}' class='resource-link'> ${sData}</a>` ); - } else if (oData.attributes.Entity === "condensate_protein") { + } else if (oData.attributes.Entity === 'condensate_protein') { $(nTd).html( `<a href='/condensate/${ - sData.split("==")[0] + sData.split('==')[0] }' class='resource-link'> ${sData}</a>` ); } else { @@ -81,20 +84,20 @@ export default { }, }, { - title: "Attribute", - data: "attributes.Attribute", + title: 'Attribute', + data: 'attributes.Attribute', }, { - title: "Value", - data: "attributes.Value", + title: 'Value', + data: 'attributes.Value', }, { - title: "Change Operation", - data: "attributes.ChangeOperation", + title: 'Change Operation', + data: 'attributes.ChangeOperation', }, { - title: "Status", - data: "attributes.Status", + title: 'Status', + data: 'attributes.Status', // render: function(row, data, index){ // console.log("in color new", data); // if(data.attributes.Status === 'rejected'){ @@ -104,19 +107,19 @@ export default { // } fnCreatedCell: (nTd, sData, oData) => { - if (sData === "synced") { + if (sData === 'synced') { $(nTd).html( `<div class="rounded-full font-bold capitalize px-4 mr-2 bg-gray-500 text-white p-2 rounded flex items-center justify-center">${sData}</div>` ); - } else if (sData === "accepted") { + } else if (sData === 'accepted') { $(nTd).html( `<div class="rounded-full font-bold capitalize px-4 mr-2 bg-green-500 text-white p-2 rounded flex items-center justify-center">${sData}</div>` ); - } else if (sData === "rejected") { + } else if (sData === 'rejected') { $(nTd).html( `<div class="rounded-full font-bold capitalize px-4 mr-2 bg-red-500 text-white p-2 rounded flex items-center justify-center">${sData}</div>` ); - } else if (sData === "requested") { + } else if (sData === 'requested') { $(nTd).html( `<div class="rounded-full font-bold capitalize px-4 mr-2 bg-yellow-500 text-white p-2 rounded flex items-center justify-center">${sData}</div>` ); @@ -124,16 +127,16 @@ export default { }, }, { - title: "Submitted at", - data: "attributes.SubmittedAt", - className: "whitespace-normal", + title: 'Submitted at', + data: 'attributes.SubmittedAt', + className: 'whitespace-normal', render: function (data, type, row, meta) { return new Date(Date.parse(data)).toLocaleString(); }, }, { - title: "Action", + title: 'Action', // data: `<button class="btn btn-primary edit-link btn-outline font-bold" style="font-weight:bold"> // View<i class="fa fa-edit" style="font-weight:bold"></i> // </button>`, @@ -210,14 +213,14 @@ export default { order: [], // order: [[0, 'asc']], bDestroy: true, // Add this property to new setting, oLanguage: { - sSearch: "Filter", + sSearch: 'Filter', }, rowCallback: function (row, data) { if ( !data.attributes.SyncResponse && - data.attributes.Status != "rejected" + data.attributes.Status != 'rejected' ) { - $(row).css("background-color", "#e6e6e6"); + $(row).css('background-color', '#e6e6e6'); } }, fnServerData: function (sSource, aoData, fnCallback, oSettings) { @@ -236,15 +239,15 @@ export default { const tableBody = `${tableId} tbody`; - $(table.row(1).nodes()).addClass("Highlight_inUse"); + $(table.row(1).nodes()).addClass('Highlight_inUse'); - $(tableBody).on("click", "tr td a.edit-link", (e) => { + $(tableBody).on('click', 'tr td a.edit-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); const row = table.row(tr); vm.editUpdateItem(row.data().id); }); - $(tableBody).on("click", "tr td button.view-link", (e) => { + $(tableBody).on('click', 'tr td button.view-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); const row = table.row(tr); @@ -255,10 +258,10 @@ export default { let vm = this; // console.log(aoData) - let orderItem = aoData.find((x) => x.name === "order"); - let startItem = aoData.find((x) => x.name === "start"); - let lengthItem = aoData.find((x) => x.name === "length"); - let searchItem = aoData.find((x) => x.name === "search"); + let orderItem = aoData.find((x) => x.name === 'order'); + let startItem = aoData.find((x) => x.name === 'start'); + let lengthItem = aoData.find((x) => x.name === 'length'); + let searchItem = aoData.find((x) => x.name === 'search'); // console.log(`length = ${lengthItem.value}, offset = ${startItem.value}`) // console.log(`orderItem = ${orderItem.value}, searchItem = ${searchItem.value.value}`) @@ -267,10 +270,10 @@ export default { let search = searchItem.value.value; if (vm.isDev) { - host = require("./js/const").devApiHost; + host = require('./js/const').devApiHost; } - const qs = require("qs"); + const qs = require('qs'); const query = { pagination: { pageSize: lengthItem.value, @@ -279,17 +282,17 @@ export default { }; const columns = [ - "id", - "Entity", - "EntityId", - "Attribute", - "Value", - "ChangeOperation", - "Status", - "SubmittedAt", + 'id', + 'Entity', + 'EntityId', + 'Attribute', + 'Value', + 'ChangeOperation', + 'Status', + 'SubmittedAt', ]; - let order = ["SubmittedAt:desc"]; + let order = ['SubmittedAt:desc']; if (orderItem.value.length > 0) { orderItem.value.forEach(function (data) { // console.log(data) @@ -298,10 +301,10 @@ export default { // console.log(order) } - query["sort"] = order; + query['sort'] = order; if (searchItem.value.value) { - query["filters"] = { + query['filters'] = { $or: [ { Entity: { @@ -353,7 +356,7 @@ export default { if (res.data) { let dat = { draw: aoData.draw, - recordsTotal: query["filters"] + recordsTotal: query['filters'] ? vm.total : (vm.total = res.data.meta.pagination.total), recordsFiltered: res.data.meta.pagination.total, @@ -364,7 +367,7 @@ export default { } } catch (error) { this.error = true; - this.errorMsg = "You are not authorized to access this item."; + this.errorMsg = 'You are not authorized to access this item.'; } }, exportTsv() { diff --git a/web/src/components/LlpsTable.vue b/web/src/components/LlpsTable.vue index dbe854e..a375475 100644 --- a/web/src/components/LlpsTable.vue +++ b/web/src/components/LlpsTable.vue @@ -30,29 +30,29 @@ </template> <script> -import TheActionModal from "./UI/TheActionModal.vue"; -import TheDeleteModal from "./UI/TheDeleteModal.vue"; +import TheActionModal from './UI/TheActionModal.vue'; +import TheDeleteModal from './UI/TheDeleteModal.vue'; -const _ = require("lodash"); -const $ = (window.jQuery = require("jquery")); -require("./js/clipboard"); -require("@/components/js/datatable"); +const _ = require('lodash'); +const $ = (window.jQuery = require('jquery')); +require('./js/clipboard'); +require('@/components/js/datatable'); let table; const scoreMap = { - "http://llps.biocuckoo.cn/": 1, - "http://db.phasep.pro/browse/highthroughput/": 2, - "http://db.phasep.pro/browse/reviewed/": 4, - "http://db.phasep.pro/browse/uniprotreviewed/": 4, - "http://bio-comp.org.cn/llpsdb/": 4, - "https://phasepro.elte.hu/": 4, - "https://pubmed.ncbi.nlm.nih.gov/": 4, - "https://ddcode.org/": 5, + 'http://llps.biocuckoo.cn/': 1, + 'http://db.phasep.pro/browse/highthroughput/': 2, + 'http://db.phasep.pro/browse/reviewed/': 4, + 'http://db.phasep.pro/browse/uniprotreviewed/': 4, + 'http://bio-comp.org.cn/llpsdb/': 4, + 'https://phasepro.elte.hu/': 4, + 'https://pubmed.ncbi.nlm.nih.gov/': 4, + 'https://ddcode.org/': 5, }; function getStartWith(url) { - let ret = ""; + let ret = ''; _.forEach(_.keys(scoreMap), (i) => { if (url.startsWith(i)) { ret = i; @@ -77,39 +77,39 @@ function getRating(data) { } } - r.push("</div>"); + r.push('</div>'); return r; } export default { - name: "LlpsTable", + name: 'LlpsTable', components: { TheActionModal, TheDeleteModal, }, props: [ - "id", - "data", - "map", - "pubmed", - "dbTags", - "isExperimental", - "canonicalId", - "proteinDriverCriterion", - "proteinExperimentalEvidence", - "proteinFunctionalType", + 'id', + 'data', + 'map', + 'pubmed', + 'dbTags', + 'isExperimental', + 'canonicalId', + 'proteinDriverCriterion', + 'proteinExperimentalEvidence', + 'proteinFunctionalType', ], data() { return { toggleActionModal: false, toggleDeleteModal: false, - uniprotId: "", - selectedRowData: "", - canonicaliD: "", + uniprotId: '', + selectedRowData: '', + canonicaliD: '', proteinConfidenceScore: 0, - proteinFunctionalTypeData: "", - proteinExperimentalEvidenceData: "", - proteinDriverCriterionData: "", + proteinFunctionalTypeData: '', + proteinExperimentalEvidenceData: '', + proteinDriverCriterionData: '', }; }, mounted() { @@ -120,11 +120,11 @@ export default { methods: { closeModal() { this.toggleActionModal = false; - this.$emit("update-key"); + this.$emit('update-key'); }, closeDeleteModal() { this.toggleDeleteModal = false; - this.$emit("update-key"); + this.$emit('update-key'); }, fetchProtein(uniprot_id) { const vm = this; @@ -161,11 +161,11 @@ export default { // console.log(item) if (item) { const url = - "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json&id="; + 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json&id='; const request = url + item; - let $row = $("#" + item); + let $row = $('#' + item); - if (!$row.attr("aria-label")) { + if (!$row.attr('aria-label')) { fetch(request) .then((response) => response.json()) .then((response) => { @@ -174,9 +174,9 @@ export default { $(`a[id="${item}"]`).each(function () { $(this).attr( - "aria-label", + 'aria-label', `${res.title}\n\n${_.map(res.authors, (a) => a.name).join( - ", " + ', ' )}` ); }); @@ -195,16 +195,16 @@ export default { const columns = vm.isExperimental ? [ { - title: "UniProt", - data: "uniprot_id", - className: "text-nowrap", + title: 'UniProt', + data: 'uniprot_id', + className: 'text-nowrap', fnCreatedCell: (nTd, sData, oData) => { $(nTd).html(`<a href="" class="protein-link"> ${sData} </a>`); }, }, { - title: "Gene Name", - data: "gene_name", + title: 'Gene Name', + data: 'gene_name', fnCreatedCell: (nTd, sData, oData) => { if (sData) { $(nTd).html(`<a href="" class="protein-link"> ${sData}</a>`); @@ -214,8 +214,8 @@ export default { }, }, { - title: "Name", - data: "name", + title: 'Name', + data: 'name', fnCreatedCell: (nTd, sData, oData) => { if (sData) { $(nTd).html(`<a href="" class="protein-link"> ${sData}</a>`); @@ -260,19 +260,19 @@ export default { // } // }, { - title: "Pubmed", - data: "uniprot_id", - className: "text-nowrap", + title: 'Pubmed', + data: 'uniprot_id', + className: 'text-nowrap', render: function (data, type, row, meta) { if (vm.pubmed) { let dat = vm.pubmed[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } else { - return ""; + return ''; } } else { - return ""; + return ''; } }, fnCreatedCell: (nTd, sData, oData) => { @@ -283,13 +283,13 @@ export default { // $(nTd).html(data.filter(a => a.startsWith('http')).join('\n')); // $(nTd).html(data.map(i => vm.createLink(i)).join('<br/>')); $(nTd).html( - data.map((i) => vm.createPubMedLink(i)).join(" ") + data.map((i) => vm.createPubMedLink(i)).join(' ') ); } else { - $(nTd).html(""); + $(nTd).html(''); } } else { - $(nTd).html(""); + $(nTd).html(''); } }, }, @@ -349,16 +349,16 @@ export default { // }, { - title: "DB", - data: "uniprot_id", - className: "text-nowrap", + title: 'DB', + data: 'uniprot_id', + className: 'text-nowrap', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) let dat = vm.dbTags[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } - return ""; + return ''; }, }, // { @@ -379,22 +379,22 @@ export default { // }, // } { - title: "Evidence Stars", - className: "text-nowrap", - data: "uniprot_id", + title: 'Evidence Stars', + className: 'text-nowrap', + data: 'uniprot_id', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) let dat = vm.map[row.uniprot_id]; if (dat) { return dat; } - return ""; + return ''; }, fnCreatedCell: (nTd, sData, oData) => { // console.log(sData) let data = vm.map[oData.uniprot_id]; if (data) { - $(nTd).html(getRating(data).join("\n")); + $(nTd).html(getRating(data).join('\n')); } }, }, @@ -428,17 +428,17 @@ export default { ] : [ { - title: "UniProt", - data: "uniprot_id", - className: "whitespace-normal", + title: 'UniProt', + data: 'uniprot_id', + className: 'whitespace-normal', fnCreatedCell: (nTd, sData, oData) => { $(nTd).html(`<a href="" class="protein-link"> ${sData} </a>`); }, }, { - title: "Gene Name", - data: "gene_name", - className: "whitespace-normal", + title: 'Gene Name', + data: 'gene_name', + className: 'whitespace-normal', fnCreatedCell: (nTd, sData, oData) => { if (sData) { $(nTd).html(`<a href="" class="protein-link"> ${sData}</a>`); @@ -448,9 +448,9 @@ export default { }, }, { - title: "Name", - data: "name", - className: "whitespace-normal break-all", + title: 'Name', + data: 'name', + className: 'whitespace-normal break-all', fnCreatedCell: (nTd, sData, oData) => { if (sData) { $(nTd).html(`<a href="" class="protein-link"> ${sData}</a>`); @@ -478,19 +478,19 @@ export default { // } // }, { - title: "Pubmed", - data: "uniprot_id", - className: "whitespace-normal", + title: 'Pubmed', + data: 'uniprot_id', + className: 'whitespace-normal', render: function (data, type, row, meta) { if (vm.pubmed) { let dat = vm.pubmed[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } else { - return ""; + return ''; } } else { - return ""; + return ''; } }, fnCreatedCell: (nTd, sData, oData) => { @@ -501,21 +501,21 @@ export default { // $(nTd).html(data.filter(a => a.startsWith('http')).join('\n')); // $(nTd).html(data.map(i => vm.createLink(i)).join('<br/>')); $(nTd).html( - data.map((i) => vm.createPubMedLink(i)).join(" ") + data.map((i) => vm.createPubMedLink(i)).join(' ') ); } else { - $(nTd).html(""); + $(nTd).html(''); } } else { - $(nTd).html(""); + $(nTd).html(''); } }, }, { - title: "Functional Type", - data: "protein_functional_type", - className: "whitespace-nowrap", - defaultContent: "<i>No data</i>", + title: 'Functional Type', + data: 'protein_functional_type', + className: 'whitespace-nowrap', + defaultContent: '<i>No data</i>', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) if (!vm.proteinFunctionalType) { @@ -525,15 +525,15 @@ export default { if (dat) { return dat; } else { - return ""; + return ''; } }, }, { - title: "Experimental Evidence", - data: "protein_exp_evidence", - className: "whitespace-nowrap", - defaultContent: "<i>No data</i>", + title: 'Experimental Evidence', + data: 'protein_exp_evidence', + className: 'whitespace-nowrap', + defaultContent: '<i>No data</i>', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) if (!vm.proteinExperimentalEvidence) { @@ -542,16 +542,16 @@ export default { let dat = vm.proteinExperimentalEvidence[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } - return ""; + return ''; }, }, { - title: "Driver Criterion", - data: "driver_criterion", - className: "whitespace-nowrap", - defaultContent: "<i>No data</i>", + title: 'Driver Criterion', + data: 'driver_criterion', + className: 'whitespace-nowrap', + defaultContent: '<i>No data</i>', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) if (!vm.proteinDriverCriterion) { @@ -559,22 +559,22 @@ export default { } let dat = vm.proteinDriverCriterion[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } - return ""; + return ''; }, }, { - title: "DB", - data: "uniprot_id", - className: "whitespace-normal", + title: 'DB', + data: 'uniprot_id', + className: 'whitespace-normal', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) let dat = vm.dbTags[row.uniprot_id]; if (dat) { - return dat.join(", "); + return dat.join(', '); } - return ""; + return ''; }, }, // { @@ -595,10 +595,10 @@ export default { // }, // } { - title: "Evidence Stars", - className: "whitespace-nowrap", - data: "uniprot_id", - name: "evidenceStar", + title: 'Evidence Stars', + className: 'whitespace-nowrap', + data: 'uniprot_id', + name: 'evidenceStar', render: function (data, type, row, meta) { // console.log(_.flatMap(row.condensates, c => c.data_sources)) let dat = vm.map[row.uniprot_id]; @@ -606,20 +606,20 @@ export default { // console.log(getRatingValue(vm.map[row.uniprot_id])) return dat; } - return ""; + return ''; }, fnCreatedCell: (nTd, sData, oData) => { let data = vm.map[oData.uniprot_id]; if (data) { - $(nTd).html(getRating(data).join("\n")); + $(nTd).html(getRating(data).join('\n')); } }, }, { - title: "Action", - data: "uniprot_id", - name: "action", - className: "text-nowrap", + title: 'Action', + data: 'uniprot_id', + name: 'action', + className: 'text-nowrap', fnCreatedCell: (nTd, sData, oData) => { $(nTd).html( `<button class="rounded-md bg-transparent hover:bg-blue-600 text-blue-700 @@ -669,7 +669,7 @@ export default { // aaSorting: [[ 0, 'asc' ]], lengthMenu: [ [10, 25, 50, -1], - [10, 25, 50, "All"], + [10, 25, 50, 'All'], ], paging: true, searching: true, @@ -678,7 +678,7 @@ export default { order: [], // order: [[0, 'asc']], bDestroy: true, // Add this property to new setting, oLanguage: { - sSearch: "Filter", + sSearch: 'Filter', }, dom: '<"row"<"col-sm-2"l><"col-sm-2"f><"col-sm-8"p>><"row"t><"row"<"col-sm-4"i><"col-sm-8"p>>', // initComplete: function () { @@ -713,13 +713,13 @@ export default { table = $(tableId).DataTable(nTableOptions); if ( - !this.$store.getters["User/userRole"] || - this.$store.getters["User/userRole"] === "Administrator" || - this.$store.getters["User/userRole"] === "Authenticated" + !this.$store.getters['User/userRole'] || + this.$store.getters['User/userRole'] === 'Administrator' || + this.$store.getters['User/userRole'] === 'Authenticated' ) { var colIndex; table.columns().every(function () { - colIndex = table.column("action:name").index(); + colIndex = table.column('action:name').index(); // ... do something with data(), or this.nodes(), etc }); @@ -728,20 +728,20 @@ export default { const tableBody = `${tableId} tbody`; - $(tableBody).on("click", "tr td a.protein-link", (e) => { + $(tableBody).on('click', 'tr td a.protein-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); const row = table.row(tr); vm.fetchProtein(row.data().uniprot_id); }); - $(tableBody).on("click", "tr td a.uniprot-link", (e) => { + $(tableBody).on('click', 'tr td a.uniprot-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); const row = table.row(tr); vm.forwardUniprot(row.data().uniprot_id); }); - $(tableBody).on("click", "tr td button.edit-link", (e) => { + $(tableBody).on('click', 'tr td button.edit-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); @@ -785,19 +785,19 @@ export default { // vm.$router.push(`/protein/editDetails/${id}`); // vm.fetchPubMedId(e.target.id); }); - $(tableBody).on("click", "tr td button.delete-link", (e) => { + $(tableBody).on('click', 'tr td button.delete-link', (e) => { e.preventDefault(); const tr = $(e.target).parent().parent(); const row = table.row(tr); const id = row.data().uniprot_id; vm.uniprotId = id; - console.log("delete uniprotid is", id); + console.log('delete uniprotid is', id); vm.toggleDeleteModal = true; // vm.$router.push(`/protein/editDetails/${id}`); // vm.fetchPubMedId(e.target.id); }); - $(tableBody).on("mouseover", "tr td a.pubmed-link", (e) => { + $(tableBody).on('mouseover', 'tr td a.pubmed-link', (e) => { e.preventDefault(); // console.log(e.target.id) vm.fetchPubMedId(e.target.id); diff --git a/web/src/components/UI/TheActionModal.vue b/web/src/components/UI/TheActionModal.vue index ae530c6..3bd9514 100644 --- a/web/src/components/UI/TheActionModal.vue +++ b/web/src/components/UI/TheActionModal.vue @@ -1,6 +1,9 @@ <template> <section> - <div v-if="show" id="deleteModal"> + <div + v-if="show" + id="deleteModal" + > <div class="fixed z-40 h-full inset-0 opacity-25 bg-black" /> <div class=" @@ -75,7 +78,9 @@ mb-4 " > - <p class="font-bold text-2xl">Select an action.</p> + <p class="font-bold text-2xl"> + Select an action. + </p> <button type="button" @@ -311,11 +316,11 @@ </template> <script> -import addDeletePubmed from "../CMS/addDeletePubmed.vue"; -import DriverCriterion from "../CMS/DriverCriterion.vue"; -import EvidenceStarRating from "../CMS/evidenceStarRating.vue"; -import ExperimentalEvidence from "../CMS/ExperimentalEvidence.vue"; -import ProteinFunctionalType from "../CMS/ProteinFunctionalType.vue"; +import addDeletePubmed from '../CMS/addDeletePubmed.vue'; +import DriverCriterion from '../CMS/DriverCriterion.vue'; +import EvidenceStarRating from '../CMS/evidenceStarRating.vue'; +import ExperimentalEvidence from '../CMS/ExperimentalEvidence.vue'; +import ProteinFunctionalType from '../CMS/ProteinFunctionalType.vue'; export default { components: { @@ -326,15 +331,15 @@ export default { DriverCriterion, }, props: [ - "show", - "proteinUniprot", - "rowData", - "pubmed", - "canonicalId", - "proteinEvidenceScore", - "proteinFunctionalType", - "proteinExperimentalEvidence", - "proteinDriverCriterion", + 'show', + 'proteinUniprot', + 'rowData', + 'pubmed', + 'canonicalId', + 'proteinEvidenceScore', + 'proteinFunctionalType', + 'proteinExperimentalEvidence', + 'proteinDriverCriterion', ], data() { return { @@ -364,7 +369,7 @@ export default { }, close() { - this.$emit("close"); + this.$emit('close'); }, openAddPubmed() { this.toggleList = false; diff --git a/web/src/components/UI/TheDeleteModal.vue b/web/src/components/UI/TheDeleteModal.vue index 3b94014..bbd7aed 100644 --- a/web/src/components/UI/TheDeleteModal.vue +++ b/web/src/components/UI/TheDeleteModal.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,12 +12,21 @@ /> <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> - <div v-if="show" id="deleteModal"> + <div + v-if="show" + id="deleteModal" + > <div class="fixed z-40 h-full inset-0 opacity-25 bg-black" /> <div class=" @@ -185,17 +197,17 @@ </template> <script> -import BaseSpinner from "./BaseSpinner.vue"; -import BaseToaster from "./BaseToaster.vue"; -const _ = require("lodash"); -let host = require("../js/const").apiHost; +import BaseSpinner from './BaseSpinner.vue'; +import BaseToaster from './BaseToaster.vue'; +const _ = require('lodash'); +let host = require('../js/const').apiHost; export default { components: { BaseToaster, BaseSpinner }, - props: ["show", "title", "uniprotId", "canonicalId"], + props: ['show', 'title', 'uniprotId', 'canonicalId'], data() { return { - comment: "", - message: "", + comment: '', + message: '', error: false, toasterIsOpen: false, isLoading: false, @@ -203,10 +215,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: { @@ -217,13 +229,13 @@ export default { this.toasterIsOpen = false; }, validateComment() { - this.message = ""; + this.message = ''; }, confirm() { - this.$emit("confirm"); + this.$emit('confirm'); }, close() { - this.$emit("cancel"); + this.$emit('cancel'); }, async deleteUniprotIdReq() { const vm = this; @@ -231,40 +243,40 @@ export default { // console.log(host) if (vm.isDev) { - host = require("../js/const").devApiHost; + host = require('../js/const').devApiHost; } let url = `${host}/api/update-items`; let data; - if (this.role === "Maintainer") { + if (this.role === 'Maintainer') { data = { - Entity: "condensate", + Entity: 'condensate', EntityId: vm.canonicalId, - ChangeOperation: "remove", - Attribute: "proteins", + ChangeOperation: 'remove', + Attribute: 'proteins', Value: vm.uniprotId, SubmissionComments: this.comment, - Status: "accepted", + Status: 'accepted', }; } else { - if (vm.comment === "") { + if (vm.comment === '') { this.error = true; vm.message = `Enter a reason for such request. It should not be empty!`; return; } data = { - Entity: "condensate", + Entity: 'condensate', EntityId: vm.canonicalId, - ChangeOperation: "remove", - Attribute: "proteins", + ChangeOperation: 'remove', + Attribute: 'proteins', Value: vm.uniprotId, SubmissionComments: this.comment, - Status: "requested", + Status: 'requested', }; } this.error = false; - vm.message = ""; + vm.message = ''; this.isLoading = true; try { @@ -280,18 +292,18 @@ export default { this.isLoading = false; this.toasterIsOpen = true; - this.$emit("update-key"); + this.$emit('update-key'); setTimeout(() => { this.toasterIsOpen = false; }, 2000); - this.comment = ""; + this.comment = ''; } catch (e) { console.error(e); 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/UpdateItemTable.vue b/web/src/components/UpdateItemTable.vue index ff34990..ef08a8b 100644 --- a/web/src/components/UpdateItemTable.vue +++ b/web/src/components/UpdateItemTable.vue @@ -1,13 +1,9 @@ <template> - - - <table :id="id" class="table table-striped table-bordered table-hover" style="width:100%" /> - </template> <script> -- GitLab