예제 #1
0
  private void assignDsTag(final DragAndDropEvent event) {
    final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
    final Table distTable = (Table) taregtDet.getTarget();
    final Set<DistributionSetIdName> distsSelected = getTableValue(distTable);
    final Set<Long> distList = new HashSet<>();

    final AbstractSelectTargetDetails dropData =
        (AbstractSelectTargetDetails) event.getTargetDetails();
    final Object distItemId = dropData.getItemIdOver();

    if (!distsSelected.contains(distItemId)) {
      distList.add(((DistributionSetIdName) distItemId).getId());
    } else {
      distList.addAll(distsSelected.stream().map(t -> t.getId()).collect(Collectors.toList()));
    }

    final String distTagName =
        HawkbitCommonUtil.removePrefix(
            event.getTransferable().getSourceComponent().getId(),
            SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);

    final DistributionSetTagAssignmentResult result =
        distributionSetManagement.toggleTagAssignment(distList, distTagName);

    uiNotification.displaySuccess(
        HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
    if (result.getAssigned() >= 1
        && managementUIState.getDistributionTableFilters().isNoTagSelected()) {
      refreshFilter();
    }
  }
예제 #2
0
 private String getItemid(final String filename, final SoftwareModule softwareModule) {
   return new StringBuilder(filename)
       .append(
           HawkbitCommonUtil.getFormattedNameVersion(
               softwareModule.getName(), softwareModule.getVersion()))
       .toString();
 }
예제 #3
0
 private void restoreState() {
   final Indexed container = grid.getContainerDataSource();
   if (container.getItemIds().isEmpty()) {
     container.removeAllItems();
     for (final UploadStatusObject statusObject :
         artifactUploadState.getUploadedFileStatusList()) {
       final Item item =
           container.addItem(
               getItemid(statusObject.getFilename(), statusObject.getSelectedSoftwareModule()));
       item.getItemProperty(REASON)
           .setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
       if (statusObject.getStatus() != null) {
         item.getItemProperty(STATUS).setValue(statusObject.getStatus());
       }
       if (statusObject.getProgress() != null) {
         item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
       }
       item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
       final SoftwareModule sw = statusObject.getSelectedSoftwareModule();
       item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
           .setValue(HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
     }
     if (artifactUploadState.isUploadCompleted()) {
       minimizeButton.setEnabled(false);
     }
   }
 }
예제 #4
0
 @SuppressWarnings("unchecked")
 private void uploadRecevied(final String filename, final SoftwareModule softwareModule) {
   final Item item = uploads.addItem(getItemid(filename, softwareModule));
   if (item != null) {
     item.getItemProperty(FILE_NAME).setValue(filename);
     item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
         .setValue(
             HawkbitCommonUtil.getFormattedNameVersion(
                 softwareModule.getName(), softwareModule.getVersion()));
     final UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
     uploadStatus.setStatus("Active");
     artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
   }
 }
예제 #5
0
 private String validate(
     final Set<TargetIdName> targetDetailsList,
     final DistributionSetIdName distributionSetIdName) {
   String pendingActionMessage = null;
   for (final TargetIdName trgtNameId : targetDetailsList) {
     if (null != trgtNameId) {
       if (managementUIState.getAssignedList().keySet().contains(trgtNameId)
           && managementUIState.getAssignedList().get(trgtNameId).equals(distributionSetIdName)) {
         pendingActionMessage =
             getPendingActionMessage(
                 pendingActionMessage,
                 trgtNameId.getControllerId(),
                 HawkbitCommonUtil.getDistributionNameAndVersion(
                     distributionSetIdName.getName(), distributionSetIdName.getVersion()));
       } else {
         managementUIState.getAssignedList().put(trgtNameId, distributionSetIdName);
       }
     }
   }
   return pendingActionMessage;
 }
예제 #6
0
 private void assignTargetTag(final DragAndDropEvent event) {
   final AbstractSelectTargetDetails dropData =
       (AbstractSelectTargetDetails) event.getTargetDetails();
   final Object distItemId = dropData.getItemIdOver();
   final String targetTagName =
       HawkbitCommonUtil.removePrefix(
           event.getTransferable().getSourceComponent().getId(),
           SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
   // get all the targets assigned to the tag
   // assign dist to those targets
   final List<Target> assignedTargets = targetService.findTargetsByTag(targetTagName);
   if (!assignedTargets.isEmpty()) {
     final Set<TargetIdName> targetDetailsList = new HashSet<>();
     assignedTargets.forEach(
         target ->
             targetDetailsList.add(
                 new TargetIdName(target.getId(), target.getControllerId(), target.getName())));
     assignTargetToDs(getItem(distItemId), targetDetailsList);
   } else {
     uiNotification.displaySuccess(
         i18n.get("message.no.targets.assiged.fortag", new Object[] {targetTagName}));
   }
 }
 @Override
 protected String getName() {
   return HawkbitCommonUtil.getFormattedNameVersion(
       getSelectedBaseEntity().getName(), getSelectedBaseEntity().getVersion());
 }
예제 #8
0
 @Override
 protected void addContainerProperties(final Container container) {
   HawkbitCommonUtil.getDsTableColumnProperties(container);
 }