@@ -136,24 +136,30 @@ export default pagedGrid({
136136 { value: ' CONTINUED_AS_NEW' , label: ' Continued As New' },
137137 { value: ' TIMED_OUT' , label: ' Timed Out' },
138138 ],
139- maxRetentionDays: 30 ,
139+ maxRetentionDays: undefined ,
140140 filterMode: ' basic' ,
141141 };
142142 },
143143 created () {
144144 this .$http (` /api/domains/${ this .domain } ` ).then (r => {
145+ const { domain , state } = this ;
146+
145147 this .maxRetentionDays =
146148 Number (r .configuration .workflowExecutionRetentionPeriodInDays ) || 30 ;
147149
148- if (! this .isRouteRangeValid (this .minStartDate )) {
150+ const minStartDate = this .getMinStartDate ();
151+
152+ if (! this .isRouteRangeValid (minStartDate)) {
149153 const prevRange = localStorage .getItem (
150- ` ${ this . domain } :workflows-time-range`
154+ ` ${ domain} :workflows-time-range`
151155 );
152156
153- if (prevRange && this .isRangeValid (prevRange, this . minStartDate )) {
157+ if (prevRange && this .isRangeValid (prevRange, minStartDate)) {
154158 this .setRange (prevRange);
155159 } else {
156- this .setRange (` last-${ Math .min (30 , this .maxRetentionDays )} -days` );
160+ const defaultRange = state === ' open' ? 30 : this .maxRetentionDays ;
161+
162+ this .setRange (` last-${ defaultRange} -days` );
157163 }
158164 }
159165 });
@@ -216,6 +222,10 @@ export default pagedGrid({
216222 startTime () {
217223 const { range , startTime } = this .$route .query ;
218224
225+ if (this .range && this .range .startTime ) {
226+ return getStartTimeIsoString (null , this .range .startTime .toISOString ());
227+ }
228+
219229 return getStartTimeIsoString (range, startTime);
220230 },
221231 state () {
@@ -232,12 +242,16 @@ export default pagedGrid({
232242 return this .status .value ;
233243 },
234244 range () {
245+ const { state } = this ;
235246 const query = this .$route .query || {};
236247
248+ if (state === ' closed' && this .maxRetentionDays === undefined ) {
249+ return null ;
250+ }
251+
237252 if (! this .isRouteRangeValid (this .minStartDate )) {
238- const updatedQuery = this .setRange (
239- ` last-${ Math .min (30 , this .maxRetentionDays )} -days`
240- );
253+ const defaultRange = state === ' open' ? 30 : this .maxRetentionDays ;
254+ const updatedQuery = this .setRange (` last-${ defaultRange} -days` );
241255
242256 query .startTime = getStartTimeIsoString (
243257 updatedQuery .range ,
@@ -296,18 +310,7 @@ export default pagedGrid({
296310 return this .$route .query .queryString ;
297311 },
298312 minStartDate () {
299- const {
300- maxRetentionDays ,
301- status: { value: status },
302- } = this ;
303-
304- if (status === ' OPEN' ) {
305- return null ;
306- }
307-
308- return moment (this .now )
309- .subtract (maxRetentionDays, ' days' )
310- .startOf (' days' );
313+ return this .getMinStartDate ();
311314 },
312315 workflowId () {
313316 return this .$route .query .workflowId ;
@@ -340,9 +343,20 @@ export default pagedGrid({
340343 return [];
341344 });
342345 },
343- typeof Mocha === ' undefined' ? 200 : 60 ,
346+ typeof Mocha === ' undefined' ? 350 : 60 ,
344347 { maxWait: 1000 }
345348 ),
349+ getMinStartDate () {
350+ const { maxRetentionDays , statusName } = this ;
351+
352+ if (statusName === ' OPEN' ) {
353+ return null ;
354+ }
355+
356+ return moment (this .now )
357+ .subtract (maxRetentionDays, ' days' )
358+ .startOf (' days' );
359+ },
346360 setWorkflowFilter (e ) {
347361 const target = e .target || e .testTarget ; // test hook since Event.target is readOnly and unsettable
348362
0 commit comments