Sort controller attributes alphabetically (#928)
* Sort controller attributes alphabetically * Use TreeMap instead of streams to sort controller attributes Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>
This commit is contained in:
committed by
Stefan Behl
parent
4969bf3eb7
commit
835757e93a
@@ -8,18 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.targettable;
|
package org.eclipse.hawkbit.ui.management.targettable;
|
||||||
|
|
||||||
import com.vaadin.server.FontAwesome;
|
import java.net.URI;
|
||||||
import com.vaadin.shared.ui.label.ContentMode;
|
import java.util.Map;
|
||||||
import com.vaadin.ui.Button;
|
import java.util.Optional;
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
import java.util.TreeMap;
|
||||||
import com.vaadin.ui.Component;
|
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.TextField;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
@@ -44,9 +37,18 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
|||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
import java.net.URI;
|
import com.vaadin.server.FontAwesome;
|
||||||
import java.util.Map;
|
import com.vaadin.shared.ui.label.ContentMode;
|
||||||
import java.util.Optional;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
import com.vaadin.ui.Component;
|
||||||
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
|
import com.vaadin.ui.TextField;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
import com.vaadin.ui.Window;
|
||||||
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target details layout which is shown on the Deployment View.
|
* Target details layout which is shown on the Deployment View.
|
||||||
@@ -259,16 +261,19 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
|
|
||||||
private void updateAttributesLabelsList(final VerticalLayout attributesLayout,
|
private void updateAttributesLabelsList(final VerticalLayout attributesLayout,
|
||||||
final Map<String, String> attributes) {
|
final Map<String, String> attributes) {
|
||||||
for (final Map.Entry<String, String> entry : attributes.entrySet()) {
|
final TreeMap<String, String> sortedAttributes = new TreeMap<>((key1, key2) -> key1.compareToIgnoreCase(key2));
|
||||||
final Label conAttributeLabel = SPUIComponentProvider.createNameValueLabel(entry.getKey().concat(" : "),
|
sortedAttributes.putAll(attributes);
|
||||||
entry.getValue() == null ? "" : entry.getValue());
|
sortedAttributes.forEach((key, value) -> {
|
||||||
conAttributeLabel.setDescription(entry.getKey().concat(" : ") + entry.getValue());
|
final Label conAttributeLabel = SPUIComponentProvider.createNameValueLabel(key.concat(" : "),
|
||||||
|
value == null ? "" : value);
|
||||||
|
conAttributeLabel.setDescription(key.concat(" : ") + value);
|
||||||
conAttributeLabel.addStyleName("label-style");
|
conAttributeLabel.addStyleName("label-style");
|
||||||
attributesLayout.addComponent(conAttributeLabel);
|
attributesLayout.addComponent(conAttributeLabel);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAttributesUpdateComponents(final HorizontalLayout attributesRequestLayout, final VerticalLayout attributesLayout, final String controllerId) {
|
private void updateAttributesUpdateComponents(final HorizontalLayout attributesRequestLayout,
|
||||||
|
final VerticalLayout attributesLayout, final String controllerId) {
|
||||||
final boolean isRequestAttributes = targetManagement.isControllerAttributesRequested(controllerId);
|
final boolean isRequestAttributes = targetManagement.isControllerAttributesRequested(controllerId);
|
||||||
|
|
||||||
if (isRequestAttributes) {
|
if (isRequestAttributes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user