private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) { final DistributionSetTagAssignmentResult result = distributionSetManagement .toggleTagAssignment(Sets.newHashSet(selectedEntity.getId()), tagNameSelected); processTargetTagAssigmentResult(result); uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n)); return result; }
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) { final DistributionSetTagAssignmentResult result = distributionSetManagement .toggleTagAssignment(Sets.newHashSet(selectedEntity.getId()), tagNameSelected); processTargetTagAssigmentResult(result); uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n)); return result; }
/** * Creates {@link DistributionSet} in repository including three * {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} * , {@link #SM_TYPE_APP}. * * @param prefix * for {@link SoftwareModule}s and {@link DistributionSet}s name, * vendor and description. * @param version * {@link DistributionSet#getVersion()} and * {@link SoftwareModule#getVersion()} extended by a random * number.updat * @param tags * {@link DistributionSet#getTags()} * * @return {@link DistributionSet} entity. */ public DistributionSet createDistributionSet(final String prefix, final String version, final Collection<DistributionSetTag> tags) { final DistributionSet set = createDistributionSet(prefix, version, false); tags.forEach(tag -> distributionSetManagement.toggleTagAssignment(Arrays.asList(set.getId()), tag.getName())); return distributionSetManagement.get(set.getId()).get(); }
/** * Creates {@link DistributionSet} in repository including three * {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} * , {@link #SM_TYPE_APP}. * * @param prefix * for {@link SoftwareModule}s and {@link DistributionSet}s name, * vendor and description. * @param version * {@link DistributionSet#getVersion()} and * {@link SoftwareModule#getVersion()} extended by a random * number.updat * @param tags * {@link DistributionSet#getTags()} * * @return {@link DistributionSet} entity. */ public DistributionSet createDistributionSet(final String prefix, final String version, final Collection<DistributionSetTag> tags) { final DistributionSet set = createDistributionSet(prefix, version, false); tags.forEach(tag -> distributionSetManagement.toggleTagAssignment(Arrays.asList(set.getId()), tag.getName())); return distributionSetManagement.get(set.getId()).get(); }
@Override public ResponseEntity<MgmtDistributionSetTagAssigmentResult> toggleTagAssignment( @PathVariable("distributionsetTagId") final Long distributionsetTagId, @RequestBody final List<MgmtAssignedDistributionSetRequestBody> assignedDSRequestBodies) { LOG.debug("Toggle distribution set assignment {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId); final DistributionSetTag tag = findDistributionTagById(distributionsetTagId); final DistributionSetTagAssignmentResult assigmentResult = this.distributionSetManagement .toggleTagAssignment(findDistributionSetIds(assignedDSRequestBodies), tag.getName()); final MgmtDistributionSetTagAssigmentResult tagAssigmentResultRest = new MgmtDistributionSetTagAssigmentResult(); tagAssigmentResultRest.setAssignedDistributionSets( MgmtDistributionSetMapper.toResponseDistributionSets(assigmentResult.getAssignedEntity())); tagAssigmentResultRest.setUnassignedDistributionSets( MgmtDistributionSetMapper.toResponseDistributionSets(assigmentResult.getUnassignedEntity())); LOG.debug("Toggled assignedDS {} and unassignedDS{}", assigmentResult.getAssigned(), assigmentResult.getUnassigned()); return ResponseEntity.ok(tagAssigmentResultRest); }
private void assignDsTag(final DragAndDropEvent event) { final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails(); final Table distTable = (Table) taregtDet.getTarget(); final Set<Long> 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((Long) distItemId); } else { distList.addAll(distsSelected); } final String distTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(), SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS); final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distList, distTagName); getNotification().displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, getI18n())); if (result.getAssigned() >= 1 && managementUIState.getDistributionTableFilters().isNoTagSelected()) { refreshFilter(); } }
private void assignDsTag(final DragAndDropEvent event) { final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails(); final Table distTable = (Table) taregtDet.getTarget(); final Set<Long> 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((Long) distItemId); } else { distList.addAll(distsSelected); } final String distTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(), SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS); final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distList, distTagName); getNotification().displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, getI18n())); if (result.getAssigned() >= 1 && managementUIState.getDistributionTableFilters().isNoTagSelected()) { refreshFilter(); } }
private void processDistributionDrop(final DragAndDropEvent event) { final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails(); final TableTransferable transferable = (TableTransferable) event.getTransferable(); final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent(); final Set<Long> distSelected = source.getSelectedEntitiesByTransferable(transferable); final String distTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(), SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS); final List<String> tagsClickedList = distFilterParameters.getDistSetTags(); final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distSelected, distTagName); notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n)); if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) { eventBus.publish(this, TargetFilterEvent.FILTER_BY_TAG); } }
private void processDistributionDrop(final DragAndDropEvent event) { final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails(); final TableTransferable transferable = (TableTransferable) event.getTransferable(); final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent(); final Set<Long> distSelected = source.getSelectedEntitiesByTransferable(transferable); final String distTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(), SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS); final List<String> tagsClickedList = distFilterParameters.getDistSetTags(); final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distSelected, distTagName); notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n)); if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) { eventBus.publish(this, TargetFilterEvent.FILTER_BY_TAG); } }