Skip to content

Commit

Permalink
feat(reachable-nodes): add screen for reachable/unreachable nodes
Browse files Browse the repository at this point in the history
And complete translations
  • Loading branch information
germanferrero committed Apr 22, 2021
1 parent ee9f341 commit d483240
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 379 deletions.
16 changes: 7 additions & 9 deletions i18n/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
"confirm_6556b3a6": "Confirm",
"confirm_location_2fe5ae11": "confirm location",
"congratulations_ffe43bf9": "Congratulations",
"connected_howmany_228826ea": "Connected (%{howMany})",
"connected_nodes_4b7e6f49": "Connected Nodes",
"count_days_de0c6a32": {
"one": "1 days",
"other": "%{count} days"
Expand Down Expand Up @@ -61,8 +59,6 @@
"delete_a6efa79d": "Delete",
"delete_nodes_f63ec0d5": "Delete Nodes",
"device_95d26d94": "Device",
"disconnected_howmany_10fc7bd5": "Disconnected (%{howMany})",
"disconnected_nodes_88f80d1e": "Disconnected Nodes",
"don_t_show_this_message_again_9950c20": "Don't show this message again",
"download_c7ffdfb9": "Download",
"downloading_1e41f805": "Downloading",
Expand All @@ -75,15 +71,13 @@
"full_path_metrics_2859608f": "Full path metrics",
"go_64ecd1fd": "Go!",
"go_to_community_view_d12b8d67": "Go to Community View",
"go_to_delete_nodes_1203128b": "Go to Delete Nodes",
"go_to_node_view_26ba929d": "Go to Node View",
"ground_routing_12ab04c9": "Ground Routing",
"ground_routing_configuration_3f4fa9c1": "Ground Routing configuration",
"hide_community_773b3f33": "hide community",
"hide_console_9bbb309e": "Hide Console",
"host_name_d865cef3": "Host name",
"i_don_t_know_the_shared_password_336b198": "I don't know the shared password",
"if_some_of_these_nodes_no_longer_belong_to_the_net_a75d316f": "If some of these nodes no longer belong to the network you can delete them from Delete Nodes.",
"interface_177dac54": "Interface",
"internet_connection_fda60ffa": "Internet connection",
"ip_addresses_440ac240": "IP Addresses",
Expand Down Expand Up @@ -129,10 +123,11 @@
"radio_2573b256": "Radio",
"re_enter_password_49757ed": "Re-enter Password",
"re_enter_the_shared_password_20f09406": "Re-enter the shared password",
"reachable_howmany_6f891e31": "Reachable (%{howMany})",
"reachable_nodes_748c93f0": "Reachable Nodes",
"reload_3e45154f": "Reload",
"reload_page_2d381199": "Reload page",
"remote_support_9ba7a3a7": "Remote Support",
"remove_nodes_2dd26e14": "Remove Nodes",
"rescan_dff042fc": "Rescan",
"retry_ebd5f8ba": "Retry",
"revert_702e7694": "Revert",
Expand Down Expand Up @@ -175,17 +170,20 @@
"there_s_an_active_remote_support_session_4a40a8bb": "There's an active remote support session",
"there_s_no_open_session_for_remote_support_click_a_efd0d415": "There's no open session for remote support. Click at Create Session to begin one",
"these_are_the_nodes_associated_on_this_radio_3d302167": "These are the nodes associated on this radio",
"these_are_the_nodes_with_which_you_do_not_have_con_ef5cc209": "These are the nodes with which you do not have connectivity, it is possible that they are not turned on or a link to reach them is down.",
"these_are_the_nodes_with_which_you_have_connectivi_ef11819b": "These are the nodes with which you have connectivity, i.e. there is a working path from your node to each of them.",
"these_are_the_nodes_that_can_be_reached_from_your__4c524abe": "These are the nodes that can be reached from your node, i.e. there is a working path from your node to each of them.",
"these_are_the_nodes_that_can_t_be_reached_from_you_dbbf9032": "These are the nodes that can't be reached from your node, it is possible that they are not turned on or a link to reach them is down.",
"this_device_does_not_support_secure_rollback_to_pr_1c167a2c": "This device does not support secure rollback to previous version if something goes wrong",
"this_device_supports_secure_rollback_to_previous_v_a60ddbcb": "This device supports secure rollback to previous version if something goes wrong",
"this_information_is_synced_periodically_and_can_be_8b74cb8c": "This information is synced periodically and can be outdated by some minutes",
"this_node_is_the_gateway_1e20aaff": "This node is the gateway",
"this_radio_is_not_associated_with_other_nodes_6722a471": "This radio is not associated with other nodes",
"to_internet_494eb85c": "To Internet",
"to_keep_the_current_configuration_or_ab76f6d1": "to keep the current configuration. Or ...",
"to_the_previous_configuration_bf087867": "to the previous configuration",
"traffic_bfe536d2": "Traffic",
"try_reloading_the_app_4e4c3a66": "Try reloading the app",
"unreachable_howmany_e5c8f844": "Unreachable (%{howMany})",
"unreachable_nodes_e6785f10": "Unreachable Nodes",
"upgrade_5de364f8": "Upgrade",
"upgrade_now_f300d697": "Upgrade Now",
"upgrade_to_lastest_firmware_version_9b159910": "Upgrade to lastest firmware version",
Expand Down
22 changes: 10 additions & 12 deletions i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,22 @@
"visit_864b4060": "Visitar",
"go_to_node_view_26ba929d": "Ir a Vista de Nodo",
"network_nodes_4368eb67": "Nodos de la Red",
"connected_howmany_228826ea": "Conectados (%{howMany})",
"connected_nodes_4b7e6f49": "Nodos Conectados",
"delete_a6efa79d": "Eliminar",
"delete_nodes_f63ec0d5": "Eliminar Nodos",
"disconnected_howmany_10fc7bd5": "Desconectados (%{howMany})",
"disconnected_nodes_88f80d1e": "Nodos Desconectados",
"delete_nodes_f63ec0d5": "Baja de Nodos",
"go_to_community_view_d12b8d67": "Ir a Vista de Comunidad",
"go_to_delete_nodes_1203128b": "Ir a Eliminar Nodos",
"count_selected_nodes_19bbd632": {
"one": "nodo seleccionado",
"other": "nodos seleccionados"
},
"successfully_deleted_23ce0a20": "Eliminado/s correctamente",
"these_are_the_nodes_with_which_you_do_not_have_con_ef5cc209": "Son los nodos con los que no tienes conectividad, es posible que no estén encendidos o que algún enlace para llegar a ellos esté caído.",
"these_are_the_nodes_with_which_you_have_connectivi_ef11819b": "Son los nodos con los que tienes conectividad, es decir que hay un camino funcionando entre tu nodo y cada uno de ellos.",
"if_some_of_these_nodes_no_longer_belong_to_the_net_a75d316f": "Si alguno de estos nodos no pertence más a la red puedes eliminarlo desde Eliminar Nodos.",
"remove_nodes_2dd26e14": "Baja de Nodos",
"select_the_nodes_which_no_longer_belong_to_the_net_92f853ef": "Selecciona los nodos que ya no pertenecen a la red y elimínalos de la lista de nodos inalcanzables",
"there_are_no_left_unreachable_nodes_c0bec63d": "No hay nodos inalcanzables"
"select_the_nodes_which_no_longer_belong_to_the_net_92f853ef": "Selecciona los nodos que ya no pertenecen a la red y elimínalos de la lista de nodos no alcanzables",
"there_are_no_left_unreachable_nodes_c0bec63d": "No hay nodos inalcanzables",
"reachable_howmany_6f891e31": "Alcanzables (%{howMany})",
"reachable_nodes_748c93f0": "Nodos Alcanzables",
"these_are_the_nodes_that_can_be_reached_from_your__4c524abe": "Son los nodos con los que no tienes conectividad, es posible que no estén encendidos o que algún enlace para llegar a ellos esté caído.",
"these_are_the_nodes_that_can_t_be_reached_from_you_dbbf9032": "Son los nodos con los que tienes conectividad, es decir que hay un camino funcionando entre tu nodo y cada uno de ellos.",
"this_information_is_synced_periodically_and_can_be_8b74cb8c": "Esta información se sincroniza periódicamente, puede estar desactualizada algunos minutos.",
"unreachable_howmany_e5c8f844": "No Alcanzables (%{howMany})",
"unreachable_nodes_e6785f10": "Nodos No Alcanzables"
}

