Skip to content

Commit

Permalink
Merge pull request #5434 from bcgov/dev-rook
Browse files Browse the repository at this point in the history
merge historical search to dev
  • Loading branch information
nkan-aot2 authored Nov 13, 2024
2 parents 4bdc101 + 8cbc24a commit 912dade
Show file tree
Hide file tree
Showing 97 changed files with 4,797 additions and 685 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/historical-search-api-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Historical Search API CD


on:
push:
branches:
- dev
- dev-marshal
- test-marshal
- dev-rook
- test-rook
- main
paths:
- "historical-search-api/**"

defaults:
run:
shell: bash
working-directory: ./historical-search-api

env:
APP_NAME: "historical-search-api"

jobs:
historical-search-api-cd-by-push:
runs-on: ubuntu-20.04

if: github.event_name == 'push' && github.repository == 'bcgov/foi-flow'
steps:
- uses: actions/checkout@v2
- name: Set ENV variables
id: set-variable
run: |
if [ ${{ github.ref_name }} == 'dev' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="dev"" >> $GITHUB_ENV
echo "BRANCH_NAME="dev"" >> $GITHUB_ENV
echo "ENV_NAME="dev"" >> $GITHUB_ENV
elif [ ${{ github.ref_name }} == 'dev-marshal' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="dev-marshal"" >> $GITHUB_ENV
echo "BRANCH_NAME="dev-marshal"" >> $GITHUB_ENV
echo "ENV_NAME="dev"" >> $GITHUB_ENV
elif [ ${{ github.ref_name }} == 'test-marshal' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="test-marshal"" >> $GITHUB_ENV
echo "BRANCH_NAME="test-marshal"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
elif [ ${{ github.ref_name }} == 'dev-rook' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="dev-rook"" >> $GITHUB_ENV
echo "BRANCH_NAME="dev-rook"" >> $GITHUB_ENV
echo "ENV_NAME="dev"" >> $GITHUB_ENV
elif [ ${{ github.ref_name }} == 'test-rook' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="test-rook"" >> $GITHUB_ENV
echo "BRANCH_NAME="test-rook"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
elif [ ${{ github.ref_name }} == 'main' ]; then
echo "For ${{ github.ref_name }} branch"
echo "TOOLS_NAME=${{secrets.OPENSHIFT4_FRONTEND_REPOSITORY}}" >> $GITHUB_ENV
echo "TAG_NAME="test"" >> $GITHUB_ENV
echo "BRANCH_NAME="main"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
else
echo "For ${{ github.ref_name }} branch"
fi
shell: bash

- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}}
- name: Tools project
shell: bash
run: |
oc project ${{ env.TOOLS_NAME }}-tools
- name: Build from ${{ env.BRANCH_NAME }} branch
shell: bash
run: |
oc patch bc/${{ env.APP_NAME }}-build -p '{"spec":{"source":{"git":{"ref":"${{ env.BRANCH_NAME }}"}}}}'
- name: Start Build Openshift
shell: bash
run: |
oc start-build ${{ env.APP_NAME }}-build --wait
- name: Tag+Deploy for ${{ env.TAG_NAME }}
shell: bash
run: |
oc tag ${{ env.APP_NAME }}:latest ${{ env.APP_NAME }}:${{ env.TAG_NAME }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ datamigrations/FOIMOD.CFD.ConsoleApp.DocMigration/FOIMOD.CFD.DocMigration.OCR/bi
datamigrations/FOIMOD.CFD.ConsoleApp.DocMigration/FOIMOD.CFD.DocMigration.OCR.Tests/obj/*
datamigrations/FOIMOD.CFD.ConsoleApp.DocMigration/FOIMOD.CFD.DocMigration.OCR.Tests/bin/*
/datamigrations/FOIMOD.CFD.ConsoleApp.DocMigration/FOIMOD.CFD.DocMigration.Utils.UnitTests/appsettings.dev.json
historical-search-api/env/*
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@ services:
#- SQLALCHEMY_CONNECT_TIMEOUT=${SQLALCHEMY_CONNECT_TIMEOUT}
#- SQLALCHEMY_POOL_PRE_PING=${SQLALCHEMY_POOL_PRE_PING}
#- SQLALCHEMY_ECHO=${SQLALCHEMY_ECHO}
historical-search-api:
build:
context: ./historical-search-api
dockerfile: dockerfile.local
image: historicalsearchapi
container_name: historical_search_api
networks:
services-network:
aliases:
- backendnw
ports:
- 15001:6000
environment:
- DATABASE_USERNAME=${FOI_EDW_DATABASE_USERNAME}
- DATABASE_PASSWORD=${FOI_EDW_DATABASE_PASSWORD}
- DATABASE_NAME=${FOI_EDW_DATABASE_NAME}
- DATABASE_HOST=${FOI_EDW_DATABASE_HOST}
- DATABASE_PORT=${FOI_EDW_DATABASE_PORT}
- FLASK_ENV:production
- JWT_OIDC_AUDIENCE=${JWT_OIDC_AUDIENCE}
- CORS_ORIGIN=${CORS_ORIGIN}
- KEYCLOAK_URL=${KEYCLOAK_URL}
- KEYCLOAK_URL_REALM=${KEYCLOAK_URL_REALM}
- JWT_OIDC_WELL_KNOWN_CONFIG=${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM}/.well-known/openid-configuration
- JWT_OIDC_ALGORITHMS=RS256
- JWT_OIDC_JWKS_URI=${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM}/protocol/openid-connect/certs
- JWT_OIDC_ISSUER=${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM}
- JWT_OIDC_CACHING_ENABLED=True
- JWT_OIDC_JWKS_CACHE_TIMEOUT=300
- CORS_ORIGIN=http://localhost:8000,http://localhost:9000,http://localhost:3000,http://foiflow.local:3000


foi-requests-DB:
image: postgres
container_name: aot_foi_requests_db_pg
Expand Down Expand Up @@ -229,6 +261,7 @@ services:
- REACT_APP_DISABLE_GATHERINGRECORDS_TAB=${DISABLE_GATHERINGRECORDS_TAB}
- REACT_APP_RECORD_DOWNLOAD_LIMIT=${RECORD_DOWNLOAD_LIMIT}
- REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT=${RECORD_DOWNLOAD_SIZE_LIMIT}
- REACT_APP_HISTORICAL_API_URL=${HISTORICAL_API_URL}
- REACT_APP_SESSION_SECURITY_KEY=${REACT_APP_SESSION_SECURITY_KEY}
volumes:
- ".:/app"
Expand Down
5 changes: 4 additions & 1 deletion forms-flow-web/src/actions/FOI/foiActionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const FOI_ACTION_CONSTANTS = {
EVENT_QUEUE_PARAMS: "EVENT_QUEUE_PARAMS",
SHOW_EVENT_QUEUE: "SHOW_EVENT_QUEUE",
SHOW_ADVANCED_SEARCH: "SHOW_ADVANCED_SEARCH",
FOI_ADVANCED_SEARCH_PARAMS: "FOI_ADVANCED_SEARCH_PARAMS",
FOI_ADVANCED_SEARCH_PARAMS: "FOI_ADVANCED_SEARCH_PARAMS",
IS_ASSIGNEDTOLIST_LOADING: "IS_ASSIGNEDTOLIST_LOADING",
IS_ATTACHMENTLIST_LOADING: "IS_ATTACHMENTLIST_LOADING",
IS_COMMENTTAGLIST_LOADING: "IS_COMMENTTAGLIST_LOADING",
Expand Down Expand Up @@ -107,6 +107,9 @@ const FOI_ACTION_CONSTANTS = {
OIPC_REVIEWTYPES: "OIPC_REVIEWTYPES",
OIPC_INQUIRYOUTCOMES: "OIPC_INQUIRYOUTCOMES",

FOI_ADVANCED_SEARCH_FILTER: "FOI_ADVANCED_SEARCH_FILTER",
FOI_HISTORIC_SEARCH_PARAMS: "FOI_HISTORIC_SEARCH_PARAMS",

FOI_COMMENT_TYPES: "FOI_COMMENT_TYPES",
};

Expand Down
14 changes: 14 additions & 0 deletions forms-flow-web/src/actions/FOI/foiRequestActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,20 @@ export const setOIPCInquiryoutcomes = (data) => (dispatch) => {
});
};

export const setAdvancedSearchFilter = (data) => (dispatch) => {
dispatch({
type: FOI_ACTION_CONSTANTS.FOI_ADVANCED_SEARCH_FILTER,
payload: data,
});
};

export const setHistoricalSearchParams = (data) => (dispatch) => {
dispatch({
type: FOI_ACTION_CONSTANTS.FOI_HISTORIC_SEARCH_PARAMS,
payload: data,
});
};

export const setFOICommentTypes = (data) => (dispatch) => {
dispatch({
type: FOI_ACTION_CONSTANTS.FOI_COMMENT_TYPES,
Expand Down
4 changes: 3 additions & 1 deletion forms-flow-web/src/apiManager/endpoints/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const FOI_BASE_API_URL = `${(window._env_ && window._env_.REACT_APP_FOI_B

export const AXIS_API_URL = `${(window._env_ && window._env_.REACT_APP_AXIS_API_URL) || process.env.REACT_APP_AXIS_API_URL}`;

export const DOC_REVIEWER_BASE_API_URL = `${(window._env_ && window._env_.REACT_APP_DOCREVIEWER_BASE_API_URL) || process.env.REACT_APP_DOCREVIEWER_BASE_API_URL}`;
export const DOC_REVIEWER_BASE_API_URL = `${(window._env_ && window._env_.REACT_APP_DOCREVIEWER_BASE_API_URL) || process.env.REACT_APP_DOCREVIEWER_BASE_API_URL}`;

export const FOI_HISTORICAL_API_URL = `${(window._env_ && window._env_.REACT_APP_HISTORICAL_API_URL) || process.env.REACT_APP_HISTORICAL_API_URL}`;
7 changes: 7 additions & 0 deletions forms-flow-web/src/apiManager/endpoints/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
FOI_BASE_API_URL,
AXIS_API_URL,
DOC_REVIEWER_BASE_API_URL,
FOI_HISTORICAL_API_URL
} from "./config";

const API = {
Expand Down Expand Up @@ -50,6 +51,12 @@ const API = {
FOI_GET_APPLICANT_REQUEST_HISTORY: `${FOI_BASE_API_URL}/api/foiapplicants/requests/<applicantid>`,
FOI_GET_APPLICANT_INFO: `${FOI_BASE_API_URL}/api/foiapplicants/applicantid/<applicantid>`,

FOI_HISTORICAL_REQUEST_API: `${FOI_HISTORICAL_API_URL}/api/foihistoricalrequest`,
FOI_HISTORICAL_REQUEST_DESCRIPTION_API: `${FOI_HISTORICAL_API_URL}/api/foihistoricalrequest/descriptionhistory`,
FOI_HISTORICAL_REQUEST_EXTENSIONS_API: `${FOI_HISTORICAL_API_URL}/api/foihistoricalrequest/extensions`,
FOI_HISTORICAL_RECORDS_API: `${FOI_BASE_API_URL}/api/foirecord/historical/<axisrequestid>`,
FOI_HISTORICAL_SEARCH_API: `${FOI_HISTORICAL_API_URL}/api/advancedsearch`,

FOI_GET_PROGRAMAREADIVISIONS: `${FOI_BASE_API_URL}/api/foiadmin/divisions`,
FOI_POST_PROGRAMAREADIVISION: `${FOI_BASE_API_URL}/api/foiadmin/division`,
FOI_PUT_PROGRAMAREADIVISIONS: `${FOI_BASE_API_URL}/api/foiadmin/division/<divisionid>`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { httpGETRequest } from "../../httpRequestHandler";
import API from "../../endpoints";
import { catchError } from "./foiServicesUtil";
import UserService from "../../../services/UserService";

export const fetchHistoricalSearchData = ({
page = 1,
size = 10,
sort = [{ field: "receivedDate", sort: "desc" }],
search = "",
keywords = [],
requestType = [],
requestFlags = [],
dateRangeType = null,
fromDate = null,
toDate = null,
publicBodies = [],
callback,
errorCallback,
dispatch,
}) => {
// let sortingItems = [];
// let sortingOrders = [];
// sort.forEach((item) => {
// sortingItems.push(item.field);
// sortingOrders.push(item.sort);
// });

httpGETRequest(
API.FOI_HISTORICAL_SEARCH_API,
{
page: page,
size: size,
sortingitem: sort[0]['field'],
sortingorder: sort[0]['sort'],
search: search,
keywords: keywords,
requestType: requestType,
requestFlags: requestFlags,
dateRangeType: dateRangeType,
fromDate: fromDate,
toDate: toDate,
publicBodies: publicBodies,
},
UserService.getToken()
)
.then((res) => {
if (res.data) {
callback(res.data);
} else {
throw new Error();
}
})
.catch((error) => {
catchError(error, dispatch);
errorCallback("Error in fetching historicalsearch for IAO");
});
};
36 changes: 35 additions & 1 deletion forms-flow-web/src/apiManager/services/FOI/foiRecordServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
setFOIPDFStitchStatusForOipcRedlineReview,
setFOIPDFStitchStatusForOipcRedline,
setFOIPDFStitchedRecordForOipcRedline,
setRequestAttachments,
setFOIAttachmentListLoader,
setFOIPDFStitchStatusForConsults,
setFOIPDFStitchedRecordForConsults,
} from "../../../actions/FOI/foiRequestActions";
Expand Down Expand Up @@ -639,6 +641,38 @@ export const fetchPDFStitchedRecordForOIPCRedlineReview = (
};
}

export const fetchHistoricalRecords = (axisRequestId, ...rest) => {
const done = fnDone(rest);
let apiUrl = replaceUrl(API.FOI_HISTORICAL_RECORDS_API, "<axisrequestid>", axisRequestId);
return (dispatch) => {
dispatch(setRecordsLoader("inprogress"));
httpGETRequest(apiUrl, {}, UserService.getToken())
.then((res) => {
if (res.data) {
if (!res.data.records) {
dispatch(setRequestAttachments(res.data));
dispatch(setFOIAttachmentListLoader(false));
} else {
dispatch(setRequestRecords(res.data));
dispatch(setRecordsLoader("completed"));
}
done(null, res.data);
} else {
console.log("Error in fetching historical records", res);
dispatch(serviceActionError(res));
dispatch(setRecordsLoader("error"));
}
})
.catch((error) => {
console.log("Error in fetching historical records", error);
dispatch(serviceActionError(error));
dispatch(setRecordsLoader("error"));
done(error);
});
};
};


export const fetchPDFStitchStatusForConsults = (
requestId,
ministryId,
Expand Down Expand Up @@ -729,4 +763,4 @@ export const updateUserLockedRecords = (data, requestId, ministryId, ...rest) =>
done(error);
});
};
}
}
Loading

0 comments on commit 912dade

Please sign in to comment.