Skip to content

Commit

Permalink
Merge branch 'main' into NDT-529-Format-of-Federal-Funding-requested-…
Browse files Browse the repository at this point in the history
…needs-refinement
  • Loading branch information
rafasdc authored Sep 18, 2024
2 parents 5ec38ba + b3173bf commit 4954893
Show file tree
Hide file tree
Showing 37 changed files with 1,024 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_tools_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
- run: |
helm upgrade ccbc-tools helm/ccbc-tools --install --atomic -n ${{ secrets.NAMESPACE_PREFIX }}-tools --set namespacePrefix=${{ secrets.NAMESPACE_PREFIX }}
helm upgrade ccbc-tools helm/ccbc-tools --install --atomic -n ${{ secrets.NAMESPACE_PREFIX }}-tools --set namespacePrefix=${{ secrets.NAMESPACE_PREFIX }} --set deployer.githubToken=${{ secrets.TEKTON_GITHUB}} --set deployer.headerSecret=${{ secrets.JIRA_SECRET }}
2 changes: 1 addition & 1 deletion .github/workflows/test-containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Self-hosted Renovate
uses: renovatebot/github-action@v40.2.8
uses: renovatebot/github-action@v40.2.9
with:
configurationFile: ./.github/renovate.json
token: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## [1.193.1](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.193.0...v1.193.1) (2024-09-18)

### Bug Fixes

