mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
visgraph: improve splitId(node_id,'id') : return always integer
node_id value examples: * 'accompanying_period_124' --> 124 * '124' --> 124 * 124 --> 124
This commit is contained in:
parent
0f8ca77105
commit
9494bdee2a
@ -237,6 +237,11 @@ export default {
|
|||||||
let nodeType = splitId(data.nodes[0], 'type')
|
let nodeType = splitId(data.nodes[0], 'type')
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
|
|
||||||
|
// test
|
||||||
|
console.log(
|
||||||
|
splitId('accompanying_period_124', 'id')
|
||||||
|
)
|
||||||
|
|
||||||
case 'person':
|
case 'person':
|
||||||
let person = this.nodes.filter(n => n.id === data.nodes[0])[0]
|
let person = this.nodes.filter(n => n.id === data.nodes[0])[0]
|
||||||
console.log('@@@@@@ event on selected Node', person.id)
|
console.log('@@@@@@ event on selected Node', person.id)
|
||||||
|
@ -88,13 +88,14 @@ const store = createStore({
|
|||||||
*/
|
*/
|
||||||
getFoldedPersons: (state) => (array) => {
|
getFoldedPersons: (state) => (array) => {
|
||||||
let folded = []
|
let folded = []
|
||||||
|
console.log('array', array.map(item => item.person.id))
|
||||||
array.forEach(item => {
|
array.forEach(item => {
|
||||||
let id = (typeof item.person._id !== 'undefined') ? item.person._id : item.person.id
|
let id = splitId(item.person.id, 'id')
|
||||||
|
console.log(id)
|
||||||
if (state.personLoadedIds.includes(id)) {
|
if (state.personLoadedIds.includes(id)) {
|
||||||
folded.push(state.persons.filter(person => person._id === id)[0])
|
folded.push(state.persons.filter(person => person._id === id)[0])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//console.log('array', array.map(r => r.person.id))
|
|
||||||
console.log('get FoldedPersons', folded.map(f => f.id))
|
console.log('get FoldedPersons', folded.map(f => f.id))
|
||||||
return folded
|
return folded
|
||||||
},
|
},
|
||||||
|
@ -270,8 +270,11 @@ const splitId = (id, position) => {
|
|||||||
switch (position) {
|
switch (position) {
|
||||||
case 'type':
|
case 'type':
|
||||||
return /(.+)_/.exec(id)[1] // return 'accompanying_period'
|
return /(.+)_/.exec(id)[1] // return 'accompanying_period'
|
||||||
case 'id':
|
case 'id': // return 124
|
||||||
return id.split("_").pop() // return '124'
|
return parseInt(id
|
||||||
|
.toString()
|
||||||
|
.split("_")
|
||||||
|
.pop())
|
||||||
default:
|
default:
|
||||||
throw 'position undefined'
|
throw 'position undefined'
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user