@ -464,6 +464,10 @@ class DashboardView {
return ( overlapSize >= 0 && overlapSize <= segmentSize - 1 ) ;
return ( overlapSize >= 0 && overlapSize <= segmentSize - 1 ) ;
}
}
function validateStopFrame ( stopFrame , startFrame ) {
return ! customStopFrame . prop ( 'checked' ) || stopFrame >= startFrame ;
}
function requestCreatingStatus ( tid , onUpdateStatus , onSuccess , onError ) {
function requestCreatingStatus ( tid , onUpdateStatus , onSuccess , onError ) {
function checkCallback ( ) {
function checkCallback ( ) {
$ . get ( ` /api/v1/tasks/ ${ tid } /status ` ) . done ( ( data ) => {
$ . get ( ` /api/v1/tasks/ ${ tid } /status ` ) . done ( ( data ) => {
@ -516,6 +520,12 @@ class DashboardView {
const customOverlapSize = $ ( '#dashboardCustomOverlap' ) ;
const customOverlapSize = $ ( '#dashboardCustomOverlap' ) ;
const imageQualityInput = $ ( '#dashboardImageQuality' ) ;
const imageQualityInput = $ ( '#dashboardImageQuality' ) ;
const customCompressQuality = $ ( '#dashboardCustomQuality' ) ;
const customCompressQuality = $ ( '#dashboardCustomQuality' ) ;
const startFrameInput = $ ( '#dashboardStartFrame' ) ;
const customStartFrame = $ ( '#dashboardCustomStart' ) ;
const stopFrameInput = $ ( '#dashboardStopFrame' ) ;
const customStopFrame = $ ( '#dashboardCustomStop' ) ;
const frameFilterInput = $ ( '#dashboardFrameFilter' ) ;
const customFrameFilter = $ ( '#dashboardCustomFilter' ) ;
const taskMessage = $ ( '#dashboardCreateTaskMessage' ) ;
const taskMessage = $ ( '#dashboardCreateTaskMessage' ) ;
const submitCreate = $ ( '#dashboardSubmitTask' ) ;
const submitCreate = $ ( '#dashboardSubmitTask' ) ;
@ -529,6 +539,9 @@ class DashboardView {
let segmentSize = 5000 ;
let segmentSize = 5000 ;
let overlapSize = 0 ;
let overlapSize = 0 ;
let compressQuality = 50 ;
let compressQuality = 50 ;
let startFrame = 0 ;
let stopFrame = 0 ;
let frameFilter = '' ;
let files = [ ] ;
let files = [ ] ;
dashboardCreateTaskButton . on ( 'click' , ( ) => {
dashboardCreateTaskButton . on ( 'click' , ( ) => {
@ -612,6 +625,9 @@ class DashboardView {
customSegmentSize . on ( 'change' , ( e ) => segmentSizeInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customSegmentSize . on ( 'change' , ( e ) => segmentSizeInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customOverlapSize . on ( 'change' , ( e ) => overlapSizeInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customOverlapSize . on ( 'change' , ( e ) => overlapSizeInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customCompressQuality . on ( 'change' , ( e ) => imageQualityInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customCompressQuality . on ( 'change' , ( e ) => imageQualityInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customStartFrame . on ( 'change' , ( e ) => startFrameInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customStopFrame . on ( 'change' , ( e ) => stopFrameInput . prop ( 'disabled' , ! e . target . checked ) ) ;
customFrameFilter . on ( 'change' , ( e ) => frameFilterInput . prop ( 'disabled' , ! e . target . checked ) ) ;
segmentSizeInput . on ( 'change' , ( ) => {
segmentSizeInput . on ( 'change' , ( ) => {
const value = Math . clamp (
const value = Math . clamp (
@ -646,6 +662,28 @@ class DashboardView {
compressQuality = value ;
compressQuality = value ;
} ) ;
} ) ;
startFrameInput . on ( 'change' , function ( ) {
let value = Math . max (
+ startFrameInput . prop ( 'value' ) ,
+ startFrameInput . prop ( 'min' )
) ;
startFrameInput . prop ( 'value' , value ) ;
startFrame = value ;
} ) ;
stopFrameInput . on ( 'change' , function ( ) {
let value = Math . max (
+ stopFrameInput . prop ( 'value' ) ,
+ stopFrameInput . prop ( 'min' )
) ;
stopFrameInput . prop ( 'value' , value ) ;
stopFrame = value ;
} ) ;
frameFilterInput . on ( 'change' , function ( ) {
frameFilter = frameFilterInput . prop ( 'value' ) ;
} ) ;
submitCreate . on ( 'click' , ( ) => {
submitCreate . on ( 'click' , ( ) => {
if ( ! validateName ( name ) ) {
if ( ! validateName ( name ) ) {
taskMessage . css ( 'color' , 'red' ) ;
taskMessage . css ( 'color' , 'red' ) ;
@ -677,6 +715,12 @@ class DashboardView {
return ;
return ;
}
}
if ( ! validateStopFrame ( stopFrame , startFrame ) ) {
taskMessage . css ( 'color' , 'red' ) ;
taskMessage . text ( 'Stop frame must be greater than or equal to start frame' ) ;
return ;
}
if ( files . length <= 0 ) {
if ( files . length <= 0 ) {
taskMessage . css ( 'color' , 'red' ) ;
taskMessage . css ( 'color' , 'red' ) ;
taskMessage . text ( 'No files specified for the task' ) ;
taskMessage . text ( 'No files specified for the task' ) ;
@ -717,6 +761,15 @@ class DashboardView {
if ( customOverlapSize . prop ( 'checked' ) ) {
if ( customOverlapSize . prop ( 'checked' ) ) {
description . overlap = overlapSize ;
description . overlap = overlapSize ;
}
}
if ( customStartFrame . prop ( 'checked' ) ) {
description . start _frame = startFrame ;
}
if ( customStopFrame . prop ( 'checked' ) ) {
description . stop _frame = stopFrame ;
}
if ( customFrameFilter . prop ( 'checked' ) ) {
description . frame _filter = frameFilter ;
}
function cleanupTask ( tid ) {
function cleanupTask ( tid ) {
$ . ajax ( {
$ . ajax ( {