Merge branch 'master' into develop/2.3
This commit is contained in:
commit
915d1f683c
@ -49,25 +49,53 @@ import static org.thingsboard.server.dao.model.ModelConstants.TS_COLUMN;
|
||||
@IdClass(TsKvCompositeKey.class)
|
||||
public final class TsKvEntity implements ToData<TsKvEntry> {
|
||||
|
||||
private static final String SUM = "SUM";
|
||||
private static final String AVG = "AVG";
|
||||
private static final String MIN = "MIN";
|
||||
private static final String MAX = "MAX";
|
||||
|
||||
public TsKvEntity() {
|
||||
}
|
||||
|
||||
public TsKvEntity(Double avgLongValue, Double avgDoubleValue) {
|
||||
if(avgLongValue != null) {
|
||||
this.longValue = avgLongValue.longValue();
|
||||
}
|
||||
this.doubleValue = avgDoubleValue;
|
||||
}
|
||||
|
||||
public TsKvEntity(Long sumLongValue, Double sumDoubleValue) {
|
||||
this.longValue = sumLongValue;
|
||||
this.doubleValue = sumDoubleValue;
|
||||
}
|
||||
|
||||
public TsKvEntity(String strValue, Long longValue, Double doubleValue) {
|
||||
public TsKvEntity(String strValue) {
|
||||
this.strValue = strValue;
|
||||
}
|
||||
|
||||
public TsKvEntity(Long longValue, Double doubleValue, Long longCountValue, Long doubleCountValue, String aggType) {
|
||||
switch (aggType) {
|
||||
case AVG:
|
||||
double sum = 0.0;
|
||||
if (longValue != null) {
|
||||
sum += longValue;
|
||||
}
|
||||
if (doubleValue != null) {
|
||||
sum += doubleValue;
|
||||
}
|
||||
long totalCount = longCountValue + doubleCountValue;
|
||||
if (totalCount > 0) {
|
||||
this.doubleValue = sum / (longCountValue + doubleCountValue);
|
||||
} else {
|
||||
this.doubleValue = 0.0;
|
||||
}
|
||||
break;
|
||||
case SUM:
|
||||
if (doubleCountValue > 0) {
|
||||
this.doubleValue = doubleValue + (longValue != null ? longValue.doubleValue() : 0.0);
|
||||
} else {
|
||||
this.longValue = longValue;
|
||||
}
|
||||
break;
|
||||
case MIN:
|
||||
case MAX:
|
||||
if (longCountValue > 0 && doubleCountValue > 0) {
|
||||
this.doubleValue = MAX.equals(aggType) ? Math.max(doubleValue, longValue.doubleValue()) : Math.min(doubleValue, longValue.doubleValue());
|
||||
} else if (doubleCountValue > 0) {
|
||||
this.doubleValue = doubleValue;
|
||||
} else if (longCountValue > 0) {
|
||||
this.longValue = longValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public TsKvEntity(Long booleanValueCount, Long strValueCount, Long longValueCount, Long doubleValueCount) {
|
||||
@ -75,10 +103,8 @@ public final class TsKvEntity implements ToData<TsKvEntry> {
|
||||
this.longValue = booleanValueCount;
|
||||
} else if (strValueCount != 0) {
|
||||
this.longValue = strValueCount;
|
||||
} else if (longValueCount != 0) {
|
||||
this.longValue = longValueCount;
|
||||
} else if (doubleValueCount != 0) {
|
||||
this.longValue = doubleValueCount;
|
||||
} else {
|
||||
this.longValue = longValueCount + doubleValueCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -161,52 +161,62 @@ public class JpaTimeseriesDao extends JpaAbstractDaoListeningExecutorService imp
|
||||
}
|
||||
|
||||
private ListenableFuture<Optional<TsKvEntry>> findAndAggregateAsync(EntityId entityId, String key, long startTs, long endTs, long ts, Aggregation aggregation) {
|
||||
CompletableFuture<TsKvEntity> entity;
|
||||
List<CompletableFuture<TsKvEntity>> entitiesFutures = new ArrayList<>();
|
||||
String entityIdStr = fromTimeUUID(entityId.getId());
|
||||
switch (aggregation) {
|
||||
case AVG:
|
||||
entity = tsKvRepository.findAvg(
|
||||
entitiesFutures.add(tsKvRepository.findAvg(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs);
|
||||
endTs));
|
||||
|
||||
break;
|
||||
case MAX:
|
||||
entity = tsKvRepository.findMax(
|
||||
entitiesFutures.add(tsKvRepository.findStringMax(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs);
|
||||
endTs));
|
||||
entitiesFutures.add(tsKvRepository.findNumericMax(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs));
|
||||
|
||||
break;
|
||||
case MIN:
|
||||
entity = tsKvRepository.findMin(
|
||||
entitiesFutures.add(tsKvRepository.findStringMin(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs);
|
||||
|
||||
endTs));
|
||||
entitiesFutures.add(tsKvRepository.findNumericMin(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs));
|
||||
break;
|
||||
case SUM:
|
||||
entity = tsKvRepository.findSum(
|
||||
entitiesFutures.add(tsKvRepository.findSum(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs);
|
||||
|
||||
endTs));
|
||||
break;
|
||||
case COUNT:
|
||||
entity = tsKvRepository.findCount(
|
||||
entitiesFutures.add(tsKvRepository.findCount(
|
||||
entityIdStr,
|
||||
entityId.getEntityType(),
|
||||
key,
|
||||
startTs,
|
||||
endTs);
|
||||
endTs));
|
||||
|
||||
break;
|
||||
default:
|
||||
@ -214,11 +224,27 @@ public class JpaTimeseriesDao extends JpaAbstractDaoListeningExecutorService imp
|
||||
}
|
||||
|
||||
SettableFuture<TsKvEntity> listenableFuture = SettableFuture.create();
|
||||
entity.whenComplete((tsKvEntity, throwable) -> {
|
||||
|
||||
|
||||
CompletableFuture<List<TsKvEntity>> entities =
|
||||
CompletableFuture.allOf(entitiesFutures.toArray(new CompletableFuture[entitiesFutures.size()]))
|
||||
.thenApply(v -> entitiesFutures.stream()
|
||||
.map(CompletableFuture::join)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
|
||||
entities.whenComplete((tsKvEntities, throwable) -> {
|
||||
if (throwable != null) {
|
||||
listenableFuture.setException(throwable);
|
||||
} else {
|
||||
listenableFuture.set(tsKvEntity);
|
||||
TsKvEntity result = null;
|
||||
for (TsKvEntity entity : tsKvEntities) {
|
||||
if (entity.isNotEmpty()) {
|
||||
result = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
listenableFuture.set(result);
|
||||
}
|
||||
});
|
||||
return Futures.transform(listenableFuture, new Function<TsKvEntity, Optional<TsKvEntry>>() {
|
||||
|
||||
@ -35,7 +35,7 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite
|
||||
|
||||
@Query("SELECT tskv FROM TsKvEntity tskv WHERE tskv.entityId = :entityId " +
|
||||
"AND tskv.entityType = :entityType AND tskv.key = :entityKey " +
|
||||
"AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
"AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
List<TsKvEntity> findAllWithLimit(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String key,
|
||||
@ -55,29 +55,63 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(MAX(tskv.strValue), MAX(tskv.longValue), MAX(tskv.doubleValue)) FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
CompletableFuture<TsKvEntity> findMax(@Param("entityId") String entityId,
|
||||
@Query("SELECT new TsKvEntity(MAX(tskv.strValue)) FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.strValue IS NOT NULL " +
|
||||
"AND tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findStringMax(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(MIN(tskv.strValue), MIN(tskv.longValue), MIN(tskv.doubleValue)) FROM TsKvEntity tskv " +
|
||||
@Query("SELECT new TsKvEntity(MAX(COALESCE(tskv.longValue, -9223372036854775807)), " +
|
||||
"MAX(COALESCE(tskv.doubleValue, -1.79769E+308)), " +
|
||||
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"'MAX') FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
CompletableFuture<TsKvEntity> findMin(@Param("entityId") String entityId,
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findNumericMax(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(MIN(tskv.strValue)) FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.strValue IS NOT NULL " +
|
||||
"AND tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findStringMin(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(COUNT(tskv.booleanValue), COUNT(tskv.strValue), COUNT(tskv.longValue), COUNT(tskv.doubleValue)) FROM TsKvEntity tskv " +
|
||||
@Query("SELECT new TsKvEntity(MIN(COALESCE(tskv.longValue, 9223372036854775807)), " +
|
||||
"MIN(COALESCE(tskv.doubleValue, 1.79769E+308)), " +
|
||||
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"'MIN') FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findNumericMin(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(SUM(CASE WHEN tskv.booleanValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.strValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END)) FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findCount(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@ -85,23 +119,31 @@ public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvComposite
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(AVG(tskv.longValue), AVG(tskv.doubleValue)) FROM TsKvEntity tskv " +
|
||||
@Query("SELECT new TsKvEntity(SUM(COALESCE(tskv.longValue, 0)), " +
|
||||
"SUM(COALESCE(tskv.doubleValue, 0.0)), " +
|
||||
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"'AVG') FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findAvg(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
|
||||
@Async
|
||||
@Query("SELECT new TsKvEntity(SUM(tskv.longValue), SUM(tskv.doubleValue)) FROM TsKvEntity tskv " +
|
||||
@Query("SELECT new TsKvEntity(SUM(COALESCE(tskv.longValue, 0)), " +
|
||||
"SUM(COALESCE(tskv.doubleValue, 0.0)), " +
|
||||
"SUM(CASE WHEN tskv.longValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"SUM(CASE WHEN tskv.doubleValue IS NULL THEN 0 ELSE 1 END), " +
|
||||
"'SUM') FROM TsKvEntity tskv " +
|
||||
"WHERE tskv.entityId = :entityId AND tskv.entityType = :entityType " +
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts < :endTs")
|
||||
"AND tskv.key = :entityKey AND tskv.ts > :startTs AND tskv.ts <= :endTs")
|
||||
CompletableFuture<TsKvEntity> findSum(@Param("entityId") String entityId,
|
||||
@Param("entityType") EntityType entityType,
|
||||
@Param("entityKey") String entityKey,
|
||||
@Param("startTs") long startTs,
|
||||
@Param("endTs") long endTs);
|
||||
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
}
|
||||
|
||||
private void processResultSetRow(Row row, AggregationResult aggResult) {
|
||||
long curCount;
|
||||
long curCount = 0L;
|
||||
|
||||
Long curLValue = null;
|
||||
Double curDValue = null;
|
||||
@ -91,14 +91,18 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
long boolCount = row.getLong(BOOL_CNT_POS);
|
||||
long strCount = row.getLong(STR_CNT_POS);
|
||||
|
||||
if (longCount > 0 || doubleCount > 0) {
|
||||
if (longCount > 0) {
|
||||
aggResult.dataType = DataType.LONG;
|
||||
curCount = longCount;
|
||||
curCount += longCount;
|
||||
curLValue = getLongValue(row);
|
||||
} else if (doubleCount > 0) {
|
||||
}
|
||||
if (doubleCount > 0) {
|
||||
aggResult.hasDouble = true;
|
||||
aggResult.dataType = DataType.DOUBLE;
|
||||
curCount = doubleCount;
|
||||
curCount += doubleCount;
|
||||
curDValue = getDoubleValue(row);
|
||||
}
|
||||
} else if (boolCount > 0) {
|
||||
aggResult.dataType = DataType.BOOLEAN;
|
||||
curCount = boolCount;
|
||||
@ -126,16 +130,20 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
aggResult.count += curCount;
|
||||
if (curDValue != null) {
|
||||
aggResult.dValue = aggResult.dValue == null ? curDValue : aggResult.dValue + curDValue;
|
||||
} else if (curLValue != null) {
|
||||
}
|
||||
if (curLValue != null) {
|
||||
aggResult.lValue = aggResult.lValue == null ? curLValue : aggResult.lValue + curLValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void processMinAggregation(AggregationResult aggResult, Long curLValue, Double curDValue, Boolean curBValue, String curSValue) {
|
||||
if (curDValue != null || curLValue != null) {
|
||||
if (curDValue != null) {
|
||||
aggResult.dValue = aggResult.dValue == null ? curDValue : Math.min(aggResult.dValue, curDValue);
|
||||
} else if (curLValue != null) {
|
||||
}
|
||||
if (curLValue != null) {
|
||||
aggResult.lValue = aggResult.lValue == null ? curLValue : Math.min(aggResult.lValue, curLValue);
|
||||
}
|
||||
} else if (curBValue != null) {
|
||||
aggResult.bValue = aggResult.bValue == null ? curBValue : aggResult.bValue && curBValue;
|
||||
} else if (curSValue != null && (aggResult.sValue == null || curSValue.compareTo(aggResult.sValue) < 0)) {
|
||||
@ -144,10 +152,13 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
}
|
||||
|
||||
private void processMaxAggregation(AggregationResult aggResult, Long curLValue, Double curDValue, Boolean curBValue, String curSValue) {
|
||||
if (curDValue != null || curLValue != null) {
|
||||
if (curDValue != null) {
|
||||
aggResult.dValue = aggResult.dValue == null ? curDValue : Math.max(aggResult.dValue, curDValue);
|
||||
} else if (curLValue != null) {
|
||||
}
|
||||
if (curLValue != null) {
|
||||
aggResult.lValue = aggResult.lValue == null ? curLValue : Math.max(aggResult.lValue, curLValue);
|
||||
}
|
||||
} else if (curBValue != null) {
|
||||
aggResult.bValue = aggResult.bValue == null ? curBValue : aggResult.bValue || curBValue;
|
||||
} else if (curSValue != null && (aggResult.sValue == null || curSValue.compareTo(aggResult.sValue) > 0)) {
|
||||
@ -211,19 +222,26 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
private Optional<TsKvEntry> processAvgOrSumResult(AggregationResult aggResult) {
|
||||
if (aggResult.count == 0 || (aggResult.dataType == DataType.DOUBLE && aggResult.dValue == null) || (aggResult.dataType == DataType.LONG && aggResult.lValue == null)) {
|
||||
return Optional.empty();
|
||||
} else if (aggResult.dataType == DataType.DOUBLE) {
|
||||
return Optional.of(new BasicTsKvEntry(ts, new DoubleDataEntry(key, aggregation == Aggregation.SUM ? aggResult.dValue : (aggResult.dValue / aggResult.count))));
|
||||
} else if (aggResult.dataType == DataType.LONG) {
|
||||
} else if (aggResult.dataType == DataType.DOUBLE || aggResult.dataType == DataType.LONG) {
|
||||
if(aggregation == Aggregation.AVG || aggResult.hasDouble) {
|
||||
double sum = Optional.ofNullable(aggResult.dValue).orElse(0.0d) + Optional.ofNullable(aggResult.lValue).orElse(0L);
|
||||
return Optional.of(new BasicTsKvEntry(ts, new DoubleDataEntry(key, aggregation == Aggregation.SUM ? sum : (sum / aggResult.count))));
|
||||
} else {
|
||||
return Optional.of(new BasicTsKvEntry(ts, new LongDataEntry(key, aggregation == Aggregation.SUM ? aggResult.lValue : (aggResult.lValue / aggResult.count))));
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
private Optional<TsKvEntry> processMinOrMaxResult(AggregationResult aggResult) {
|
||||
if (aggResult.dataType == DataType.DOUBLE) {
|
||||
return Optional.of(new BasicTsKvEntry(ts, new DoubleDataEntry(key, aggResult.dValue)));
|
||||
} else if (aggResult.dataType == DataType.LONG) {
|
||||
if (aggResult.dataType == DataType.DOUBLE || aggResult.dataType == DataType.LONG) {
|
||||
if(aggResult.hasDouble) {
|
||||
double currentD = aggregation == Aggregation.MIN ? Optional.ofNullable(aggResult.dValue).orElse(Double.MAX_VALUE) : Optional.ofNullable(aggResult.dValue).orElse(Double.MIN_VALUE);
|
||||
double currentL = aggregation == Aggregation.MIN ? Optional.ofNullable(aggResult.lValue).orElse(Long.MAX_VALUE) : Optional.ofNullable(aggResult.lValue).orElse(Long.MIN_VALUE);
|
||||
return Optional.of(new BasicTsKvEntry(ts, new DoubleDataEntry(key, aggregation == Aggregation.MIN ? Math.min(currentD, currentL) : Math.max(currentD, currentL))));
|
||||
} else {
|
||||
return Optional.of(new BasicTsKvEntry(ts, new LongDataEntry(key, aggResult.lValue)));
|
||||
}
|
||||
} else if (aggResult.dataType == DataType.STRING) {
|
||||
return Optional.of(new BasicTsKvEntry(ts, new StringDataEntry(key, aggResult.sValue)));
|
||||
} else {
|
||||
@ -238,5 +256,6 @@ public class AggregatePartitionsFunction implements com.google.common.base.Funct
|
||||
Double dValue = null;
|
||||
Long lValue = null;
|
||||
long count = 0;
|
||||
boolean hasDouble = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,9 +25,7 @@ import java.util.Arrays;
|
||||
|
||||
@RunWith(ClasspathSuite.class)
|
||||
@ClassnameFilters({
|
||||
"org.thingsboard.server.dao.service.*ServiceNoSqlTest",
|
||||
"org.thingsboard.server.dao.service.queue.cassandra.*.*.*Test",
|
||||
"org.thingsboard.server.dao.service.queue.cassandra.*Test"
|
||||
"org.thingsboard.server.dao.service.*ServiceNoSqlTest"
|
||||
})
|
||||
public class NoSqlDaoServiceTestSuite {
|
||||
|
||||
|
||||
@ -17,10 +17,7 @@ package org.thingsboard.server.dao.service.timeseries;
|
||||
|
||||
import com.datastax.driver.core.utils.UUIDs;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
import org.thingsboard.server.common.data.EntityView;
|
||||
import org.thingsboard.server.common.data.Tenant;
|
||||
import org.thingsboard.server.common.data.id.DeviceId;
|
||||
@ -221,13 +218,13 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest {
|
||||
60000, 20000, 3, Aggregation.AVG))).get();
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(150L), list.get(0).getLongValue());
|
||||
assertEquals(java.util.Optional.of(150.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(350L), list.get(1).getLongValue());
|
||||
assertEquals(java.util.Optional.of(350.0), list.get(1).getDoubleValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(550L), list.get(2).getLongValue());
|
||||
assertEquals(java.util.Optional.of(550.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.SUM))).get();
|
||||
@ -280,6 +277,157 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest {
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(2).getLongValue());
|
||||
|
||||
|
||||
entries.add(save(deviceId, 65000, "A1"));
|
||||
entries.add(save(deviceId, 75000, "A2"));
|
||||
entries.add(save(deviceId, 85000, "B1"));
|
||||
entries.add(save(deviceId, 95000, "B2"));
|
||||
entries.add(save(deviceId, 105000, "C1"));
|
||||
entries.add(save(deviceId, 115000, "C2"));
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 60000,
|
||||
120000, 20000, 3, Aggregation.NONE))).get();
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(115000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of("C2"), list.get(0).getStrValue());
|
||||
|
||||
assertEquals(105000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of("C1"), list.get(1).getStrValue());
|
||||
|
||||
assertEquals(95000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of("B2"), list.get(2).getStrValue());
|
||||
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 60000,
|
||||
120000, 20000, 3, Aggregation.MIN))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(70000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of("A1"), list.get(0).getStrValue());
|
||||
|
||||
assertEquals(90000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of("B1"), list.get(1).getStrValue());
|
||||
|
||||
assertEquals(110000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of("C1"), list.get(2).getStrValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 60000,
|
||||
120000, 20000, 3, Aggregation.MAX))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(70000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of("A2"), list.get(0).getStrValue());
|
||||
|
||||
assertEquals(90000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of("B2"), list.get(1).getStrValue());
|
||||
|
||||
assertEquals(110000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of("C2"), list.get(2).getStrValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 60000,
|
||||
120000, 20000, 3, Aggregation.COUNT))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(70000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(0).getLongValue());
|
||||
|
||||
assertEquals(90000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(1).getLongValue());
|
||||
|
||||
assertEquals(110000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(2).getLongValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindDeviceLongAndDoubleTsData() throws Exception {
|
||||
DeviceId deviceId = new DeviceId(UUIDs.timeBased());
|
||||
List<TsKvEntry> entries = new ArrayList<>();
|
||||
|
||||
entries.add(save(deviceId, 5000, 100));
|
||||
entries.add(save(deviceId, 15000, 200.0));
|
||||
|
||||
entries.add(save(deviceId, 25000, 300));
|
||||
entries.add(save(deviceId, 35000, 400.0));
|
||||
|
||||
entries.add(save(deviceId, 45000, 500));
|
||||
entries.add(save(deviceId, 55000, 600.0));
|
||||
|
||||
List<TsKvEntry> list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.NONE))).get();
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(55000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(600.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(45000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(500L), list.get(1).getLongValue());
|
||||
|
||||
assertEquals(35000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(400.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.AVG))).get();
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(150.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(350.0), list.get(1).getDoubleValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(550.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.SUM))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(300.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(700.0), list.get(1).getDoubleValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(1100.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.MIN))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(100.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(300.0), list.get(1).getDoubleValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(500.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.MAX))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(200.0), list.get(0).getDoubleValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(400.0), list.get(1).getDoubleValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(600.0), list.get(2).getDoubleValue());
|
||||
|
||||
list = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery(LONG_KEY, 0,
|
||||
60000, 20000, 3, Aggregation.COUNT))).get();
|
||||
|
||||
assertEquals(3, list.size());
|
||||
assertEquals(10000, list.get(0).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(0).getLongValue());
|
||||
|
||||
assertEquals(30000, list.get(1).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(1).getLongValue());
|
||||
|
||||
assertEquals(50000, list.get(2).getTs());
|
||||
assertEquals(java.util.Optional.of(2L), list.get(2).getLongValue());
|
||||
}
|
||||
|
||||
private TsKvEntry save(DeviceId deviceId, long ts, long value) throws Exception {
|
||||
@ -288,6 +436,19 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest {
|
||||
return entry;
|
||||
}
|
||||
|
||||
private TsKvEntry save(DeviceId deviceId, long ts, double value) throws Exception {
|
||||
TsKvEntry entry = new BasicTsKvEntry(ts, new DoubleDataEntry(LONG_KEY, value));
|
||||
tsService.save(tenantId, deviceId, entry).get();
|
||||
return entry;
|
||||
}
|
||||
|
||||
private TsKvEntry save(DeviceId deviceId, long ts, String value) throws Exception {
|
||||
TsKvEntry entry = new BasicTsKvEntry(ts, new StringDataEntry(LONG_KEY, value));
|
||||
tsService.save(tenantId, deviceId, entry).get();
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
private void saveEntries(DeviceId deviceId, long ts) throws ExecutionException, InterruptedException {
|
||||
tsService.save(tenantId, deviceId, toTsEntry(ts, stringKvEntry)).get();
|
||||
tsService.save(tenantId, deviceId, toTsEntry(ts, longKvEntry)).get();
|
||||
|
||||
143
ui/package-lock.json
generated
143
ui/package-lock.json
generated
@ -6264,6 +6264,37 @@
|
||||
"glogg": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"happypack": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/happypack/-/happypack-5.0.1.tgz",
|
||||
"integrity": "sha512-AzXVxLzX0mtv0T40Kic72rfcGK4Y2b/cDdtcyw+e+V/13ozl7x0+EZ4hvrL1rJ8MoefR9+FfUJQsK2irH0GWOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async": "1.5.0",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"loader-utils": "1.1.0",
|
||||
"serialize-error": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-1.5.0.tgz",
|
||||
"integrity": "sha1-J5ZkJyNXOFlWVjP8YnRES+4vjOM=",
|
||||
"dev": true
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz",
|
||||
"integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"big.js": "^3.1.3",
|
||||
"emojis-list": "^2.0.0",
|
||||
"json5": "^0.5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz",
|
||||
@ -12928,6 +12959,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"serialize-error": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
|
||||
"integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go=",
|
||||
"dev": true
|
||||
},
|
||||
"serialize-javascript": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz",
|
||||
@ -15377,6 +15414,103 @@
|
||||
"integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
|
||||
"dev": true
|
||||
},
|
||||
"uglifyjs-webpack-plugin": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz",
|
||||
"integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cacache": "^10.0.4",
|
||||
"find-cache-dir": "^1.0.0",
|
||||
"schema-utils": "^0.4.5",
|
||||
"serialize-javascript": "^1.4.0",
|
||||
"source-map": "^0.6.1",
|
||||
"uglify-es": "^3.3.4",
|
||||
"webpack-sources": "^1.1.0",
|
||||
"worker-farm": "^1.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz",
|
||||
"integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^2.0.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"ajv-keywords": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.3.0.tgz",
|
||||
"integrity": "sha512-CMzN9S62ZOO4sA/mJZIO4S++ZM7KFWzH3PPWkveLhy4OZ9i1/VatgwWMD46w/XbGCBy7Ye0gCk+Za6mmyfKK7g==",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.13.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
|
||||
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==",
|
||||
"dev": true
|
||||
},
|
||||
"find-cache-dir": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz",
|
||||
"integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commondir": "^1.0.1",
|
||||
"make-dir": "^1.0.0",
|
||||
"pkg-dir": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
|
||||
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"pkg-dir": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz",
|
||||
"integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"find-up": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"schema-utils": {
|
||||
"version": "0.4.7",
|
||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz",
|
||||
"integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ajv": "^6.1.0",
|
||||
"ajv-keywords": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-es": {
|
||||
"version": "3.3.9",
|
||||
"resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz",
|
||||
"integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "~2.13.0",
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ultron": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
|
||||
@ -16256,6 +16390,15 @@
|
||||
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
|
||||
"dev": true
|
||||
},
|
||||
"worker-farm": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz",
|
||||
"integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"errno": "~0.1.7"
|
||||
}
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"start": "babel-node --max_old_space_size=4096 server.js",
|
||||
"build": "cross-env NODE_ENV=production webpack -p"
|
||||
"build": "cross-env NODE_ENV=production webpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"@flowjs/ng-flow": "^2.7.1",
|
||||
@ -136,7 +136,9 @@
|
||||
"webpack-dev-middleware": "^1.6.1",
|
||||
"webpack-dev-server": "^1.15.1",
|
||||
"webpack-hot-middleware": "^2.12.2",
|
||||
"webpack-material-design-icons": "^0.1.0"
|
||||
"webpack-material-design-icons": "^0.1.0",
|
||||
"uglifyjs-webpack-plugin": "^1.3.0",
|
||||
"happypack": "^5.0.1"
|
||||
},
|
||||
"engine": "node >= 5.9.0",
|
||||
"nyc": {
|
||||
|
||||
@ -1575,7 +1575,8 @@
|
||||
"ru_RU": "Russisch",
|
||||
"es_ES": "Spanisch",
|
||||
"ja_JA": "Japanisch",
|
||||
"tr_TR": "Türkisch"
|
||||
"tr_TR": "Türkisch",
|
||||
"fa_IR": "Persisch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1575,7 +1575,8 @@
|
||||
"ru_RU": "Russian",
|
||||
"es_ES": "Spanish",
|
||||
"ja_JA": "Japanese",
|
||||
"tr_TR": "Turkish"
|
||||
"tr_TR": "Turkish",
|
||||
"fa_IR": "Persian"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1575,7 +1575,8 @@
|
||||
"ru_RU": "Ruso",
|
||||
"es_ES": "Español",
|
||||
"ja_JA": "Japonés",
|
||||
"tr_TR": "Turco"
|
||||
"tr_TR": "Turco",
|
||||
"fa_IR": "Persa"
|
||||
}
|
||||
}
|
||||
}
|
||||
1582
ui/src/app/locale/locale.constant-fa_IR.json
Normal file
1582
ui/src/app/locale/locale.constant-fa_IR.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1011,7 +1011,9 @@
|
||||
"ko_KR": "Coréen",
|
||||
"ru_RU": "Russe",
|
||||
"zh_CN": "Chinois",
|
||||
"tr_TR": "Turc"
|
||||
"ja_JA": "Japonaise",
|
||||
"tr_TR": "Turc",
|
||||
"fa_IR": "Persane"
|
||||
}
|
||||
},
|
||||
"layout": {
|
||||
|
||||
@ -1441,7 +1441,8 @@
|
||||
"ru_RU": "Russo",
|
||||
"es_ES": "Spagnolo",
|
||||
"ja_JA": "Giapponese",
|
||||
"tr_TR": "Turco"
|
||||
"tr_TR": "Turco",
|
||||
"fa_IR": "Persiana"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1450,6 +1450,7 @@
|
||||
"language": "言語",
|
||||
"locales": {
|
||||
"de_DE": "ドイツ語",
|
||||
"fr_FR": "フランス語",
|
||||
"en_US": "英語",
|
||||
"ko_KR": "韓国語",
|
||||
"it_IT": "イタリアの",
|
||||
@ -1457,7 +1458,8 @@
|
||||
"ru_RU": "ロシア",
|
||||
"es_ES": "スペイン語",
|
||||
"ja_JA": "日本語",
|
||||
"tr_TR": "トルコ語"
|
||||
"tr_TR": "トルコ語",
|
||||
"fa_IR": "ペルシャ語"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1334,7 +1334,8 @@
|
||||
"es_ES": "스페인어",
|
||||
"it_IT": "이탈리아 사람",
|
||||
"ja_JA": "일본어",
|
||||
"tr_TR": "터키어"
|
||||
"tr_TR": "터키어",
|
||||
"fa_IR": "페르시아 인"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1573,7 +1573,8 @@
|
||||
"ru_RU": "Русский",
|
||||
"tr_TR": "Турецкий",
|
||||
"fr_FR": "Французский",
|
||||
"ja_JA": "Японский"
|
||||
"ja_JA": "Японский",
|
||||
"fa_IR": "Персидский"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1540,7 +1540,8 @@
|
||||
"ru_RU": "Rusça",
|
||||
"es_ES": "İspanyol",
|
||||
"ja_JA": "Japonca",
|
||||
"tr_TR": "Türkçe"
|
||||
"tr_TR": "Türkçe",
|
||||
"fa_IR": "Farsça"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1444,7 +1444,8 @@
|
||||
"es_ES": "西班牙语",
|
||||
"it_IT": "意大利",
|
||||
"ja_JA": "日本",
|
||||
"tr_TR": "土耳其"
|
||||
"tr_TR": "土耳其",
|
||||
"fa_IR": "波斯语"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,13 +18,15 @@
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const StyleLintPlugin = require('stylelint-webpack-plugin')
|
||||
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
||||
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const dirTree = require('directory-tree');
|
||||
const jsonminify = require("jsonminify");
|
||||
|
||||
const HappyPack = require('happypack');
|
||||
|
||||
const PUBLIC_RESOURCE_PATH = '/';
|
||||
|
||||
var langs = [];
|
||||
@ -34,6 +36,9 @@ dirTree('./src/app/locale/', {extensions:/\.json$/}, (item) => {
|
||||
langs.push(item.name.slice(item.name.lastIndexOf('-') + 1, -5));
|
||||
});
|
||||
|
||||
|
||||
var happyThreadPool = HappyPack.ThreadPool({ size: 3 });
|
||||
|
||||
/* devtool: 'cheap-module-eval-source-map', */
|
||||
|
||||
module.exports = {
|
||||
@ -93,6 +98,21 @@ module.exports = {
|
||||
PUBLIC_PATH: JSON.stringify(PUBLIC_RESOURCE_PATH),
|
||||
SUPPORTED_LANGS: JSON.stringify(langs)
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'cached-babel',
|
||||
loaders: ["babel-loader?cacheDirectory=true"]
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'eslint',
|
||||
loaders: ["eslint-loader?{parser: 'babel-eslint'}"]
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'ng-annotate-and-cached-babel-loader',
|
||||
loaders: ['ng-annotate', 'babel-loader?cacheDirectory=true']
|
||||
})
|
||||
],
|
||||
node: {
|
||||
tls: "empty",
|
||||
@ -102,19 +122,19 @@ module.exports = {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx$/,
|
||||
loader: 'babel',
|
||||
loader: 'happypack/loader?id=cached-babel',
|
||||
exclude: /node_modules/,
|
||||
include: __dirname,
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loaders: ['ng-annotate', 'babel'],
|
||||
loaders: ['happypack/loader?id=ng-annotate-and-cached-babel-loader'],
|
||||
exclude: /node_modules/,
|
||||
include: __dirname,
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: "eslint-loader?{parser: 'babel-eslint'}",
|
||||
loader: 'happypack/loader?id=eslint',
|
||||
exclude: /node_modules|vendor/,
|
||||
include: __dirname,
|
||||
},
|
||||
|
||||
@ -23,6 +23,8 @@ const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const dirTree = require('directory-tree');
|
||||
const jsonminify = require("jsonminify");
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
const HappyPack = require('happypack');
|
||||
|
||||
const PUBLIC_RESOURCE_PATH = '/static/';
|
||||
|
||||
@ -33,6 +35,8 @@ dirTree('./src/app/locale/', {extensions:/\.json$/}, (item) => {
|
||||
langs.push(item.name.slice(item.name.lastIndexOf('-') + 1, -5));
|
||||
});
|
||||
|
||||
var happyThreadPool = HappyPack.ThreadPool({ size: 3 });
|
||||
|
||||
module.exports = {
|
||||
devtool: 'source-map',
|
||||
entry: [
|
||||
@ -95,6 +99,25 @@ module.exports = {
|
||||
test: /\.js$|\.css$|\.svg$|\.ttf$|\.woff$|\.woff2|\.eot$\.json$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
cache: true,
|
||||
parallel: true
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'cached-babel',
|
||||
loaders: ["babel-loader?cacheDirectory=true"]
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'eslint',
|
||||
loaders: ["eslint-loader?{parser: 'babel-eslint'}"]
|
||||
}),
|
||||
new HappyPack({
|
||||
threadPool: happyThreadPool,
|
||||
id: 'ng-annotate-and-cached-babel-loader',
|
||||
loaders: ['ng-annotate', 'babel-loader?cacheDirectory=true']
|
||||
})
|
||||
],
|
||||
node: {
|
||||
@ -105,19 +128,20 @@ module.exports = {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx$/,
|
||||
loader: 'babel',
|
||||
loader: 'happypack/loader?id=cached-babel',
|
||||
exclude: /node_modules/,
|
||||
include: __dirname,
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loaders: ['ng-annotate', 'babel'],
|
||||
loaders: ['happypack/loader?id=ng-annotate-and-cached-babel-loader'],
|
||||
exclude: /node_modules/,
|
||||
include: __dirname,
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: "eslint-loader?{parser: 'babel-eslint'}",
|
||||
loaders: ['happypack/loader?id=eslint'],
|
||||
// loader: "eslint-loader?{parser: 'babel-eslint'}",
|
||||
exclude: /node_modules|vendor/,
|
||||
include: __dirname,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user