diff --git a/src/components/nodes/NodeDropDownMenu.vue b/src/components/nodes/NodeDropDownMenu.vue new file mode 100644 index 0000000..649f6b5 --- /dev/null +++ b/src/components/nodes/NodeDropDownMenu.vue @@ -0,0 +1,109 @@ + + + diff --git a/src/components/nodes/NodesList.vue b/src/components/nodes/NodesList.vue index f4d154f..2b7385b 100644 --- a/src/components/nodes/NodesList.vue +++ b/src/components/nodes/NodesList.vue @@ -40,61 +40,8 @@ - - - - - + + @@ -107,14 +54,14 @@ import NodeUtils from "../../js/NodeUtils.js"; import moment from "moment"; import NodeIcon from "./NodeIcon.vue"; import GlobalState from "../../js/GlobalState.js"; -import IconButton from "../IconButton.vue"; -import DropDownMenu from "../DropDownMenu.vue"; -import NodeAPI from "../../js/NodeAPI.js"; -import DropDownMenuItem from "../DropDownMenuItem.vue"; +import NodeDropDownMenu from "./NodeDropDownMenu.vue"; export default { name: 'NodesList', - components: {DropDownMenuItem, DropDownMenu, IconButton, NodeIcon}, + components: { + NodeDropDownMenu, + NodeIcon, + }, emits: [ "node-click", ], @@ -139,26 +86,6 @@ export default { formatUnixSecondsAgo(unixSeconds) { return moment.unix(unixSeconds).fromNow(); }, - onRequestNodeInfo(node) { - - // request node info - NodeAPI.requestNodeInfo(node.num); - - // show alert - alert("A request has been sent to the node to send its info back to us."); - - }, - async onDeleteNode(node) { - - // confirm user wants to remove this node - if(!confirm("Are you sure you want to forget this node?")){ - return; - } - - // remove node - await NodeAPI.removeNodeByNum(node.num); - - }, }, computed: { GlobalState() { diff --git a/src/components/pages/NodeMessagesPage.vue b/src/components/pages/NodeMessagesPage.vue index 4294714..57211c3 100644 --- a/src/components/pages/NodeMessagesPage.vue +++ b/src/components/pages/NodeMessagesPage.vue @@ -7,11 +7,7 @@ @@ -31,10 +27,12 @@ import NodeIcon from "../nodes/NodeIcon.vue"; import Page from "./Page.vue"; import IconButton from "../IconButton.vue"; import NodeUtils from "../../js/NodeUtils.js"; +import NodeDropDownMenu from "../nodes/NodeDropDownMenu.vue"; export default { name: 'NodeMessagesPage', components: { + NodeDropDownMenu, IconButton, Page, NodeIcon, @@ -57,13 +55,13 @@ export default { }, methods: { getNodeLongName: (nodeId) => NodeUtils.getNodeLongName(nodeId), - onNodeInfoClick(node) { + onNodeDeleted() { + + // go back to main page this.$router.push({ - name: "node", - params: { - nodeId: node.num, - }, + name: "main", }); + }, }, computed: { diff --git a/src/components/pages/NodePage.vue b/src/components/pages/NodePage.vue index 81d7bf7..9577967 100644 --- a/src/components/pages/NodePage.vue +++ b/src/components/pages/NodePage.vue @@ -7,16 +7,7 @@ @@ -99,14 +90,13 @@ import AppBar from "../AppBar.vue"; import NodeIcon from "../nodes/NodeIcon.vue"; import Page from "./Page.vue"; import NodeUtils from "../../js/NodeUtils.js"; -import IconButton from "../IconButton.vue"; -import NodeAPI from "../../js/NodeAPI.js"; import moment from "moment"; +import NodeDropDownMenu from "../nodes/NodeDropDownMenu.vue"; export default { name: 'NodePage', components: { - IconButton, + NodeDropDownMenu, Page, NodeIcon, AppBar, @@ -131,24 +121,13 @@ export default { getRoleName: (roleId) => NodeUtils.getRoleName(roleId), getHardwareName: (roleId) => NodeUtils.getHardwareName(roleId), latLongIntegerToLatLong: (latLongInteger) => NodeUtils.latLongIntegerToLatLong(latLongInteger), - async onDeleteNode(node) { - - // confirm user wants to remove this node - if(!confirm("Are you sure you want to forget this node?")){ - return; - } + onNodeDeleted() { // go back to main page this.$router.push({ name: "main", }); - // remove node - await NodeAPI.removeNodeByNum(node.num); - - }, - onRequestNodeInfo(node) { - NodeAPI.requestNodeInfo(node.num); }, }, computed: {