Skip to content

Commit

Permalink
improve topo edit toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyangXYZ committed Dec 31, 2023
1 parent 8e01e05 commit 120faf2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
26 changes: 21 additions & 5 deletions src/components/TopoEditToolbox.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Network, SignalUpdateTopology } from '@/hooks/useStates'
import { Plus, Switch } from '@element-plus/icons-vue'
import { Network, SignalEditTopology, SignalUpdateTopology } from '@/hooks/useStates'
import { Check, Plus, Switch } from '@element-plus/icons-vue'
const nodeType = ref(0)
// must follow NODE_TYPE enum defined in '@/core/typedefs'
Expand Down Expand Up @@ -33,16 +33,24 @@ const connect = () => {
Network.ConstructTopology()
SignalUpdateTopology.value++
}
const finishEdit = () => {
Network.StartWebWorkers()
SignalEditTopology.value = !SignalEditTopology.value
}
</script>

<template>
<el-card class="card">
<el-row :gutter="30">
<el-col>Load preset topology:</el-col>
</el-row>
<el-row :gutter="30">
<el-col>
Add a
<el-select class="select" v-model="nodeType" placeholder="Select">
<el-select size="20px" v-model="nodeType">
<el-option-group v-for="group in nodeTypes" :key="group.label" :label="group.label">
<el-option
class="item"
v-for="item in group.types"
:key="item.value"
:label="item.label"
Expand All @@ -54,10 +62,15 @@ const connect = () => {
</el-col>
</el-row>
<el-row :gutter="30">
<el-col>Connect<el-button size="small" @click="connect" type="success" :icon="Switch" circle /></el-col>
<el-col>
Connect<el-button size="small" @click="connect" type="info" :icon="Switch" circle />
</el-col>
</el-row>

<el-row :gutter="30">
<el-col>Load preset topology:</el-col>
<el-col>
Finish<el-button size="small" @click="finishEdit" type="danger" :icon="Check" circle />
</el-col>
</el-row>
</el-card>
</template>
Expand All @@ -68,6 +81,9 @@ const connect = () => {
height: 120px;
/* background-color:white; */
/* width: 380px; */
font-size: 0.87rem;
}
.item {
font-size: 0.82rem;
}
</style>
4 changes: 1 addition & 3 deletions src/core/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ export class NetworkHub {
this.AddLink(n.id, nn)
})
}
this.StartWorkers()
}

StartWorkers() {
StartWebWorkers() {
for (const n of this.Nodes.value) {
if (n.id == 0) continue
if (n.w != undefined) {
Expand Down Expand Up @@ -186,7 +185,6 @@ export class NetworkHub {
}

Run = () => {
// this.StartWorkers()
this.Step()
this.Running.value = true
this.asnTimer = setInterval(() => {
Expand Down

0 comments on commit 120faf2

Please sign in to comment.