Commits (1)
<template>
<v-row>
<v-btn depressed color="primary" small outlined @click="testSaveState">
Save
</v-btn>
<v-col cols="12">
<v-row>
<v-col cols="12">
......@@ -25,6 +28,7 @@
:query="datasetState.query"
:initial-load="datasetState.initialLoad"
:download-formats="datasetState.downloadFormats"
:dataset-state="datasetState"
:store-module-name="storeModuleName"
/>
<ActionsProgress :dataset-jobs="datasetState.datasetJobs" />
......@@ -78,6 +82,11 @@ export default {
default: () => {},
},
},
methods: {
testSaveState() {
console.log('TEST SAVE STATE')
},
},
}
</script>
......
......@@ -10,7 +10,12 @@
type="paragraph"
></v-skeleton-loader>
<template v-else>
<LinksToOtherEntities v-if="initialLoad" class="actions-item" />
<LinksToOtherEntities
v-if="initialLoad"
class="actions-item"
:store-module-name="storeModuleName"
:dataset-state="datasetState"
/>
<v-divider class="section-divider" vertical></v-divider>
<DatasetDownloadButtons
......@@ -45,6 +50,10 @@ export default {
type: String,
default: () => `dataset_browser`,
},
datasetState: {
type: Object,
default: () => {},
},
indexName: {
type: String,
default: () => 'some_index',
......
<template>
<div>
<v-btn color="primary" depressed> Related Activities </v-btn>
<v-menu bottom left offset-y>
<v-btn
v-if="firstLink != null"
color="primary"
depressed
@click="triggerEntityJoin(firstLink.entityID)"
>
Related {{ firstLink.pluralEntityName }}
</v-btn>
<v-menu v-if="otherLinks != null" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn color="primary" depressed v-bind="attrs" v-on="on">
<v-icon>mdi-chevron-down</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item>
<v-list-item v-for="link in otherLinks" :key="link.entityID">
<v-list-item-content>
<v-btn color="primary" depressed> Related Compounds </v-btn>
<v-btn
color="primary"
depressed
@click="triggerEntityJoin(link.entityID)"
>
Related {{ link.pluralEntityName }}
</v-btn>
</v-list-item-content>
</v-list-item>
</v-list>
......@@ -28,11 +41,43 @@
<script>
export default {
props: {
datasetState: {
type: Object,
default: () => {},
},
storeModuleName: {
type: String,
default: () => '',
},
},
data() {
return {
mode: 'all_items',
}
},
computed: {
firstLink() {
if (this.datasetState.possibleJoinDestinations == null) {
return null
}
return this.datasetState.possibleJoinDestinations[0]
},
otherLinks() {
if (this.datasetState.possibleJoinDestinations == null) {
return null
}
if (this.datasetState.possibleJoinDestinations.length < 2) {
return null
}
return this.datasetState.possibleJoinDestinations.slice(1)
},
},
methods: {
triggerEntityJoin(destinationEntity) {
console.log('triggerEntityJoin: ', destinationEntity)
},
},
}
</script>
......
......@@ -19,7 +19,6 @@ import { datasetMixin } from '~/web-components-submodule/mixins/datasets/dataset
import EntityBrowser from '~/web-components-submodule/components/common/Browsers/EntityBrowser.vue'
import DrugWarningInfo from '~/web-components-submodule/store/datasets/generators/compound/DrugWarningInfo.js'
import EntityNames from '~/web-components-submodule/standardisation/EntityNames.js'
import IndexNames from '~/web-components-submodule/standardisation/IndexNames.js'
export default {
components: {
......@@ -41,9 +40,8 @@ export default {
propertiesGroups: {
1: { id: 'browser_table', selected: true, allHeaders: [] },
},
pluralEntityName:
EntityNames[IndexNames.getDrugWarningInfoByParentIndexName()]
.pluralEntityName,
entityID: EntityNames.DrugWarning.entityID,
pluralEntityName: EntityNames.DrugWarning.pluralEntityName,
querystringExamples: [
'drug_warning.warning_type:("Black Box Warning" OR "Withdrawn") AND drug_warning.warning_class:"Cardiotoxicity"',
'drug_warning.where.country:France',
......
......@@ -14,7 +14,6 @@
import EntityBrowser from '~/web-components-submodule/components/common/Browsers/EntityBrowser.vue'
import { datasetMixin } from '~/web-components-submodule/mixins/datasets/datasetMixin.js'
import EntityNames from '~/web-components-submodule/standardisation/EntityNames.js'
import IndexNames from '~/web-components-submodule/standardisation/IndexNames.js'
import EubopenCompound from '~/web-components-submodule/store/datasets/generators/eubopen/chemicalProbe/EubopenCompound.js'
export default {
......@@ -33,8 +32,8 @@ export default {
propertiesGroups: {
1: { id: 'browser_table', selected: true, allHeaders: [] },
},
pluralEntityName:
EntityNames[IndexNames.getMoleculeIndexName()].pluralEntityName,
entityID: EntityNames.Compound.entityID,
pluralEntityName: EntityNames.Compound.pluralEntityName,
querystringExamples: [
'molecule_chembl_id:CHEMBL25',
'_exists_:molecule_properties.full_molformula',
......
......@@ -14,7 +14,6 @@
import EntityBrowser from '~/web-components-submodule/components/common/Browsers/EntityBrowser.vue'
import { datasetMixin } from '~/web-components-submodule/mixins/datasets/datasetMixin.js'
import EntityNames from '~/web-components-submodule/standardisation/EntityNames.js'
import IndexNames from '~/web-components-submodule/standardisation/IndexNames.js'
import EubopenTarget from '~/web-components-submodule/store/datasets/generators/eubopen/target/EubopenTarget.js'
export default {
......@@ -33,8 +32,8 @@ export default {
propertiesGroups: {
1: { id: 'browser_table', selected: true, allHeaders: [] },
},
pluralEntityName:
EntityNames[IndexNames.getTargetIndexName()].pluralEntityName,
entityID: EntityNames.Target.entityID,
pluralEntityName: EntityNames.Target.pluralEntityName,
querystringExamples: [
'target_chembl_id:CHEMBL2364169',
'_exists_:species_group_flag',
......
import { mapState } from 'vuex'
import DatasetStoreGenerator from '~/web-components-submodule/store/datasets/generators/DatasetStoreGenerator.js'
import EntitiesJoin from '~/web-components-submodule/standardisation/datasets/EntitiesJoin.js'
export const datasetMixin = {
created() {
......@@ -24,12 +25,6 @@ export const datasetMixin = {
this.customDataRepresentationParams
)
}
if (this.pluralEntityName != null) {
this.$store.dispatch(
`${this.storeModuleName}/setPluralEntityName`,
this.pluralEntityName
)
}
if (this.querystringExamples != null) {
this.$store.dispatch(
......@@ -45,6 +40,22 @@ export const datasetMixin = {
)
}
// This is always retuired so it can't be null
this.$store.dispatch(`${this.storeModuleName}/setEntityID`, this.entityID)
const possibleJoinDestinations = EntitiesJoin.getPossibleDestinationEntityIDsAndNames(
this.entityID
)
this.$store.dispatch(
`${this.storeModuleName}/setPossibleJoinDestinations`,
possibleJoinDestinations
)
this.$store.dispatch(
`${this.storeModuleName}/setPluralEntityName`,
this.pluralEntityName
)
this.$store.dispatch(
`${this.storeModuleName}/initialLoadData`,
this.starterParams
......
import IndexNames from '~/web-components-submodule/standardisation/IndexNames.js'
const entityNames = {
[IndexNames.getDrugWarningInfoByParentIndexName()]: {
DrugWarning: {
pluralEntityName: 'Drug Warnings',
entityID: 'DrugWarning',
},
[IndexNames.getMoleculeIndexName()]: {
Compound: {
pluralEntityName: 'Compounds',
entityID: 'Compound',
},
Drug: {
pluralEntityName: 'Drugs',
entityID: 'Drug',
},
DrugMechanism: {
pluralEntityName: 'Drug Mechanisms',
entityID: 'DrugMechanism',
},
[IndexNames.getTargetIndexName()]: {
DrugIndication: {
pluralEntityName: 'Drug Indications',
entityID: 'DrugIndication',
},
Target: {
pluralEntityName: 'Targets',
entityID: 'Target',
},
Activity: {
pluralEntityName: 'Activities',
entityID: 'Activity',
},
}
......
import EntityNames from '~/web-components-submodule/standardisation/EntityNames.js'
const originsDestinationsConfig = {
from: {
[EntityNames.DrugWarning.entityID]: {
originParamName: 'CHEMBL_DRUG_WARNINGS',
to: {
[EntityNames.Activity.entityID]: {
destinationParamName: 'CHEMBL_ACTIVITIES',
},
[EntityNames.Compound.entityID]: {
destinationParamName: 'CHEMBL_COMPOUNDS',
},
[EntityNames.Drug.entityID]: {
destinationParamName: 'CHEMBL_DRUGS',
},
[EntityNames.Drug.entityID]: {
destinationParamName: 'CHEMBL_DRUGS',
},
[EntityNames.DrugMechanism.entityID]: {
destinationParamName: 'CHEMBL_DRUG_MECHANISMS',
},
[EntityNames.DrugIndication.entityID]: {
destinationParamName: 'CHEMBL_DRUG_INDICATIONS',
},
},
},
},
}
const getPossibleDestinationEntityIDsAndNames = function (originEntityID) {
const possibleDestinationConfigKeys = Object.keys(
originsDestinationsConfig.from[originEntityID].to
)
return possibleDestinationConfigKeys.map((key) => {
return {
entityID: key,
pluralEntityName: EntityNames[key].pluralEntityName,
}
})
}
export default {
getPossibleDestinationEntityIDsAndNames,
}
......@@ -130,6 +130,15 @@ export default {
setPluralEntityName({ commit, state, dispatch }, pluralEntityName) {
commit('SET_PLURAL_ENTITY_NAME', pluralEntityName)
},
setEntityID({ commit, state, dispatch }, entityID) {
commit('SET_ENTITY_ID', entityID)
},
setPossibleJoinDestinations(
{ commit, state, dispatch },
possibleJoinDestinations
) {
commit('SET_POSSIBLE_JOIN_DESTINATIONS', possibleJoinDestinations)
},
setQuerystringExamples({ commit, state, dispatch }, querystringExamples) {
commit('SET_QUERYSTRING_EXAMPLES', querystringExamples)
},
......
......@@ -14,6 +14,12 @@ export default {
SET_INDEX_NAME(state, indexName) {
state.indexName = indexName
},
SET_ENTITY_ID(state, entityID) {
state.entityID = entityID
},
SET_POSSIBLE_JOIN_DESTINATIONS(state, possibleJoinDestinations) {
state.possibleJoinDestinations = possibleJoinDestinations
},
SET_QUERY(state, query) {
state.query = Object.assign({}, query)
},
......
......@@ -9,6 +9,8 @@ export default {
propertiesLoaded: false,
facetsLoaded: false,
indexName: undefined,
entityID: undefined,
possibleJoinDestinations: [],
query: {},
initialQuery: {},
propertiesGroups: {},
......