Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR-330 add switch to topology layers #1646

Merged
merged 31 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d3c95fa
Merge main to story-geomap (#1592)
oskovran Jul 30, 2024
2ecf6f0
Fr 323 react1820 geomap devices inventory (#1598)
oskovran Aug 7, 2024
b751909
FR-203 (react 18.2.0) topology map layer (#1599)
oskovran Aug 7, 2024
ca12b01
Fr 201 add device location (#1600)
plehocky Aug 8, 2024
fd8578e
Fd 684 change location on edit device page (#1601)
plehocky Aug 12, 2024
e9dba63
FR-311 mpls device details (#1602)
soson Aug 12, 2024
2f9b684
Fr 325 list of locations (#1603)
oskovran Aug 14, 2024
ca444a4
Fd 685 leaflet icon crash (#1604)
oskovran Aug 15, 2024
ef9f9da
Fr 329 integration into topology layers - PART-1 (#1606)
plehocky Aug 19, 2024
b09e940
FR-310 lsp count (#1605)
soson Aug 19, 2024
bf31726
Fd 690 edit location refactor (#1608)
oskovran Aug 21, 2024
4a639c1
FR 329 integration into topology layers part2 (#1611)
plehocky Aug 21, 2024
45134d6
FR-317 mpls topology version (#1609)
soson Aug 21, 2024
dd9b978
FR-328 topology map layer filter by name (#1607)
oskovran Aug 22, 2024
caa9d93
Fr 327 show overlay topology (#1613)
plehocky Sep 2, 2024
17b3606
Fr 312 lsp path (#1614)
soson Sep 2, 2024
78e7eb8
encode key=value pairs in uniconfig urls (#1616)
soson Sep 6, 2024
8127a03
finished map topology and adjusted last issues (#1617)
plehocky Sep 9, 2024
1bb1007
Merge branch 'main' into story-geomap
soson Sep 9, 2024
aecd2c3
setup for switching to different topologies
plehocky Sep 12, 2024
eea38e6
setup
plehocky Sep 13, 2024
0dce148
finished switch to layer functionality
plehocky Sep 26, 2024
6046632
css adjustments
plehocky Sep 26, 2024
a45bd6d
resolved merge conflicts
plehocky Sep 26, 2024
40a3ff1
Merge branch 'main' into FR330-add-switch-to-topology-layers
plehocky Sep 26, 2024
e31bef7
Merge branch 'main' into FR330-add-switch-to-topology-layers
plehocky Sep 27, 2024
604c30a
Merge branch 'main' into FR330-add-switch-to-topology-layers
plehocky Sep 30, 2024
18a11b3
Merge branch 'main' into FR330-add-switch-to-topology-layers
plehocky Oct 4, 2024
5f63db5
resolved conflicts
plehocky Oct 9, 2024
3c2685d
Merge branch 'main' into FR330-add-switch-to-topology-layers
plehocky Oct 9, 2024
c668570
fixed conflicts
plehocky Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/frinx-device-topology/src/__generated__/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,40 +1,61 @@
import { FormControl, FormLabel, Select } from '@chakra-ui/react';
import { Button, Flex, FormControl, FormLabel, Select } from '@chakra-ui/react';
import React, { VoidFunctionComponent } from 'react';
import { MapTopologyType, setMapTopologyType } from '../../state.actions';
import { MapTopologyType, setMapTopologyType, setTopologyLayer } from '../../state.actions';
import { useStateContext } from '../../state.provider';
import { TopologyLayer } from '../../state.reducer';

type Layer = {
name: string;
value: 'PHYSICAL_TOPOLOGY' | 'PTP_TOPOLOGY' | 'ETH_TOPOLOGY' | 'NETWORK_TOPOLOGY' | 'MPLS_TOPOLOGY';
layer: TopologyLayer;
};

export const topologyLayers: Layer[] = [
{ name: 'Physical Topology', value: 'PHYSICAL_TOPOLOGY', layer: 'LLDP' },
{ name: 'Ptp Topology', value: 'PTP_TOPOLOGY', layer: 'PTP' },
{ name: 'Eth Topology', value: 'ETH_TOPOLOGY', layer: 'Synchronous Ethernet' },
{ name: 'Mpls Topology', value: 'MPLS_TOPOLOGY', layer: 'MPLS' },
];

const TopologyTypeSelect: VoidFunctionComponent = () => {
const { state, dispatch } = useStateContext();
const { mapTopologyType } = state;

const topologyLayers = [
{ name: 'Physical Topology', value: 'PHYSICAL_TOPOLOGY' },
{ name: 'Ptp Topology', value: 'PTP_TOPOLOGY' },
{ name: 'Eth Topology', value: 'ETH_TOPOLOGY' },
{ name: 'Mpls Topology', value: 'MPLS_TOPOLOGY' },
];

const handleTopologyTypeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const value = e.target.value as MapTopologyType;
dispatch(setMapTopologyType(value));
};

const handleSwitchLayer = () => {
const layer = topologyLayers.find((l) => l.value === mapTopologyType);
if (mapTopologyType && layer) {
dispatch(setTopologyLayer(layer.layer));
dispatch(setMapTopologyType(null));
}
};

return (
<FormControl width="sm" paddingBottom="24px">
<FormControl paddingBottom="24px">
<FormLabel marginBottom={4}>Select topology type:</FormLabel>
<Select
data-cy="select-topology-type"
placeholder="Select topology type"
background="white"
onChange={handleTopologyTypeChange}
value={mapTopologyType || ''}
>
{topologyLayers.map((layer) => (
<option key={layer.value} value={layer.value}>
{layer.name}
</option>
))}
</Select>
<Flex gap={2}>
<Select
width="300px"
data-cy="select-topology-type"
placeholder="Select topology type"
background="white"
onChange={handleTopologyTypeChange}
value={mapTopologyType || ''}
>
{topologyLayers.map((layer) => (
<option key={layer.value} value={layer.value}>
{layer.name}
</option>
))}
</Select>
<Button isDisabled={!mapTopologyType} onClick={handleSwitchLayer} colorScheme="blue">
Switch layer
</Button>
</Flex>
</FormControl>
);
};
Expand Down
Loading