예제 #1
0
 /**
  * Display message.
  *
  * @param distId as dist ID
  */
 private void displayCountLabel(final Long distId) {
   final Long targetsWithAssigedDsCount =
       targetManagement.countTargetByAssignedDistributionSet(distId);
   final Long targetsWithInstalledDsCount =
       targetManagement.countTargetByInstalledDistributionSet(distId);
   final StringBuilder message = new StringBuilder(i18n.get("label.target.count"));
   message.append("<span class=\"assigned-count-message\">");
   message.append(i18n.get("label.assigned.count", new Object[] {targetsWithAssigedDsCount}));
   message.append("</span>, <span class=\"installed-count-message\"> ");
   message.append(i18n.get("label.installed.count", new Object[] {targetsWithInstalledDsCount}));
   message.append("</span>");
   setValue(message.toString());
 }
  /**
   * Method to send a message to a RabbitMQ Exchange after the Distribution set has been assign to a
   * Target.
   *
   * @param assignedEvent the object to be send.
   */
  @EventListener(classes = TargetAssignDistributionSetEvent.class)
  public void targetAssignDistributionSet(final TargetAssignDistributionSetEvent assignedEvent) {
    if (isFromSelf(assignedEvent)) {
      return;
    }

    sendUpdateMessageToTarget(
        assignedEvent.getTenant(),
        targetManagement.findTargetByControllerID(assignedEvent.getControllerId()),
        assignedEvent.getActionId(),
        assignedEvent.getModules());
  }
예제 #3
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}));
   }
 }
예제 #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);
    }
  }