Merge pull request #118 from bsinno/Methods_only_called_by_inner_classes_should_move_to_those_classes
Methods only called by inner classes should move to those classes
This commit is contained in:
@@ -215,13 +215,15 @@ public class UploadLayout extends VerticalLayout {
|
||||
hasDirectory = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isDirectory(final Html5File file) {
|
||||
if (Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0) {
|
||||
return true;
|
||||
private StreamVariable createStreamVariable(final Html5File file) {
|
||||
return new UploadHandler(file.getFileName(), file.getFileSize(), UploadLayout.this, uploadInfoWindow,
|
||||
spInfo.getMaxArtifactFileSize(), null, file.getType());
|
||||
}
|
||||
|
||||
private boolean isDirectory(final Html5File file) {
|
||||
return Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void displayCompositeMessage() {
|
||||
@@ -282,11 +284,6 @@ public class UploadLayout extends VerticalLayout {
|
||||
discardBtn.addClickListener(event -> discardUploadData(event));
|
||||
}
|
||||
|
||||
private StreamVariable createStreamVariable(final Html5File file) {
|
||||
return new UploadHandler(file.getFileName(), file.getFileSize(), this, uploadInfoWindow,
|
||||
spInfo.getMaxArtifactFileSize(), null, file.getType());
|
||||
}
|
||||
|
||||
boolean checkForDuplicate(final String filename) {
|
||||
final Boolean isDuplicate = checkIfFileIsDuplicate(filename);
|
||||
if (isDuplicate) {
|
||||
@@ -349,17 +346,17 @@ public class UploadLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
Boolean validate(DragAndDropEvent event) {
|
||||
Boolean validate(final DragAndDropEvent event) {
|
||||
// check if drop is valid.If valid ,check if software module is
|
||||
// selected.
|
||||
if(!isFilesDropped(event)){
|
||||
if (!isFilesDropped(event)) {
|
||||
uiNotification.displayValidationError(i18n.get("message.action.not.allowed"));
|
||||
return false;
|
||||
}
|
||||
return checkIfSoftwareModuleIsSelected();
|
||||
}
|
||||
|
||||
private boolean isFilesDropped(DragAndDropEvent event) {
|
||||
private boolean isFilesDropped(final DragAndDropEvent event) {
|
||||
if (event.getTransferable() instanceof WrapperTransferable) {
|
||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||
// other components can also be wrapped in WrapperTransferable , so
|
||||
@@ -448,7 +445,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
}
|
||||
|
||||
private String getDuplicateFileValidationMessage() {
|
||||
StringBuilder message = new StringBuilder();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
if (!duplicateFileNamesList.isEmpty()) {
|
||||
final String fileNames = StringUtils.collectionToCommaDelimitedString(duplicateFileNamesList);
|
||||
if (duplicateFileNamesList.size() == 1) {
|
||||
@@ -655,8 +652,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
return uiNotification;
|
||||
}
|
||||
|
||||
|
||||
public void setHasDirectory(Boolean hasDirectory) {
|
||||
public void setHasDirectory(final Boolean hasDirectory) {
|
||||
this.hasDirectory = hasDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,18 +178,25 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void updateTokenStyle(final Object tokenId, final Button button) {
|
||||
final String color = getColor(tokenId);
|
||||
button.setCaption("<span style=\"color:" + color + " !important;\">" + FontAwesome.CIRCLE.getHtml()
|
||||
+ "</span>" + " " + getItemNameProperty(tokenId).getValue().toString().concat(" ×"));
|
||||
button.setCaptionAsHtml(true);
|
||||
}
|
||||
|
||||
private void updateTokenStyle(final Object tokenId, final Button button) {
|
||||
final String color = getColor(tokenId);
|
||||
button.setCaption("<span style=\"color:" + color + " !important;\">" + FontAwesome.CIRCLE.getHtml() + "</span>"
|
||||
+ " " + getItemNameProperty(tokenId).getValue().toString().concat(" ×"));
|
||||
button.setCaptionAsHtml(true);
|
||||
}
|
||||
private void onTokenSearch(final Object tokenId) {
|
||||
assignTag(getItemNameProperty(tokenId).getValue().toString());
|
||||
removeTagAssignedFromCombo((Long) tokenId);
|
||||
}
|
||||
|
||||
private void tokenClick(final Object tokenId) {
|
||||
final Item item = tokenField.getContainerDataSource().addItem(tokenId);
|
||||
item.getItemProperty("name").setValue(tagDetails.get(tokenId).getName());
|
||||
item.getItemProperty(COLOR_PROPERTY).setValue(tagDetails.get(tokenId).getColor());
|
||||
unassignTag(tagDetails.get(tokenId).getName());
|
||||
}
|
||||
|
||||
private void onTokenSearch(final Object tokenId) {
|
||||
assignTag(getItemNameProperty(tokenId).getValue().toString());
|
||||
removeTagAssignedFromCombo((Long) tokenId);
|
||||
}
|
||||
|
||||
private Property getItemNameProperty(final Object tokenId) {
|
||||
@@ -211,13 +218,6 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
return (String) item.getItemProperty("name").getValue();
|
||||
}
|
||||
|
||||
private void tokenClick(final Object tokenId) {
|
||||
final Item item = tokenField.getContainerDataSource().addItem(tokenId);
|
||||
item.getItemProperty("name").setValue(tagDetails.get(tokenId).getName());
|
||||
item.getItemProperty(COLOR_PROPERTY).setValue(tagDetails.get(tokenId).getColor());
|
||||
unassignTag(tagDetails.get(tokenId).getName());
|
||||
}
|
||||
|
||||
protected void removePreviouslyAddedTokens() {
|
||||
tokensAdded.keySet().forEach(previouslyAddedToken -> tokenField.removeToken(previouslyAddedToken));
|
||||
}
|
||||
|
||||
@@ -63,14 +63,10 @@ import com.vaadin.ui.Upload.SucceededListener;
|
||||
|
||||
/**
|
||||
* Bulk target upload handler.
|
||||
*
|
||||
*/
|
||||
public class BulkUploadHandler extends CustomComponent
|
||||
implements SucceededListener, FailedListener, Receiver, StartedListener {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1273494705754674501L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BulkUploadHandler.class);
|
||||
|
||||
@@ -149,12 +145,6 @@ public class BulkUploadHandler extends CustomComponent
|
||||
setCompositionRoot(horizontalLayout);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.vaadin.ui.Upload.Receiver#receiveUpload(java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public OutputStream receiveUpload(final String filename, final String mimeType) {
|
||||
try {
|
||||
@@ -170,25 +160,11 @@ public class BulkUploadHandler extends CustomComponent
|
||||
return new NullOutputStream();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.ui.Upload.FailedListener#uploadFailed(com.vaadin.ui.Upload.
|
||||
* FailedEvent)
|
||||
*/
|
||||
@Override
|
||||
public void uploadFailed(final FailedEvent event) {
|
||||
LOG.info("Upload failed for file :{} due to {}", event.getFilename(), event.getReason());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.ui.Upload.SucceededListener#uploadSucceeded(com.vaadin.ui.
|
||||
* Upload.SucceededEvent)
|
||||
*/
|
||||
@Override
|
||||
public void uploadSucceeded(final SucceededEvent event) {
|
||||
executor.execute(new UploadAsync(event));
|
||||
@@ -252,6 +228,61 @@ public class BulkUploadHandler extends CustomComponent
|
||||
}
|
||||
}
|
||||
|
||||
private double getTotalNumberOfLines() {
|
||||
|
||||
double totalFileSize = 0;
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(tempFile),
|
||||
Charset.defaultCharset())) {
|
||||
try (BufferedReader readerForSize = new BufferedReader(inputStreamReader)) {
|
||||
totalFileSize = readerForSize.lines().count();
|
||||
}
|
||||
} catch (final FileNotFoundException e) {
|
||||
LOG.error("Error reading file {}", tempFile.getName(), e);
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Error while closing reader of file {}", tempFile.getName(), e);
|
||||
}
|
||||
|
||||
return totalFileSize;
|
||||
}
|
||||
|
||||
private void resetCounts() {
|
||||
successfullTargetCount = 0;
|
||||
failedTargetCount = 0;
|
||||
}
|
||||
|
||||
private void deleteFile() {
|
||||
if (tempFile.exists()) {
|
||||
final boolean isDeleted = tempFile.delete();
|
||||
if (!isDeleted) {
|
||||
LOG.info("File {} was not deleted !", tempFile.getName());
|
||||
}
|
||||
}
|
||||
tempFile = null;
|
||||
}
|
||||
|
||||
private void readEachLine(final String line, final double innerCounter, final double totalFileSize) {
|
||||
final String csvDelimiter = ",";
|
||||
final String[] targets = line.split(csvDelimiter);
|
||||
if (targets.length == 2) {
|
||||
final String controllerId = targets[0];
|
||||
final String targetName = targets[1];
|
||||
addNewTarget(controllerId, targetName);
|
||||
} else {
|
||||
failedTargetCount++;
|
||||
}
|
||||
final float current = managementUIState.getTargetTableFilters().getBulkUpload()
|
||||
.getProgressBarCurrentValue();
|
||||
final float next = (float) (innerCounter / totalFileSize);
|
||||
if (Math.abs(next - 0.1) < 0.00001 || current - next >= 0 || next - current >= 0.05
|
||||
|| Math.abs(next - 1) < 0.00001) {
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().setProgressBarCurrentValue(next);
|
||||
managementUIState.getTargetTableFilters().getBulkUpload()
|
||||
.setSucessfulUploadCount(successfullTargetCount);
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().setFailedUploadCount(failedTargetCount);
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_CREATED));
|
||||
}
|
||||
}
|
||||
|
||||
private void doAssignments() {
|
||||
final StringBuilder errorMessage = new StringBuilder();
|
||||
String dsAssignmentFailedMsg = null;
|
||||
@@ -267,6 +298,41 @@ public class BulkUploadHandler extends CustomComponent
|
||||
displayValidationMessage(errorMessage, dsAssignmentFailedMsg, tagAssignmentFailedMsg);
|
||||
}
|
||||
|
||||
private String saveAllAssignments() {
|
||||
final ActionType actionType = ActionType.FORCED;
|
||||
final long forcedTimeStamp = new Date().getTime();
|
||||
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
|
||||
final List<String> targetsList = targetBulkUpload.getTargetsCreated();
|
||||
final DistributionSetIdName dsSelected = (DistributionSetIdName) comboBox.getValue();
|
||||
if (distributionSetManagement.findDistributionSetById(dsSelected.getId()) == null) {
|
||||
return i18n.get("message.bulk.upload.assignment.failed");
|
||||
}
|
||||
deploymentManagement.assignDistributionSet(targetBulkUpload.getDsNameAndVersion().getId(), actionType,
|
||||
forcedTimeStamp, targetsList.toArray(new String[targetsList.size()]));
|
||||
return null;
|
||||
}
|
||||
|
||||
private String tagAssignment() {
|
||||
final Map<Long, TagData> tokensSelected = targetBulkTokenTags.getTokensAdded();
|
||||
final List<String> deletedTags = new ArrayList<>();
|
||||
for (final TagData tagData : tokensSelected.values()) {
|
||||
if (tagManagement.findTargetTagById(tagData.getId()) == null) {
|
||||
deletedTags.add(tagData.getName());
|
||||
} else {
|
||||
targetManagement.toggleTagAssignment(
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated(),
|
||||
tagData.getName());
|
||||
}
|
||||
}
|
||||
if (deletedTags.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (deletedTags.size() == 1) {
|
||||
return i18n.get("message.bulk.upload.tag.assignment.failed", deletedTags.get(0));
|
||||
}
|
||||
return i18n.get("message.bulk.upload.tag.assignments.failed");
|
||||
}
|
||||
|
||||
private boolean ifTagsSelected() {
|
||||
return targetBulkTokenTags.getTokenField().getValue() != null;
|
||||
}
|
||||
@@ -307,59 +373,6 @@ public class BulkUploadHandler extends CustomComponent
|
||||
}
|
||||
}
|
||||
|
||||
private double getTotalNumberOfLines() {
|
||||
|
||||
double totalFileSize = 0;
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(tempFile),
|
||||
Charset.defaultCharset())) {
|
||||
try (BufferedReader readerForSize = new BufferedReader(inputStreamReader)) {
|
||||
totalFileSize = readerForSize.lines().count();
|
||||
}
|
||||
} catch (final FileNotFoundException e) {
|
||||
LOG.error("Error reading file {}", tempFile.getName(), e);
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Error while closing reader of file {}", tempFile.getName(), e);
|
||||
}
|
||||
|
||||
return totalFileSize;
|
||||
}
|
||||
|
||||
private void resetCounts() {
|
||||
successfullTargetCount = 0;
|
||||
failedTargetCount = 0;
|
||||
}
|
||||
|
||||
private void deleteFile() {
|
||||
if (tempFile.exists()) {
|
||||
final boolean isDeleted = tempFile.delete();
|
||||
if (!isDeleted) {
|
||||
LOG.info("File {} was not deleted !", tempFile.getName());
|
||||
}
|
||||
}
|
||||
tempFile = null;
|
||||
}
|
||||
|
||||
private void readEachLine(final String line, final double innerCounter, final double totalFileSize) {
|
||||
final String csvDelimiter = ",";
|
||||
final String[] targets = line.split(csvDelimiter);
|
||||
if (targets.length == 2) {
|
||||
final String controllerId = targets[0];
|
||||
final String targetName = targets[1];
|
||||
addNewTarget(controllerId, targetName);
|
||||
} else {
|
||||
failedTargetCount++;
|
||||
}
|
||||
final float current = managementUIState.getTargetTableFilters().getBulkUpload().getProgressBarCurrentValue();
|
||||
final float next = (float) (innerCounter / totalFileSize);
|
||||
if (Math.abs(next - 0.1) < 0.00001 || current - next >= 0 || next - current >= 0.05
|
||||
|| Math.abs(next - 1) < 0.00001) {
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().setProgressBarCurrentValue(next);
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().setSucessfulUploadCount(successfullTargetCount);
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().setFailedUploadCount(failedTargetCount);
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_CREATED));
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewTarget(final String controllerId, final String name) {
|
||||
final String newControllerId = HawkbitCommonUtil.trimAndNullIfEmpty(controllerId);
|
||||
if (mandatoryCheck(newControllerId) && duplicateCheck(newControllerId)) {
|
||||
@@ -405,43 +418,6 @@ public class BulkUploadHandler extends CustomComponent
|
||||
}
|
||||
}
|
||||
|
||||
private String saveAllAssignments() {
|
||||
final ActionType actionType = ActionType.FORCED;
|
||||
final long forcedTimeStamp = new Date().getTime();
|
||||
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
|
||||
final List<String> targetsList = targetBulkUpload.getTargetsCreated();
|
||||
final DistributionSetIdName dsSelected = (DistributionSetIdName) comboBox.getValue();
|
||||
if (distributionSetManagement.findDistributionSetById(dsSelected.getId()) == null) {
|
||||
return i18n.get("message.bulk.upload.assignment.failed");
|
||||
} else {
|
||||
deploymentManagement.assignDistributionSet(targetBulkUpload.getDsNameAndVersion().getId(), actionType,
|
||||
forcedTimeStamp, targetsList.toArray(new String[targetsList.size()]));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String tagAssignment() {
|
||||
final Map<Long, TagData> tokensSelected = targetBulkTokenTags.getTokensAdded();
|
||||
final List<String> deletedTags = new ArrayList<>();
|
||||
for (final TagData tagData : tokensSelected.values()) {
|
||||
if (tagManagement.findTargetTagById(tagData.getId()) == null) {
|
||||
deletedTags.add(tagData.getName());
|
||||
} else {
|
||||
targetManagement.toggleTagAssignment(
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated(),
|
||||
tagData.getName());
|
||||
}
|
||||
}
|
||||
if (!deletedTags.isEmpty()) {
|
||||
if (deletedTags.size() == 1) {
|
||||
return i18n.get("message.bulk.upload.tag.assignment.failed", deletedTags.get(0));
|
||||
} else {
|
||||
return i18n.get("message.bulk.upload.tag.assignments.failed");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class NullOutputStream extends OutputStream {
|
||||
/**
|
||||
* null output stream.
|
||||
@@ -462,13 +438,6 @@ public class BulkUploadHandler extends CustomComponent
|
||||
return upload;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.ui.Upload.StartedListener#uploadStarted(com.vaadin.ui.Upload
|
||||
* .StartedEvent)
|
||||
*/
|
||||
@Override
|
||||
public void uploadStarted(final StartedEvent event) {
|
||||
if (!event.getFilename().endsWith(".csv")) {
|
||||
|
||||
@@ -356,7 +356,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
private void getUpdateMenuItem(final ContextMenu context, final Long rolloutId) {
|
||||
// Add 'Update' option only if user has update permission
|
||||
if (!permissionChecker.hasRolloutUpdatePermission()) {
|
||||
@@ -366,17 +365,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE));
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
final String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
}
|
||||
|
||||
private void menuItemClicked(final ContextMenuItemClickEvent event) {
|
||||
final ContextMenuItem item = (ContextMenuItem) event.getSource();
|
||||
final ContextMenuData contextMenuData = (ContextMenuData) item.getData();
|
||||
@@ -537,6 +525,13 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,14 +544,16 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
private static final long serialVersionUID = -5794528427855153924L;
|
||||
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(final String value, final Class<? extends TotalTargetCountStatus> targetType,
|
||||
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
public TotalTargetCountStatus convertToModel(final String value,
|
||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final TotalTargetCountStatus value, final Class<? extends String> targetType,
|
||||
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||
final Class<? extends String> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
@@ -250,18 +250,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
final String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
}
|
||||
|
||||
private void createRolloutGroupStatusToFontMap() {
|
||||
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
@@ -316,14 +304,16 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
private static final long serialVersionUID = -9205943894818450807L;
|
||||
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(final String value, final Class<? extends TotalTargetCountStatus> targetType,
|
||||
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
public TotalTargetCountStatus convertToModel(final String value,
|
||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final TotalTargetCountStatus value, final Class<? extends String> targetType,
|
||||
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||
final Class<? extends String> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
|
||||
@@ -369,5 +359,13 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,11 +196,9 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
public String convertToPresentation(final Status status, final Class<? extends String> targetType,
|
||||
final Locale locale) {
|
||||
if (status == null) {
|
||||
// Actions are not created for targets when
|
||||
// rollout's status
|
||||
// is READY and when duplicate assignment is done.
|
||||
// In these cases display a appropriate status with
|
||||
// description
|
||||
// Actions are not created for targets when rollout's status is
|
||||
// READY and when duplicate assignment is done. In these cases
|
||||
// display a appropriate status with description
|
||||
return getStatus();
|
||||
}
|
||||
return processActionStatus(status);
|
||||
@@ -216,16 +214,27 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String processActionStatus(final Status status) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(status);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
private String processActionStatus(final Status status) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(status);
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(), null);
|
||||
}
|
||||
final String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(), null);
|
||||
|
||||
private String getStatus() {
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent()
|
||||
? rolloutUIState.getRolloutGroup().get() : null;
|
||||
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) {
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()), "statusIconLightBlue", null);
|
||||
}
|
||||
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.MINUS_CIRCLE.getCodepoint()), "statusIconBlue", null);
|
||||
}
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.QUESTION_CIRCLE.getCodepoint()), "statusIconBlue", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createRolloutStatusToFontMap() {
|
||||
@@ -249,21 +258,6 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
private String getStatus() {
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent()
|
||||
? rolloutUIState.getRolloutGroup().get() : null;
|
||||
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) {
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()), "statusIconLightBlue", null);
|
||||
} else if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.MINUS_CIRCLE.getCodepoint()), "statusIconBlue", null);
|
||||
} else {
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.QUESTION_CIRCLE.getCodepoint()), "statusIconBlue", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String getDescription(final CellReference cell) {
|
||||
if (!SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
return null;
|
||||
@@ -274,7 +268,6 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
}
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
private String getDescriptionWhenNoAction() {
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent()
|
||||
|
||||
@@ -14,8 +14,6 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem;
|
||||
|
||||
import com.vaadin.data.Property.ValueChangeEvent;
|
||||
import com.vaadin.data.Property.ValueChangeListener;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.CheckBox;
|
||||
import com.vaadin.ui.GridLayout;
|
||||
@@ -50,8 +48,8 @@ public class DurationConfigField extends GridLayout implements ConfigurationItem
|
||||
this.addComponent(durationField, 1, 0);
|
||||
this.setComponentAlignment(durationField, Alignment.MIDDLE_LEFT);
|
||||
|
||||
checkBox.addValueChangeListener(event->checkBoxChange());
|
||||
durationField.addValueChangeListener(event->notifyConfigurationChanged());
|
||||
checkBox.addValueChangeListener(event -> checkBoxChange());
|
||||
durationField.addValueChangeListener(event -> notifyConfigurationChanged());
|
||||
}
|
||||
|
||||
private void checkBoxChange() {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTable;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
@@ -1352,4 +1353,19 @@ public final class HawkbitCommonUtil {
|
||||
return val.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive the code point of a given StatusFontIcon.
|
||||
*
|
||||
* @param statusFontIcon
|
||||
* the status font icon
|
||||
* @return the code point of the StatusFontIcon
|
||||
*/
|
||||
public static String getCodePoint(final StatusFontIcon statusFontIcon) {
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
return statusFontIcon.getFontIcon() != null ? Integer.toString(statusFontIcon.getFontIcon().getCodepoint())
|
||||
: null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user