From 49662e98c28c7d38937edbc43971b3f97f509378 Mon Sep 17 00:00:00 2001 From: NickolaiYurchenko Date: Wed, 2 Jun 2021 19:46:39 +0300 Subject: [PATCH] web/multinode: node selection component added node selection dropdown component, fixed minor bugs, bandwidth route added Change-Id: I87fd1bf6c6a59d895b14524ab7c0fa5d80955cd5 --- .../src/app/components/common/NodeOptions.vue | 14 ++-- .../common/NodeSelectionDropdown.vue | 42 +++++++++++ .../common/SatelliteSelectionDropdown.vue | 3 +- .../src/app/components/common/VDropdown.vue | 4 +- .../src/app/components/common/VModal.vue | 11 ++- .../src/app/components/modals/DeleteNode.vue | 6 +- .../src/app/components/modals/UpdateName.vue | 7 +- .../components/navigation/NavigationArea.vue | 2 +- web/multinode/src/app/router/index.ts | 3 + web/multinode/src/app/store/nodes.ts | 23 ++++++ .../src/app/views/bandwidth/BandwidthPage.vue | 72 +++++++++++++++++++ web/multinode/tests/unit/store/nodes.spec.ts | 16 +++++ 12 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 web/multinode/src/app/components/common/NodeSelectionDropdown.vue create mode 100644 web/multinode/src/app/views/bandwidth/BandwidthPage.vue diff --git a/web/multinode/src/app/components/common/NodeOptions.vue b/web/multinode/src/app/components/common/NodeOptions.vue index 3dfb8426c..38f44cfe3 100644 --- a/web/multinode/src/app/components/common/NodeOptions.vue +++ b/web/multinode/src/app/components/common/NodeOptions.vue @@ -2,12 +2,12 @@ // See LICENSE for copying information. @@ -33,8 +33,8 @@ export default class NodeOptions extends Vue { public areOptionsShown: boolean = false; - public toggleOptions(): void { - this.areOptionsShown = !this.areOptionsShown; + public openOptions(): void { + this.areOptionsShown = true; } public closeOptions(): void { @@ -75,8 +75,8 @@ export default class NodeOptions extends Vue { .options { position: absolute; - top: 16px; - right: 55px; + top: 0; + right: 45px; width: 140px; height: auto; background: white; diff --git a/web/multinode/src/app/components/common/NodeSelectionDropdown.vue b/web/multinode/src/app/components/common/NodeSelectionDropdown.vue new file mode 100644 index 000000000..ed473c487 --- /dev/null +++ b/web/multinode/src/app/components/common/NodeSelectionDropdown.vue @@ -0,0 +1,42 @@ +// Copyright (C) 2021 Storj Labs, Inc. +// See LICENSE for copying information. + + + + diff --git a/web/multinode/src/app/components/common/SatelliteSelectionDropdown.vue b/web/multinode/src/app/components/common/SatelliteSelectionDropdown.vue index 94714056a..b865b1eed 100644 --- a/web/multinode/src/app/components/common/SatelliteSelectionDropdown.vue +++ b/web/multinode/src/app/components/common/SatelliteSelectionDropdown.vue @@ -9,12 +9,11 @@ import { Component, Vue } from 'vue-property-decorator'; import VDropdown, { Option } from '@/app/components/common/VDropdown.vue'; -import NodesTable from '@/app/components/myNodes/tables/NodesTable.vue'; import { NodeURL } from '@/nodes'; @Component({ - components: { VDropdown, NodesTable }, + components: { VDropdown }, }) export default class SatelliteSelectionDropdown extends Vue { /** diff --git a/web/multinode/src/app/components/common/VDropdown.vue b/web/multinode/src/app/components/common/VDropdown.vue index 83f9e24dd..6805e84e4 100644 --- a/web/multinode/src/app/components/common/VDropdown.vue +++ b/web/multinode/src/app/components/common/VDropdown.vue @@ -108,7 +108,7 @@ export default class VDropdown extends Vue { position: absolute; top: 52px; left: 0; - width: 300px; + width: 100%; border: 1px solid var(--c-gray--light); border-radius: 6px; overflow: hidden; @@ -130,6 +130,7 @@ export default class VDropdown extends Vue { width: 100% !important; cursor: pointer; border-bottom: 1px solid var(--c-gray--light); + box-sizing: border-box; &:hover { background: var(--c-background); @@ -142,6 +143,7 @@ export default class VDropdown extends Vue { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + margin-right: 5px; } ::-webkit-scrollbar { diff --git a/web/multinode/src/app/components/common/VModal.vue b/web/multinode/src/app/components/common/VModal.vue index 780034a21..1373edf80 100644 --- a/web/multinode/src/app/components/common/VModal.vue +++ b/web/multinode/src/app/components/common/VModal.vue @@ -2,10 +2,7 @@ // See LICENSE for copying information. + + diff --git a/web/multinode/tests/unit/store/nodes.spec.ts b/web/multinode/tests/unit/store/nodes.spec.ts index 6d749105e..bdeb71526 100644 --- a/web/multinode/tests/unit/store/nodes.spec.ts +++ b/web/multinode/tests/unit/store/nodes.spec.ts @@ -38,6 +38,14 @@ describe('mutations', () => { expect(state.nodes.selectedSatellite.address).toBe(satellite.address); }); + + it('saves selected node', () => { + expect(state.nodes.selectedNode).toBe(null); + + store.commit('nodes/setSelectedNode', node.id); + + expect(state.nodes.selectedNode.id).toBe(node.id); + }); }); describe('actions', () => { @@ -173,4 +181,12 @@ describe('actions', () => { expect(state.nodes.selectedSatellite.address).toBe(satellite.address); expect(state.nodes.nodes.length).toBe(1); }); + + it('success set selected node', async () => { + store.commit('nodes/populate', nodes); + + await store.dispatch('nodes/selectNode', node.id); + + expect(state.nodes.selectedNode.id).toBe(node.id); + }); });