Skip to content

Commit a6c71a7

Browse files
Merge pull request #338 from bcgov/fixing-application-page-error
Merging with latest formsflow web changes
2 parents c10c325 + fbbbf59 commit a6c71a7

2 files changed

Lines changed: 51 additions & 31 deletions

File tree

forms-flow-ai/forms-flow-web/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /forms-flow-web/app
88
# expect a build-time variable
99
ARG FORMFLOW_SOURCE_REPO_BRANCH
1010
# use the value to set the ENV var default
11-
ENV FORMFLOW_SOURCE_REPO_BRANCH master
11+
ENV FORMFLOW_SOURCE_REPO_BRANCH patch/v5.1.1
1212
# expect a build-time variable
1313
ARG FORMFLOW_SOURCE_REPO_URL
1414
# use the value to set the ENV var default

forms-flow-ai/forms-flow-web/src/components/Application/List.js

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import overlayFactory from "react-bootstrap-table2-overlay";
3434
import { SpinnerSVG } from "../../containers/SpinnerSVG";
3535
import Head from "../../containers/Head";
3636
import { push } from "connected-react-router";
37+
import isValiResourceId from "../../helper/regExp/validResourceId";
3738
import { Button } from "react-bootstrap";
3839
export const ApplicationList = React.memo(() => {
3940
const { t } = useTranslation();
@@ -61,6 +62,8 @@ export const ApplicationList = React.memo(() => {
6162
const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/";
6263
const [lastModified, setLastModified] = React.useState(null);
6364
const [isLoading, setIsLoading] = React.useState(false);
65+
const [invalidFilters, setInvalidFilters] = React.useState({});
66+
6467
useEffect(() => {
6568
setIsLoading(false);
6669
}, [applications]);
@@ -116,6 +119,16 @@ export const ApplicationList = React.memo(() => {
116119
</div>
117120
);
118121
};
122+
const validateFilters = (newState) => {
123+
if (
124+
newState.filters?.id?.filterVal &&
125+
!isValiResourceId(newState.filters?.id?.filterVal)
126+
) {
127+
return setInvalidFilters({ ...invalidFilters, APPLICATION_ID: true });
128+
} else {
129+
return setInvalidFilters({ ...invalidFilters, APPLICATION_ID: false });
130+
}
131+
};
119132

120133
const getReactDashboardURL = () =>{
121134
if(window.location.href.includes("localhost")){
@@ -128,6 +141,7 @@ export const ApplicationList = React.memo(() => {
128141
};
129142

130143
const handlePageChange = (type, newState) => {
144+
validateFilters(newState);
131145
if (type === "filter") {
132146
setfiltermode(true);
133147
} else if (type === "pagination") {
@@ -172,6 +186,7 @@ export const ApplicationList = React.memo(() => {
172186
if (!DRAFT_ENABLED) {
173187
headOptions.pop();
174188
}
189+
175190
return (
176191
<ToolkitProvider
177192
bootstrap4
@@ -182,7 +197,8 @@ export const ApplicationList = React.memo(() => {
182197
lastModified,
183198
setLastModified,
184199
t,
185-
redirectUrl
200+
redirectUrl,
201+
invalidFilters
186202
)}
187203
search
188204
>
@@ -193,34 +209,38 @@ export const ApplicationList = React.memo(() => {
193209
<Button className="" onClick={() =>{ window.location = getReactDashboardURL();}}>
194210
Return To Dashboard</Button>
195211
<div>
196-
{applicationCount > 0 || filtermode ? <BootstrapTable
197-
remote={{ pagination: true, filter: true, sort: true }}
198-
loading={isLoading}
199-
filter={filterFactory()}
200-
pagination={paginationFactory(
201-
getoptions(applicationCount, page, countPerPage)
202-
)}
203-
onTableChange={handlePageChange}
204-
filterPosition={"top"}
205-
{...props.baseProps}
206-
noDataIndication={() =>
207-
!isLoading && getNoDataIndicationContent()
208-
}
209-
defaultSorted={defaultSortedBy}
210-
overlay={overlayFactory({
211-
spinner: <SpinnerSVG />,
212-
styles: {
213-
overlay: (base) => ({
214-
...base,
215-
background: "rgba(255, 255, 255)",
216-
height: `${
217-
countPerPage > 5 ? "100% !important" : "350px !important"
218-
}`,
219-
top: "65px",
220-
}),
221-
},
222-
})}
223-
/> : iserror ? (
212+
{applicationCount > 0 || filtermode ? (
213+
<BootstrapTable
214+
remote={{ pagination: true, filter: true, sort: true }}
215+
loading={isLoading}
216+
filter={filterFactory()}
217+
pagination={paginationFactory(
218+
getoptions(applicationCount, page, countPerPage)
219+
)}
220+
onTableChange={handlePageChange}
221+
filterPosition={"top"}
222+
{...props.baseProps}
223+
noDataIndication={() =>
224+
!isLoading && getNoDataIndicationContent()
225+
}
226+
defaultSorted={defaultSortedBy}
227+
overlay={overlayFactory({
228+
spinner: <SpinnerSVG />,
229+
styles: {
230+
overlay: (base) => ({
231+
...base,
232+
background: "rgba(255, 255, 255)",
233+
height: `${
234+
countPerPage > 5
235+
? "100% !important"
236+
: "350px !important"
237+
}`,
238+
top: "65px",
239+
}),
240+
},
241+
})}
242+
/>
243+
) : iserror ? (
224244
<Alert variant={"danger"}>{error}</Alert>
225245
) : (
226246
<Nodata text={t("No Applications Found")} />
@@ -232,4 +252,4 @@ export const ApplicationList = React.memo(() => {
232252
);
233253
});
234254

235-
export default ApplicationList;
255+
export default ApplicationList;

0 commit comments

Comments
 (0)