예제 #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 void pinDitribution(final Button eventBtn) {

    /* if distribution set is pinned ,unpin target if pinned */
    managementUIState.getDistributionTableFilters().setPinnedTargetId(null);
    /* Dist table restyle */
    eventBus.publish(this, PinUnpinEvent.PIN_DISTRIBUTION);
    applyPinStyle(eventBtn);
    styleDistributionSetTable();
    isDistPinned = Boolean.FALSE;
  }
예제 #3
0
 private Map<String, Object> prepareQueryConfigFilters() {
   final Map<String, Object> queryConfig = Maps.newHashMapWithExpectedSize(4);
   managementUIState
       .getDistributionTableFilters()
       .getSearchText()
       .ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
   managementUIState
       .getDistributionTableFilters()
       .getPinnedTargetId()
       .ifPresent(value -> queryConfig.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
   final List<String> list = new ArrayList<>();
   queryConfig.put(
       SPUIDefinitions.FILTER_BY_NO_TAG,
       managementUIState.getDistributionTableFilters().isNoTagSelected());
   if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
     list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
   }
   queryConfig.put(SPUIDefinitions.FILTER_BY_TAG, list);
   return queryConfig;
 }
예제 #4
0
  private void styleDistributionTableOnPinning() {
    if (!managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()) {
      return;
    }

    final Target targetObj =
        targetService.findTargetByControllerIDWithDetails(
            managementUIState.getDistributionTableFilters().getPinnedTargetId().get());

    if (targetObj != null) {
      final DistributionSet assignedDistribution = targetObj.getAssignedDistributionSet();
      final DistributionSet installedDistribution =
          targetObj.getTargetInfo().getInstalledDistributionSet();
      Long installedDistId = null;
      Long assignedDistId = null;
      if (null != installedDistribution) {
        installedDistId = installedDistribution.getId();
      }
      if (null != assignedDistribution) {
        assignedDistId = assignedDistribution.getId();
      }
      styleDistributionSetTable(installedDistId, assignedDistId);
    }
  }