|
|
|
@ -28,6 +28,7 @@ import org.thingsboard.common.util.JacksonUtil; |
|
|
|
import org.thingsboard.server.common.data.Customer; |
|
|
|
import org.thingsboard.server.common.data.Dashboard; |
|
|
|
import org.thingsboard.server.common.data.DashboardInfo; |
|
|
|
import org.thingsboard.server.common.data.DataConstants; |
|
|
|
import org.thingsboard.server.common.data.EntityType; |
|
|
|
import org.thingsboard.server.common.data.edge.Edge; |
|
|
|
import org.thingsboard.server.common.data.id.CustomerId; |
|
|
|
@ -38,7 +39,6 @@ import org.thingsboard.server.common.data.id.HasId; |
|
|
|
import org.thingsboard.server.common.data.id.TenantId; |
|
|
|
import org.thingsboard.server.common.data.page.PageData; |
|
|
|
import org.thingsboard.server.common.data.page.PageLink; |
|
|
|
import org.thingsboard.server.common.data.query.EntityFilterType; |
|
|
|
import org.thingsboard.server.common.data.relation.EntityRelation; |
|
|
|
import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
|
|
|
import org.thingsboard.server.dao.customer.CustomerDao; |
|
|
|
@ -123,22 +123,21 @@ public class DashboardServiceImpl extends AbstractEntityService implements Dashb |
|
|
|
if (filter == null || filter.get("type") == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
updateFilterByTypeIfRequired(filter, EntityFilterType.ASSET_TYPE.getLabel()); |
|
|
|
updateFilterByTypeIfRequired(filter, EntityFilterType.DEVICE_TYPE.getLabel()); |
|
|
|
updateFilterByTypeIfRequired(filter, EntityFilterType.ENTITY_VIEW_TYPE.getLabel()); |
|
|
|
updateFilterByTypeIfRequired(filter, EntityFilterType.EDGE_TYPE.getLabel()); |
|
|
|
for (String filterTypeForUpdate : DataConstants.DASHBOARD_FILTER_TYPES_FOR_UPDATE) { |
|
|
|
updateFilterByTypeIfRequired(filter, filterTypeForUpdate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void updateFilterByTypeIfRequired(JsonNode filter, String FILTER_TYPE_SINGULAR_LABEL) { |
|
|
|
if (filter.get(FILTER_TYPE_SINGULAR_LABEL) == null) { |
|
|
|
private static void updateFilterByTypeIfRequired(JsonNode filter, String filterTypeSingularLabel) { |
|
|
|
if (filter.get(filterTypeSingularLabel) == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (FILTER_TYPE_SINGULAR_LABEL.equals(filter.get("type").asText())) { |
|
|
|
if (filterTypeSingularLabel.equals(filter.get("type").asText())) { |
|
|
|
ArrayNode filterTypes = JacksonUtil.OBJECT_MAPPER.createArrayNode(); |
|
|
|
filterTypes.add(filter.get(FILTER_TYPE_SINGULAR_LABEL).asText()); |
|
|
|
final String FILTER_TYPES_PLURAL_LABEL = String.format("%ss", FILTER_TYPE_SINGULAR_LABEL); |
|
|
|
((ObjectNode) filter).set(FILTER_TYPES_PLURAL_LABEL, filterTypes); |
|
|
|
((ObjectNode) filter).remove(FILTER_TYPE_SINGULAR_LABEL); |
|
|
|
filterTypes.add(filter.get(filterTypeSingularLabel).asText()); |
|
|
|
final String filterTypesPluralLabel = String.format("%ss", filterTypeSingularLabel); |
|
|
|
((ObjectNode) filter).set(filterTypesPluralLabel, filterTypes); |
|
|
|
((ObjectNode) filter).remove(filterTypeSingularLabel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -329,6 +328,11 @@ public class DashboardServiceImpl extends AbstractEntityService implements Dashb |
|
|
|
return dashboardDao.findByTenantIdAndTitle(tenantId.getId(), title); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<DashboardInfo> findDashboardsByTenantIdAndConfigurationText(TenantId tenantId, String searchText, PageLink pageLink) { |
|
|
|
return dashboardInfoDao.findByTenantIdAndConfigurationText(tenantId.getId(), searchText, pageLink); |
|
|
|
} |
|
|
|
|
|
|
|
private PaginatedRemover<TenantId, DashboardInfo> tenantDashboardsRemover = |
|
|
|
new PaginatedRemover<TenantId, DashboardInfo>() { |
|
|
|
|
|
|
|
|