Skip to content

Commit 0c0872e

Browse files
committed
Fix null property error, remove created date filters
1 parent 893fa0d commit 0c0872e

File tree

3 files changed

+13
-98
lines changed

3 files changed

+13
-98
lines changed

service/src/main/kotlin/app/cash/backfila/dashboard/GetBackfillRunsAction.kt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,10 @@ class GetBackfillRunsAction @Inject constructor(
6060
@QueryParam pagination_token: String? = null,
6161
@QueryParam backfill_name: String? = null,
6262
@QueryParam created_by_user: String? = null,
63-
@QueryParam created_start_date: Instant? = null,
64-
@QueryParam created_end_date: Instant? = null,
6563
): GetBackfillRunsResponse {
6664
val filterArgs = FilterArgs(
6765
backfillName = backfill_name,
6866
createdByUser = created_by_user,
69-
createdStartDate = created_start_date,
70-
createdEndDate = created_end_date,
7167
)
7268
return search(service, variant, pagination_token, filterArgs)
7369
}
@@ -214,33 +210,13 @@ class GetBackfillRunsAction @Inject constructor(
214210
}
215211
}
216212

217-
private fun BackfillRunQuery.filterByStartDate(startDate: Instant?): BackfillRunQuery {
218-
return if (startDate == null) {
219-
this
220-
} else {
221-
this.createdAfter(startDate)
222-
}
223-
}
224-
225-
private fun BackfillRunQuery.filterByEndDate(endDate: Instant?): BackfillRunQuery {
226-
return if (endDate == null) {
227-
this
228-
} else {
229-
this.createdBefore(endDate)
230-
}
231-
}
232-
233213
private fun BackfillRunQuery.filterByArgs(filterArgs: FilterArgs): BackfillRunQuery {
234214
return this.filterByUserCreatedIfPresent(filterArgs.createdByUser)
235215
.filterByBackfillNameIfPresent(filterArgs.backfillName)
236-
.filterByStartDate(filterArgs.createdStartDate)
237-
.filterByEndDate(filterArgs.createdEndDate)
238216
}
239217

240218
private data class FilterArgs(
241219
val backfillName: String? = null,
242220
val createdByUser: String? = null,
243-
val createdStartDate: Instant? = null,
244-
val createdEndDate: Instant? = null,
245221
)
246222
}

service/src/test/kotlin/app/cash/backfila/actions/GetBackfillRunsActionFilteredTest.kt

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import app.cash.backfila.protos.service.CreateBackfillRequest
1616
import app.cash.backfila.service.persistence.BackfilaDb
1717
import app.cash.backfila.service.persistence.RegisteredBackfillQuery
1818
import com.google.inject.Module
19-
import java.time.Duration
2019
import javax.inject.Inject
2120
import misk.hibernate.Query
2221
import misk.hibernate.Transacter
@@ -220,71 +219,6 @@ class GetBackfillRunsActionFilteredTest {
220219
}
221220
}
222221

223-
@Test
224-
fun `search by date`() {
225-
scope.fakeCaller(user = "molly") {
226-
val backfillStartTime1 = clock.instant()
227-
228-
createBackfillAction.create(
229-
"deep-fryer",
230-
ConfigureServiceAction.RESERVED_VARIANT,
231-
CreateBackfillRequest.Builder()
232-
.backfill_name("ChickenSandwich")
233-
.build(),
234-
)
235-
236-
clock.add(Duration.ofDays(1))
237-
val backfillStartTime2 = clock.instant()
238-
createBackfillAction.create(
239-
"deep-fryer",
240-
ConfigureServiceAction.RESERVED_VARIANT,
241-
CreateBackfillRequest.Builder()
242-
.backfill_name("FrenchFries")
243-
.build(),
244-
)
245-
createBackfillAction.create(
246-
"deep-fryer",
247-
ConfigureServiceAction.RESERVED_VARIANT,
248-
CreateBackfillRequest.Builder()
249-
.backfill_name("FrenchFries")
250-
.build(),
251-
)
252-
var backfillSearchResults = getBackfillRunsAction.backfillRuns(
253-
service = "deep-fryer",
254-
variant = RESERVED_VARIANT,
255-
pagination_token = null,
256-
created_start_date = backfillStartTime1,
257-
created_end_date = backfillStartTime1.plus(Duration.ofSeconds(1)),
258-
)
259-
assertThat(backfillSearchResults.paused_backfills).hasSize(1)
260-
261-
backfillSearchResults = getBackfillRunsAction.backfillRuns(
262-
service = "deep-fryer",
263-
variant = RESERVED_VARIANT,
264-
pagination_token = null,
265-
created_start_date = backfillStartTime1 + Duration.ofSeconds(1),
266-
created_end_date = backfillStartTime2,
267-
)
268-
assertThat(backfillSearchResults.paused_backfills).hasSize(2)
269-
270-
backfillSearchResults = getBackfillRunsAction.backfillRuns(
271-
service = "deep-fryer",
272-
variant = RESERVED_VARIANT,
273-
pagination_token = null,
274-
created_start_date = backfillStartTime1,
275-
)
276-
assertThat(backfillSearchResults.paused_backfills).hasSize(3)
277-
278-
backfillSearchResults = getBackfillRunsAction.backfillRuns(
279-
service = "deep-fryer",
280-
variant = RESERVED_VARIANT,
281-
pagination_token = null,
282-
created_end_date = backfillStartTime1,
283-
)
284-
assertThat(backfillSearchResults.paused_backfills).hasSize(1)
285-
}
286-
}
287-
288222
@Test
289223
fun `multiple criteria search`() {
290224
scope.fakeCaller(user = "diana") {

service/web/tabs/app/src/containers/ServiceDetailsContainer.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { Link } from "react-router-dom"
2626
import { LayoutContainer } from "."
2727
import { RESERVED_VARIANT } from "../utilities"
2828

29+
type IProps = IState & IDispatchProps
30+
2931
interface BackfillSearchState {
3032
loading: boolean
3133
errorText?: string
@@ -36,27 +38,30 @@ interface BackfillSearchState {
3638

3739
class ServiceDetailsContainer extends React.Component<
3840
IState & IDispatchProps,
39-
IState & BackfillSearchState
41+
BackfillSearchState
4042
> {
4143
private service: string = (this.props as any).match.params.service
4244
private variant: string =
4345
(this.props as any).match.params.variant ?? RESERVED_VARIANT
4446
private backfillRunsTag: string = `${this.service}::${this.variant}::BackfillRuns`
4547
private registeredBackfills: string = `${this.service}::BackfillRuns`
4648

49+
constructor(props: IProps) {
50+
super(props)
51+
this.state = {
52+
loading: false,
53+
errorText: null,
54+
backfillName: null,
55+
createdBy: null
56+
}
57+
}
58+
4759
componentDidMount() {
4860
this.props.simpleNetworkGet(
4961
this.registeredBackfills,
5062
`/services/${this.service}/variants/${this.variant}/registered-backfills`
5163
)
5264

53-
this.setState({
54-
loading: false,
55-
errorText: null,
56-
backfillName: null,
57-
createdBy: null
58-
})
59-
6065
this.fetchBackfillRuns()
6166
}
6267

0 commit comments

Comments
 (0)