- table height when time machine is not shown ([8fa63d9](https://github.com/bcgov/CONN-CCBC-portal/commit/8fa63d9d5e9c7ddbc8f83c1529858c46f004b39f))

# [1.193.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.192.1...v1.193.0) (2024-09-16)

### Bug Fixes

- numbers to not heave leading dollar sign ([b063d36](https://github.com/bcgov/CONN-CCBC-portal/commit/b063d36fc2de4a72d196db8fc3f3cd4579ff1a16))
- overflow wrap strictly enforced ([92407e0](https://github.com/bcgov/CONN-CCBC-portal/commit/92407e052c1e3ccebabd325a86fcc2b724e5c592))

### Features

- history for cbc data changes ([018c2db](https://github.com/bcgov/CONN-CCBC-portal/commit/018c2dbf2216d918a732d399805ea4d3f8270a42))
- new computed column for cbc history ([16707fc](https://github.com/bcgov/CONN-CCBC-portal/commit/16707fc65036d80281aab4fe127e2aae02c74510))

## [1.192.1](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.192.0...v1.192.1) (2024-09-16)

# [1.192.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.191.0...v1.192.0) (2024-09-13)

### Features

- pm assessments notify from table ([3d07ca0](https://github.com/bcgov/CONN-CCBC-portal/commit/3d07ca0562335a215a2d06fb3dee62608d429cfc))

# [1.191.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.190.12...v1.191.0) (2024-09-13)

### Bug Fixes
Expand Down
88 changes: 88 additions & 0 deletions app/components/Analyst/CBC/History/CbcHistoryContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import HistoryDetails from 'components/Analyst/History/HistoryDetails';
import cbcData from 'formSchema/uiSchema/history/cbcData';
import { DateTime } from 'luxon';
import styled from 'styled-components';

const StyledContent = styled.span`
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
margin-bottom: 8px;
& span {
margin: 0 4px;
}
& span:first-child {
margin-left: 0;
}
`;

const StyledChange = styled.div`
padding: 8px 16px;
`;

const ChangeReason = ({ reason }) => {
return (
<StyledChange>
<b>Reason for change:</b> {reason}
</StyledChange>
);
};

const HistoryContent = ({
createdAt,
updatedAt,
prevJson,
json,
givenName,
changeReason,
familyName,
op,
tableName,
}) => {
const fullName = `${givenName} ${familyName}`;

const createdAtFormatted =
op === 'UPDATE'
? DateTime.fromJSDate(new Date(updatedAt)).toLocaleString(
DateTime.DATETIME_MED
)
: DateTime.fromJSDate(new Date(createdAt)).toLocaleString(
DateTime.DATETIME_MED
);

if (tableName === 'cbc_data') {
return (
<>
<StyledContent data-testid="cbc-data-updater-and-timestamp">
<span>
{fullName} {op === 'UPDATE' ? 'updated' : 'created'} the CBC data on{' '}
{createdAtFormatted}
</span>
</StyledContent>
<HistoryDetails
data-testid="cbc-data-history-details"
json={json}
prevJson={prevJson}
excludedKeys={[
'id',
'created_at',
'updated_at',
'change_reason',
'cbc_data_id',
]}
diffSchema={cbcData}
overrideParent="cbcData"
/>
{op === 'UPDATE' && changeReason !== '' && (
<ChangeReason reason={changeReason} />
)}
</>
);
}
return null;
};

export default HistoryContent;
72 changes: 72 additions & 0 deletions app/components/Analyst/CBC/History/CbcHistoryRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import styled from 'styled-components';
import React from 'react';
import { HistoryIcon } from 'components/Analyst/History';
import CbcHistoryContent from './CbcHistoryContent';

const StyledIconCell = styled.td`
width: 5px;
border-left: 1px solid ${(props) => props.theme.color.links};
border-bottom: none;
position: relative;
& div {
position: absolute;
right: 2px;
top: -2px;
}
`;

const StyledCell = styled.td`
border-bottom: none;
& b {
text-transform: capitalize;
}
`;

interface Props {
json: any;
prevJson: any;
changeReason: string;
tableName: string;
updatedAt: string;
createdAt: string;
givenName: string;
familyName: string;
op: string;
}

const CbcHistoryRow: React.FC<Props> = ({
json,
prevJson,
changeReason,
tableName,
createdAt,
givenName,
familyName,
updatedAt,
op,
}) => {
return (
<tr>
<StyledIconCell>
<HistoryIcon type="form_data" />
</StyledIconCell>
<StyledCell>
<CbcHistoryContent
json={json}
prevJson={prevJson}
createdAt={createdAt}
updatedAt={updatedAt}
familyName={familyName}
givenName={givenName}
tableName={tableName}
changeReason={changeReason}
op={op}
/>
</StyledCell>
</tr>
);
};

export default CbcHistoryRow;
87 changes: 87 additions & 0 deletions app/components/Analyst/CBC/History/CbcHistoryTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { CbcHistoryTable_query$key } from '__generated__/CbcHistoryTable_query.graphql';
import React from 'react';
import { useFragment, graphql } from 'react-relay';
import styled from 'styled-components';
import CbcHistoryRow from './CbcHistoryRow';

const StyledTable = styled.table`
border: none;
table-layout: fixed;
margin-left: 8px;
& td {
padding-top: 0;
padding-bottom: 16px;
}
& tr:last-child {
& td:first-child {
border: none;
}
td {
padding-bottom: 0px;
}
}
`;

interface Props {
query: any;
}

const CbcHistoryTable: React.FC<Props> = ({ query }) => {
const queryFragment = useFragment<CbcHistoryTable_query$key>(
graphql`
fragment CbcHistoryTable_query on Query {
cbcByRowId(rowId: $rowId) {
history {
nodes {
rowId
record
oldRecord
op
tableName
createdAt
ccbcUserByCreatedBy {
givenName
familyName
}
}
}
}
}
`,
query
);

const { cbcByRowId } = queryFragment;
const { history } = cbcByRowId;

return (
<StyledTable>
<tbody>
{history.nodes.map((historyItem) => (
<CbcHistoryRow
key={historyItem.rowId}
json={{
...historyItem.record?.json_data,
project_number: historyItem.record?.project_number,
}}
prevJson={{
...historyItem.oldRecord?.json_data,
project_number: historyItem.oldRecord?.project_number,
}}
changeReason={historyItem.record?.change_reason}
tableName={historyItem.tableName}
createdAt={historyItem.createdAt}
updatedAt={historyItem.record?.updated_at}
givenName={historyItem.ccbcUserByCreatedBy.givenName}
familyName={historyItem.ccbcUserByCreatedBy.familyName}
op={historyItem.op}
/>
))}
</tbody>
</StyledTable>
);
};

export default CbcHistoryTable;
6 changes: 5 additions & 1 deletion app/components/AnalystDashboard/AllDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ClearFilters from 'components/Table/ClearFilters';
import type { AllDashboardTable_query$key } from '__generated__/AllDashboardTable_query.graphql';
import { TableCellProps } from '@mui/material';
import { useFeature } from '@growthbook/growthbook-react';
import getConfig from 'next/config';
import {
filterZones,
sortStatus,
Expand Down Expand Up @@ -249,6 +250,8 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
const [isFirstRender, setIsFirstRender] = useState(true);

const defaultFilters = [{ id: 'program', value: ['CCBC', 'CBC', 'OTHER'] }];
const enableTimeMachine =
getConfig()?.publicRuntimeConfig?.ENABLE_MOCK_TIME || false;
const [columnFilters, setColumnFilters] =
useState<MRT_ColumnFiltersState>(defaultFilters);
const showLeadFeatureFlag = useFeature('show_lead').value ?? false;
Expand Down Expand Up @@ -585,6 +588,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
setSorting(sort);
}
};
const tableHeightOffset = enableTimeMachine ? '460px' : '360px';

const table = useMaterialReactTable({
columns,
Expand All @@ -595,7 +599,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
muiTableContainerProps: {
sx: {
padding: '0 8px 8px 8px',
maxHeight: freezeHeader ? 'calc(100vh - 460px)' : '100%',
maxHeight: freezeHeader ? `calc(100vh - ${tableHeightOffset})` : '100%',
},
},
layoutMode: isLargeUp ? 'grid' : 'semantic',
Expand Down
10 changes: 10 additions & 0 deletions app/components/AnalystDashboard/AssessmentAssignmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ const AssessmentAssignmentTable: React.FC<Props> = ({ query }) => {
application.allAssessments.edges,
'projectManagement'
),
pmNotification: findNotification(
application.assessmentNotifications.edges,
'assignment_projectManagement'
),
techAssessment: findAssessment(
application.allAssessments.edges,
'technical'
Expand Down Expand Up @@ -528,9 +532,15 @@ const AssessmentAssignmentTable: React.FC<Props> = ({ query }) => {
application,
'financialRisk'
);
const pmAssignment = createAssignment(
application,
'pm',
'projectManagement'
);

if (techAssignment) assignmentsList.push(techAssignment);
if (financialAssignment) assignmentsList.push(financialAssignment);
if (pmAssignment) assignmentsList.push(pmAssignment);

return assignmentsList;
}, []);
Expand Down
5 changes: 5 additions & 0 deletions app/components/DiffTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const StyledTable = styled.table`
td {
padding: 8px;
width: 30%;
overflow-wrap: anywhere;
}
thead tr th:first-child,
Expand All @@ -35,6 +36,10 @@ const format = (value, type) => {
if (typeof value === 'undefined' || value === null) {
return 'N/A';
}
if (typeof value === 'string' && value.includes('T00:00:00.000Z')) {
return value.split('T')[0];
}

return value;
};

Expand Down
Loading

0 comments on commit 4954893

Please sign in to comment.