From 34ca13eb5f9df226417660483658e8f9946f35af Mon Sep 17 00:00:00 2001 From: SimoneFiorani Date: Mon, 16 Dec 2024 17:04:12 +0100 Subject: [PATCH] feat: refactored both popups Signed-off-by: SimoneFiorani --- .../ui/settings/SnapshotDownloadModal.java | 17 ++++++++--------- .../ui/settings/SnapshotDownloadModal.ui.xml | 4 ++-- .../web/client/messages/Messages.properties | 7 ++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.java index ba8dd8a681..8f9dbd013a 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.java @@ -43,15 +43,14 @@ public class SnapshotDownloadModal extends Composite { private static SnapshotDownloadModalUiBinder uiBinder = GWT.create(SnapshotDownloadModalUiBinder.class); private static final Messages MSGS = GWT.create(Messages.class); - private static final String SELECT_ALL_PIDS_SELECTION = "Select All Pids"; - private static final String REMOVE_ALL_PIDS_SELECTION = "Remove All Pids"; - interface SnapshotDownloadModalUiBinder extends UiBinder { } @UiField Paragraph downloadModalDescription; @UiField + Paragraph formatModalHint; + @UiField ScrollPanel pidSelectionScrollPanel; @UiField Anchor selectOrRemoveAllAnchor; @@ -80,7 +79,6 @@ public SnapshotDownloadModal() { this.pidSelectionScrollPanel.setVisible(false); this.selectOrRemoveAllAnchor.setVisible(false); this.noPidSelectedError.setVisible(false); - this.noPidSelectedError.setText("Please select at least one pid from the list"); this.cancelButton.addClickHandler(this::onCancelClick); @@ -89,6 +87,7 @@ public SnapshotDownloadModal() { public void show(Consumer consumer) { this.snapshotDownloadConsumer = consumer; this.modal.setTitle(MSGS.deviceWiregraphDownloadModalTitle()); + this.downloadModalDescription.setText(MSGS.deviceWiregraphDownloadModalHint()); initWiregraphDownloadButtons(); this.modal.show(); } @@ -127,7 +126,7 @@ private void initSnapshotSelectAllAnchor() { this.anchorClickHandler.removeHandler(); } this.areAllPidsSelected = true; - this.selectOrRemoveAllAnchor.setText(REMOVE_ALL_PIDS_SELECTION); + this.selectOrRemoveAllAnchor.setText(MSGS.removeAllAnchorText()); this.anchorClickHandler = this.selectOrRemoveAllAnchor.addClickHandler(this::selectOrRemoveAllSelection); this.selectOrRemoveAllAnchor.setVisible(true); } @@ -204,8 +203,8 @@ private Optional> getSelectedPids() { List selectedPids = new ArrayList<>(); this.pidPanel.iterator().forEachRemaining(pid -> { CheckBox checkBox = (CheckBox) pid; - if (checkBox.getValue().booleanValue() && !checkBox.getText().equals(SELECT_ALL_PIDS_SELECTION) - && !checkBox.getText().equals(REMOVE_ALL_PIDS_SELECTION)) { + if (checkBox.getValue().booleanValue() && !checkBox.getText().equals(MSGS.selectAllAnchorText()) + && !checkBox.getText().equals(MSGS.removeAllAnchorText())) { selectedPids.add(checkBox.getText()); } }); @@ -247,9 +246,9 @@ private void checkAllPidsSelected() { private void updateSelectOrRemoveAllText() { if (this.areAllPidsSelected) { - this.selectOrRemoveAllAnchor.setText(REMOVE_ALL_PIDS_SELECTION); + this.selectOrRemoveAllAnchor.setText(MSGS.removeAllAnchorText()); } else { - this.selectOrRemoveAllAnchor.setText(SELECT_ALL_PIDS_SELECTION); + this.selectOrRemoveAllAnchor.setText(MSGS.selectAllAnchorText()); } } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.ui.xml b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.ui.xml index e1e1a21347..32fbabf909 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.ui.xml +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SnapshotDownloadModal.ui.xml @@ -37,15 +37,15 @@ + - + - diff --git a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/client/messages/Messages.properties b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/client/messages/Messages.properties index 7efef07770..d7e6b88212 100644 --- a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/client/messages/Messages.properties +++ b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/client/messages/Messages.properties @@ -309,9 +309,14 @@ deviceSnapshotsNone=No Snapshots Available deviceSnapshotRollbackConfirm=Are you sure you want to rollback to a previous configuration? During the rollback operation, the device will disconnect and reconnect. If a timeout is encountered during the reload of the device configuration, please refresh it manually. deviceSnapshotDownloadModalTitle=Snapshot download deviceWiregraphDownloadModalTitle=Wiregraph snapshot download -deviceSnapshotDownloadModalHint=Select pids of the service configurations that will be included in the downloaded snapshot. +deviceSnapshotDownloadModalHint=Select the PIDs for the service configurations that will be downloaded locally. +deviceWiregraphDownloadModalHint=Download partial snapshot containing the configuration of the current wiregraph. +formatDownloadHint=The configurations can be exported either as JSON or XML format. downloadSnapshotXmlButton=Download as XML downloadSnapshotJsonButton=Download as JSON +downloadSnapshotError=Please select at least one pid from the list +selectAllAnchorText=Select All Pids +removeAllAnchorText=Remove All Pids netIntro=Select a Network Interface and configure it. DHCP Server and NAT can be configured only for interfaces enabled for LAN usage. When applying your changes, your connection to the gateway may be lost depending on your network configuration changes. netInterfaceName=Interface Name