Merge pull request #142 from bsinno/Rollout_Management_issues_refactor
Rollout management issues refactor
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
package org.eclipse.hawkbit.ui.customrenderers.client;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
|
||||||
|
|
||||||
import com.vaadin.client.connectors.ButtonRendererConnector;
|
|
||||||
import com.vaadin.shared.ui.Connect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* A connector for {@link LinkRenderer}.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer.class)
|
|
||||||
public class LinkRendererConnector extends ButtonRendererConnector {
|
|
||||||
private static final long serialVersionUID = 7987417436367399331L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer getRenderer() {
|
|
||||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer) super.getRenderer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
|
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||||
|
import com.vaadin.client.connectors.ClickableRendererConnector;
|
||||||
|
import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
|
||||||
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
|
import elemental.json.JsonObject;
|
||||||
|
/**
|
||||||
|
* A connector for {@link CustomObjectRenderer }.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer.class)
|
||||||
|
public class RolloutRendererConnector extends ClickableRendererConnector<RolloutRendererData> {
|
||||||
|
private static final long serialVersionUID = 7734682321931830566L;
|
||||||
|
|
||||||
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer getRenderer() {
|
||||||
|
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer) super.getRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected HandlerRegistration addClickHandler(
|
||||||
|
RendererClickHandler<JsonObject> handler) {
|
||||||
|
return getRenderer().addClickHandler(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.Button;
|
|
||||||
import com.vaadin.client.renderers.ButtonRenderer;
|
|
||||||
import com.vaadin.client.ui.VButton;
|
|
||||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Renders link with provided text.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LinkRenderer extends ButtonRenderer {
|
|
||||||
@Override
|
|
||||||
public void render(RendererCellReference cell, String text, Button button) {
|
|
||||||
button.setText(text);
|
|
||||||
applystyle(button);
|
|
||||||
// this is to allow the button to disappear, if the text is null
|
|
||||||
button.setVisible(text != null);
|
|
||||||
button.getElement().setId(new StringBuilder("link").append(".").append(text).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applystyle(Button button) {
|
|
||||||
button.setStyleName(VButton.CLASSNAME);
|
|
||||||
button.addStyleName(getStyle("borderless"));
|
|
||||||
button.addStyleName(getStyle("small"));
|
|
||||||
button.addStyleName(getStyle("on-focus-no-border"));
|
|
||||||
button.addStyleName(getStyle("link"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStyle(final String style) {
|
|
||||||
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.vaadin.client.renderers.ClickableRenderer;
|
||||||
|
import com.vaadin.client.ui.VButton;
|
||||||
|
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders button with provided CustomObject.
|
||||||
|
* Used to display button with link.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData, VButton> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VButton createWidget() {
|
||||||
|
VButton b = GWT.create(VButton.class);
|
||||||
|
b.addClickHandler(this);
|
||||||
|
b.setStylePrimaryName("v-nativebutton");
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RendererCellReference cell, RolloutRendererData text, VButton button) {
|
||||||
|
final String creating = "CREATING";
|
||||||
|
button.setText(text.getName());
|
||||||
|
applystyle(button);
|
||||||
|
// this is to allow the button to disappear, if the text is null
|
||||||
|
button.setVisible(text.getName() != null);
|
||||||
|
button.getElement().setId(new StringBuilder("link").append(".").append(text.getName()).toString());
|
||||||
|
/*
|
||||||
|
* checking Rollout Status for applying button style. If Rollout status
|
||||||
|
* is not "CREATING", then the Rollout button is applying hyperlink
|
||||||
|
* style
|
||||||
|
*/
|
||||||
|
final boolean isStatusCreate = text.getStatus() != null && creating.equalsIgnoreCase(text.getStatus());
|
||||||
|
if (isStatusCreate) {
|
||||||
|
button.addStyleName(getStyle("boldhide"));
|
||||||
|
button.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
button.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applystyle(VButton button) {
|
||||||
|
button.setStyleName(VButton.CLASSNAME);
|
||||||
|
button.addStyleName(getStyle("borderless"));
|
||||||
|
button.addStyleName(getStyle("small"));
|
||||||
|
button.addStyleName(getStyle("on-focus-no-border"));
|
||||||
|
button.addStyleName(getStyle("link"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getStyle(final String style) {
|
||||||
|
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RendererData class with Name and Status.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RolloutRendererData implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5018181529953620263L;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the RendererData.
|
||||||
|
*/
|
||||||
|
public RolloutRendererData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the RendererData.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* Name of the Rollout.
|
||||||
|
* @param status
|
||||||
|
* Status of Rollout.
|
||||||
|
*/
|
||||||
|
public RolloutRendererData(String name, String status) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
|
||||||
|
|
||||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Renders link with provided text.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LinkRenderer extends ButtonRenderer {
|
|
||||||
private static final long serialVersionUID = -1242995370043404892L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intialise link renderer.
|
|
||||||
*/
|
|
||||||
public LinkRenderer() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intialise link renderer with {@link RendererClickListener}
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* RendererClickListener
|
|
||||||
*/
|
|
||||||
public LinkRenderer(RendererClickListener listener) {
|
|
||||||
super(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
|
import com.vaadin.ui.renderers.ClickableRenderer;
|
||||||
|
|
||||||
|
import elemental.json.JsonValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders button with provided CustomObject.
|
||||||
|
* Used to display button with link.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8754180585906263554L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new custom object renderer.
|
||||||
|
*/
|
||||||
|
public RolloutRenderer() {
|
||||||
|
super(RolloutRendererData.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize custom object renderer with {@link Class<CustomObject>}
|
||||||
|
*
|
||||||
|
* @param presentationType
|
||||||
|
* Class<CustomObject>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public RolloutRenderer(Class<RolloutRendererData> presentationType) {
|
||||||
|
super(presentationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new custom object renderer and adds the given click listener to it.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* the click listener to register
|
||||||
|
*/
|
||||||
|
public RolloutRenderer(RendererClickListener listener) {
|
||||||
|
this();
|
||||||
|
addClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonValue encode(RolloutRendererData resource) {
|
||||||
|
return super.encode(resource, RolloutRendererData.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,122 +9,133 @@
|
|||||||
package org.eclipse.hawkbit.ui.rollout.rollout;
|
package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy rollout with suctome properties.
|
* Proxy rollout with custom properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRollout extends Rollout {
|
public class ProxyRollout extends Rollout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4539849939617681918L;
|
private static final long serialVersionUID = 4539849939617681918L;
|
||||||
|
|
||||||
private String distributionSetNameVersion;
|
private String distributionSetNameVersion;
|
||||||
|
|
||||||
private String createdDate;
|
private String createdDate;
|
||||||
|
|
||||||
private String modifiedDate;
|
private String modifiedDate;
|
||||||
|
|
||||||
private Long numberOfGroups;
|
private Long numberOfGroups;
|
||||||
|
|
||||||
private Boolean isActionRecieved = Boolean.FALSE;
|
private Boolean isActionRecieved = Boolean.FALSE;
|
||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
/**
|
private RolloutRendererData rendererData;
|
||||||
* @return the distributionSetNameVersion
|
|
||||||
*/
|
|
||||||
public String getDistributionSetNameVersion() {
|
|
||||||
return distributionSetNameVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distributionSetNameVersion
|
|
||||||
* the distributionSetNameVersion to set
|
|
||||||
*/
|
|
||||||
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
|
||||||
this.distributionSetNameVersion = distributionSetNameVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the numberOfGroups
|
|
||||||
*/
|
|
||||||
public Long getNumberOfGroups() {
|
|
||||||
return numberOfGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param numberOfGroups
|
|
||||||
* the numberOfGroups to set
|
|
||||||
*/
|
|
||||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
|
||||||
this.numberOfGroups = numberOfGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the createdDate
|
|
||||||
*/
|
|
||||||
public String getCreatedDate() {
|
|
||||||
return createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param createdDate
|
|
||||||
* the createdDate to set
|
|
||||||
*/
|
|
||||||
public void setCreatedDate(final String createdDate) {
|
|
||||||
this.createdDate = createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the modifiedDate
|
|
||||||
*/
|
|
||||||
public String getModifiedDate() {
|
|
||||||
return modifiedDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param modifiedDate
|
|
||||||
* the modifiedDate to set
|
|
||||||
*/
|
|
||||||
public void setModifiedDate(final String modifiedDate) {
|
|
||||||
this.modifiedDate = modifiedDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isActionRecieved
|
|
||||||
*/
|
|
||||||
public Boolean getIsActionRecieved() {
|
|
||||||
return isActionRecieved;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isActionRecieved
|
|
||||||
* the isActionRecieved to set
|
|
||||||
*/
|
|
||||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
|
||||||
this.isActionRecieved = isActionRecieved;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the totalTargetsCount
|
|
||||||
*/
|
|
||||||
public String getTotalTargetsCount() {
|
|
||||||
return totalTargetsCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param totalTargetsCount
|
|
||||||
* the totalTargetsCount to set
|
|
||||||
*/
|
|
||||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
|
||||||
this.totalTargetsCount = totalTargetsCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getAction() {
|
public RolloutRendererData getRendererData() {
|
||||||
return FontAwesome.CIRCLE_O.getHtml();
|
return rendererData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRendererData(RolloutRendererData rendererData) {
|
||||||
|
this.rendererData = rendererData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the distributionSetNameVersion
|
||||||
|
*/
|
||||||
|
public String getDistributionSetNameVersion() {
|
||||||
|
return distributionSetNameVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param distributionSetNameVersion
|
||||||
|
* the distributionSetNameVersion to set
|
||||||
|
*/
|
||||||
|
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
||||||
|
this.distributionSetNameVersion = distributionSetNameVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the numberOfGroups
|
||||||
|
*/
|
||||||
|
public Long getNumberOfGroups() {
|
||||||
|
return numberOfGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param numberOfGroups
|
||||||
|
* the numberOfGroups to set
|
||||||
|
*/
|
||||||
|
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||||
|
this.numberOfGroups = numberOfGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the createdDate
|
||||||
|
*/
|
||||||
|
public String getCreatedDate() {
|
||||||
|
return createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param createdDate
|
||||||
|
* the createdDate to set
|
||||||
|
*/
|
||||||
|
public void setCreatedDate(final String createdDate) {
|
||||||
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the modifiedDate
|
||||||
|
*/
|
||||||
|
public String getModifiedDate() {
|
||||||
|
return modifiedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param modifiedDate
|
||||||
|
* the modifiedDate to set
|
||||||
|
*/
|
||||||
|
public void setModifiedDate(final String modifiedDate) {
|
||||||
|
this.modifiedDate = modifiedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isActionRecieved
|
||||||
|
*/
|
||||||
|
public Boolean getIsActionRecieved() {
|
||||||
|
return isActionRecieved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isActionRecieved
|
||||||
|
* the isActionRecieved to set
|
||||||
|
*/
|
||||||
|
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||||
|
this.isActionRecieved = isActionRecieved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the totalTargetsCount
|
||||||
|
*/
|
||||||
|
public String getTotalTargetsCount() {
|
||||||
|
return totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param totalTargetsCount
|
||||||
|
* the totalTargetsCount to set
|
||||||
|
*/
|
||||||
|
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||||
|
this.totalTargetsCount = totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return FontAwesome.CIRCLE_O.getHtml();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
@@ -39,163 +40,165 @@ import com.google.common.base.Strings;
|
|||||||
*/
|
*/
|
||||||
public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4027879794344836185L;
|
private static final long serialVersionUID = 4027879794344836185L;
|
||||||
|
|
||||||
private final String searchText;
|
private final String searchText;
|
||||||
|
|
||||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||||
|
|
||||||
private transient RolloutManagement rolloutManagement;
|
private transient RolloutManagement rolloutManagement;
|
||||||
|
|
||||||
private transient TargetFilterQueryManagement filterQueryManagement;
|
private transient TargetFilterQueryManagement filterQueryManagement;
|
||||||
|
|
||||||
private transient RolloutUIState rolloutUIState;
|
private transient RolloutUIState rolloutUIState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parametric Constructor.
|
* Parametric Constructor.
|
||||||
*
|
*
|
||||||
* @param definition
|
* @param definition
|
||||||
* as QueryDefinition
|
* as QueryDefinition
|
||||||
* @param queryConfig
|
* @param queryConfig
|
||||||
* as Config
|
* as Config
|
||||||
* @param sortIds
|
* @param sortIds
|
||||||
* as sort
|
* as sort
|
||||||
* @param sortStates
|
* @param sortStates
|
||||||
* as Sort status
|
* as Sort status
|
||||||
*/
|
*/
|
||||||
public RolloutBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
public RolloutBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||||
final Object[] sortIds, final boolean[] sortStates) {
|
final Object[] sortIds, final boolean[] sortStates) {
|
||||||
super(definition, queryConfig, sortIds, sortStates);
|
super(definition, queryConfig, sortIds, sortStates);
|
||||||
|
|
||||||
searchText = getSearchText();
|
searchText = getSearchText();
|
||||||
|
|
||||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||||
// Initalize Sor
|
// Initalize Sor
|
||||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
|
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
|
||||||
// Add sort.
|
// Add sort.
|
||||||
for (int targetId = 1; targetId < sortIds.length; targetId++) {
|
for (int targetId = 1; targetId < sortIds.length; targetId++) {
|
||||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId]));
|
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSearchText() {
|
private String getSearchText() {
|
||||||
if (getRolloutUIState().getSearchText().isPresent()) {
|
if (getRolloutUIState().getSearchText().isPresent()) {
|
||||||
return String.format("%%%s%%", getRolloutUIState().getSearchText().get());
|
return String.format("%%%s%%", getRolloutUIState().getSearchText().get());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyRollout constructBean() {
|
protected ProxyRollout constructBean() {
|
||||||
return new ProxyRollout();
|
return new ProxyRollout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||||
* int)
|
* int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
||||||
final Slice<Rollout> rolloutBeans;
|
final Slice<Rollout> rolloutBeans;
|
||||||
if (Strings.isNullOrEmpty(searchText)) {
|
if (Strings.isNullOrEmpty(searchText)) {
|
||||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
||||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
||||||
} else {
|
} else {
|
||||||
rolloutBeans = getRolloutManagement().findRolloutByFilters(
|
rolloutBeans = getRolloutManagement().findRolloutByFilters(
|
||||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
||||||
searchText);
|
searchText);
|
||||||
}
|
}
|
||||||
return getProxyRolloutList(rolloutBeans);
|
return getProxyRolloutList(rolloutBeans);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||||
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
||||||
for (final Rollout rollout : rolloutBeans) {
|
for (final Rollout rollout : rolloutBeans) {
|
||||||
final ProxyRollout proxyRollout = new ProxyRollout();
|
final ProxyRollout proxyRollout = new ProxyRollout();
|
||||||
proxyRollout.setName(rollout.getName());
|
proxyRollout.setName(rollout.getName());
|
||||||
proxyRollout.setDescription(rollout.getDescription());
|
proxyRollout.setDescription(rollout.getDescription());
|
||||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||||
proxyRollout.setDistributionSetNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
proxyRollout.setDistributionSetNameVersion(
|
||||||
distributionSet.getName(), distributionSet.getVersion()));
|
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||||
proxyRollout.setDistributionSet(distributionSet);
|
proxyRollout.setDistributionSet(distributionSet);
|
||||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||||
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
||||||
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
||||||
proxyRollout.setForcedTime(rollout.getForcedTime());
|
proxyRollout.setForcedTime(rollout.getForcedTime());
|
||||||
proxyRollout.setId(rollout.getId());
|
proxyRollout.setId(rollout.getId());
|
||||||
proxyRollout.setStatus(rollout.getStatus());
|
proxyRollout.setStatus(rollout.getStatus());
|
||||||
|
proxyRollout.setRendererData(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||||
|
|
||||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||||
|
|
||||||
proxyRolloutList.add(proxyRollout);
|
proxyRolloutList.add(proxyRollout);
|
||||||
}
|
}
|
||||||
return proxyRolloutList;
|
return proxyRolloutList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
||||||
* .util.List, java.util.List, java.util.List)
|
* .util.List, java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1, final List<ProxyRollout> arg2) {
|
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1,
|
||||||
/**
|
final List<ProxyRollout> arg2) {
|
||||||
* CRUD operations on Target will be done through repository methods
|
/**
|
||||||
*/
|
* CRUD operations on Target will be done through repository methods
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
int size = getRolloutManagement().countRolloutsAll().intValue();
|
int size = getRolloutManagement().countRolloutsAll().intValue();
|
||||||
if (!Strings.isNullOrEmpty(searchText)) {
|
if (!Strings.isNullOrEmpty(searchText)) {
|
||||||
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
|
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rolloutManagement
|
* @return the rolloutManagement
|
||||||
*/
|
*/
|
||||||
public RolloutManagement getRolloutManagement() {
|
public RolloutManagement getRolloutManagement() {
|
||||||
if (null == rolloutManagement) {
|
if (null == rolloutManagement) {
|
||||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||||
}
|
}
|
||||||
return rolloutManagement;
|
return rolloutManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the filterQueryManagement
|
* @return the filterQueryManagement
|
||||||
*/
|
*/
|
||||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||||
if (null == filterQueryManagement) {
|
if (null == filterQueryManagement) {
|
||||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||||
}
|
}
|
||||||
return filterQueryManagement;
|
return filterQueryManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rolloutUIState
|
* @return the rolloutUIState
|
||||||
*/
|
*/
|
||||||
public RolloutUIState getRolloutUIState() {
|
public RolloutUIState getRolloutUIState() {
|
||||||
if (null == rolloutUIState) {
|
if (null == rolloutUIState) {
|
||||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||||
}
|
}
|
||||||
return rolloutUIState;
|
return rolloutUIState;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,200 +9,211 @@
|
|||||||
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy rollout group with suctome properties.
|
* Proxy rollout group with renderer properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRolloutGroup extends RolloutGroup {
|
public class ProxyRolloutGroup extends RolloutGroup {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2745056813306692356L;
|
private static final long serialVersionUID = -2745056813306692356L;
|
||||||
|
|
||||||
private String createdDate;
|
private String createdDate;
|
||||||
|
|
||||||
private String modifiedDate;
|
private String modifiedDate;
|
||||||
|
|
||||||
private String finishedPercentage;
|
private String finishedPercentage;
|
||||||
|
|
||||||
private Long runningTargetsCount;
|
private Long runningTargetsCount;
|
||||||
|
|
||||||
private Long scheduledTargetsCount;
|
private Long scheduledTargetsCount;
|
||||||
|
|
||||||
private Long cancelledTargetsCount;
|
private Long cancelledTargetsCount;
|
||||||
|
|
||||||
private Long errorTargetsCount;
|
private Long errorTargetsCount;
|
||||||
|
|
||||||
private Long finishedTargetsCount;
|
private Long finishedTargetsCount;
|
||||||
|
|
||||||
private Long notStartedTargetsCount;
|
private Long notStartedTargetsCount;
|
||||||
|
|
||||||
private Boolean isActionRecieved = Boolean.FALSE;
|
private Boolean isActionRecieved = Boolean.FALSE;
|
||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
/**
|
private RolloutRendererData rendererData;
|
||||||
* @return the createdDate
|
|
||||||
*/
|
|
||||||
public String getCreatedDate() {
|
|
||||||
return createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public RolloutRendererData getRendererData() {
|
||||||
* @param createdDate
|
return rendererData;
|
||||||
* the createdDate to set
|
}
|
||||||
*/
|
|
||||||
public void setCreatedDate(final String createdDate) {
|
|
||||||
this.createdDate = createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setRendererData(RolloutRendererData rendererData) {
|
||||||
* @return the modifiedDate
|
this.rendererData = rendererData;
|
||||||
*/
|
}
|
||||||
public String getModifiedDate() {
|
|
||||||
return modifiedDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param modifiedDate
|
* @return the createdDate
|
||||||
* the modifiedDate to set
|
*/
|
||||||
*/
|
public String getCreatedDate() {
|
||||||
public void setModifiedDate(final String modifiedDate) {
|
return createdDate;
|
||||||
this.modifiedDate = modifiedDate;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the finishedPercentage
|
* @param createdDate
|
||||||
*/
|
* the createdDate to set
|
||||||
public String getFinishedPercentage() {
|
*/
|
||||||
return finishedPercentage;
|
public void setCreatedDate(final String createdDate) {
|
||||||
}
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param finishedPercentage
|
* @return the modifiedDate
|
||||||
* the finishedPercentage to set
|
*/
|
||||||
*/
|
public String getModifiedDate() {
|
||||||
public void setFinishedPercentage(final String finishedPercentage) {
|
return modifiedDate;
|
||||||
this.finishedPercentage = finishedPercentage;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the runningTargetsCount
|
* @param modifiedDate
|
||||||
*/
|
* the modifiedDate to set
|
||||||
public Long getRunningTargetsCount() {
|
*/
|
||||||
return runningTargetsCount;
|
public void setModifiedDate(final String modifiedDate) {
|
||||||
}
|
this.modifiedDate = modifiedDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param runningTargetsCount
|
* @return the finishedPercentage
|
||||||
* the runningTargetsCount to set
|
*/
|
||||||
*/
|
public String getFinishedPercentage() {
|
||||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
return finishedPercentage;
|
||||||
this.runningTargetsCount = runningTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the scheduledTargetsCount
|
* @param finishedPercentage
|
||||||
*/
|
* the finishedPercentage to set
|
||||||
public Long getScheduledTargetsCount() {
|
*/
|
||||||
return scheduledTargetsCount;
|
public void setFinishedPercentage(final String finishedPercentage) {
|
||||||
}
|
this.finishedPercentage = finishedPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scheduledTargetsCount
|
* @return the runningTargetsCount
|
||||||
* the scheduledTargetsCount to set
|
*/
|
||||||
*/
|
public Long getRunningTargetsCount() {
|
||||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
return runningTargetsCount;
|
||||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cancelledTargetsCount
|
* @param runningTargetsCount
|
||||||
*/
|
* the runningTargetsCount to set
|
||||||
public Long getCancelledTargetsCount() {
|
*/
|
||||||
return cancelledTargetsCount;
|
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||||
}
|
this.runningTargetsCount = runningTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cancelledTargetsCount
|
* @return the scheduledTargetsCount
|
||||||
* the cancelledTargetsCount to set
|
*/
|
||||||
*/
|
public Long getScheduledTargetsCount() {
|
||||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
return scheduledTargetsCount;
|
||||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the errorTargetsCount
|
* @param scheduledTargetsCount
|
||||||
*/
|
* the scheduledTargetsCount to set
|
||||||
public Long getErrorTargetsCount() {
|
*/
|
||||||
return errorTargetsCount;
|
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||||
}
|
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param errorTargetsCount
|
* @return the cancelledTargetsCount
|
||||||
* the errorTargetsCount to set
|
*/
|
||||||
*/
|
public Long getCancelledTargetsCount() {
|
||||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
return cancelledTargetsCount;
|
||||||
this.errorTargetsCount = errorTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the finishedTargetsCount
|
* @param cancelledTargetsCount
|
||||||
*/
|
* the cancelledTargetsCount to set
|
||||||
public Long getFinishedTargetsCount() {
|
*/
|
||||||
return finishedTargetsCount;
|
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||||
}
|
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param finishedTargetsCount
|
* @return the errorTargetsCount
|
||||||
* the finishedTargetsCount to set
|
*/
|
||||||
*/
|
public Long getErrorTargetsCount() {
|
||||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
return errorTargetsCount;
|
||||||
this.finishedTargetsCount = finishedTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the notStartedTargetsCount
|
* @param errorTargetsCount
|
||||||
*/
|
* the errorTargetsCount to set
|
||||||
public Long getNotStartedTargetsCount() {
|
*/
|
||||||
return notStartedTargetsCount;
|
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||||
}
|
this.errorTargetsCount = errorTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param notStartedTargetsCount
|
* @return the finishedTargetsCount
|
||||||
* the notStartedTargetsCount to set
|
*/
|
||||||
*/
|
public Long getFinishedTargetsCount() {
|
||||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
return finishedTargetsCount;
|
||||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isActionRecieved
|
* @param finishedTargetsCount
|
||||||
*/
|
* the finishedTargetsCount to set
|
||||||
public Boolean getIsActionRecieved() {
|
*/
|
||||||
return isActionRecieved;
|
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||||
}
|
this.finishedTargetsCount = finishedTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param isActionRecieved
|
* @return the notStartedTargetsCount
|
||||||
* the isActionRecieved to set
|
*/
|
||||||
*/
|
public Long getNotStartedTargetsCount() {
|
||||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
return notStartedTargetsCount;
|
||||||
this.isActionRecieved = isActionRecieved;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the totalTargetsCount
|
* @param notStartedTargetsCount
|
||||||
*/
|
* the notStartedTargetsCount to set
|
||||||
public String getTotalTargetsCount() {
|
*/
|
||||||
return totalTargetsCount;
|
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||||
}
|
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param totalTargetsCount
|
* @return the isActionRecieved
|
||||||
* the totalTargetsCount to set
|
*/
|
||||||
*/
|
public Boolean getIsActionRecieved() {
|
||||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
return isActionRecieved;
|
||||||
this.totalTargetsCount = totalTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* @param isActionRecieved
|
||||||
|
* the isActionRecieved to set
|
||||||
|
*/
|
||||||
|
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||||
|
this.isActionRecieved = isActionRecieved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the totalTargetsCount
|
||||||
|
*/
|
||||||
|
public String getTotalTargetsCount() {
|
||||||
|
return totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param totalTargetsCount
|
||||||
|
* the totalTargetsCount to set
|
||||||
|
*/
|
||||||
|
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||||
|
this.totalTargetsCount = totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
@@ -34,158 +35,160 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
|||||||
*/
|
*/
|
||||||
public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup> {
|
public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 5342450502894318589L;
|
private static final long serialVersionUID = 5342450502894318589L;
|
||||||
|
|
||||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||||
|
|
||||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
||||||
|
|
||||||
private transient RolloutManagement rolloutManagement;
|
private transient RolloutManagement rolloutManagement;
|
||||||
|
|
||||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||||
|
|
||||||
private transient RolloutUIState rolloutUIState;
|
private transient RolloutUIState rolloutUIState;
|
||||||
|
|
||||||
private final Long rolloutId;
|
private final Long rolloutId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parametric Constructor.
|
* Parametric Constructor.
|
||||||
*
|
*
|
||||||
* @param definition
|
* @param definition
|
||||||
* as QueryDefinition
|
* as QueryDefinition
|
||||||
* @param queryConfig
|
* @param queryConfig
|
||||||
* as Config
|
* as Config
|
||||||
* @param sortPropertyIds
|
* @param sortPropertyIds
|
||||||
* as sort
|
* as sort
|
||||||
* @param sortStates
|
* @param sortStates
|
||||||
* as Sort status
|
* as Sort status
|
||||||
*/
|
*/
|
||||||
public RolloutGroupBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
public RolloutGroupBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||||
|
|
||||||
rolloutId = getRolloutId();
|
rolloutId = getRolloutId();
|
||||||
|
|
||||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||||
// Initalize Sor
|
// Initalize Sor
|
||||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||||
// Add sort.
|
// Add sort.
|
||||||
for (int targetId = 1; targetId < sortPropertyIds.length; targetId++) {
|
for (int targetId = 1; targetId < sortPropertyIds.length; targetId++) {
|
||||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC,
|
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC,
|
||||||
(String) sortPropertyIds[targetId]));
|
(String) sortPropertyIds[targetId]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Long getRolloutId() {
|
private Long getRolloutId() {
|
||||||
return getRolloutUIState().getRolloutId().isPresent() ? getRolloutUIState().getRolloutId().get() : null;
|
return getRolloutUIState().getRolloutId().isPresent() ? getRolloutUIState().getRolloutId().get() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyRolloutGroup constructBean() {
|
protected ProxyRolloutGroup constructBean() {
|
||||||
return new ProxyRolloutGroup();
|
return new ProxyRolloutGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
||||||
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||||
} else if (null != rolloutId) {
|
} else if (null != rolloutId) {
|
||||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||||
.getContent();
|
.getContent();
|
||||||
}
|
}
|
||||||
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
|
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
|
||||||
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||||
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
|
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
|
||||||
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
|
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
|
||||||
proxyRolloutGroup.setName(rolloutGroup.getName());
|
proxyRolloutGroup.setName(rolloutGroup.getName());
|
||||||
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
||||||
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
||||||
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
||||||
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
||||||
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
||||||
proxyRolloutGroup.setId(rolloutGroup.getId());
|
proxyRolloutGroup.setId(rolloutGroup.getId());
|
||||||
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
||||||
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
||||||
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
|
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
|
||||||
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
|
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
|
||||||
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
|
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
|
||||||
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
||||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||||
|
|
||||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
proxyRolloutGroup.setRendererData(new RolloutRendererData(rolloutGroup.getName(), null));
|
||||||
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
|
||||||
|
|
||||||
proxyRolloutGroupsList.add(proxyRolloutGroup);
|
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||||
}
|
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
||||||
return proxyRolloutGroupsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
proxyRolloutGroupsList.add(proxyRolloutGroup);
|
||||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
|
}
|
||||||
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
return proxyRolloutGroupsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||||
protected void saveBeans(final List<ProxyRolloutGroup> arg0, final List<ProxyRolloutGroup> arg1,
|
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
|
||||||
final List<ProxyRolloutGroup> arg2) {
|
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||||
/**
|
}
|
||||||
* CRUD operations be done through repository methods.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
protected void saveBeans(final List<ProxyRolloutGroup> arg0, final List<ProxyRolloutGroup> arg1,
|
||||||
long size = 0;
|
final List<ProxyRolloutGroup> arg2) {
|
||||||
if (null != rolloutId) {
|
/**
|
||||||
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(rolloutId,
|
* CRUD operations be done through repository methods.
|
||||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
*/
|
||||||
size = firstPageRolloutGroupSets.getTotalElements();
|
}
|
||||||
}
|
|
||||||
if (size > Integer.MAX_VALUE) {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) size;
|
@Override
|
||||||
}
|
public int size() {
|
||||||
|
long size = 0;
|
||||||
|
if (null != rolloutId) {
|
||||||
|
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(rolloutId,
|
||||||
|
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
||||||
|
size = firstPageRolloutGroupSets.getTotalElements();
|
||||||
|
}
|
||||||
|
if (size > Integer.MAX_VALUE) {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return (int) size;
|
||||||
* @return the rolloutManagement
|
}
|
||||||
*/
|
|
||||||
public RolloutManagement getRolloutManagement() {
|
|
||||||
if (null == rolloutManagement) {
|
|
||||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
|
||||||
}
|
|
||||||
return rolloutManagement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rolloutManagement
|
* @return the rolloutManagement
|
||||||
*/
|
*/
|
||||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
public RolloutManagement getRolloutManagement() {
|
||||||
if (null == rolloutGroupManagement) {
|
if (null == rolloutManagement) {
|
||||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||||
}
|
}
|
||||||
return rolloutGroupManagement;
|
return rolloutManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rolloutUIState
|
* @return the rolloutManagement
|
||||||
*/
|
*/
|
||||||
public RolloutUIState getRolloutUIState() {
|
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||||
if (null == rolloutUIState) {
|
if (null == rolloutGroupManagement) {
|
||||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||||
}
|
}
|
||||||
return rolloutUIState;
|
return rolloutGroupManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the rolloutUIState
|
||||||
|
*/
|
||||||
|
public RolloutUIState getRolloutUIState() {
|
||||||
|
if (null == rolloutUIState) {
|
||||||
|
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||||
|
}
|
||||||
|
return rolloutUIState;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,16 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
|
||||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
@@ -57,315 +60,329 @@ import com.vaadin.ui.renderers.HtmlRenderer;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class RolloutGroupListGrid extends AbstractGrid {
|
public class RolloutGroupListGrid extends AbstractGrid {
|
||||||
private static final long serialVersionUID = 4060904914954370524L;
|
private static final long serialVersionUID = 4060904914954370524L;
|
||||||
|
|
||||||
@Autowired
|
private static final String customObject = "customObject";
|
||||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient RolloutUIState rolloutUIState;
|
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient SpPermissionChecker permissionChecker;
|
private transient RolloutManagement rolloutManagement;
|
||||||
|
|
||||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
@Autowired
|
||||||
|
private transient RolloutUIState rolloutUIState;
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@Autowired
|
||||||
void onEvent(final RolloutEvent event) {
|
private transient SpPermissionChecker permissionChecker;
|
||||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||||
*
|
|
||||||
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param rolloutGroupChangeEvent
|
|
||||||
* the event which contains the rollout group which has been
|
|
||||||
* change
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
|
||||||
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
|
||||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
|
||||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
|
||||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
|
||||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
|
||||||
if (item == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
|
||||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
protected Container createContainer() {
|
void onEvent(final RolloutEvent event) {
|
||||||
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||||
return new LazyQueryContainer(
|
return;
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf);
|
}
|
||||||
}
|
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected void addContainerProperties() {
|
*
|
||||||
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
*
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
*
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
* @param rolloutGroupChangeEvent
|
||||||
false, false);
|
* the event which contains the rollout group which has been
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE,
|
* change
|
||||||
String.class, null, false, false);
|
*/
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD, String.class,
|
@SuppressWarnings("unchecked")
|
||||||
null, false, false);
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
|
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
||||||
|
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||||
|
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||||
|
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
|
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||||
|
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||||
|
.setValue(calculateFinishedPercentage(rolloutGroup));
|
||||||
|
}
|
||||||
|
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null,
|
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||||
false, false);
|
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
|
||||||
|
rolloutManagement.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||||
|
}
|
||||||
|
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
@Override
|
||||||
false);
|
protected Container createContainer() {
|
||||||
|
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
||||||
|
return new LazyQueryContainer(
|
||||||
|
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf);
|
||||||
|
}
|
||||||
|
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null,
|
@Override
|
||||||
false, false);
|
protected void addContainerProperties() {
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
false);
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
|
||||||
false);
|
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
|
||||||
false);
|
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
|
||||||
TotalTargetCountStatus.class, null, false, false);
|
|
||||||
|
|
||||||
}
|
rolloutGroupGridContainer.addContainerProperty(customObject, RolloutRendererData.class, null, false, false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
||||||
|
false, false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE,
|
||||||
|
String.class, null, false, false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD, String.class,
|
||||||
|
null, false, false);
|
||||||
|
|
||||||
@Override
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null,
|
||||||
protected void setColumnExpandRatio() {
|
false, false);
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);
|
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
false);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null,
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
false, false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
||||||
|
false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||||
|
false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||||
|
false);
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
||||||
|
TotalTargetCountStatus.class, null, false, false);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
}
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMaximumWidth(100);
|
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
@Override
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
protected void setColumnExpandRatio() {
|
||||||
|
getColumn(customObject).setMinimumWidth(40);
|
||||||
|
getColumn(customObject).setMaximumWidth(200);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
||||||
|
|
||||||
setFrozenColumnCount(7);
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
||||||
}
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMaximumWidth(100);
|
||||||
|
|
||||||
@Override
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
||||||
protected void setColumnHeaderNames() {
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
|
||||||
.setHeaderCaption(i18n.get("header.detail.status"));
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
|
||||||
.setHeaderCaption(i18n.get("header.rolloutgroup.installed.percentage"));
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD)
|
|
||||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold.error"));
|
|
||||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD)
|
|
||||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description"));
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
||||||
protected String getGridId() {
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
||||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||||
protected void setColumnProperties() {
|
|
||||||
final List<Object> columnList = new ArrayList<>();
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
|
||||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE);
|
|
||||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD);
|
|
||||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
|
||||||
columnList.add(SPUILabelDefinitions.VAR_DESC);
|
|
||||||
setColumnOrder(columnList.toArray());
|
|
||||||
alignColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
setFrozenColumnCount(7);
|
||||||
protected void addColumnRenderes() {
|
}
|
||||||
createRolloutGroupStatusToFontMap();
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
|
||||||
new RolloutGroupStatusConverter());
|
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
@Override
|
||||||
new TotalTargetCountStatusConverter());
|
protected void setColumnHeaderNames() {
|
||||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
getColumn(customObject).setHeaderCaption(i18n.get("header.name"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME)
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
||||||
.setRenderer(new LinkRenderer(event -> onClickOfRolloutGroupName(event)));
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||||
}
|
.setHeaderCaption(i18n.get("header.detail.status"));
|
||||||
}
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||||
|
.setHeaderCaption(i18n.get("header.rolloutgroup.installed.percentage"));
|
||||||
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD)
|
||||||
|
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold.error"));
|
||||||
|
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD)
|
||||||
|
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description"));
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setHiddenColumns() {
|
protected String getGridId() {
|
||||||
final List<Object> columnsToBeHidden = new ArrayList<>();
|
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
}
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
|
||||||
for (final Object propertyId : columnsToBeHidden) {
|
|
||||||
getColumn(propertyId).setHidden(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
protected void setColumnProperties() {
|
||||||
return cell -> getDescription(cell);
|
final List<Object> columnList = new ArrayList<>();
|
||||||
}
|
columnList.add(customObject);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
||||||
|
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE);
|
||||||
|
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD);
|
||||||
|
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||||
|
columnList.add(SPUILabelDefinitions.VAR_DESC);
|
||||||
|
setColumnOrder(columnList.toArray());
|
||||||
|
alignColumns();
|
||||||
|
}
|
||||||
|
|
||||||
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
|
@Override
|
||||||
rolloutUIState
|
protected void addColumnRenderes() {
|
||||||
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
createRolloutGroupStatusToFontMap();
|
||||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||||
}
|
new RolloutGroupStatusConverter());
|
||||||
|
|
||||||
private void createRolloutGroupStatusToFontMap() {
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||||
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
new TotalTargetCountStatusConverter());
|
||||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||||
statusIconMap.put(RolloutGroupStatus.SCHEDULED,
|
getColumn(customObject).setRenderer(new RolloutRenderer(event -> onClickOfRolloutGroupName(event)));
|
||||||
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
}
|
||||||
statusIconMap.put(RolloutGroupStatus.RUNNING,
|
}
|
||||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
|
||||||
statusIconMap.put(RolloutGroupStatus.READY,
|
|
||||||
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
|
||||||
statusIconMap.put(RolloutGroupStatus.ERROR,
|
|
||||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDescription(final CellReference cell) {
|
@Override
|
||||||
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
protected void setHiddenColumns() {
|
||||||
return cell.getProperty().getValue().toString().toLowerCase();
|
final List<Object> columnsToBeHidden = new ArrayList<>();
|
||||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME);
|
||||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||||
} else if (SPUILabelDefinitions.VAR_NAME.equals(cell.getPropertyId())) {
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||||
return cell.getProperty().getValue().toString();
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||||
return DistributionBarHelper
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
||||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
for (final Object propertyId : columnsToBeHidden) {
|
||||||
}
|
getColumn(propertyId).setHidden(true);
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void alignColumns() {
|
@Override
|
||||||
setCellStyleGenerator(new CellStyleGenerator() {
|
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||||
private static final long serialVersionUID = 5573570647129792429L;
|
return cell -> getDescription(cell);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
|
||||||
public String getStyle(final CellReference cellReference) {
|
rolloutUIState
|
||||||
final String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS,
|
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
||||||
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS };
|
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||||
if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) {
|
}
|
||||||
return "centeralign";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private void createRolloutGroupStatusToFontMap() {
|
||||||
*
|
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
||||||
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||||
* and count details.
|
statusIconMap.put(RolloutGroupStatus.SCHEDULED,
|
||||||
*
|
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||||
*/
|
statusIconMap.put(RolloutGroupStatus.RUNNING,
|
||||||
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||||
|
statusIconMap.put(RolloutGroupStatus.READY,
|
||||||
|
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
||||||
|
statusIconMap.put(RolloutGroupStatus.ERROR,
|
||||||
|
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||||
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = -9205943894818450807L;
|
private String getDescription(final CellReference cell) {
|
||||||
|
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||||
|
return cell.getProperty().getValue().toString().toLowerCase();
|
||||||
|
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||||
|
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||||
|
} else if (customObject.equals(cell.getPropertyId())) {
|
||||||
|
return ((RolloutRendererData) cell.getProperty().getValue()).getName();
|
||||||
|
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||||
|
return DistributionBarHelper
|
||||||
|
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private void alignColumns() {
|
||||||
public TotalTargetCountStatus convertToModel(final String value,
|
setCellStyleGenerator(new CellStyleGenerator() {
|
||||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
private static final long serialVersionUID = 5573570647129792429L;
|
||||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
public String getStyle(final CellReference cellReference) {
|
||||||
final Class<? extends String> targetType, final Locale locale)
|
final String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS,
|
||||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS };
|
||||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) {
|
||||||
}
|
return "centeralign";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public Class<TotalTargetCountStatus> getModelType() {
|
*
|
||||||
return TotalTargetCountStatus.class;
|
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
||||||
}
|
* and count details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
||||||
|
|
||||||
@Override
|
private static final long serialVersionUID = -9205943894818450807L;
|
||||||
public Class<String> getPresentationType() {
|
|
||||||
return String.class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
*
|
public TotalTargetCountStatus convertToModel(final String value,
|
||||||
* Converts {@link RolloutGroupStatus} to string.
|
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||||
*
|
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
*/
|
return null;
|
||||||
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 5448062736373292820L;
|
@Override
|
||||||
|
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||||
|
final Class<? extends String> targetType, final Locale locale)
|
||||||
|
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
|
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RolloutGroupStatus convertToModel(final String value,
|
public Class<TotalTargetCountStatus> getModelType() {
|
||||||
final Class<? extends RolloutGroupStatus> targetType, final Locale locale) {
|
return TotalTargetCountStatus.class;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToPresentation(final RolloutGroupStatus value, final Class<? extends String> targetType,
|
public Class<String> getPresentationType() {
|
||||||
final Locale locale) {
|
return String.class;
|
||||||
return convertRolloutGroupStatusToString(value);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public Class<RolloutGroupStatus> getModelType() {
|
*
|
||||||
return RolloutGroupStatus.class;
|
* Converts {@link RolloutGroupStatus} to string.
|
||||||
}
|
*
|
||||||
|
*/
|
||||||
|
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
||||||
|
|
||||||
@Override
|
private static final long serialVersionUID = 5448062736373292820L;
|
||||||
public Class<String> getPresentationType() {
|
|
||||||
return String.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
@Override
|
||||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
public RolloutGroupStatus convertToModel(final String value,
|
||||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
final Class<? extends RolloutGroupStatus> targetType, final Locale locale) {
|
||||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
return null;
|
||||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String convertToPresentation(final RolloutGroupStatus value, final Class<? extends String> targetType,
|
||||||
|
final Locale locale) {
|
||||||
|
return convertRolloutGroupStatusToString(value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public Class<RolloutGroupStatus> getModelType() {
|
||||||
|
return RolloutGroupStatus.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<String> getPresentationType() {
|
||||||
|
return String.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||||
|
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||||
|
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||||
|
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||||
|
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,20 +19,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.v-context-menu .v-context-menu-item-basic-icon-container{
|
.v-context-menu .v-context-menu-item-basic-icon-container{
|
||||||
height:0px !important;
|
height:0px !important;
|
||||||
width:0px !important;
|
width:0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-context-menu, .v-context-menu .v-context-menu-item-basic{
|
.v-context-menu .v-context-menu-item-basic{
|
||||||
background-color: #feffff !important;
|
background-color: #feffff !important;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
font-family : $app-font-family;
|
||||||
|
font-size : $app-text-font-size;
|
||||||
|
font-weight : normal;
|
||||||
|
font-style : normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.v-context-menu{
|
||||||
|
background-color: #feffff !important;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.v-context-menu .v-context-menu-item-basic:focus, .v-context-menu .v-context-menu-item-basic-submenu:focus, .v-context-menu .v-context-menu-item-basic-open {
|
.v-context-menu .v-context-menu-item-basic:focus, .v-context-menu .v-context-menu-item-basic-submenu:focus, .v-context-menu .v-context-menu-item-basic-open {
|
||||||
@include valo-gradient($color: $hawkbit-primary-color);
|
@include valo-gradient($color: $hawkbit-primary-color);
|
||||||
background-color: $hawkbit-primary-color !important;
|
background-color: $hawkbit-primary-color !important;
|
||||||
color: #e8eef3;
|
color: #e8eef3;
|
||||||
|
height: 30px;
|
||||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,5 +89,9 @@
|
|||||||
border-left: $v-grid-border-size solid $widget-border-color ;
|
border-left: $v-grid-border-size solid $widget-border-color ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.v-button-boldhide{
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user