Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4890a25
feat(cloud-tenants): a tenant serves several customers, so its row na…
oleksandr-blip Oct 23, 2026
d8de44a
Merge remote-tracking branch 'origin/main' into feature/directory-con…
oleksandr-blip Oct 23, 2026
11479e8
Merge openframe-frontend-core 0.0.794 (05d57fab1) into feature/direct…
oleksandr-blip Oct 26, 2026
a3fc6e0
feat(cloud-tenants): the customer cell says how many users no custome…
oleksandr-blip Oct 26, 2026
896172e
fix(cloud-tenants): "+N" tells a screen reader what it counts, and cu…
oleksandr-blip Oct 26, 2026
c5476e1
Merge branch 'main' of https://github.com/flamingo-stack/openframe-os…
oleksandr-blip Oct 27, 2026
7cd8782
test(ui): the field-wrapper tests follow #2840: an unlabelled field h…
oleksandr-blip Oct 27, 2026
9d25902
Merge remote-tracking branch 'origin/main' into feature/directory-con…
oleksandr-blip Oct 27, 2026
c15492b
Merge remote-tracking branch 'origin/main' into feature/directory-con…
oleksandr-blip Oct 28, 2026
abe38f1
Merge main (#2856 untrusted markdown media, lib 0.0.811) into feature…
oleksandr-blip Oct 28, 2026
7247e31
Merge main (#2861 MeetingSchedulerModal, #2867, #2869, lib 0.0.812) i…
oleksandr-blip Oct 29, 2026
27be55c
Merge main (#2877 field-height checkbox blocks and label scale, lib 0…
oleksandr-blip Oct 29, 2026
a08d672
Merge main (#2855 Tailwind content from the import graph, #2870, lib …
oleksandr-blip Oct 29, 2026
af4737a
feat(cloud-tenants): the list's Licences column, funnels, and the pau…
oleksandr-blip Oct 30, 2026
3cfe0d8
feat(devices): the list's USER and SOURCES columns and funnels CU-86a…
oleksandr-blip Nov 2, 2026
f7b4e37
Merge main into feature/directory-connection-customers so its PR can …
oleksandr-blip Nov 2, 2026
fc11c79
feat(devices): directory summary fields, hardware facts and SOURCES/U…
andriikachur Nov 2, 2026
1381186
fix(devices,cloud-tenants): the phone filter clears USER and SOURCES,…
andriikachur Nov 2, 2026
a977e3d
Merge remote-tracking branch 'origin/main' into feature/directory-con…
andriikachur Nov 2, 2026
33a0cd3
fix(devices): the device filter window follows the content area and c…
oleksandr-blip Nov 3, 2026
c13ee34
fix(date-picker): a trigger named by its label is described by the da…
oleksandr-blip Nov 3, 2026
8c1c809
fix(devices): the filter window carries SOURCES only from lg until xl…
oleksandr-blip Nov 3, 2026
ef67f91
Merge origin/main into feature/directory-connection-customers
andriikachur Nov 3, 2026
6a19876
fix(frontend-core): review fixes on the device and tenant views CU-86…
oleksandr-blip Nov 3, 2026
7b70e59
Merge branch 'main' into feature/directory-connection-customers
andriikachur Nov 4, 2026
43755cd
chore: retrigger the PR build after the GitHub incident
andriikachur Nov 4, 2026
8af739a
fix(pinot): let Spring pick the public PinotConfigInitializer constru…
andriikachur Nov 4, 2026
864d3cc
Merge branch 'main' into feature/directory-connection-customers
oleksandr-blip Nov 5, 2026
15e57b3
Merge origin/main into feature/directory-connection-customers
andriikachur Nov 5, 2026
1f7b331
merge(tm2-flag): bring origin/main into feature/directory-connection-…
andriikachur Nov 6, 2026
bd9353f
fix(tm2-flag): hold the machine version on the Fleet host facts marker
andriikachur Nov 6, 2026
735cf1a
merge(tm2-flag): bring origin/main into feature/directory-connection-…
andriikachur Nov 6, 2026
31dd5c2
merge(tm2-flag): bring origin/main into feature/directory-connection-…
andriikachur Nov 6, 2026
b6d01b5
test(client-core): keep the metrics instance referenced in its gauge …
andriikachur Nov 6, 2026
2a94d0c
fix(embeds): name the action skeleton counts and mark their items CU-…
oleksandr-blip Nov 6, 2026
ade67dd
feat(cloud-tenants): lib main's single-customer table stays the defau…
oleksandr-blip Nov 6, 2026
ade40a1
test(markdown): table parity snapshots without the newline hast-util-…
oleksandr-blip Nov 6, 2026
8a62691
Merge remote-tracking branch 'origin/main' into feature/directory-con…
oleksandr-blip Nov 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.openframe.data.document.device.DeviceStatus;
import com.openframe.data.document.device.DeviceType;
import com.openframe.data.document.device.DirectorySource;
import com.openframe.data.document.device.DirectoryUserLink;
import com.openframe.data.document.packagesearch.PackageManagerType;
import com.openframe.data.document.rmm.script.OsType;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -31,6 +33,8 @@ public class DeviceFilterCriteria {
private String pattern;
private List<String> hostnames;
private List<String> nicknames;
private List<DirectorySource> directorySources;
private List<DirectoryUserLink> userLinks;

public DeviceFilterCriteria(List<DeviceStatus> statuses, List<DeviceType> deviceTypes, List<OsType> osTypes,
List<String> organizationIds, List<String> tagKeys, List<String> tagValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@ public enum DeviceFilterFacet {
OS_TYPES("osTypes"),
ORGANIZATION_IDS("organizationIds"),
TAG_KEYS("tagKeys"),
DIRECTORY_SOURCES("directorySources"),
USER_LINKS("userLinks"),
FILTERED_COUNT("filteredCount");

/** Every facet — the behaviour non-GraphQL callers (the external REST API) still want. */
/**
* Every facet, the directory ones included. For a caller that has no selection set to narrow
* it and whose response can carry all of them. A caller whose response does not expose a
* facet must not use this: each unused facet is a Pinot round trip made for nothing.
*/
public static final Set<DeviceFilterFacet> ALL =
Collections.unmodifiableSet(EnumSet.allOf(DeviceFilterFacet.class));

/**
* What the external REST {@code /filters} response carries: everything except the directory
* facets ({@link #DIRECTORY_SOURCES}, {@link #USER_LINKS}), which its DTO does not expose.
* Listed explicitly so a facet added later stays off the REST path until the DTO exposes it.
*/
public static final Set<DeviceFilterFacet> REST =
Collections.unmodifiableSet(EnumSet.of(
STATUSES, DEVICE_TYPES, OS_TYPES, ORGANIZATION_IDS, TAG_KEYS, FILTERED_COUNT));

private final String graphQlField;

DeviceFilterFacet(String graphQlField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ public class DeviceFilters {
private List<DeviceFilterOption> osTypes;
private List<DeviceFilterOption> organizationIds;
private List<TagFilterOption> tagKeys;
private List<DeviceFilterOption> directorySources;
private List<DeviceFilterOption> userLinks;
private Integer filteredCount;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import com.openframe.data.service.TenantIdProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -20,11 +22,13 @@
import java.util.function.Supplier;

import static com.openframe.api.dto.device.DeviceFilterFacet.DEVICE_TYPES;
import static com.openframe.api.dto.device.DeviceFilterFacet.DIRECTORY_SOURCES;
import static com.openframe.api.dto.device.DeviceFilterFacet.FILTERED_COUNT;
import static com.openframe.api.dto.device.DeviceFilterFacet.ORGANIZATION_IDS;
import static com.openframe.api.dto.device.DeviceFilterFacet.OS_TYPES;
import static com.openframe.api.dto.device.DeviceFilterFacet.STATUSES;
import static com.openframe.api.dto.device.DeviceFilterFacet.TAG_KEYS;
import static com.openframe.api.dto.device.DeviceFilterFacet.USER_LINKS;
import static java.util.Collections.emptyList;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.concurrent.CompletableFuture.supplyAsync;
Expand All @@ -33,25 +37,36 @@
@Slf4j
public class DeviceFilterService {

private static final Set<DeviceFilterFacet> DIRECTORY_FACETS = EnumSet.of(DIRECTORY_SOURCES, USER_LINKS);

private final PinotDeviceRepository pinotDeviceRepository;
private final DeviceFilterOptionMapper optionMapper;
private final TenantIdProvider tenantIdProvider;
private final Executor facetExecutor;
private final boolean directoryFacetsEnabled;

// The directory facets count values only an external directory integration writes. Without one (OSS) every
// machine reads as no source and NONE, so the two Pinot queries are skipped and the facets stay empty. The
// directory filters still apply either way.
public DeviceFilterService(PinotDeviceRepository pinotDeviceRepository,
DeviceFilterOptionMapper optionMapper,
TenantIdProvider tenantIdProvider,
@Qualifier(DeviceFilterExecutorConfig.DEVICE_FILTER_FACET_EXECUTOR)
Executor facetExecutor) {
Executor facetExecutor,
@Value("${openframe.device.directory-facets.enabled:false}")
boolean directoryFacetsEnabled) {
this.pinotDeviceRepository = pinotDeviceRepository;
this.optionMapper = optionMapper;
this.tenantIdProvider = tenantIdProvider;
this.facetExecutor = facetExecutor;
this.directoryFacetsEnabled = directoryFacetsEnabled;
}

/**
* Every facet. For callers with no selection set of their own — the external REST API, whose
* response DTO always carries all of them.
* Every facet ({@link DeviceFilterFacet#ALL}); the directory ones only while
* {@code openframe.device.directory-facets.enabled} is true, otherwise they come back empty. A
* caller whose response does not expose all of them should pass its own set instead, as the
* external REST API does with {@link DeviceFilterFacet#REST}.
*/
public CompletableFuture<DeviceFilters> getDeviceFilters(DeviceFilterCriteria filters) {
return getDeviceFilters(filters, DeviceFilterFacet.ALL);
Expand All @@ -70,7 +85,7 @@
*/
public CompletableFuture<DeviceFilters> getDeviceFilters(DeviceFilterCriteria filters,
Set<DeviceFilterFacet> requestedFacets) {
Set<DeviceFilterFacet> facets = requestedFacets != null ? requestedFacets : DeviceFilterFacet.ALL;
Set<DeviceFilterFacet> facets = queriedFacets(requestedFacets != null ? requestedFacets : DeviceFilterFacet.ALL);
List<String> statuses = filters != null && filters.getStatuses() != null ?
filters.getStatuses().stream().map(Enum::name).toList() : emptyList();
List<String> deviceTypes = filters != null && filters.getDeviceTypes() != null ?
Expand All @@ -80,36 +95,55 @@
List<String> organizationIds = filters != null ? filters.getOrganizationIds() : emptyList();
List<String> tagKeys = filters != null ? filters.getTagKeys() : emptyList();
List<String> tagKeyValues = buildTagKeyValuesFilter(filters);
List<String> directorySources = filters != null && filters.getDirectorySources() != null ?
filters.getDirectorySources().stream().map(Enum::name).toList() : emptyList();
List<String> userLinks = filters != null && filters.getUserLinks() != null ?
filters.getUserLinks().stream().map(Enum::name).toList() : emptyList();

String tenantId = tenantIdProvider.getTenantId();

CompletableFuture<Map<String, Integer>> statusesFuture = facetQuery(facets, STATUSES, () ->
pinotDeviceRepository.getStatusFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getStatusFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));
CompletableFuture<Map<String, Integer>> deviceTypesFuture = facetQuery(facets, DEVICE_TYPES, () ->
pinotDeviceRepository.getDeviceTypeFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getDeviceTypeFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));

Check warning on line 108 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceFilterService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

Mutant survived: EmptyObjectReturnValsMutator

replaced return value with Collections.emptyMap for com/openframe/api/service/device/DeviceFilterService::lambda$getDeviceFilters$1 (in lambda$getDeviceFilters$1). A test runs this line, but none fails when it changes.
CompletableFuture<Map<String, Integer>> osTypesFuture = facetQuery(facets, OS_TYPES, () ->
pinotDeviceRepository.getOsTypeFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getOsTypeFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));

Check warning on line 110 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceFilterService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

Mutant survived: EmptyObjectReturnValsMutator

replaced return value with Collections.emptyMap for com/openframe/api/service/device/DeviceFilterService::lambda$getDeviceFilters$2 (in lambda$getDeviceFilters$2). A test runs this line, but none fails when it changes.
CompletableFuture<Map<String, Integer>> organizationsFuture = facetQuery(facets, ORGANIZATION_IDS, () ->
pinotDeviceRepository.getOrganizationFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getOrganizationFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));

Check warning on line 112 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceFilterService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

Mutant survived: EmptyObjectReturnValsMutator

replaced return value with Collections.emptyMap for com/openframe/api/service/device/DeviceFilterService::lambda$getDeviceFilters$3 (in lambda$getDeviceFilters$3). A test runs this line, but none fails when it changes.
CompletableFuture<Map<String, Integer>> tagKeysFuture = facetQuery(facets, TAG_KEYS, () ->
pinotDeviceRepository.getTagKeyFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getTagKeyFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));

Check warning on line 114 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceFilterService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

Mutant survived: EmptyObjectReturnValsMutator

replaced return value with Collections.emptyMap for com/openframe/api/service/device/DeviceFilterService::lambda$getDeviceFilters$4 (in lambda$getDeviceFilters$4). A test runs this line, but none fails when it changes.
CompletableFuture<Map<String, Integer>> directorySourcesFuture = facetQuery(facets, DIRECTORY_SOURCES, () ->
pinotDeviceRepository.getDirectorySourceFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));
CompletableFuture<Map<String, Integer>> userLinksFuture = facetQuery(facets, USER_LINKS, () ->
pinotDeviceRepository.getUserLinkFilterOptions(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));
CompletableFuture<Integer> filteredCountFuture = facetQuery(facets, FILTERED_COUNT, () ->
pinotDeviceRepository.getFilteredDeviceCount(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues));
pinotDeviceRepository.getFilteredDeviceCount(tenantId, statuses, deviceTypes, osTypes, organizationIds, tagKeys, tagKeyValues, directorySources, userLinks));

return CompletableFuture.allOf(
statusesFuture, deviceTypesFuture, osTypesFuture,
organizationsFuture, tagKeysFuture, filteredCountFuture)
statusesFuture, deviceTypesFuture, osTypesFuture, organizationsFuture, tagKeysFuture,
directorySourcesFuture, userLinksFuture, filteredCountFuture)
.thenApply(v -> DeviceFilters.builder()
.statuses(optionMapper.selfLabeled(statusesFuture.join()))
.deviceTypes(optionMapper.selfLabeled(deviceTypesFuture.join()))
.osTypes(optionMapper.selfLabeled(osTypesFuture.join()))
.organizationIds(optionMapper.organizationLabeled(organizationsFuture.join()))
.tagKeys(optionMapper.tagLabeled(tagKeysFuture.join()))
.directorySources(optionMapper.selfLabeled(directorySourcesFuture.join()))
.userLinks(optionMapper.selfLabeled(userLinksFuture.join()))
.filteredCount(filteredCountFuture.join())
.build()
);
}

private Set<DeviceFilterFacet> queriedFacets(Set<DeviceFilterFacet> requested) {
if (directoryFacetsEnabled || requested.isEmpty()) {
return requested;
}
EnumSet<DeviceFilterFacet> queried = EnumSet.copyOf(requested);
queried.removeAll(DIRECTORY_FACETS);
return queried;
}

/**
* Submits one facet query, or short-circuits to {@code null} when the caller didn't ask for it.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -48,6 +47,7 @@
import java.util.stream.Collectors;

import static com.openframe.data.service.machine.MachineFields.NICKNAME;
import static com.openframe.data.service.machine.MachineFields.STATUS;
import static com.openframe.data.service.machine.MachineUpdate.machineUpdate;

@Service
Expand Down Expand Up @@ -181,6 +181,9 @@
.osTypes(deviceFilterOptionMapper.selfLabeled(machineRepository.facet(tenantId, filter, search, DeviceFacetDimension.OS_TYPE)))
.organizationIds(deviceFilterOptionMapper.organizationLabeled(machineRepository.facet(tenantId, filter, search, DeviceFacetDimension.ORGANIZATION_ID)))
.tagKeys(List.of())
// The pickers' Mongo facets have no directory dimension: the two filters apply, their counts are []
.directorySources(List.of())
.userLinks(List.of())
.filteredCount((int) machineRepository.countMachines(tenantId, filter, search))
.build();
}
Expand Down Expand Up @@ -273,7 +276,9 @@
.hostnames(filter.getHostnames())
.nicknames(filter.getNicknames())
.tagKeys(filter.getTagKeys())
.tagValues(filter.getTagValues());
.tagValues(filter.getTagValues())
.directorySources(filter.getDirectorySources())
.directoryUserLinks(filter.getUserLinks());
filterOsTypes = filter.getOsTypes();
}
return builder.osTypes(resolveOsTypes(filterOsTypes, osTypeScope))
Expand Down Expand Up @@ -353,13 +358,14 @@
deletedMachineCleanup.removeFromSchedules(machine.getTenantId(), machineId);
}

machine.setStatus(status);
machine.setUpdatedAt(Instant.now());
machineRepository.save(machine);
// Field-level: a whole-document save would overwrite what other writers set on the machine since the read
Machine updated = machineWriter.update(machineId, machineUpdate().set(STATUS, status))
.map(MachineWriteResult::after)
.orElseThrow(() -> new DeviceNotFoundException("Device not found: " + machineId));

Check notice on line 364 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

No test reaches this line: NullReturnValsMutator

replaced return value with null for com/openframe/api/service/device/DeviceService::lambda$updateStatusByMachineId$1 (in lambda$updateStatusByMachineId$1). No test runs this line.
log.info("Device {} status updated to {}", machineId, status);

try {
deviceStatusProcessor.postProcessStatusUpdated(machine);
deviceStatusProcessor.postProcessStatusUpdated(updated);

Check notice on line 368 in openframe-api-lib/src/main/java/com/openframe/api/service/device/DeviceService.java

View check run for this annotation

Flamingo / Flamingo Code Review / tests and mutation

No test reaches this line: VoidMethodCallMutator

removed call to com/openframe/api/service/processor/DeviceStatusProcessor::postProcessStatusUpdated (in updateStatusByMachineId). No test runs this line.
} catch (Exception e) {
log.error("Post-processor failed for machineId={}: {}", machineId, e.getMessage(), e);
}
Expand Down
Loading
Loading