Last active
October 26, 2017 19:55
-
-
Save mekhami/16bcd5aec1f909a584cde820f5acc1ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Can't find field samplePage({"name":"","sampleTypeName":"","desc":"","inWorkflowInstance":false,"owner":"","page":0,"pageSize":50}) on object (ROOT_QUERY) { | |
"samplePage({\"name\":[\"\"],\"sampleTypeName\":\"\",\"desc\":\"\",\"inWorkflowInstance\":null,\"owner\":\"\",\"page\":0,\"pageSize\":50})": { | |
"type": "id", | |
"id": "$ROOT_QUERY.samplePage({\"name\":[\"\"],\"sampleTypeName\":\"\",\"desc\":\"\",\"inWorkflowInstance\":null,\"owner\":\"\",\"page\":0,\"pageSize\":50})", | |
"generated": true | |
}, | |
"sampleTypes": [ | |
{ | |
"type": "id", | |
"id": "ROOT_QUERY.sampleTypes.0", | |
"generated": true | |
} | |
] | |
}. | |
at readStoreResolver (readFromStore.js?f639:42) | |
at executeField (graphql.js?206d:74) | |
at eval (graphql.js?206d:31) | |
at Array.forEach (<anonymous>) | |
at executeSelectionSet (graphql.js?206d:26) | |
at graphql (graphql.js?206d:20) | |
at diffQueryAgainstStore (readFromStore.js?f639:75) | |
at readQueryFromStore (readFromStore.js?f639:18) | |
at TransactionDataProxy.readQuery (proxy.js?d9b2:114) | |
at update (255:101) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerSamples () { | |
this.$apollo.mutate({ | |
mutation: REGISTER_SAMPLES, | |
variables: { | |
number: this.quantity, | |
sampleType: this.selectedType.head.uuid, | |
tags: this.tags | |
}, | |
update: (proxy, { data: { registerSamples } }) => { | |
const variables = { | |
name: '', | |
desc: '', | |
sampleTypeName: '', | |
inWorkflowInstance: null, | |
owner: '', | |
page: 0, | |
pageSize: 50 | |
} | |
const newSamplePage = registerSamples.samplePage | |
const data = proxy.readQuery({ | |
query: SAMPLES_QUERY, | |
variables | |
}) | |
data.samplePage.samples = [...newSamplePage.samples, ...data.samplePage.samples] | |
proxy.writeQuery({ query: SAMPLES_QUERY, data, variables }) | |
} | |
}).then((response) => { | |
let metaFields = JSON.parse(this.selectedType.head.meta) | |
if (Object.keys(metaFields).length) { // SampleType for these samples has meta data | |
this.$emit('openMetaModal', { metaPage: response.data.registerSamples.samplePage, metaFields: metaFields }) | |
} | |
}).catch((error) => { | |
this.errorMessage = error | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apollo: { | |
samplePage: { | |
query: SAMPLES_QUERY, | |
variables () { | |
let names = this.filters.sampleId.split(',').map((item) => item.trim()) | |
let PageLimit = PAGE_SIZE | |
if (names.length > 0 && names[0] !== '') { | |
names = names.concat(this.selectedSamples.map((item) => item.name)) | |
if (names.length === 1) { | |
names.push('') | |
} | |
} | |
if (names.length > PAGE_SIZE) { | |
PageLimit = names.length | |
} | |
return { | |
name: names, | |
sampleTypeName: this.filters.sampleType, | |
desc: this.filters.sampleNote, | |
owner: this.filters.sampleOwner, | |
inWorkflowInstance: JSON.parse(this.filters.inWorkflowInstance), | |
page: 0, | |
pageSize: PageLimit | |
} | |
} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment