Skip to content

Commit

Permalink
v0.5.12: return to caller part2: if a node's last node has caller; fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssst0n3 committed Aug 28, 2023
1 parent ec0921e commit 8b68b55
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
volumes:
- source-analysis-system_secret:/secret
source-analysis-system:
image: ghcr.io/ssst0n3/source-analysis-system:v0.5.11
image: ghcr.io/ssst0n3/source-analysis-system:v0.5.12
restart: always
ports:
- "16080:8080"
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/components/Analysis/MarkdownCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<b-icon-arrow-up/>
</b-link>
</b-badge>
<b-badge v-if="hasParent" pill variant="secondary" @click.stop="navi(directions.left)">
<b-badge pill variant="secondary" @click.stop="navi(directions.left)">
<b-link class="text-white">
<b-icon-arrow-left/>
</b-link>
Expand Down Expand Up @@ -109,20 +109,22 @@ export default {
this.$emit('call', this.nodeId, this.childId)
},
navi(direction) {
let navId
switch (direction) {
case this.directions.up:
this.$emit('navi', this.lastId)
navId = this.lastId
break
case this.directions.left:
this.$emit('navi', this.parentId)
navId = this.parentId
break
case this.directions.down:
this.$emit('navi', this.nextId)
navId = this.nextId
break
case this.directions.right:
this.$emit('navi', this.childId)
navId = this.childId
break
}
this.$emit('navi', this.nodeId, navId, direction)
},
insert() {
this.$emit('insert', this.nodeId)
Expand Down
24 changes: 14 additions & 10 deletions frontend/src/components/Node/NodeMatrix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default {
return {
nodesMap: {},
nodeRelationsMap: {},
matrix: {},
nodeMatrix: [],
mode: 0,
baseNode: 0,
Expand Down Expand Up @@ -218,13 +219,13 @@ export default {
await this.listNodes(this.root)
await this.listNodeRelationsByRoot(this.root)
console.log('time after data pulled is', `${new Date().getTime() - this.time_start}ms`)
let matrix = new Matrix.Matrix(this.root, this.nodesMap, this.nodeRelationsMap)
matrix.childRecursive(0)
matrix.shift()
matrix.cleanSuffix()
this.nodeMatrix = matrix.dumpNode()
matrix.generateToc(this.root)
this.toc = matrix.toc
this.matrix = new Matrix.Matrix(this.root, this.nodesMap, this.nodeRelationsMap)
this.matrix.childRecursive(0)
this.matrix.shift()
this.matrix.cleanSuffix()
this.nodeMatrix = this.matrix.dumpNode()
this.matrix.generateToc(this.root)
this.toc = this.matrix.toc
},
async refreshWorld() {
this.plumbInstance.deleteEveryConnection()
Expand Down Expand Up @@ -324,9 +325,12 @@ export default {
this.$bvModal.show('node-common')
}
},
navi(id) {
anchor('card-' + id)
this.focus = id
navi(nodeId, navId, direction) {
if (direction === consts.directions.left) {
navId = this.matrix.caller(nodeId)
}
anchor('card-' + navId)
this.focus = navId
},
insert(id) {
this.baseNode = parseInt(id)
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/util/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,32 @@ class Matrix {
this.generateToc(nodeRelation.next)
}
}

/*
* return caller's id
* type1:
* caller -> callee
* type2:
* caller -> node1
* |
* ...
* |
* callee
*/
caller(id) {
let node = this.nodes[id]
if (id > 0) {
if (node.parent > 0) {
return node.parent
}
if (node.last > 0) {
return this.caller(node.last)
}
} else {
return undefined
}
return undefined
}
}

export default {
Expand Down

0 comments on commit 8b68b55

Please sign in to comment.