2 changes: 1 addition & 1 deletion plugins/lime-plugin-delete-nodes/src/deleteNodesMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { h } from 'preact';
import I18n from 'i18n-js';

const Menu = () => (
<a href={'#/deletenodes'}>{I18n.t('Remove Nodes')}</a>
<a href={'#/deletenodes'}>{I18n.t('Delete Nodes')}</a>
);

export default Menu;
10 changes: 3 additions & 7 deletions plugins/lime-plugin-reachable-nodes/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import Page from './src/networkNodesPage';
import { NetworkNodesMenu } from './src/networkNodesMenu';
import DeleteNodesPage from './src/containers/deleteNodesPage';
import Page from './src/reachableNodesPage';
import { ReachableNodesMenu } from './src/reachableNodesMenu';

export default {
name: 'NetworkNodes',
page: Page,
menu: NetworkNodesMenu,
menu: ReachableNodesMenu,
menuView: 'community',
additionalProtectedRoutes: [
['delete-nodes', DeleteNodesPage]
]
};
134 changes: 0 additions & 134 deletions plugins/lime-plugin-reachable-nodes/networkNodes.spec.js

This file was deleted.

34 changes: 0 additions & 34 deletions plugins/lime-plugin-reachable-nodes/networkNodes.stories.js

This file was deleted.

