Rollouts can be deleted (#436)
* Management UI Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Repository Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com> * Optimisations and scheduler deleting enabled Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
804522f966
commit
5628d625e8
@@ -240,7 +240,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
||||
.getItemProperty(PROVIDED_FILE_NAME).getValue();
|
||||
final Button deleteIcon = SPUIComponentProvider.getButton(
|
||||
fileName + "-" + UIComponentIdProvider.UPLOAD_FILE_DELETE_ICON, "",
|
||||
SPUILabelDefinitions.DISCARD, ValoTheme.BUTTON_TINY + " " + "redicon", true,
|
||||
SPUILabelDefinitions.DISCARD, ValoTheme.BUTTON_TINY + " " + "blueicon", true,
|
||||
FontAwesome.TRASH_O, SPUIButtonStyleSmallNoBorder.class);
|
||||
deleteIcon.setData(itemId);
|
||||
deleteIcon.addClickListener(event -> confirmAndDeleteArtifact((Long) itemId, fileName));
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
||||
@@ -238,9 +239,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
||||
private void deleteSMtypeAll(final ConfirmationTab tab) {
|
||||
final int deleteSWModuleTypeCount = artifactUploadState.getSelectedDeleteSWModuleTypes().size();
|
||||
for (final String swModuleTypeName : artifactUploadState.getSelectedDeleteSWModuleTypes()) {
|
||||
|
||||
softwareManagement.deleteSoftwareModuleType(
|
||||
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).get().getId());
|
||||
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
|
||||
.ifPresent(softwareManagement::deleteSoftwareModuleType);
|
||||
}
|
||||
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow.SaveDialogCloseListener;
|
||||
@@ -26,7 +29,6 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
@@ -116,6 +118,56 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
||||
public boolean canWindowSaveOrUpdate() {
|
||||
return editSwModule || !isDuplicate();
|
||||
}
|
||||
|
||||
private void addNewBaseSoftware() {
|
||||
final String name = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
|
||||
final String version = HawkbitCommonUtil.trimAndNullIfEmpty(versionTextField.getValue());
|
||||
final String vendor = HawkbitCommonUtil.trimAndNullIfEmpty(vendorTextField.getValue());
|
||||
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
|
||||
final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create()
|
||||
.type(softwareManagement.findSoftwareModuleTypeByName(type).get()).name(name).version(version)
|
||||
.description(description).vendor(vendor);
|
||||
|
||||
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
|
||||
|
||||
if (newSoftwareModule != null) {
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
|
||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDuplicate() {
|
||||
final String name = nameTextField.getValue();
|
||||
final String version = versionTextField.getValue();
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
|
||||
final Optional<Long> moduleType = softwareManagement.findSoftwareModuleTypeByName(type)
|
||||
.map(SoftwareModuleType::getId);
|
||||
if (moduleType.isPresent() && softwareManagement
|
||||
.findSoftwareModuleByNameAndVersion(name, version, moduleType.get()).isPresent()) {
|
||||
uiNotifcation.displayValidationError(
|
||||
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* updates a softwareModule
|
||||
*/
|
||||
private void updateSwModule() {
|
||||
final SoftwareModule newSWModule = softwareManagement.updateSoftwareModule(entityFactory.softwareModule()
|
||||
.update(baseSwModuleId).description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
|
||||
if (newSWModule != null) {
|
||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
|
||||
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.UPDATED_ENTITY, newSWModule));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,56 +269,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
||||
return window;
|
||||
}
|
||||
|
||||
private void addNewBaseSoftware() {
|
||||
final String name = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
|
||||
final String version = HawkbitCommonUtil.trimAndNullIfEmpty(versionTextField.getValue());
|
||||
final String vendor = HawkbitCommonUtil.trimAndNullIfEmpty(vendorTextField.getValue());
|
||||
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
|
||||
final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create()
|
||||
.type(softwareManagement.findSoftwareModuleTypeByName(type).get()).name(name).version(version)
|
||||
.description(description).vendor(vendor);
|
||||
|
||||
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
|
||||
|
||||
if (newSoftwareModule != null) {
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
|
||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDuplicate() {
|
||||
final String name = nameTextField.getValue();
|
||||
final String version = versionTextField.getValue();
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
|
||||
final SoftwareManagement swMgmtService = SpringContextHelper.getBean(SoftwareManagement.class);
|
||||
|
||||
if (swMgmtService.findSoftwareModuleByNameAndVersion(name, version,
|
||||
swMgmtService.findSoftwareModuleTypeByName(type).get().getId()).isPresent()) {
|
||||
uiNotifcation.displayValidationError(
|
||||
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* updates a softwareModule
|
||||
*/
|
||||
private void updateSwModule() {
|
||||
final SoftwareModule newSWModule = softwareManagement.updateSoftwareModule(entityFactory.softwareModule()
|
||||
.update(baseSwModuleId).description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
|
||||
if (newSWModule != null) {
|
||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
|
||||
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.UPDATED_ENTITY, newSWModule));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fill the data of a softwareModule in the content of the window
|
||||
*/
|
||||
@@ -275,16 +277,17 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
||||
return;
|
||||
}
|
||||
editSwModule = Boolean.TRUE;
|
||||
final SoftwareModule swModule = softwareManagement.findSoftwareModuleById(baseSwModuleId).get();
|
||||
nameTextField.setValue(swModule.getName());
|
||||
versionTextField.setValue(swModule.getVersion());
|
||||
vendorTextField.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getVendor()));
|
||||
descTextArea.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getDescription()));
|
||||
softwareManagement.findSoftwareModuleById(baseSwModuleId).ifPresent(swModule -> {
|
||||
nameTextField.setValue(swModule.getName());
|
||||
versionTextField.setValue(swModule.getVersion());
|
||||
vendorTextField.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getVendor()));
|
||||
descTextArea.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getDescription()));
|
||||
|
||||
if (swModule.getType().isDeleted()) {
|
||||
typeComboBox.addItem(swModule.getType().getName());
|
||||
}
|
||||
typeComboBox.setValue(swModule.getType().getName());
|
||||
if (swModule.getType().isDeleted()) {
|
||||
typeComboBox.addItem(swModule.getType().getName());
|
||||
}
|
||||
typeComboBox.setValue(swModule.getType().getName());
|
||||
});
|
||||
}
|
||||
|
||||
public FormLayout getFormLayout() {
|
||||
|
||||
@@ -201,9 +201,8 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId()).get();
|
||||
/* display the window */
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
|
||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -260,9 +260,8 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long itemId) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId).get();
|
||||
/* display the window */
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
softwareManagement.findSoftwareModuleById(itemId)
|
||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||
@@ -48,10 +47,11 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
|
||||
|
||||
@Override
|
||||
protected void filterClicked(final Button clickedButton) {
|
||||
final SoftwareModuleType softwareModuleType = softwareManagement
|
||||
.findSoftwareModuleTypeByName(clickedButton.getData().toString()).get();
|
||||
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
|
||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
||||
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
|
||||
.ifPresent(softwareModuleType -> {
|
||||
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
|
||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
newItem.getItemProperty(SIZE).setValue(customFile.getFileSize());
|
||||
final Button deleteIcon = SPUIComponentProvider.getButton(
|
||||
UIComponentIdProvider.UPLOAD_DELETE_ICON + "-" + itemId, "", SPUILabelDefinitions.DISCARD,
|
||||
ValoTheme.BUTTON_TINY + " " + "redicon", true, FontAwesome.TRASH_O,
|
||||
ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
deleteIcon.addClickListener(this);
|
||||
deleteIcon.setData(itemId);
|
||||
|
||||
@@ -143,10 +143,8 @@ public class UploadStatusInfoWindow extends Window {
|
||||
case RECEIVE_UPLOAD:
|
||||
uploadRecevied(uploadStatus.getFileName(), uploadStatus.getSoftwareModule());
|
||||
break;
|
||||
case UPLOAD_FINISHED:
|
||||
case ABORT_UPLOAD:
|
||||
case UPLOAD_FAILED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.vaadin.ui.GridLayout;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
@@ -90,11 +91,11 @@ public class CommonDialogWindow extends Window {
|
||||
|
||||
private final ClickListener cancelButtonClickListener;
|
||||
|
||||
private final ClickListener closeClickListener = event -> onCloseEvent(event);
|
||||
private final ClickListener closeClickListener = this::onCloseEvent;
|
||||
|
||||
private final transient Map<Component, Object> orginalValues;
|
||||
|
||||
private final List<AbstractField<?>> allComponents;
|
||||
private List<AbstractField<?>> allComponents;
|
||||
|
||||
private final I18N i18n;
|
||||
|
||||
@@ -207,7 +208,7 @@ public class CommonDialogWindow extends Window {
|
||||
addStyleName("marginTop");
|
||||
}
|
||||
|
||||
if (null != content) {
|
||||
if (content != null) {
|
||||
mainLayout.addComponent(content);
|
||||
mainLayout.setExpandRatio(content, 1.0F);
|
||||
}
|
||||
@@ -391,6 +392,16 @@ public class CommonDialogWindow extends Window {
|
||||
if (c instanceof FlexibleOptionGroupItemComponent) {
|
||||
components.add(((FlexibleOptionGroupItemComponent) c).getOwner());
|
||||
}
|
||||
|
||||
if (c instanceof TabSheet) {
|
||||
final TabSheet tabSheet = (TabSheet) c;
|
||||
for (final Iterator<Component> i = tabSheet.iterator(); i.hasNext();) {
|
||||
final Component component = i.next();
|
||||
if (component instanceof AbstractLayout) {
|
||||
components.addAll(getAllComponents((AbstractLayout) component));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return components;
|
||||
}
|
||||
@@ -560,4 +571,15 @@ public class CommonDialogWindow extends Window {
|
||||
void saveOrUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the field allComponents. All components existing on the given
|
||||
* layout are added to the list of allComponents
|
||||
*
|
||||
* @param layout
|
||||
* AbstractLayout
|
||||
*/
|
||||
public void updateAllComponents(final AbstractLayout layout) {
|
||||
allComponents = getAllComponents(layout);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
*
|
||||
*/
|
||||
public class ConfirmationDialog implements Button.ClickListener {
|
||||
/** Serial version UID. */
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** The confirmation callback. */
|
||||
private transient ConfirmationDialogCallback callback;
|
||||
|
||||
@@ -32,11 +32,9 @@ import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
*
|
||||
* SoftwareModule Metadata details layout.
|
||||
*
|
||||
*/
|
||||
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
public class SoftwareModuleMetadatadetailslayout extends Table {
|
||||
@@ -174,10 +172,8 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId).get();
|
||||
/* display the window */
|
||||
UI.getCurrent()
|
||||
.addWindow(swMetadataPopupLayout.getWindow(swmodule, entityFactory.generateMetadata(metadataKey, "")));
|
||||
softwareManagement.findSoftwareModuleById(selectedSWModuleId).ifPresent(swmodule -> UI.getCurrent()
|
||||
.addWindow(swMetadataPopupLayout.getWindow(swmodule, entityFactory.generateMetadata(metadataKey, ""))));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,15 +155,18 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
searchResetIcon.togleIcon(FontAwesome.TIMES);
|
||||
searchResetIcon.setData(Boolean.TRUE);
|
||||
searchField.removeStyleName(SPUIDefinitions.FILTER_BOX_HIDE);
|
||||
searchField.setVisible(true);
|
||||
searchField.focus();
|
||||
}
|
||||
|
||||
private void closeSearchTextField() {
|
||||
searchField.setValue("");
|
||||
searchField.addStyleName(SPUIDefinitions.FILTER_BOX_HIDE);
|
||||
searchField.setVisible(false);
|
||||
searchResetIcon.removeStyleName(SPUIDefinitions.FILTER_RESET_ICON);
|
||||
searchResetIcon.togleIcon(FontAwesome.SEARCH);
|
||||
searchResetIcon.setData(Boolean.FALSE);
|
||||
|
||||
resetSearchText();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,4 +88,9 @@ public abstract class AbstractGridLayout extends VerticalLayout {
|
||||
* @return count message
|
||||
*/
|
||||
protected abstract Label getCountMessageLabel();
|
||||
|
||||
public AbstractGrid getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public final class ViewComponentClientCriterion extends VAcceptCriterion {
|
||||
public static final String HINT_AREA_STYLE = "show-drop-hint";
|
||||
|
||||
@Override
|
||||
protected boolean accept(VDragEvent drag, UIDL configuration) {
|
||||
protected boolean accept(final VDragEvent drag, final UIDL configuration) {
|
||||
// 1. check if this component is responsible for the drag source:
|
||||
if (!isValidDragSource(drag, configuration)) {
|
||||
return false;
|
||||
@@ -81,14 +81,14 @@ public final class ViewComponentClientCriterion extends VAcceptCriterion {
|
||||
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
|
||||
// Exception semantics changes
|
||||
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
|
||||
boolean isValidDragSource(VDragEvent drag, UIDL configuration) {
|
||||
boolean isValidDragSource(final VDragEvent drag, final UIDL configuration) {
|
||||
try {
|
||||
String dragSource = drag.getTransferable().getDragSource().getWidget().getElement().getId();
|
||||
String dragSourcePrefix = configuration.getStringAttribute(DRAG_SOURCE);
|
||||
final String dragSource = drag.getTransferable().getDragSource().getWidget().getElement().getId();
|
||||
final String dragSourcePrefix = configuration.getStringAttribute(DRAG_SOURCE);
|
||||
if (dragSource.startsWith(dragSourcePrefix)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// log and continue
|
||||
LOGGER.log(Level.SEVERE, "Error verifying drag source: " + e.getLocalizedMessage());
|
||||
}
|
||||
@@ -106,19 +106,20 @@ public final class ViewComponentClientCriterion extends VAcceptCriterion {
|
||||
// Exception squid:S1166 - Hide origin exception
|
||||
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
|
||||
// Exception semantics changes
|
||||
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
|
||||
void showDropTargetHints(UIDL configuration) {
|
||||
int dropAreaCount = configuration.getIntAttribute(DROP_AREA_COUNT);
|
||||
// Exception squid:S2629 - not supported by GWT
|
||||
@SuppressWarnings({ "squid:S1166", "squid:S2221", "squid:S2629" })
|
||||
void showDropTargetHints(final UIDL configuration) {
|
||||
final int dropAreaCount = configuration.getIntAttribute(DROP_AREA_COUNT);
|
||||
for (int dropAreaIndex = 0; dropAreaIndex < dropAreaCount; dropAreaIndex++) {
|
||||
try {
|
||||
String dropArea = configuration.getStringAttribute(DROP_AREA + dropAreaIndex);
|
||||
final String dropArea = configuration.getStringAttribute(DROP_AREA + dropAreaIndex);
|
||||
LOGGER.log(Level.FINE, "Hint Area: " + dropArea);
|
||||
|
||||
Element showHintFor = Document.get().getElementById(dropArea);
|
||||
final Element showHintFor = Document.get().getElementById(dropArea);
|
||||
if (showHintFor != null) {
|
||||
showHintFor.addClassName(HINT_AREA_STYLE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// log and continue
|
||||
LOGGER.log(Level.SEVERE, "Error highlighting drop targets: " + e.getLocalizedMessage());
|
||||
}
|
||||
@@ -140,20 +141,21 @@ public final class ViewComponentClientCriterion extends VAcceptCriterion {
|
||||
// Exception squid:S1166 - Hide origin exception
|
||||
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
|
||||
// Exception semantics changes
|
||||
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
|
||||
boolean isValidDropTarget(UIDL configuration) {
|
||||
// Exception squid:S2629 - not supported by GWT
|
||||
@SuppressWarnings({ "squid:S1166", "squid:S2221", "squid:S2629" })
|
||||
boolean isValidDropTarget(final UIDL configuration) {
|
||||
try {
|
||||
String dropTarget = VDragAndDropManager.get().getCurrentDropHandler().getConnector().getWidget()
|
||||
final String dropTarget = VDragAndDropManager.get().getCurrentDropHandler().getConnector().getWidget()
|
||||
.getElement().getId();
|
||||
int dropTargetCount = configuration.getIntAttribute(DROP_TARGET_COUNT);
|
||||
final int dropTargetCount = configuration.getIntAttribute(DROP_TARGET_COUNT);
|
||||
for (int dropTargetIndex = 0; dropTargetIndex < dropTargetCount; dropTargetIndex++) {
|
||||
String dropTargetPrefix = configuration.getStringAttribute(DROP_TARGET + dropTargetIndex);
|
||||
final String dropTargetPrefix = configuration.getStringAttribute(DROP_TARGET + dropTargetIndex);
|
||||
LOGGER.log(Level.FINE, "Drop Target: " + dropTargetPrefix);
|
||||
if (dropTarget.startsWith(dropTargetPrefix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// log and continue
|
||||
LOGGER.log(Level.SEVERE, "Error verifying drop target: " + e.getLocalizedMessage());
|
||||
}
|
||||
@@ -161,7 +163,7 @@ public final class ViewComponentClientCriterion extends VAcceptCriterion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
|
||||
public boolean needsServerSideCheck(final VDragEvent drag, final UIDL criterioUIDL) {
|
||||
// client-side only
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -373,9 +373,11 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
||||
if (assignedSWModule != null) {
|
||||
assignedSWModule.clear();
|
||||
}
|
||||
setSelectedBaseEntity(
|
||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()).get());
|
||||
UI.getCurrent().access(this::populateModule);
|
||||
|
||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()).ifPresent(set -> {
|
||||
setSelectedBaseEntity(set);
|
||||
UI.getCurrent().access(this::populateModule);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,8 +410,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final DistributionSet ds = distributionSetManagement
|
||||
.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()).get();
|
||||
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
|
||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId())
|
||||
.ifPresent(ds -> UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,13 +266,14 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
final String name = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
final String swVersion = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
|
||||
|
||||
final SoftwareModule softwareModule = softwareManagement.findSoftwareModuleById(softwareModuleId).get();
|
||||
if (validSoftwareModule((Long) distId, softwareModule)) {
|
||||
final Optional<SoftwareModule> softwareModule = softwareManagement.findSoftwareModuleById(softwareModuleId);
|
||||
|
||||
if (softwareModule.isPresent() && validSoftwareModule((Long) distId, softwareModule.get())) {
|
||||
final SoftwareModuleIdName softwareModuleIdName = new SoftwareModuleIdName(softwareModuleId,
|
||||
name.concat(":" + swVersion));
|
||||
publishAssignEvent((Long) distId, softwareModule);
|
||||
handleSoftwareCase(map, softwareModule, softwareModuleIdName);
|
||||
handleFirmwareCase(map, softwareModule, softwareModuleIdName);
|
||||
publishAssignEvent((Long) distId, softwareModule.get());
|
||||
handleSoftwareCase(map, softwareModule.get(), softwareModuleIdName);
|
||||
handleFirmwareCase(map, softwareModule.get(), softwareModuleIdName);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -328,14 +329,14 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
if (!isSoftwareModuleDragged(distId, sm)) {
|
||||
return false;
|
||||
}
|
||||
final DistributionSet ds = distributionSetManagement.findDistributionSetByIdWithDetails(distId).get();
|
||||
if (!validateSoftwareModule(sm, ds)) {
|
||||
final Optional<DistributionSet> ds = distributionSetManagement.findDistributionSetByIdWithDetails(distId);
|
||||
if (!ds.isPresent() || !validateSoftwareModule(sm, ds.get())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (distributionSetManagement.isDistributionSetInUse(ds.getId())) {
|
||||
notification.displayValidationError(
|
||||
i18n.get("message.error.notification.ds.target.assigned", ds.getName(), ds.getVersion()));
|
||||
if (distributionSetManagement.isDistributionSetInUse(ds.get().getId())) {
|
||||
notification.displayValidationError(i18n.get("message.error.notification.ds.target.assigned",
|
||||
ds.get().getName(), ds.get().getVersion()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -492,8 +493,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long itemId) {
|
||||
final DistributionSet ds = distributionSetManagement.findDistributionSetByIdWithDetails(itemId).get();
|
||||
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
|
||||
distributionSetManagement.findDistributionSetByIdWithDetails(itemId)
|
||||
.ifPresent(ds -> UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null)));
|
||||
}
|
||||
|
||||
private String getNameAndVerion(final Object itemId) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||
@@ -276,8 +277,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
final int deleteSWModuleTypeCount = manageDistUIState.getSelectedDeleteSWModuleTypes().size();
|
||||
for (final String swModuleTypeName : manageDistUIState.getSelectedDeleteSWModuleTypes()) {
|
||||
|
||||
softwareManagement.deleteSoftwareModuleType(
|
||||
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).get().getId());
|
||||
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
|
||||
.ifPresent(softwareManagement::deleteSoftwareModuleType);
|
||||
}
|
||||
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));
|
||||
|
||||
@@ -215,7 +215,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId()).get();
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
|
||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,8 +421,8 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long itemId) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId).get();
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
softwareManagement.findSoftwareModuleById(itemId)
|
||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
@@ -48,10 +47,10 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
|
||||
|
||||
@Override
|
||||
protected void filterClicked(final Button clickedButton) {
|
||||
final SoftwareModuleType smType = softwareManagement
|
||||
.findSoftwareModuleTypeByName(clickedButton.getData().toString()).get();
|
||||
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
|
||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
||||
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString()).ifPresent(smType -> {
|
||||
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
|
||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
@@ -199,22 +200,22 @@ public class CreateOrUpdateFilterTable extends Table {
|
||||
label.setContentMode(ContentMode.HTML);
|
||||
if (targetStatus == TargetUpdateStatus.PENDING) {
|
||||
label.setDescription("Pending");
|
||||
label.setStyleName("statusIconYellow");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
|
||||
label.setValue(FontAwesome.ADJUST.getHtml());
|
||||
} else if (targetStatus == TargetUpdateStatus.REGISTERED) {
|
||||
label.setDescription("Registered");
|
||||
label.setStyleName("statusIconLightBlue");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
|
||||
label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
|
||||
} else if (targetStatus == TargetUpdateStatus.ERROR) {
|
||||
label.setDescription(i18n.get("label.error"));
|
||||
label.setStyleName("statusIconRed");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
|
||||
label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
} else if (targetStatus == TargetUpdateStatus.IN_SYNC) {
|
||||
label.setStyleName("statusIconGreen");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
|
||||
label.setDescription("In-Synch");
|
||||
label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
} else if (targetStatus == TargetUpdateStatus.UNKNOWN) {
|
||||
label.setStyleName("statusIconBlue");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
|
||||
label.setDescription(i18n.get("label.unknown"));
|
||||
label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml());
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -162,7 +161,7 @@ public class TargetFilterTable extends Table {
|
||||
final Item row = getItem(itemId);
|
||||
final String tfName = (String) row.getItemProperty(SPUILabelDefinitions.NAME).getValue();
|
||||
final Button deleteIcon = SPUIComponentProvider.getButton(getDeleteIconId(tfName), "",
|
||||
SPUILabelDefinitions.DELETE_CUSTOM_FILTER, ValoTheme.BUTTON_TINY + " " + "redicon", true,
|
||||
SPUILabelDefinitions.DELETE_CUSTOM_FILTER, ValoTheme.BUTTON_TINY + " " + "blueicon", true,
|
||||
FontAwesome.TRASH_O, SPUIButtonStyleSmallNoBorder.class);
|
||||
deleteIcon.setData(itemId);
|
||||
deleteIcon.addClickListener(this::onDelete);
|
||||
@@ -253,12 +252,12 @@ public class TargetFilterTable extends Table {
|
||||
|
||||
private void onClickOfDetailButton(final ClickEvent event) {
|
||||
final String targetFilterName = (String) ((Button) event.getComponent()).getData();
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
|
||||
.findTargetFilterQueryByName(targetFilterName).get();
|
||||
filterManagementUIState.setFilterQueryValue(targetFilterQuery.getQuery());
|
||||
filterManagementUIState.setTfQuery(targetFilterQuery);
|
||||
filterManagementUIState.setEditViewDisplayed(true);
|
||||
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW);
|
||||
targetFilterQueryManagement.findTargetFilterQueryByName(targetFilterName).ifPresent(targetFilterQuery -> {
|
||||
filterManagementUIState.setFilterQueryValue(targetFilterQuery.getQuery());
|
||||
filterManagementUIState.setTfQuery(targetFilterQuery);
|
||||
filterManagementUIState.setEditViewDisplayed(true);
|
||||
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW);
|
||||
});
|
||||
}
|
||||
|
||||
private void populateTableData() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.layouts;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -299,15 +300,15 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
|
||||
protected Color getColorForColorPicker() {
|
||||
final Optional<TargetTag> targetTagSelected = tagManagement
|
||||
.findTargetTag(tagNameComboBox.getValue().toString());
|
||||
if (!targetTagSelected.isPresent()) {
|
||||
final DistributionSetTag distTag = tagManagement
|
||||
.findDistributionSetTag(tagNameComboBox.getValue().toString()).get();
|
||||
return distTag.getColour() != null ? ColorPickerHelper.rgbToColorConverter(distTag.getColour())
|
||||
: ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR);
|
||||
if (targetTagSelected.isPresent()) {
|
||||
return ColorPickerHelper.rgbToColorConverter(targetTagSelected.map(TargetTag::getColour)
|
||||
.filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
|
||||
}
|
||||
return targetTagSelected.get().getColour() != null
|
||||
? ColorPickerHelper.rgbToColorConverter(targetTagSelected.get().getColour())
|
||||
: ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR);
|
||||
|
||||
return ColorPickerHelper.rgbToColorConverter(tagManagement
|
||||
.findDistributionSetTag(tagNameComboBox.getValue().toString()).map(DistributionSetTag::getColour)
|
||||
.filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
|
||||
|
||||
}
|
||||
|
||||
private void tagNameChosen(final ValueChangeEvent event) {
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.management.actionhistory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ActionStatusFields;
|
||||
@@ -104,10 +105,10 @@ public class ActionHistoryTable extends TreeTable {
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEvent(final ManagementUIEvent mgmtUIEvent) {
|
||||
if (mgmtUIEvent == ManagementUIEvent.MAX_ACTION_HISTORY) {
|
||||
UI.getCurrent().access(() -> createTableContentForMax());
|
||||
UI.getCurrent().access(this::createTableContentForMax);
|
||||
}
|
||||
if (mgmtUIEvent == ManagementUIEvent.MIN_ACTION_HISTORY) {
|
||||
UI.getCurrent().access(() -> normalActionHistoryTable());
|
||||
UI.getCurrent().access(this::normalActionHistoryTable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,8 +432,12 @@ public class ActionHistoryTable extends TreeTable {
|
||||
final Long actionId = (Long) item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
|
||||
.getValue();
|
||||
|
||||
final org.eclipse.hawkbit.repository.model.Action action = deploymentManagement
|
||||
.findActionWithDetails(actionId).get();
|
||||
final Optional<Action> action = deploymentManagement.findActionWithDetails(actionId);
|
||||
|
||||
if (!action.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Pageable pageReq = new PageRequest(0, 1000,
|
||||
new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()));
|
||||
final Page<ActionStatus> actionStatusList;
|
||||
@@ -458,8 +463,9 @@ public class ActionHistoryTable extends TreeTable {
|
||||
*/
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
|
||||
action.getDistributionSet().getName() + ":" + action.getDistributionSet().getVersion());
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
|
||||
.setValue(action.get().getDistributionSet().getName() + ":"
|
||||
+ action.get().getDistributionSet().getVersion());
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
|
||||
@@ -517,7 +523,6 @@ public class ActionHistoryTable extends TreeTable {
|
||||
label.setDescription(i18n.get(mapping.getDescriptionI18N()));
|
||||
label.setStyleName(mapping.getStyleName());
|
||||
label.setValue(mapping.getIcon().getHtml());
|
||||
|
||||
return label;
|
||||
|
||||
}
|
||||
@@ -568,7 +573,7 @@ public class ActionHistoryTable extends TreeTable {
|
||||
label.setStyleName("statusIconActive");
|
||||
} else if (SPUIDefinitions.IN_ACTIVE.equals(activeValue)) {
|
||||
if (endedWithError) {
|
||||
label.setStyleName("statusIconRed");
|
||||
label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
|
||||
} else {
|
||||
label.setStyleName("statusIconNeutral");
|
||||
}
|
||||
|
||||
@@ -128,6 +128,77 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
return !isDuplicate();
|
||||
}
|
||||
|
||||
private void updateDistribution() {
|
||||
|
||||
if (isDuplicate()) {
|
||||
return;
|
||||
}
|
||||
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
||||
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
|
||||
|
||||
distributionSetManagement.findDistributionSetTypeById(distSetTypeId).ifPresent(type -> {
|
||||
final DistributionSet currentDS = distributionSetManagement.updateDistributionSet(
|
||||
entityFactory.distributionSet().update(editDistId).name(distNameTextField.getValue())
|
||||
.description(descTextArea.getValue()).version(distVersionTextField.getValue())
|
||||
.requiredMigrationStep(isMigStepReq).type(type));
|
||||
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
|
||||
new Object[] { currentDS.getName(), currentDS.getVersion() }));
|
||||
// update table row+details layout
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Distribution set.
|
||||
*/
|
||||
private void addNewDistribution() {
|
||||
editDistribution = Boolean.FALSE;
|
||||
|
||||
final String name = HawkbitCommonUtil.trimAndNullIfEmpty(distNameTextField.getValue());
|
||||
final String version = HawkbitCommonUtil.trimAndNullIfEmpty(distVersionTextField.getValue());
|
||||
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
|
||||
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
||||
|
||||
final DistributionSet newDist = distributionSetManagement.createDistributionSet(
|
||||
entityFactory.distributionSet().create().name(name).version(version).description(desc)
|
||||
.type(distributionSetManagement.findDistributionSetTypeById(distSetTypeId).get())
|
||||
.requiredMigrationStep(isMigStepReq));
|
||||
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
|
||||
|
||||
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
|
||||
new Object[] { newDist.getName(), newDist.getVersion() }));
|
||||
|
||||
distributionSetTable.setValue(Sets.newHashSet(newDist.getId()));
|
||||
}
|
||||
|
||||
private boolean isDuplicate() {
|
||||
final String name = distNameTextField.getValue();
|
||||
final String version = distVersionTextField.getValue();
|
||||
|
||||
final Optional<DistributionSet> existingDs = distributionSetManagement
|
||||
.findDistributionSetByNameAndVersion(name, version);
|
||||
/*
|
||||
* Distribution should not exists with the same name & version.
|
||||
* Display error message, when the "existingDs" is not null and it
|
||||
* is add window (or) when the "existingDs" is not null and it is
|
||||
* edit window and the distribution Id of the edit window is
|
||||
* different then the "existingDs"
|
||||
*/
|
||||
if (existingDs.isPresent() && !existingDs.get().getId().equals(editDistId)) {
|
||||
distNameTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
|
||||
distVersionTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
|
||||
notificationMessage.displayValidationError(i18n.get("message.duplicate.dist",
|
||||
new Object[] { existingDs.get().getName(), existingDs.get().getVersion() }));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
@@ -199,79 +270,6 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
return tenantMetaData.getDefaultDsType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Distribution.
|
||||
*/
|
||||
private void updateDistribution() {
|
||||
|
||||
if (isDuplicate()) {
|
||||
return;
|
||||
}
|
||||
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
||||
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
|
||||
|
||||
final DistributionSet currentDS = distributionSetManagement
|
||||
.updateDistributionSet(entityFactory.distributionSet().update(editDistId)
|
||||
.name(distNameTextField.getValue()).description(descTextArea.getValue())
|
||||
.version(distVersionTextField.getValue()).requiredMigrationStep(isMigStepReq)
|
||||
.type(distributionSetManagement.findDistributionSetTypeById(distSetTypeId).get()));
|
||||
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
|
||||
new Object[] { currentDS.getName(), currentDS.getVersion() }));
|
||||
// update table row+details layout
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Distribution set.
|
||||
*/
|
||||
private void addNewDistribution() {
|
||||
editDistribution = Boolean.FALSE;
|
||||
|
||||
final String name = HawkbitCommonUtil.trimAndNullIfEmpty(distNameTextField.getValue());
|
||||
final String version = HawkbitCommonUtil.trimAndNullIfEmpty(distVersionTextField.getValue());
|
||||
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
|
||||
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
|
||||
|
||||
final DistributionSet newDist = distributionSetManagement.createDistributionSet(
|
||||
entityFactory.distributionSet().create().name(name).version(version).description(desc)
|
||||
.type(distributionSetManagement.findDistributionSetTypeById(distSetTypeId).get())
|
||||
.requiredMigrationStep(isMigStepReq));
|
||||
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
|
||||
|
||||
notificationMessage.displaySuccess(
|
||||
i18n.get("message.new.dist.save.success", new Object[] { newDist.getName(), newDist.getVersion() }));
|
||||
|
||||
distributionSetTable.setValue(Sets.newHashSet(newDist.getId()));
|
||||
}
|
||||
|
||||
private boolean isDuplicate() {
|
||||
final String name = distNameTextField.getValue();
|
||||
final String version = distVersionTextField.getValue();
|
||||
|
||||
final Optional<DistributionSet> existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name,
|
||||
version);
|
||||
/*
|
||||
* Distribution should not exists with the same name & version. Display
|
||||
* error message, when the "existingDs" is not null and it is add window
|
||||
* (or) when the "existingDs" is not null and it is edit window and the
|
||||
* distribution Id of the edit window is different then the "existingDs"
|
||||
*/
|
||||
if (existingDs.isPresent() && !existingDs.get().getId().equals(editDistId)) {
|
||||
distNameTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
|
||||
distVersionTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
|
||||
notificationMessage.displayValidationError(i18n.get("message.duplicate.dist",
|
||||
new Object[] { existingDs.get().getName(), existingDs.get().getVersion() }));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* clear all the fields.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
@@ -150,12 +149,10 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
prxyTarget.setInstalledDistributionSet(null);
|
||||
prxyTarget.setAssignedDistributionSet(null);
|
||||
} else {
|
||||
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId())
|
||||
.get();
|
||||
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
|
||||
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
|
||||
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
|
||||
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
|
||||
getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId()).ifPresent(target -> {
|
||||
prxyTarget.setInstalledDistributionSet(target.getTargetInfo().getInstalledDistributionSet());
|
||||
prxyTarget.setAssignedDistributionSet(target.getAssignedDistributionSet());
|
||||
});
|
||||
}
|
||||
|
||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
|
||||
|
||||
protected void addAlreadySelectedTags() {
|
||||
for (final String tagName : managementUIState.getTargetTableFilters().getBulkUpload().getAssignedTagNames()) {
|
||||
addNewToken(tagManagement.findTargetTag(tagName).get().getId());
|
||||
tagManagement.findTargetTag(tagName).map(TargetTag::getId).ifPresent(this::addNewToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -153,7 +154,8 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
if (isFilterEnabled()) {
|
||||
refreshTargets();
|
||||
} else {
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId())).filter(
|
||||
event -> !Objects.isNull(event.getEntity()) && !Objects.isNull(event.getEntity().getTargetInfo()))
|
||||
.forEach(event -> updateVisibleItemOnEvent(event.getEntity().getTargetInfo()));
|
||||
}
|
||||
publishTargetSelectedEntityForRefresh(eventContainer.getEvents().stream());
|
||||
@@ -468,7 +470,9 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
private void resetPinStyle(final Button pinBtn) {
|
||||
pinBtn.removeStyleName(TARGET_PINNED);
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
|
||||
HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, pinBtn.getData());
|
||||
final TargetIdName targetIdname = (TargetIdName) pinBtn.getData();
|
||||
|
||||
HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, targetIdname.getTargetId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.management.targettag;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
@@ -51,10 +50,11 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
|
||||
|
||||
@Override
|
||||
protected void filterClicked(final Button clickedButton) {
|
||||
final TargetFilterQuery targetFilterQuery = this.targetFilterQueryManagement
|
||||
.findTargetFilterQueryById((Long) clickedButton.getData()).get();
|
||||
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery.getId());
|
||||
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
|
||||
targetFilterQueryManagement.findTargetFilterQueryById((Long) clickedButton.getData())
|
||||
.ifPresent(targetFilterQuery -> {
|
||||
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery.getId());
|
||||
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
|
||||
});
|
||||
}
|
||||
|
||||
protected void processButtonClick(final ClickEvent event) {
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
@@ -68,14 +67,14 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DelayedEventBusPushStrategy.class);
|
||||
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final BlockingDeque<org.eclipse.hawkbit.repository.event.TenantAwareEvent> queue = new LinkedBlockingDeque<>(
|
||||
BLOCK_SIZE);
|
||||
private final BlockingDeque<TenantAwareEvent> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final EventBus.UIEventBus eventBus;
|
||||
private final UIEventProvider eventProvider;
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
private final long delay;
|
||||
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
private UI vaadinUI;
|
||||
|
||||
/**
|
||||
@@ -248,7 +247,6 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public void onApplicationEvent(final ApplicationEvent applicationEvent) {
|
||||
if (!(applicationEvent instanceof org.eclipse.hawkbit.repository.event.TenantAwareEvent)) {
|
||||
return;
|
||||
@@ -274,7 +272,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
|
||||
private void offerEvent(final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
||||
if (!queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
LOG.trace("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,25 +280,23 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
Long rolloutId = null;
|
||||
Long rolloutGroupId = null;
|
||||
if (event instanceof ActionCreatedEvent) {
|
||||
rolloutId = getRolloutId(((ActionCreatedEvent) event).getEntity().getRollout());
|
||||
rolloutGroupId = getRolloutGroupId(((ActionCreatedEvent) event).getEntity().getRolloutGroup());
|
||||
rolloutId = ((ActionCreatedEvent) event).getRolloutId();
|
||||
rolloutGroupId = ((ActionCreatedEvent) event).getRolloutGroupId();
|
||||
} else if (event instanceof ActionUpdatedEvent) {
|
||||
rolloutId = getRolloutId(((ActionUpdatedEvent) event).getEntity().getRollout());
|
||||
rolloutGroupId = getRolloutGroupId(((ActionUpdatedEvent) event).getEntity().getRolloutGroup());
|
||||
rolloutId = ((ActionUpdatedEvent) event).getRolloutId();
|
||||
rolloutGroupId = ((ActionUpdatedEvent) event).getRolloutGroupId();
|
||||
} else if (event instanceof RolloutUpdatedEvent) {
|
||||
rolloutId = ((RolloutUpdatedEvent) event).getEntityId();
|
||||
} else if (event instanceof RolloutGroupCreatedEvent) {
|
||||
rolloutId = ((RolloutGroupCreatedEvent) event).getRolloutId();
|
||||
rolloutGroupId = ((RolloutGroupCreatedEvent) event).getEntityId();
|
||||
} else if (event instanceof RolloutGroupUpdatedEvent) {
|
||||
final RolloutGroup rolloutGroup = ((RolloutGroupUpdatedEvent) event).getEntity();
|
||||
rolloutId = rolloutGroup.getRollout().getId();
|
||||
rolloutGroupId = rolloutGroup.getId();
|
||||
}
|
||||
|
||||
if (rolloutId == null) {
|
||||
rolloutId = ((RolloutGroupUpdatedEvent) event).getRolloutId();
|
||||
rolloutGroupId = ((RolloutGroupUpdatedEvent) event).getEntityId();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
offerEventIfNotContains(new RolloutChangeEvent(event.getTenant(), rolloutId));
|
||||
|
||||
if (rolloutGroupId != null) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.RolloutDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
@@ -37,7 +38,7 @@ import com.google.common.collect.Maps;
|
||||
*/
|
||||
public class HawkbitEventProvider implements UIEventProvider {
|
||||
|
||||
private static final Map<Class<? extends TenantAwareEvent>, Class<?>> EVENTS = Maps.newHashMapWithExpectedSize(15);
|
||||
private static final Map<Class<? extends TenantAwareEvent>, Class<?>> EVENTS = Maps.newHashMapWithExpectedSize(19);
|
||||
|
||||
static {
|
||||
|
||||
@@ -60,6 +61,7 @@ public class HawkbitEventProvider implements UIEventProvider {
|
||||
|
||||
EVENTS.put(RolloutGroupChangeEvent.class, RolloutGroupChangeEventContainer.class);
|
||||
EVENTS.put(RolloutChangeEvent.class, RolloutChangeEventContainer.class);
|
||||
EVENTS.put(RolloutDeletedEvent.class, RolloutDeletedEventContainer.class);
|
||||
|
||||
EVENTS.put(SoftwareModuleCreatedEvent.class, SoftwareModuleCreatedEventContainer.class);
|
||||
EVENTS.put(SoftwareModuleDeletedEvent.class, SoftwareModuleDeletedEventContainer.class);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.RolloutDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link RolloutDeletedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class RolloutDeletedEventContainer implements EventContainer<RolloutDeletedEvent> {
|
||||
private final List<RolloutDeletedEvent> events;
|
||||
|
||||
RolloutDeletedEventContainer(final List<RolloutDeletedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RolloutDeletedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.rollout;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@@ -16,6 +18,7 @@ import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
@@ -59,6 +62,8 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
|
||||
private final RolloutUIState rolloutUIState;
|
||||
|
||||
private final transient RolloutManagement rolloutManagement;
|
||||
|
||||
private final transient EventBus.UIEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
@@ -68,6 +73,7 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
final UINotification uiNotification, final UiProperties uiProperties, final EntityFactory entityFactory,
|
||||
final I18N i18n, final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||
this.permChecker = permissionChecker;
|
||||
this.rolloutManagement = rolloutManagement;
|
||||
this.rolloutListView = new RolloutListView(permissionChecker, rolloutUIState, eventBus, rolloutManagement,
|
||||
targetManagement, uiNotification, uiProperties, entityFactory, i18n, targetFilterQueryManagement);
|
||||
this.rolloutGroupsListView = new RolloutGroupsListView(i18n, eventBus, rolloutGroupManagement, rolloutUIState,
|
||||
@@ -124,6 +130,11 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
}
|
||||
|
||||
private void showRolloutGroupTargetsListView() {
|
||||
if (isRolloutDeleted()) {
|
||||
showRolloutListView();
|
||||
return;
|
||||
}
|
||||
|
||||
rolloutGroupTargetsListView.setVisible(true);
|
||||
if (rolloutListView.isVisible()) {
|
||||
rolloutListView.setVisible(false);
|
||||
@@ -132,10 +143,15 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
rolloutGroupsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutGroupTargetsListView);
|
||||
setExpandRatio(rolloutGroupTargetsListView, 1.0f);
|
||||
setExpandRatio(rolloutGroupTargetsListView, 1.0F);
|
||||
}
|
||||
|
||||
private void showRolloutGroupListView() {
|
||||
if (isRolloutDeleted()) {
|
||||
showRolloutListView();
|
||||
return;
|
||||
}
|
||||
|
||||
rolloutGroupsListView.setVisible(true);
|
||||
if (rolloutListView.isVisible()) {
|
||||
rolloutListView.setVisible(false);
|
||||
@@ -144,7 +160,16 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
rolloutGroupTargetsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutGroupsListView);
|
||||
setExpandRatio(rolloutGroupsListView, 1.0f);
|
||||
setExpandRatio(rolloutGroupsListView, 1.0F);
|
||||
}
|
||||
|
||||
private boolean isRolloutDeleted() {
|
||||
if (!rolloutUIState.getRolloutId().isPresent()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Optional<Rollout> rollout = rolloutManagement.findRolloutById(rolloutUIState.getRolloutId().get());
|
||||
return !rollout.isPresent() || rollout.get().isDeleted();
|
||||
}
|
||||
|
||||
private void showRolloutListView() {
|
||||
@@ -156,7 +181,7 @@ public class RolloutView extends VerticalLayout implements View {
|
||||
rolloutGroupTargetsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutListView);
|
||||
setExpandRatio(rolloutListView, 1.0f);
|
||||
setExpandRatio(rolloutListView, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -23,6 +24,7 @@ import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutGroupCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.RolloutUpdate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
@@ -56,6 +58,8 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
@@ -89,6 +93,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
|
||||
private static final long serialVersionUID = 2999293468801479916L;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AddUpdateRolloutWindowLayout.class);
|
||||
|
||||
private static final String MESSAGE_ROLLOUT_FIELD_VALUE_RANGE = "message.rollout.field.value.range";
|
||||
|
||||
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
|
||||
@@ -201,6 +207,131 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
}
|
||||
return duplicateCheck();
|
||||
}
|
||||
|
||||
private void createRollout() {
|
||||
final Rollout rolloutToCreate = saveRollout();
|
||||
uiNotification.displaySuccess(i18n.get("message.save.success", rolloutToCreate.getName()));
|
||||
}
|
||||
|
||||
private boolean duplicateCheck() {
|
||||
if (rolloutManagement.findRolloutByName(getRolloutName()).isPresent()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", getRolloutName()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void editRollout() {
|
||||
if (rollout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Long distributionSetId = (Long) distributionSet.getValue();
|
||||
|
||||
final RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId())
|
||||
.name(rolloutName.getValue()).description(description.getValue()).set(distributionSetId)
|
||||
.actionType(getActionType()).forcedTime(getForcedTimeStamp());
|
||||
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) {
|
||||
rolloutUpdate.startAt(System.currentTimeMillis());
|
||||
}
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) {
|
||||
rolloutUpdate.startAt(getScheduledStartTime());
|
||||
}
|
||||
|
||||
Rollout updatedRollout;
|
||||
try {
|
||||
updatedRollout = rolloutManagement.updateRollout(rolloutUpdate);
|
||||
} catch (final EntityNotFoundException e) {
|
||||
LOGGER.warn("Rollout was deleted. Redirect to Rollouts overview.", e);
|
||||
uiNotification.displayWarning(
|
||||
"Rollout with name " + rolloutName.getValue() + " was deleted. Update is not poosible");
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||
return;
|
||||
}
|
||||
|
||||
uiNotification.displaySuccess(i18n.get("message.update.success", updatedRollout.getName()));
|
||||
eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT);
|
||||
}
|
||||
|
||||
private boolean duplicateCheckForEdit() {
|
||||
final String rolloutNameVal = getRolloutName();
|
||||
if (!rollout.getName().equals(rolloutNameVal)
|
||||
&& rolloutManagement.findRolloutByName(rolloutNameVal).isPresent()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", rolloutNameVal));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getRolloutName() {
|
||||
return HawkbitCommonUtil.trimAndNullIfEmpty(rolloutName.getValue());
|
||||
}
|
||||
|
||||
private Rollout saveRollout() {
|
||||
|
||||
final Long distributionId = (Long) distributionSet.getValue();
|
||||
|
||||
final int amountGroup = Integer.parseInt(noOfGroups.getValue());
|
||||
final int errorThresholdPercent = getErrorThresholdPercentage(amountGroup);
|
||||
final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder()
|
||||
.successAction(RolloutGroupSuccessAction.NEXTGROUP, null)
|
||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue())
|
||||
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, String.valueOf(errorThresholdPercent))
|
||||
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
||||
|
||||
final RolloutCreate rolloutCreate = entityFactory.rollout().create().name(rolloutName.getValue())
|
||||
.description(description.getValue()).set(distributionId).targetFilterQuery(getTargetFilterQuery())
|
||||
.actionType(getActionType()).forcedTime(getForcedTimeStamp());
|
||||
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) {
|
||||
rolloutCreate.startAt(System.currentTimeMillis());
|
||||
}
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) {
|
||||
rolloutCreate.startAt(getScheduledStartTime());
|
||||
}
|
||||
|
||||
if (isNumberOfGroups()) {
|
||||
return rolloutManagement.createRollout(rolloutCreate, amountGroup, conditions);
|
||||
} else if (isGroupsDefinition()) {
|
||||
final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups();
|
||||
return rolloutManagement.createRollout(rolloutCreate, groups, conditions);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Either of the Tabs must be selected");
|
||||
}
|
||||
|
||||
private long getForcedTimeStamp() {
|
||||
return ActionTypeOption.AUTO_FORCED
|
||||
.equals(actionTypeOptionGroupLayout.getActionTypeOptionGroup().getValue())
|
||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||
: RepositoryModelConstants.NO_FORCE_TIME;
|
||||
}
|
||||
|
||||
private Long getScheduledStartTime() {
|
||||
return AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())
|
||||
? autoStartOptionGroupLayout.getStartAtDateField().getValue().getTime() : null;
|
||||
}
|
||||
|
||||
private int getErrorThresholdPercentage(final int amountGroup) {
|
||||
int errorThresoldPercent = Integer.parseInt(errorThreshold.getValue());
|
||||
if (errorThresholdOptionGroup.getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
|
||||
final int groupSize = (int) Math.ceil((double) totalTargetsCount / (double) amountGroup);
|
||||
final int erroThresoldCount = Integer.parseInt(errorThreshold.getValue());
|
||||
errorThresoldPercent = (int) Math.ceil(((float) erroThresoldCount / (float) groupSize) * 100);
|
||||
}
|
||||
return errorThresoldPercent;
|
||||
}
|
||||
|
||||
private ActionType getActionType() {
|
||||
return ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||
.getActionTypeOptionGroup().getValue()).getActionType();
|
||||
}
|
||||
|
||||
private AutoStartOptionGroupLayout.AutoStartOption getAutoStartOption() {
|
||||
return (AutoStartOptionGroupLayout.AutoStartOption) autoStartOptionGroupLayout.getAutoStartOptionGroup()
|
||||
.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
CommonDialogWindow getWindow(final Long rolloutId, final boolean copy) {
|
||||
@@ -244,6 +375,9 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
noOfGroups.setVisible(true);
|
||||
removeComponent(1, 2);
|
||||
addComponent(targetFilterQueryCombo, 1, 2);
|
||||
addGroupsLegendLayout();
|
||||
addGroupsDefinitionTabs();
|
||||
|
||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||
autoStartOptionGroupLayout.selectDefaultOption();
|
||||
totalTargetsCount = 0L;
|
||||
@@ -252,6 +386,18 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
groupsDefinitionTabs.setSelectedTab(0);
|
||||
}
|
||||
|
||||
private void addGroupsDefinitionTabs() {
|
||||
if (getComponent(0, 6) == null) {
|
||||
addComponent(groupsDefinitionTabs, 0, 6, 3, 6);
|
||||
}
|
||||
}
|
||||
|
||||
private void addGroupsLegendLayout() {
|
||||
if (getComponent(3, 0) == null) {
|
||||
addComponent(groupsLegendLayout, 3, 0, 3, 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetFields() {
|
||||
rolloutName.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
noOfGroups.clear();
|
||||
@@ -497,7 +643,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
} else {
|
||||
updateGroupsChart(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +689,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
groupsPieChart.setChartState(groups, totalTargetsCount);
|
||||
groupsLegendLayout.populateGroupsLegendByTargetCounts(groups);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ComboBox createTargetFilterQueryCombo() {
|
||||
@@ -583,7 +727,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
|
||||
targetFilterQueryCombo.setValue(filterQuery.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Container createTargetFilterComboContainer() {
|
||||
@@ -594,99 +737,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
targetFilterQF);
|
||||
}
|
||||
|
||||
private void editRollout() {
|
||||
if (rollout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Long distributionSetId = (Long) distributionSet.getValue();
|
||||
|
||||
final RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId()).name(rolloutName.getValue())
|
||||
.description(description.getValue()).set(distributionSetId).actionType(getActionType())
|
||||
.forcedTime(getForcedTimeStamp());
|
||||
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) {
|
||||
rolloutUpdate.startAt(System.currentTimeMillis());
|
||||
}
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) {
|
||||
rolloutUpdate.startAt(getScheduledStartTime());
|
||||
}
|
||||
|
||||
final Rollout updatedRollout = rolloutManagement.updateRollout(rolloutUpdate);
|
||||
|
||||
uiNotification.displaySuccess(i18n.get("message.update.success", updatedRollout.getName()));
|
||||
eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT);
|
||||
}
|
||||
|
||||
private boolean duplicateCheckForEdit() {
|
||||
final String rolloutNameVal = getRolloutName();
|
||||
if (!rollout.getName().equals(rolloutNameVal)
|
||||
&& rolloutManagement.findRolloutByName(rolloutNameVal).isPresent()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", rolloutNameVal));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private long getForcedTimeStamp() {
|
||||
return ActionTypeOption.AUTO_FORCED.equals(actionTypeOptionGroupLayout.getActionTypeOptionGroup().getValue())
|
||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||
: RepositoryModelConstants.NO_FORCE_TIME;
|
||||
}
|
||||
|
||||
private Long getScheduledStartTime() {
|
||||
return AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())
|
||||
? autoStartOptionGroupLayout.getStartAtDateField().getValue().getTime() : null;
|
||||
}
|
||||
|
||||
private AutoStartOptionGroupLayout.AutoStartOption getAutoStartOption() {
|
||||
return (AutoStartOptionGroupLayout.AutoStartOption) autoStartOptionGroupLayout.getAutoStartOptionGroup()
|
||||
.getValue();
|
||||
}
|
||||
|
||||
private ActionType getActionType() {
|
||||
return ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
|
||||
.getValue()).getActionType();
|
||||
}
|
||||
|
||||
private void createRollout() {
|
||||
final Rollout rolloutToCreate = saveRollout();
|
||||
uiNotification.displaySuccess(i18n.get("message.save.success", rolloutToCreate.getName()));
|
||||
}
|
||||
|
||||
private Rollout saveRollout() {
|
||||
|
||||
final Long distributionId = (Long) distributionSet.getValue();
|
||||
|
||||
final int amountGroup = Integer.parseInt(noOfGroups.getValue());
|
||||
final int errorThresholdPercent = getErrorThresholdPercentage(amountGroup);
|
||||
final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder()
|
||||
.successAction(RolloutGroupSuccessAction.NEXTGROUP, null)
|
||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue())
|
||||
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, String.valueOf(errorThresholdPercent))
|
||||
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
||||
|
||||
final RolloutCreate rolloutCreate = entityFactory.rollout().create().name(rolloutName.getValue())
|
||||
.description(description.getValue()).set(distributionId).targetFilterQuery(getTargetFilterQuery())
|
||||
.actionType(getActionType()).forcedTime(getForcedTimeStamp());
|
||||
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) {
|
||||
rolloutCreate.startAt(System.currentTimeMillis());
|
||||
}
|
||||
if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) {
|
||||
rolloutCreate.startAt(getScheduledStartTime());
|
||||
}
|
||||
|
||||
if (isNumberOfGroups()) {
|
||||
return rolloutManagement.createRollout(rolloutCreate, amountGroup, conditions);
|
||||
} else if (isGroupsDefinition()) {
|
||||
final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups();
|
||||
return rolloutManagement.createRollout(rolloutCreate, groups, conditions);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Either of the Tabs must be selected");
|
||||
}
|
||||
|
||||
private String getTargetFilterQuery() {
|
||||
if (null != targetFilterQueryCombo.getValue()
|
||||
&& HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) {
|
||||
@@ -697,24 +747,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getErrorThresholdPercentage(final int amountGroup) {
|
||||
int errorThresoldPercent = Integer.parseInt(errorThreshold.getValue());
|
||||
if (errorThresholdOptionGroup.getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
|
||||
final int groupSize = (int) Math.ceil((double) totalTargetsCount / (double) amountGroup);
|
||||
final int erroThresoldCount = Integer.parseInt(errorThreshold.getValue());
|
||||
errorThresoldPercent = (int) Math.ceil(((float) erroThresoldCount / (float) groupSize) * 100);
|
||||
}
|
||||
return errorThresoldPercent;
|
||||
}
|
||||
|
||||
private boolean duplicateCheck() {
|
||||
if (rolloutManagement.findRolloutByName(getRolloutName()).isPresent()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", getRolloutName()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setDefaultSaveStartGroupOption() {
|
||||
errorThresholdOptionGroup.setValue(ERRORTHRESOLDOPTIONS.PERCENT.getValue());
|
||||
}
|
||||
@@ -795,10 +827,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
return rolloutNameField;
|
||||
}
|
||||
|
||||
private String getRolloutName() {
|
||||
return HawkbitCommonUtil.trimAndNullIfEmpty(rolloutName.getValue());
|
||||
}
|
||||
|
||||
class ErrorThresoldOptionValidator implements Validator {
|
||||
private static final long serialVersionUID = 9049939751976326550L;
|
||||
|
||||
@@ -855,7 +883,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
return;
|
||||
}
|
||||
|
||||
rollout = rolloutManagement.findRolloutById(rolloutId).get();
|
||||
final Optional<Rollout> rolloutFound = rolloutManagement.findRolloutById(rolloutId);
|
||||
if (!rolloutFound.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rollout = rolloutFound.get();
|
||||
description.setValue(rollout.getDescription());
|
||||
distributionSet.setValue(rollout.getDistributionSet().getId());
|
||||
setActionType(rollout);
|
||||
@@ -869,7 +902,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
groupsDefinitionTabs.setSelectedTab(1);
|
||||
|
||||
window.clearOriginalValues();
|
||||
|
||||
} else {
|
||||
editRolloutEnabled = true;
|
||||
if (rollout.getStatus() != Rollout.RolloutStatus.READY) {
|
||||
@@ -884,6 +916,10 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
addComponent(targetFilterQuery, 1, 2);
|
||||
targetFilterQuery.addValidator(nullValidator);
|
||||
|
||||
removeComponent(defineGroupsLayout);
|
||||
removeComponent(groupsDefinitionTabs);
|
||||
|
||||
window.updateAllComponents(this);
|
||||
window.setOrginaleValues();
|
||||
|
||||
updateGroupsChart(rollout.getRolloutGroups(), rollout.getTotalTargets());
|
||||
@@ -955,12 +991,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
private String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,15 +24,13 @@ import com.vaadin.server.FontAwesome;
|
||||
*/
|
||||
public class ProxyRollout {
|
||||
|
||||
private static final long serialVersionUID = 4539849939617681918L;
|
||||
|
||||
private String distributionSetNameVersion;
|
||||
|
||||
private String createdDate;
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
private Long numberOfGroups;
|
||||
private Integer numberOfGroups;
|
||||
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
@@ -151,7 +149,7 @@ public class ProxyRollout {
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
public Integer getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
|
||||
@@ -159,7 +157,7 @@ public class ProxyRollout {
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
public void setNumberOfGroups(final Integer numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
@@ -51,8 +50,6 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient TargetFilterQueryManagement filterQueryManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
/**
|
||||
@@ -95,18 +92,18 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
@Override
|
||||
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<Rollout> rolloutBeans;
|
||||
final PageRequest pageRequest = new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE,
|
||||
SPUIDefinitions.PAGE_SIZE, sort);
|
||||
if (Strings.isNullOrEmpty(searchText)) {
|
||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(pageRequest, false);
|
||||
} else {
|
||||
rolloutBeans = getRolloutManagement().findRolloutWithDetailedStatusByFilters(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
||||
searchText);
|
||||
rolloutBeans = getRolloutManagement().findRolloutWithDetailedStatusByFilters(pageRequest, searchText,
|
||||
false);
|
||||
}
|
||||
return getProxyRolloutList(rolloutBeans);
|
||||
}
|
||||
|
||||
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||
private static List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
||||
for (final Rollout rollout : rolloutBeans) {
|
||||
final ProxyRollout proxyRollout = new ProxyRollout();
|
||||
@@ -116,7 +113,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
proxyRollout.setDistributionSetNameVersion(
|
||||
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||
proxyRollout.setDistributionSet(distributionSet);
|
||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
proxyRollout.setNumberOfGroups(Integer.valueOf(rollout.getRolloutGroups().size()));
|
||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||
proxyRollout.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rollout));
|
||||
@@ -139,13 +136,6 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
return proxyRolloutList;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
||||
* .util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1,
|
||||
final List<ProxyRollout> arg2) {
|
||||
@@ -163,30 +153,14 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
private RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the filterQueryManagement
|
||||
*/
|
||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||
if (null == filterQueryManagement) {
|
||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||
}
|
||||
return filterQueryManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
private RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,10 @@ import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
@@ -43,15 +45,18 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||
import org.eclipse.hawkbit.ui.push.RolloutChangeEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.RolloutDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
@@ -70,7 +75,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.data.util.converter.Converter;
|
||||
@@ -84,7 +88,7 @@ import com.vaadin.ui.renderers.HtmlRenderer;
|
||||
*/
|
||||
public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private static final long serialVersionUID = 4060904914954370524L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String UPDATE_OPTION = "Update";
|
||||
|
||||
@@ -94,6 +98,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private static final String RUN_OPTION = "Run";
|
||||
|
||||
private static final String DELETE_OPTION = "Delete";
|
||||
|
||||
private static final String DS_TYPE = "type";
|
||||
|
||||
private static final String SW_MODULES = "swModules";
|
||||
@@ -128,6 +134,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
statusIconMap.put(RolloutStatus.ERROR_STARTING,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
statusIconMap.put(RolloutStatus.DELETING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_RED));
|
||||
}
|
||||
|
||||
RolloutListGrid(final I18N i18n, final UIEventBus eventBus, final RolloutManagement rolloutManagement,
|
||||
@@ -161,39 +168,58 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the RolloutDeletedEvent to refresh the grid.
|
||||
*
|
||||
* @param eventContainer
|
||||
* container which holds the rollout delete event
|
||||
*/
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
public void onRolloutDeletedEvent(final RolloutDeletedEventContainer eventContainer) {
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the RolloutChangeEvent to refresh the item in the grid.
|
||||
*
|
||||
* @param eventContainer
|
||||
* container which holds the rollout change event
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
public void onRolloutChangeEvent(final RolloutChangeEventContainer eventContainer) {
|
||||
eventContainer.getEvents().forEach(this::handleEvent);
|
||||
}
|
||||
|
||||
private void handleEvent(final RolloutChangeEvent rolloutChangeEvent) {
|
||||
if (!rolloutUIState.isShowRollOuts()) {
|
||||
if (!rolloutUIState.isShowRollOuts() || rolloutChangeEvent.getRolloutId() == null) {
|
||||
return;
|
||||
}
|
||||
final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId())
|
||||
.get();
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus();
|
||||
final Optional<Rollout> rollout = rolloutManagement
|
||||
.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId());
|
||||
|
||||
if (!rollout.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
|
||||
if (item == null) {
|
||||
refreshContainer();
|
||||
return;
|
||||
}
|
||||
updateItem(rollout.get(), item);
|
||||
}
|
||||
|
||||
private void updateItem(final Rollout rollout, final Item item) {
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus();
|
||||
item.getItemProperty(VAR_STATUS).setValue(rollout.getStatus());
|
||||
item.getItemProperty(VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus);
|
||||
final Long groupCount = (Long) item.getItemProperty(VAR_NUMBER_OF_GROUPS).getValue();
|
||||
final Integer groupCount = (Integer) item.getItemProperty(VAR_NUMBER_OF_GROUPS).getValue();
|
||||
final int groupsCreated = rollout.getRolloutGroupsCreated();
|
||||
if (groupsCreated != 0) {
|
||||
item.getItemProperty(VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(groupsCreated));
|
||||
} else if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
||||
item.getItemProperty(VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
item.getItemProperty(VAR_NUMBER_OF_GROUPS).setValue(Integer.valueOf(groupsCreated));
|
||||
} else if (rollout.getRolloutGroups() != null && !groupCount.equals(rollout.getRolloutGroups().size())) {
|
||||
item.getItemProperty(VAR_NUMBER_OF_GROUPS).setValue(Integer.valueOf(rollout.getRolloutGroups().size()));
|
||||
}
|
||||
item.getItemProperty(ROLLOUT_RENDERER_DATA)
|
||||
.setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||
@@ -221,13 +247,12 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
rolloutGridContainer.addContainerProperty(VAR_MODIFIED_DATE, String.class, null, false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_CREATED_USER, String.class, null, false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_MODIFIED_BY, String.class, null, false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_NUMBER_OF_GROUPS, Long.class, 0, false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_NUMBER_OF_GROUPS, Integer.class, 0, false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_TOTAL_TARGETS, String.class, "0", false, false);
|
||||
rolloutGridContainer.addContainerProperty(VAR_TOTAL_TARGETS_COUNT_STATUS, TotalTargetCountStatus.class, null,
|
||||
false, false);
|
||||
|
||||
rolloutGridContainer.addContainerProperty(RUN_OPTION, String.class, FontAwesome.PLAY.getHtml(), false, false);
|
||||
|
||||
rolloutGridContainer.addContainerProperty(PAUSE_OPTION, String.class, FontAwesome.PAUSE.getHtml(), false,
|
||||
false);
|
||||
|
||||
@@ -239,6 +264,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
rolloutGridContainer.addContainerProperty(COPY_OPTION, String.class, FontAwesome.COPY.getHtml(), false,
|
||||
false);
|
||||
}
|
||||
rolloutGridContainer.addContainerProperty(DELETE_OPTION, String.class, FontAwesome.TRASH_O.getHtml(), false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -267,15 +294,17 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
if (permissionChecker.hasRolloutUpdatePermission()) {
|
||||
getColumn(UPDATE_OPTION).setMinimumWidth(25);
|
||||
getColumn(UPDATE_OPTION).setMaximumWidth(40);
|
||||
} else {
|
||||
getColumn(PAUSE_OPTION).setMaximumWidth(60);
|
||||
getColumn(UPDATE_OPTION).setMaximumWidth(25);
|
||||
}
|
||||
|
||||
if (permissionChecker.hasRolloutCreatePermission()) {
|
||||
getColumn(COPY_OPTION).setMinimumWidth(25);
|
||||
getColumn(COPY_OPTION).setMaximumWidth(25);
|
||||
}
|
||||
|
||||
getColumn(DELETE_OPTION).setMinimumWidth(25);
|
||||
getColumn(DELETE_OPTION).setMaximumWidth(40);
|
||||
|
||||
getColumn(VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||
}
|
||||
|
||||
@@ -302,17 +331,27 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
if (permissionChecker.hasRolloutUpdatePermission()) {
|
||||
getColumn(UPDATE_OPTION).setHeaderCaption(i18n.get("header.action.update"));
|
||||
}
|
||||
|
||||
if (permissionChecker.hasRolloutCreatePermission()) {
|
||||
getColumn(COPY_OPTION).setHeaderCaption(i18n.get("header.action.copy"));
|
||||
}
|
||||
|
||||
HeaderCell join;
|
||||
if (permissionChecker.hasRolloutUpdatePermission()) {
|
||||
join = getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION, UPDATE_OPTION, COPY_OPTION);
|
||||
} else {
|
||||
join = getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION);
|
||||
getColumn(DELETE_OPTION).setHeaderCaption(i18n.get("header.action.delete"));
|
||||
|
||||
joinColumns().setText(i18n.get("header.action"));
|
||||
}
|
||||
|
||||
private HeaderCell joinColumns() {
|
||||
if (permissionChecker.hasRolloutUpdatePermission() && permissionChecker.hasRolloutCreatePermission()) {
|
||||
return getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION, UPDATE_OPTION, COPY_OPTION, DELETE_OPTION);
|
||||
}
|
||||
join.setText(i18n.get("header.action"));
|
||||
if (permissionChecker.hasRolloutUpdatePermission()) {
|
||||
return getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION, UPDATE_OPTION, DELETE_OPTION);
|
||||
}
|
||||
if (permissionChecker.hasRolloutCreatePermission()) {
|
||||
return getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION, COPY_OPTION, DELETE_OPTION);
|
||||
}
|
||||
return getDefaultHeaderRow().join(RUN_OPTION, PAUSE_OPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -342,6 +381,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
if (permissionChecker.hasRolloutCreatePermission()) {
|
||||
columnList.add(COPY_OPTION);
|
||||
}
|
||||
columnList.add(DELETE_OPTION);
|
||||
|
||||
columnList.add(VAR_CREATED_DATE);
|
||||
columnList.add(VAR_CREATED_USER);
|
||||
@@ -401,6 +441,9 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
.setRenderer(new HtmlButtonRenderer(clickEvent -> copyRollout((Long) clickEvent.getItemId())));
|
||||
}
|
||||
|
||||
getColumn(DELETE_OPTION)
|
||||
.setRenderer(new HtmlButtonRenderer(clickEvent -> deleteRollout((Long) clickEvent.getItemId())));
|
||||
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
@@ -466,6 +509,44 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void deleteRollout(final Long rolloutId) {
|
||||
final Optional<Rollout> rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutId);
|
||||
|
||||
if (!rollout.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String formattedConfirmationQuestion = getConfirmationQuestion(rollout.get());
|
||||
final ConfirmationDialog confirmationDialog = new ConfirmationDialog(i18n.get("caption.confirm.delete.rollout"),
|
||||
formattedConfirmationQuestion, i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
final Item row = getContainerDataSource().getItem(rolloutId);
|
||||
final String rolloutName = (String) row.getItemProperty(VAR_NAME).getValue();
|
||||
rolloutManagement.deleteRollout(rolloutId);
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.deleted", rolloutName));
|
||||
});
|
||||
UI.getCurrent().addWindow(confirmationDialog.getWindow());
|
||||
confirmationDialog.getWindow().bringToFront();
|
||||
}
|
||||
|
||||
private String getConfirmationQuestion(final Rollout rollout) {
|
||||
|
||||
final Map<Status, Long> statusTotalCount = rollout.getTotalTargetCountStatus().getStatusTotalCountMap();
|
||||
Long scheduledActions = statusTotalCount.get(Status.SCHEDULED);
|
||||
if (scheduledActions == null) {
|
||||
scheduledActions = 0L;
|
||||
}
|
||||
final Long runningActions = statusTotalCount.get(Status.RUNNING);
|
||||
String rolloutDetailsMessage = StringUtils.EMPTY;
|
||||
if ((scheduledActions > 0) || (runningActions > 0)) {
|
||||
rolloutDetailsMessage = i18n.get("message.delete.rollout.details", runningActions, scheduledActions);
|
||||
}
|
||||
|
||||
return i18n.get("message.delete.rollout", rollout.getName(), rolloutDetailsMessage);
|
||||
}
|
||||
|
||||
private String getDescription(final CellReference cell) {
|
||||
|
||||
String description = null;
|
||||
@@ -488,6 +569,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
private static String getDSDetails(final Item rolloutItem) {
|
||||
final StringBuilder swModuleNames = new StringBuilder();
|
||||
final StringBuilder swModuleVendors = new StringBuilder();
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();
|
||||
swModules.forEach(swModule -> {
|
||||
swModuleNames.append(swModule.getName());
|
||||
@@ -524,19 +606,22 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private static class RollouStatusCellStyleGenerator implements CellStyleGenerator {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* Contains all expected rollout status per column to enable or disable
|
||||
* the button.
|
||||
*/
|
||||
private static final Map<String, RolloutStatus> EXPECTED_ROLLOUT_STATUS_ENABLE_BUTTON = Maps
|
||||
.newHashMapWithExpectedSize(2);
|
||||
private final Container.Indexed containerDataSource;
|
||||
private static final List<RolloutStatus> DELETE_COPY_BUTTON_ENABLED = Arrays.asList(RolloutStatus.CREATING,
|
||||
RolloutStatus.ERROR_CREATING, RolloutStatus.ERROR_STARTING, RolloutStatus.PAUSED, RolloutStatus.READY,
|
||||
RolloutStatus.RUNNING, RolloutStatus.STARTING, RolloutStatus.STOPPED, RolloutStatus.FINISHED);
|
||||
|
||||
static {
|
||||
EXPECTED_ROLLOUT_STATUS_ENABLE_BUTTON.put(RUN_OPTION, RolloutStatus.READY);
|
||||
EXPECTED_ROLLOUT_STATUS_ENABLE_BUTTON.put(PAUSE_OPTION, RolloutStatus.RUNNING);
|
||||
}
|
||||
private static final List<RolloutStatus> UPDATE_BUTTON_ENABLED = Arrays.asList(RolloutStatus.CREATING,
|
||||
RolloutStatus.ERROR_CREATING, RolloutStatus.ERROR_STARTING, RolloutStatus.PAUSED, RolloutStatus.READY,
|
||||
RolloutStatus.RUNNING, RolloutStatus.STARTING, RolloutStatus.STOPPED);
|
||||
|
||||
private static final List<RolloutStatus> PAUSE_BUTTON_ENABLED = Arrays.asList(RolloutStatus.RUNNING);
|
||||
|
||||
private static final List<RolloutStatus> RUN_BUTTON_ENABLED = Arrays.asList(RolloutStatus.READY,
|
||||
RolloutStatus.PAUSED);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Container.Indexed containerDataSource;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -557,27 +642,31 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final CellReference cellReference) {
|
||||
final Object propertyId = cellReference.getPropertyId();
|
||||
final RolloutStatus expectedRolloutStatus = EXPECTED_ROLLOUT_STATUS_ENABLE_BUTTON.get(propertyId);
|
||||
if (expectedRolloutStatus == null) {
|
||||
return null;
|
||||
final String propertyId = (String) cellReference.getPropertyId();
|
||||
|
||||
if (RUN_OPTION.equals(propertyId)) {
|
||||
return getStatus(cellReference, RUN_BUTTON_ENABLED);
|
||||
}
|
||||
|
||||
if (RUN_OPTION.equals(cellReference.getPropertyId())) {
|
||||
return getStatus(cellReference, RolloutStatus.READY, RolloutStatus.PAUSED);
|
||||
if (PAUSE_OPTION.equals(propertyId)) {
|
||||
return getStatus(cellReference, PAUSE_BUTTON_ENABLED);
|
||||
}
|
||||
|
||||
if (PAUSE_OPTION.equals(cellReference.getPropertyId())) {
|
||||
return getStatus(cellReference, RolloutStatus.RUNNING);
|
||||
if (UPDATE_OPTION.equals(propertyId)) {
|
||||
return getStatus(cellReference, UPDATE_BUTTON_ENABLED);
|
||||
}
|
||||
|
||||
if (DELETE_OPTION.equals(propertyId) || COPY_OPTION.equals(propertyId)) {
|
||||
return getStatus(cellReference, DELETE_COPY_BUTTON_ENABLED);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getStatus(final CellReference cellReference, final RolloutStatus... expectedRolloutStatus) {
|
||||
private String getStatus(final CellReference cellReference, final List<RolloutStatus> expectedRolloutStatus) {
|
||||
final RolloutStatus currentRolloutStatus = getRolloutStatus(cellReference.getItemId());
|
||||
|
||||
if (Arrays.asList(expectedRolloutStatus).contains(currentRolloutStatus)) {
|
||||
if (expectedRolloutStatus.contains(currentRolloutStatus)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -622,7 +711,10 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
statusFontIcon = new StatusFontIcon(FontAwesome.QUESTION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_BLUE);
|
||||
}
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
UIComponentIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
@@ -636,7 +728,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
*/
|
||||
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
||||
|
||||
private static final long serialVersionUID = -5794528427855153924L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(final String value,
|
||||
@@ -665,17 +757,18 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
* Converter to convert 0 to empty, if total target groups is zero.
|
||||
*
|
||||
*/
|
||||
class TotalTargetGroupsConverter implements Converter<String, Long> {
|
||||
class TotalTargetGroupsConverter implements Converter<String, Integer> {
|
||||
|
||||
private static final long serialVersionUID = 6589305227035220369L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Long convertToModel(final String value, final Class<? extends Long> targetType, final Locale locale) {
|
||||
public Integer convertToModel(final String value, final Class<? extends Integer> targetType,
|
||||
final Locale locale) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final Long value, final Class<? extends String> targetType,
|
||||
public String convertToPresentation(final Integer value, final Class<? extends String> targetType,
|
||||
final Locale locale) {
|
||||
if (value == 0) {
|
||||
return "";
|
||||
@@ -684,8 +777,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Long> getModelType() {
|
||||
return Long.class;
|
||||
public Class<Integer> getModelType() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||
@@ -26,6 +27,8 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -42,9 +45,11 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
|
||||
private static final long serialVersionUID = 5342450502894318589L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(RolloutGroupBeanQuery.class);
|
||||
|
||||
private Sort sort = new Sort(Direction.ASC, "id");
|
||||
|
||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets;
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@@ -95,12 +100,14 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
@Override
|
||||
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
||||
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||
} else if (null != rolloutId) {
|
||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||
.getContent();
|
||||
if (rolloutId != null) {
|
||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||
} else {
|
||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||
.getContent();
|
||||
}
|
||||
}
|
||||
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
||||
}
|
||||
@@ -151,10 +158,17 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
@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 (rolloutId != null) {
|
||||
try {
|
||||
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(
|
||||
rolloutId, new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
size = firstPageRolloutGroupSets.getTotalElements();
|
||||
} catch (final EntityNotFoundException e) {
|
||||
LOG.error("Rollout does not exists. Redirect to Rollouts overview", e);
|
||||
rolloutUIState.setShowRolloutGroups(false);
|
||||
rolloutUIState.setShowRollOuts(true);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
@@ -164,21 +178,21 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
}
|
||||
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
if (rolloutManagement == null) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||
if (null == rolloutGroupManagement) {
|
||||
if (rolloutGroupManagement == null) {
|
||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||
}
|
||||
return rolloutGroupManagement;
|
||||
}
|
||||
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
if (rolloutUIState == null) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
|
||||
@@ -77,6 +77,20 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for RolloutGroupListGrid (Header with breadcrumbs)
|
||||
*
|
||||
* @param i18n
|
||||
* I18N
|
||||
* @param eventBus
|
||||
* UIEventBus
|
||||
* @param rolloutGroupManagement
|
||||
* RolloutGroupManagement
|
||||
* @param rolloutUIState
|
||||
* RolloutUIState
|
||||
* @param permissionChecker
|
||||
* SpPermissionChecker
|
||||
*/
|
||||
public RolloutGroupListGrid(final I18N i18n, final UIEventBus eventBus,
|
||||
final RolloutGroupManagement rolloutGroupManagement, final RolloutUIState rolloutUIState,
|
||||
final SpPermissionChecker permissionChecker) {
|
||||
@@ -87,6 +101,11 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (RolloutEvent.SHOW_ROLLOUTS == event) {
|
||||
rolloutUIState.setShowRollOuts(true);
|
||||
rolloutUIState.setShowRolloutGroups(false);
|
||||
rolloutUIState.setShowRolloutGroupTargets(false);
|
||||
}
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
@@ -107,7 +126,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||
return;
|
||||
}
|
||||
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
|
||||
@@ -149,7 +167,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
||||
TotalTargetCountStatus.class, null, false, false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -286,9 +303,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
public void click(final RendererClickEvent event) {
|
||||
rolloutUIState.setRolloutGroup(
|
||||
rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()).get());
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()).ifPresent(group -> {
|
||||
rolloutUIState.setRolloutGroup(group);
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,8 +377,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
UIComponentIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,16 @@ public class RolloutGroupsListHeader extends AbstractGridHeader {
|
||||
|
||||
private Label headerCaption;
|
||||
|
||||
/**
|
||||
* Constructor for RolloutGroupsListHeader
|
||||
*
|
||||
* @param eventBus
|
||||
* UIEventBus
|
||||
* @param rolloutUiState
|
||||
* RolloutUIState
|
||||
* @param i18n
|
||||
* I18N
|
||||
*/
|
||||
public RolloutGroupsListHeader(final UIEventBus eventBus, final RolloutUIState rolloutUiState, final I18N i18n) {
|
||||
super(null, rolloutUiState, i18n);
|
||||
this.eventBus = eventBus;
|
||||
|
||||
@@ -24,6 +24,20 @@ public class RolloutGroupsListView extends AbstractGridLayout {
|
||||
|
||||
private static final long serialVersionUID = 7252345838154270259L;
|
||||
|
||||
/**
|
||||
* Constructor for RolloutGroupsListView
|
||||
*
|
||||
* @param i18n
|
||||
* I18N
|
||||
* @param eventBus
|
||||
* UIEventBus
|
||||
* @param rolloutGroupManagement
|
||||
* RolloutGroupManagement
|
||||
* @param rolloutUIState
|
||||
* RolloutUIState
|
||||
* @param permissionChecker
|
||||
* SpPermissionChecker
|
||||
*/
|
||||
public RolloutGroupsListView(final I18N i18n, final UIEventBus eventBus,
|
||||
final RolloutGroupManagement rolloutGroupManagement, final RolloutUIState rolloutUIState,
|
||||
final SpPermissionChecker permissionChecker) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
||||
@@ -26,6 +27,8 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -41,6 +44,8 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
|
||||
|
||||
private static final long serialVersionUID = -8841076207255485907L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(RolloutGroupTargetsBeanQuery.class);
|
||||
|
||||
private static final Sort sort = new Sort(Direction.ASC, "id");
|
||||
|
||||
private transient Page<TargetWithActionStatus> firstPageTargetSets;
|
||||
@@ -134,9 +139,16 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
|
||||
long size = 0;
|
||||
|
||||
if (rolloutGroup.isPresent()) {
|
||||
firstPageTargetSets = getRolloutGroupManagement().findAllTargetsWithActionStatus(
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutGroup.get().getId());
|
||||
size = firstPageTargetSets.getTotalElements();
|
||||
try {
|
||||
firstPageTargetSets = getRolloutGroupManagement().findAllTargetsWithActionStatus(
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutGroup.get().getId());
|
||||
size = firstPageTargetSets.getTotalElements();
|
||||
} catch (final EntityNotFoundException e) {
|
||||
LOG.error("Rollout does not exists. Redirect to Rollouts overview", e);
|
||||
rolloutUIState.setShowRolloutGroupTargets(false);
|
||||
rolloutUIState.setShowRollOuts(true);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
getRolloutUIState().setRolloutGroupTargetsTotalCount(size);
|
||||
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {
|
||||
|
||||
@@ -71,6 +71,16 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for RolloutGroupTargetsListGrid
|
||||
*
|
||||
* @param i18n
|
||||
* I18N
|
||||
* @param eventBus
|
||||
* UIEventBus
|
||||
* @param rolloutUIState
|
||||
* RolloutUIState
|
||||
*/
|
||||
public RolloutGroupTargetsListGrid(final I18N i18n, final UIEventBus eventBus,
|
||||
final RolloutUIState rolloutUIState) {
|
||||
super(i18n, eventBus, null);
|
||||
@@ -273,4 +283,5 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RolloutGroupTargetsListHeader extends AbstractGridHeader {
|
||||
|
||||
private final transient EventBus.UIEventBus eventBus;
|
||||
|
||||
private Button rolloutsGroupViewLink;
|
||||
private Button rolloutNameLink;
|
||||
private Label headerCaption;
|
||||
|
||||
public RolloutGroupTargetsListHeader(final UIEventBus eventBus, final I18N i18n,
|
||||
@@ -57,7 +57,7 @@ public class RolloutGroupTargetsListHeader extends AbstractGridHeader {
|
||||
|
||||
private void setCaptionDetails() {
|
||||
rolloutUIState.getRolloutGroup().map(RolloutGroup::getName).ifPresent(headerCaption::setCaption);
|
||||
rolloutsGroupViewLink.setCaption(rolloutUIState.getRolloutGroup().map(RolloutGroup::getName).orElse(""));
|
||||
rolloutNameLink.setCaption(rolloutUIState.getRolloutName().orElse(""));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,18 +149,17 @@ public class RolloutGroupTargetsListHeader extends AbstractGridHeader {
|
||||
rolloutsListViewLink.setCaption(i18n.get("message.rollouts"));
|
||||
rolloutsListViewLink.addClickListener(value -> showRolloutListView());
|
||||
|
||||
rolloutsGroupViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
|
||||
rolloutNameLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
rolloutsGroupViewLink
|
||||
.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
|
||||
rolloutsGroupViewLink.setDescription("Rollouts Group");
|
||||
rolloutsGroupViewLink.addClickListener(value -> showRolloutGroupListView());
|
||||
rolloutNameLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
|
||||
rolloutNameLink.setDescription("Rollout");
|
||||
rolloutNameLink.addClickListener(value -> showRolloutGroupListView());
|
||||
|
||||
final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
|
||||
headerCaptionLayout.addComponent(rolloutsListViewLink);
|
||||
headerCaptionLayout.addComponent(new Label(">"));
|
||||
headerCaptionLayout.addComponent(rolloutsGroupViewLink);
|
||||
headerCaptionLayout.addComponent(new Label(">"));
|
||||
headerCaptionLayout.addComponent(rolloutNameLink);
|
||||
headerCaptionLayout.addComponent(new Label("> "));
|
||||
headerCaptionLayout.addComponent(headerCaption);
|
||||
|
||||
return headerCaptionLayout;
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.alump.distributionbar.DistributionBar;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.vaadin.data.Container;
|
||||
@@ -454,26 +453,19 @@ public final class HawkbitCommonUtil {
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
|
||||
pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue");
|
||||
if (updateStatus == TargetUpdateStatus.ERROR) {
|
||||
pinBtn.addStyleName("statusIconRed");
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
|
||||
} else if (updateStatus == TargetUpdateStatus.UNKNOWN) {
|
||||
pinBtn.addStyleName("statusIconBlue");
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
|
||||
} else if (updateStatus == TargetUpdateStatus.IN_SYNC) {
|
||||
pinBtn.addStyleName("statusIconGreen");
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
|
||||
} else if (updateStatus == TargetUpdateStatus.PENDING) {
|
||||
pinBtn.addStyleName("statusIconYellow");
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
|
||||
} else if (updateStatus == TargetUpdateStatus.REGISTERED) {
|
||||
pinBtn.addStyleName("statusIconLightBlue");
|
||||
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBarPartSize(final DistributionBar bar, final String statusName, final int count,
|
||||
final int index) {
|
||||
bar.setPartSize(index, count);
|
||||
bar.setPartTooltip(index, statusName);
|
||||
bar.setPartStyleName(index, "status-bar-part-" + statusName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the finished percentage of a rollout group into a string with one
|
||||
* digit after comma.
|
||||
@@ -504,10 +496,6 @@ public final class HawkbitCommonUtil {
|
||||
return String.format("%.1f", tmpFinishedPercentage);
|
||||
}
|
||||
|
||||
private static Long getStatusCount(final String propertName, final Item item) {
|
||||
return (Long) item.getItemProperty(propertName).getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted string as needed by label custom render .This string
|
||||
* holds the properties of a status label.
|
||||
|
||||
@@ -178,6 +178,11 @@ public final class SPUIStyleDefinitions {
|
||||
*/
|
||||
public static final String TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE = "target-filter-spinner";
|
||||
|
||||
/**
|
||||
* Rollout deleting spinner for status column
|
||||
*/
|
||||
public static final String ROLLOUT_DELETING_SPINNER = "rollout-deleting-spinner";
|
||||
|
||||
/**
|
||||
* Status icon style - red color.
|
||||
*/
|
||||
@@ -213,6 +218,11 @@ public final class SPUIStyleDefinitions {
|
||||
*/
|
||||
public static final String STATUS_SPINNER_GREY = "greySpinner";
|
||||
|
||||
/**
|
||||
* Status icon spinner style - red color.
|
||||
*/
|
||||
public static final String STATUS_SPINNER_RED = "redSpinner";
|
||||
|
||||
/**
|
||||
* Status icon spinner style - blue color.
|
||||
*/
|
||||
|
||||
@@ -802,6 +802,11 @@ public final class UIComponentIdProvider {
|
||||
*/
|
||||
public static final String ROLLOUT_COPY_BUTTON_ID = ROLLOUT_ACTION_ID + ".12";
|
||||
|
||||
/**
|
||||
* Rollout delete button id.
|
||||
*/
|
||||
public static final String ROLLOUT_DELETE_BUTTON_ID = ROLLOUT_ACTION_ID + ".13";
|
||||
|
||||
/**
|
||||
* Rollout status label id.
|
||||
*/
|
||||
|
||||
@@ -209,6 +209,11 @@
|
||||
color: $hawkbit-primary-color;
|
||||
}
|
||||
|
||||
|
||||
.redSpinner{
|
||||
@include valo-spinner($size: $v-font-size--small,$color: $red-color);
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
.greySpinner{
|
||||
@include valo-spinner($size: $v-font-size--small,$color: $grey-color);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
//Table header - filter text field style
|
||||
.filter-box {
|
||||
height: 25px !important;
|
||||
transition: width .5s ease-in-out;
|
||||
float: right;
|
||||
visibility: visible;
|
||||
border-radius: $v-border-radius;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
}
|
||||
|
||||
.filter-box-hide {
|
||||
width: 0 !important;
|
||||
padding: 0 !important;
|
||||
border-width: 0 !important;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
//Search rest icon color
|
||||
|
||||
@@ -61,6 +61,7 @@ header.action.run=Run
|
||||
header.action.pause=Pause
|
||||
header.action.update=Edit
|
||||
header.action.copy=Copy
|
||||
header.action.delete=Delete
|
||||
header.status=Status
|
||||
|
||||
# event container
|
||||
@@ -117,6 +118,7 @@ caption.forcequit.action.confirmbox = Confirm force quit action
|
||||
caption.forced.datefield = Force update at time
|
||||
caption.force.action.confirmbox = Confirm Force Active Action
|
||||
caption.confirm.abort.action = Confirm Abort Action
|
||||
caption.confirm.delete.rollout = Confirm Rollout deletion
|
||||
|
||||
caption.filter.delete.confirmbox = Confirm Filter Delete Action
|
||||
caption.metadata.popup = Metadata of
|
||||
@@ -536,12 +538,17 @@ message.rollout.field.value.range = Value should be in range {0} to {1}
|
||||
message.rollout.started = Rollout {0} started successfully
|
||||
message.rollout.paused = Rollout {0} paused successfully
|
||||
message.rollout.resumed = Rollout {0} resumed successfully
|
||||
message.rollout.deleted = Rollout {0} deleted successfully
|
||||
message.rollout.noofgroups.or.targetfilter.missing = Please enter number of groups and select target filter
|
||||
message.rollouts = Rollouts
|
||||
label.target.per.group = Targets per group :
|
||||
message.dist.already.assigned = Distribution {0} is already assigned to target
|
||||
message.error.creating.rollout = Server error. Error creating Rollout. Please contact the administrator
|
||||
message.error.starting.rollout = Server error. Error starting Rollout. Please contact the administrator
|
||||
|
||||
message.delete.rollout = You are about to delete the rollout "{0}".\n{1}Are you sure?
|
||||
message.delete.rollout.details = There are {0} running updates that will continue and {1} scheduled updates that will terminate.\n
|
||||
|
||||
caption.rollout.group.definition.desc = Define which groups the Rollout should have.
|
||||
header.target.percentage = Target percentage
|
||||
textfield.target.percentage = Target percentage
|
||||
|
||||
Reference in New Issue
Block a user