fixed cache after merge with upstream/feature/entity-view brance
This commit is contained in:
commit
74bfd4c7b4
@ -105,6 +105,9 @@ public class DefaultTelemetrySubscriptionService implements TelemetrySubscriptio
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ClusterRpcService rpcService;
|
private ClusterRpcService rpcService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityViewService entityViewService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private DeviceStateService stateService;
|
private DeviceStateService stateService;
|
||||||
@ -137,6 +140,10 @@ public class DefaultTelemetrySubscriptionService implements TelemetrySubscriptio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addLocalWsSubscription(String sessionId, EntityId entityId, SubscriptionState sub) {
|
public void addLocalWsSubscription(String sessionId, EntityId entityId, SubscriptionState sub) {
|
||||||
|
if (entityId.getEntityType().equals(EntityType.ENTITY_VIEW)) {
|
||||||
|
EntityView entityView = entityViewService.findEntityViewById(new EntityViewId(entityId.getId()));
|
||||||
|
entityId = entityView.getEntityId();
|
||||||
|
}
|
||||||
Optional<ServerAddress> server = routingService.resolveById(entityId);
|
Optional<ServerAddress> server = routingService.resolveById(entityId);
|
||||||
Subscription subscription;
|
Subscription subscription;
|
||||||
if (server.isPresent()) {
|
if (server.isPresent()) {
|
||||||
|
|||||||
@ -39,8 +39,8 @@ public class EntityView extends SearchTextBasedWithAdditionalInfo<EntityViewId>
|
|||||||
private CustomerId customerId;
|
private CustomerId customerId;
|
||||||
private String name;
|
private String name;
|
||||||
private TelemetryEntityView keys;
|
private TelemetryEntityView keys;
|
||||||
private long startTs;
|
private long startTimeMs;
|
||||||
private long endTs;
|
private long endTimeMs;
|
||||||
|
|
||||||
public EntityView() {
|
public EntityView() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@ -127,17 +127,17 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti
|
|||||||
List<AttributeKvEntry> filteredAttributes =
|
List<AttributeKvEntry> filteredAttributes =
|
||||||
attributeKvEntries.stream()
|
attributeKvEntries.stream()
|
||||||
.filter(attributeKvEntry -> {
|
.filter(attributeKvEntry -> {
|
||||||
if (entityView.getStartTs() == 0 && entityView.getEndTs() == 0) {
|
if (entityView.getStartTimeMs() == 0 && entityView.getEndTimeMs() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (entityView.getEndTs() == 0 && entityView.getStartTs() < attributeKvEntry.getLastUpdateTs()) {
|
if (entityView.getEndTimeMs() == 0 && entityView.getStartTimeMs() < attributeKvEntry.getLastUpdateTs()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (entityView.getStartTs() == 0 && entityView.getEndTs() > attributeKvEntry.getLastUpdateTs()) {
|
if (entityView.getStartTimeMs() == 0 && entityView.getEndTimeMs() > attributeKvEntry.getLastUpdateTs()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return entityView.getStartTs() < attributeKvEntry.getLastUpdateTs()
|
return entityView.getStartTimeMs() < attributeKvEntry.getLastUpdateTs()
|
||||||
&& entityView.getEndTs() > attributeKvEntry.getLastUpdateTs();
|
&& entityView.getEndTimeMs() > attributeKvEntry.getLastUpdateTs();
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
attributesService.save(entityView.getId(), scope, filteredAttributes);
|
attributesService.save(entityView.getId(), scope, filteredAttributes);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,8 +114,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.startTs = entityView.getStartTs();
|
this.startTs = entityView.getStartTimeMs();
|
||||||
this.endTs = entityView.getEndTs();
|
this.endTs = entityView.getEndTimeMs();
|
||||||
this.searchText = entityView.getSearchText();
|
this.searchText = entityView.getSearchText();
|
||||||
this.additionalInfo = entityView.getAdditionalInfo();
|
this.additionalInfo = entityView.getAdditionalInfo();
|
||||||
}
|
}
|
||||||
@ -144,8 +144,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
entityView.setStartTs(startTs);
|
entityView.setStartTimeMs(startTs);
|
||||||
entityView.setEndTs(endTs);
|
entityView.setEndTimeMs(endTs);
|
||||||
entityView.setAdditionalInfo(additionalInfo);
|
entityView.setAdditionalInfo(additionalInfo);
|
||||||
return entityView;
|
return entityView;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,8 +105,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.startTs = entityView.getStartTs() != 0L ? entityView.getStartTs() : 0L;
|
this.startTs = entityView.getStartTimeMs();
|
||||||
this.endTs = entityView.getEndTs() != 0L ? entityView.getEndTs() : 0L;
|
this.endTs = entityView.getEndTimeMs();
|
||||||
this.searchText = entityView.getSearchText();
|
this.searchText = entityView.getSearchText();
|
||||||
this.additionalInfo = entityView.getAdditionalInfo();
|
this.additionalInfo = entityView.getAdditionalInfo();
|
||||||
}
|
}
|
||||||
@ -141,8 +141,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
entityView.setStartTs(startTs);
|
entityView.setStartTimeMs(startTs);
|
||||||
entityView.setEndTs(endTs);
|
entityView.setEndTimeMs(endTs);
|
||||||
entityView.setAdditionalInfo(additionalInfo);
|
entityView.setAdditionalInfo(additionalInfo);
|
||||||
return entityView;
|
return entityView;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class BaseTimeseriesService implements TimeseriesService {
|
|||||||
}
|
}
|
||||||
List<ReadTsKvQuery> queries =
|
List<ReadTsKvQuery> queries =
|
||||||
filteredKeys.stream()
|
filteredKeys.stream()
|
||||||
.map(key -> new BaseReadTsKvQuery(key, entityView.getStartTs(), entityView.getEndTs(), 1, "ASC"))
|
.map(key -> new BaseReadTsKvQuery(key, entityView.getStartTimeMs(), entityView.getEndTimeMs(), 1, "ASC"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return timeseriesDao.findAllAsync(entityView.getEntityId(), updateQueriesForEntityView(entityView, queries));
|
return timeseriesDao.findAllAsync(entityView.getEntityId(), updateQueriesForEntityView(entityView, queries));
|
||||||
@ -133,8 +133,8 @@ public class BaseTimeseriesService implements TimeseriesService {
|
|||||||
|
|
||||||
private List<ReadTsKvQuery> updateQueriesForEntityView(EntityView entityView, List<ReadTsKvQuery> queries) {
|
private List<ReadTsKvQuery> updateQueriesForEntityView(EntityView entityView, List<ReadTsKvQuery> queries) {
|
||||||
return queries.stream().map(query -> {
|
return queries.stream().map(query -> {
|
||||||
long startTs = entityView.getStartTs() == 0 ? query.getStartTs() : entityView.getStartTs();
|
long startTs = entityView.getStartTimeMs() == 0 ? query.getStartTs() : entityView.getStartTimeMs();
|
||||||
long endTs = entityView.getEndTs() == 0 ? query.getEndTs() : entityView.getEndTs();
|
long endTs = entityView.getEndTimeMs() == 0 ? query.getEndTs() : entityView.getEndTimeMs();
|
||||||
|
|
||||||
return startTs <= query.getStartTs() && endTs >= query.getEndTs() ? query :
|
return startTs <= query.getStartTs() && endTs >= query.getEndTs() ? query :
|
||||||
new BaseReadTsKvQuery(query.getKey(), startTs, endTs, query.getInterval(), query.getLimit(), query.getAggregation());
|
new BaseReadTsKvQuery(query.getKey(), startTs, endTs, query.getInterval(), query.getLimit(), query.getAggregation());
|
||||||
|
|||||||
@ -95,23 +95,25 @@
|
|||||||
md-separator-keys="separatorKeys">
|
md-separator-keys="separatorKeys">
|
||||||
</md-chips>
|
</md-chips>
|
||||||
</section>
|
</section>
|
||||||
<section layout="row" layout-align="start start">
|
<section layout="column">
|
||||||
<mdp-date-picker ng-model="startTs"
|
<section layout="row" layout-align="start start">
|
||||||
mdp-max-date="maxStartTs"
|
<mdp-date-picker ng-model="startTimeMs"
|
||||||
mdp-placeholder="{{ 'entity-view.start-ts' | translate }}"></mdp-date-picker>
|
mdp-max-date="maxStartTimeTs"
|
||||||
<mdp-time-picker ng-model="startTs"
|
mdp-placeholder="{{ 'entity-view.start-ts' | translate }}"></mdp-date-picker>
|
||||||
mdp-max-date="maxStartTs"
|
<mdp-time-picker ng-model="startTimeMs"
|
||||||
mdp-placeholder="{{ 'entity-view.start-ts' | translate }}"
|
mdp-max-date="maxStartTimeTs"
|
||||||
mdp-auto-switch="true"></mdp-time-picker>
|
mdp-placeholder="{{ 'entity-view.start-ts' | translate }}"
|
||||||
</section>
|
mdp-auto-switch="true"></mdp-time-picker>
|
||||||
<section layout="row" layout-align="start start">
|
</section>
|
||||||
<mdp-date-picker ng-model="endTs"
|
<section layout="row" layout-align="start start">
|
||||||
mdp-min-date="minEndTs"
|
<mdp-date-picker ng-model="endTimeMs"
|
||||||
mdp-placeholder="{{ 'entity-view.end-ts' | translate }}"></mdp-date-picker>
|
mdp-min-date="minEndTimeTs"
|
||||||
<mdp-time-picker ng-model="endTs"
|
mdp-placeholder="{{ 'entity-view.end-ts' | translate }}"></mdp-date-picker>
|
||||||
mdp-min-date="minEndTs"
|
<mdp-time-picker ng-model="endTimeMs"
|
||||||
mdp-placeholder="{{ 'entity-view.end-ts' | translate }}"
|
mdp-min-date="minEndTimeTs"
|
||||||
mdp-auto-switch="true"></mdp-time-picker>
|
mdp-placeholder="{{ 'entity-view.end-ts' | translate }}"
|
||||||
|
mdp-auto-switch="true"></mdp-time-picker>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</md-content>
|
</md-content>
|
||||||
|
|||||||
@ -51,8 +51,12 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t
|
|||||||
scope.isPublic = false;
|
scope.isPublic = false;
|
||||||
scope.assignedCustomer = null;
|
scope.assignedCustomer = null;
|
||||||
}
|
}
|
||||||
scope.startTs = new Date(scope.entityView.startTs);
|
if (scope.entityView.startTimeMs > 0) {
|
||||||
scope.endTs = new Date(scope.entityView.endTs);
|
scope.startTimeMs = new Date(scope.entityView.startTimeMs);
|
||||||
|
}
|
||||||
|
if (scope.entityView.endTimeTs > 0) {
|
||||||
|
scope.endTimeTs = new Date(scope.entityView.endTimeTs);
|
||||||
|
}
|
||||||
if (!scope.entityView.keys) {
|
if (!scope.entityView.keys) {
|
||||||
scope.entityView.keys = {};
|
scope.entityView.keys = {};
|
||||||
scope.entityView.keys.timeseries = [];
|
scope.entityView.keys.timeseries = [];
|
||||||
@ -65,32 +69,32 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
scope.$watch('startTs', function (newDate) {
|
scope.$watch('startTimeMs', function (newDate) {
|
||||||
if (newDate) {
|
if (newDate) {
|
||||||
if (newDate.getTime() > scope.maxStartTs) {
|
if (newDate.getTime() > scope.maxStartTimeMs) {
|
||||||
scope.startTs = angular.copy(scope.maxStartTs);
|
scope.startTimeMs = angular.copy(scope.maxStartTimeMs);
|
||||||
}
|
}
|
||||||
updateMinMaxDates();
|
updateMinMaxDates();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
scope.$watch('endTs', function (newDate) {
|
scope.$watch('endTimeTs', function (newDate) {
|
||||||
if (newDate) {
|
if (newDate) {
|
||||||
if (newDate.getTime() < scope.minEndTs) {
|
if (newDate.getTime() < scope.minEndTimeTs) {
|
||||||
scope.endTs = angular.copy(scope.minEndTs);
|
scope.endTimeTs = angular.copy(scope.minEndTimeTs);
|
||||||
}
|
}
|
||||||
updateMinMaxDates();
|
updateMinMaxDates();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateMinMaxDates() {
|
function updateMinMaxDates() {
|
||||||
if (scope.endTs) {
|
if (scope.endTimeTs) {
|
||||||
scope.maxStartTs = angular.copy(new Date(scope.endTs.getTime()));
|
scope.maxStartTimeMs = angular.copy(new Date(scope.endTimeTs.getTime()));
|
||||||
scope.entityView.endTs = scope.endTs.getTime();
|
scope.entityView.endTimeTs = scope.endTimeTs.getTime();
|
||||||
}
|
}
|
||||||
if (scope.startTs) {
|
if (scope.startTimeMs) {
|
||||||
scope.minEndTs = angular.copy(new Date(scope.startTs.getTime()));
|
scope.minEndTimeTs = angular.copy(new Date(scope.startTimeMs.getTime()));
|
||||||
scope.entityView.startTs = scope.startTs.getTime();
|
scope.entityView.startTimeMs = scope.startTimeMs.getTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -827,8 +827,9 @@
|
|||||||
"unable-entity-view-device-alias-text": "Device alias '{{entityViewAlias}}' can't be deleted as it used by the following widget(s):<br/>{{widgetsList}}",
|
"unable-entity-view-device-alias-text": "Device alias '{{entityViewAlias}}' can't be deleted as it used by the following widget(s):<br/>{{widgetsList}}",
|
||||||
"select-entity-view": "Select entity view",
|
"select-entity-view": "Select entity view",
|
||||||
"make-public": "Make entity view public",
|
"make-public": "Make entity view public",
|
||||||
"start-ts": "Start ts",
|
"start-ts": "Start time",
|
||||||
"end-ts": "End ts",
|
"end-ts": "End time",
|
||||||
|
"date-limits": "Date limits",
|
||||||
"client-attributes": "Client attributes",
|
"client-attributes": "Client attributes",
|
||||||
"shared-attributes": "Shared attributes",
|
"shared-attributes": "Shared attributes",
|
||||||
"server-attributes": "Server attributes",
|
"server-attributes": "Server attributes",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user