68 changes: 68 additions & 0 deletions plugins/lime-plugin-reachable-nodes/reachableNodes.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { h } from 'preact';
import { fireEvent, act, screen } from '@testing-library/preact';
import '@testing-library/jest-dom';

import ReachableNodesPage from './src/reachableNodesPage';
import queryCache from 'utils/queryCache';
import { getNodes, markNodesAsGone } from 'plugins/lime-plugin-network-nodes/src/networkNodesApi';
import { render } from 'utils/test_utils';

jest.mock('plugins/lime-plugin-network-nodes/src/networkNodesApi');

beforeEach(() => {
getNodes.mockImplementation(async () => [
{ hostname: 'node1', status: 'recently_reachable' },
{ hostname: 'node2', status: 'recently_reachable' },
{ hostname: 'node3', status: 'recently_reachable' },
{ hostname: 'node4', status: 'unreachable' },
{ hostname: 'node5', status: 'unreachable' },
{ hostname: 'node6', status: 'unreachable' },
{ hostname: 'node7', status: 'unreachable' },
{ hostname: 'node8', status: 'gone' },
{ hostname: 'node9', status: 'gone' },
]);
markNodesAsGone.mockImplementation(async () => []);
});

afterEach(() => {
act(() => queryCache.clear());
});

describe('network nodes screen', () => {
it('shows one tab for reachable nodes and one for unreachable nodes with length', async () => {
render(<ReachableNodesPage />);
expect(await screen.findByRole('tab', { name: /^reachable \(3\)/i })).toBeVisible();
expect(await screen.findByRole('tab', { name: /^unreachable \(4\)/i })).toBeVisible();
})

it('shows one row with the hostname for each connect node', async () => {
render(<ReachableNodesPage />);
expect(await screen.findByText('node1')).toBeVisible();
expect(await screen.findByText('node2')).toBeVisible();
expect(await screen.findByText('node3')).toBeVisible();
})

it('shows one row with the hostname for each disconnect node', async () => {
render(<ReachableNodesPage />);
const tabDisconnected = await screen.findByRole('tab', { name: /^unreachable \(4\)/i });
fireEvent.click(tabDisconnected);
expect(await screen.findByText('node4')).toBeVisible();
expect(await screen.findByText('node5')).toBeVisible();
expect(await screen.findByText('node6')).toBeVisible();
expect(await screen.findByText('node7')).toBeVisible();
})

it('shows help message when clicking on help button', async () => {
render(<ReachableNodesPage />);
const helpButton = await screen.findByLabelText('help');
fireEvent.click(helpButton);
expect(await screen.findByText("Reachable Nodes")).toBeVisible();
expect(await screen.findByText("These are the nodes that can be reached from your node, " +
"i.e. there is a working path from your node to each of them." +
"This information is synced periodically " +
"and can be outdated by some minutes")).toBeVisible();
expect(await screen.findByText("Unreachable Nodes")).toBeVisible();
expect(await screen.findByText("These are the nodes that can't be reached from your node, " +
"it is possible that they are not turned on or a link to reach them is down.")).toBeVisible();
})
});
Loading

0 comments on commit d483240

Please sign in to comment.