@ -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 ( 'startTimeM s' , function ( newDate ) {
if ( newDate ) {
if ( newDate ) {
if ( newDate . getTime ( ) > scope . maxStartTs ) {
if ( newDate . getTime ( ) > scope . maxStartTimeM s ) {
scope . startTs = angular . copy ( scope . maxStartTs ) ;
scope . startTimeM s = angular . copy ( scope . maxStartTimeM s ) ;
}
}
updateMinMaxDates ( ) ;
updateMinMaxDates ( ) ;
}
}
} ) ;
} ) ;
scope . $watch ( 'endTs' , function ( newDate ) {
scope . $watch ( 'endTimeT s' , function ( newDate ) {
if ( newDate ) {
if ( newDate ) {
if ( newDate . getTime ( ) < scope . minEndTs ) {
if ( newDate . getTime ( ) < scope . minEndTimeT s ) {
scope . endTs = angular . copy ( scope . minEndTs ) ;
scope . endTimeT s = angular . copy ( scope . minEndTime Ts ) ;
}
}
updateMinMaxDates ( ) ;
updateMinMaxDates ( ) ;
}
}
} ) ;
} ) ;
function updateMinMaxDates ( ) {
function updateMinMaxDates ( ) {
if ( scope . endTs ) {
if ( scope . endTimeT s ) {
scope . maxStartTs = angular . copy ( new Date ( scope . endTs . getTime ( ) ) ) ;
scope . maxStartTimeM s = angular . copy ( new Date ( scope . endTime Ts . getTime ( ) ) ) ;
scope . entityView . endTs = scope . endTs . getTime ( ) ;
scope . entityView . endTimeT s = scope . endTime Ts . getTime ( ) ;
}
}
if ( scope . startTs ) {
if ( scope . startTimeM s ) {
scope . minEndTs = angular . copy ( new Date ( scope . startTs . getTime ( ) ) ) ;
scope . minEndTimeT s = angular . copy ( new Date ( scope . startTimeM s . getTime ( ) ) ) ;
scope . entityView . startTs = scope . startTs . getTime ( ) ;
scope . entityView . startTimeM s = scope . startTimeM s . getTime ( ) ;
}
}
}
}