Skip to content

Commit

Permalink
Merge pull request #1259 from bcgov/test
Browse files Browse the repository at this point in the history
chore: release
  • Loading branch information
NithinKuruba authored Aug 14, 2024
2 parents 866d7a7 + 1158758 commit c19fbdc
Show file tree
Hide file tree
Showing 209 changed files with 7,762 additions and 3,221 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-gh-pages-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=${{github.event.inputs.maintenanceEnabled}}
INCLUDE_DIGITAL_CREDENTIAL=true
INCLUDE_BC_SERVICES_CARD=false
EOF
- name: Set env to production
Expand All @@ -52,6 +53,7 @@ jobs:
DEPLOY_REPO_NAME=bcgov/sso-requests
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=${{github.event.inputs.maintenanceEnabled}}
INCLUDE_BC_SERVICES_CARD=false
EOF
- name: Checkout 🛎️
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=false
INCLUDE_DIGITAL_CREDENTIAL=true
INCLUDE_BC_SERVICES_CARD=true
EOF
- name: Set env to production
if: endsWith(github.ref, '/main') && matrix.env == 'prod'
Expand All @@ -50,6 +51,7 @@ jobs:
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=false
INCLUDE_DIGITAL_CREDENTIAL=true
INCLUDE_BC_SERVICES_CARD=false
EOF
- name: Set env to preview
Expand All @@ -65,6 +67,7 @@ jobs:
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=false
INCLUDE_DIGITAL_CREDENTIAL=true
INCLUDE_BC_SERVICES_CARD=true
EOF
- name: Checkout 🛎️
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ jobs:
AWS_ECR_URI=${{secrets.DEV_AWS_ECR_URI}}
INCLUDE_DIGITAL_CREDENTIAL=true
INSTALL_SSO_CSS_GRAFANA=true
INCLUDE_BC_SERVICES_CARD=true
BCSC_INITIAL_ACCESS_TOKEN_DEV=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_INITIAL_ACCESS_TOKEN_TEST=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_INITIAL_ACCESS_TOKEN_PROD=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_REGISTRATION_BASE_URL_DEV=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
BCSC_REGISTRATION_BASE_URL_TEST=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
BCSC_REGISTRATION_BASE_URL_PROD=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
EOF
- name: Set env to test
Expand Down Expand Up @@ -106,6 +115,15 @@ jobs:
AWS_ECR_URI=${{secrets.DEV_AWS_ECR_URI}}
INCLUDE_DIGITAL_CREDENTIAL=true
INSTALL_SSO_CSS_GRAFANA=false
INCLUDE_BC_SERVICES_CARD=true
BCSC_INITIAL_ACCESS_TOKEN_DEV=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_INITIAL_ACCESS_TOKEN_TEST=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_INITIAL_ACCESS_TOKEN_PROD=${{secrets.BCSC_INITIAL_ACCESS_TOKEN_SIT}}
BCSC_REGISTRATION_BASE_URL_DEV=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
BCSC_REGISTRATION_BASE_URL_TEST=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
BCSC_REGISTRATION_BASE_URL_PROD=${{secrets.BCSC_REGISTRATION_BASE_URL_SIT}}
EOF
- name: Set env to production
Expand Down Expand Up @@ -277,6 +295,14 @@ jobs:
ms_graph_api_client_id="${{secrets.MS_GRAPH_API_CLIENT_ID}}"
ms_graph_api_client_secret="${{secrets.MS_GRAPH_API_CLIENT_SECRET}}"
install_sso_css_grafana="${{ env.INSTALL_SSO_CSS_GRAFANA == 'true' && 1 || 0 }}"
include_bc_services_card="${{env.INCLUDE_BC_SERVICES_CARD}}"
bcsc_initial_access_token_dev="${{env.BCSC_INITIAL_ACCESS_TOKEN_DEV}}"
bcsc_initial_access_token_test="${{env.BCSC_INITIAL_ACCESS_TOKEN_TEST}}"
bcsc_initial_access_token_prod="${{env.BCSC_INITIAL_ACCESS_TOKEN_PROD}}"
bcsc_registration_base_url_dev="${{env.BCSC_REGISTRATION_BASE_URL_DEV}}"
bcsc_registration_base_url_test="${{env.BCSC_REGISTRATION_BASE_URL_TEST}}"
bcsc_registration_base_url_prod="${{env.BCSC_REGISTRATION_BASE_URL_PROD}}"
EOF
working-directory: ./terraform
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Only users with IDIR with or without MFA are allowed to login and request for an
- The user can add team members to his team and grant them either `admin` or `member` role
- The pathfinder team members have the super-admin permissions, where they have access to all the requested integrations and teams.

#### Microsoft Graph Service

For getting details on IDIR users (e.g valid user lookups, importing into keycloak) we are using Microsoft Graph. For details on implementation see [here](/lambda/app/src/ms-graph/idir.ts).

## Local Development Environment

To setup a local development environment, a detailed guide may be found [here](./docs/developer-guide.md).
Expand Down
15 changes: 10 additions & 5 deletions app/components/ActionButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEvent } from 'react';
import { MouseEvent, useState } from 'react';
import { useRouter } from 'next/router';
import styled from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
Expand Down Expand Up @@ -59,10 +59,13 @@ export default function Actionbuttons({
delIconStyle = {},
}: Props) {
const router = useRouter();
const { archived } = request || {};
const canDelete = canDeleteIntegration(request);
const canEdit = canEditIntegration(request);
const deleteModalId = `delete-modal-${request?.id}`;
const [showDeleteModal, setShowDeleteModal] = useState(false);

const handleCloseDeleteModal = () => {
setShowDeleteModal(false);
};

const handleEdit = async (event: MouseEvent) => {
event.stopPropagation();
Expand All @@ -72,7 +75,7 @@ export default function Actionbuttons({

const handleDelete = () => {
if (!request.id || !canDelete) return;
window.location.hash = deleteModalId;
setShowDeleteModal(true);
};

const confirmDelete = async () => {
Expand Down Expand Up @@ -114,11 +117,13 @@ export default function Actionbuttons({
/>
</ActionButtonContainer>
<DeleteModal
id={`delete-modal-${request?.id}`}
projectName={request.projectName}
id={deleteModalId}
onConfirm={confirmDelete}
title="Confirm Deletion"
content="You are about to delete this integration request. This action cannot be undone."
openModal={showDeleteModal}
handleCloseModal={handleCloseDeleteModal}
/>
</>
);
Expand Down
17 changes: 0 additions & 17 deletions app/components/CancelButton.tsx

This file was deleted.

120 changes: 56 additions & 64 deletions app/components/CenteredModal.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import React, { CSSProperties, useState } from 'react';
import Modal from '@button-inc/bcgov-theme/Modal';
import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import styled from 'styled-components';
import { Grid as SpinnerGrid } from 'react-loader-spinner';
import { faExclamationTriangle, faTimes } from '@fortawesome/free-solid-svg-icons';
import { Button } from '@bcgov-sso/common-react-components';
import kebabCase from 'lodash.kebabcase';
import Modal from 'react-bootstrap/Modal';

const StyledModal = styled(Modal)`
display: flex;
align-items: center;
text-align: left !important;
& .pg-modal-main {
max-width: 700px;
margin: auto;
box-shadow: 5px 5px 10px black;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
& .modal-content {
border-radius: 0;
}
& .modal-header {
border-radius: 0;
}
`;

Expand Down Expand Up @@ -54,114 +59,101 @@ const ButtonContainer = styled.div<{ buttonAlign: 'default' | 'center' }>`
}
`;

export type ButtonStyle = 'bcgov' | 'custom' | 'danger';
export type ButtonStyle = 'primary' | 'primary-inverse' | 'secondary' | 'secondary-inverse' | 'danger';

interface Props {
id?: string;
onConfirm?: () => void;
onClose?: () => void;
openModal?: boolean;
handleClose?: () => void;
title: string;
content: any;
icon?: any;
id: string;
title?: string;
closable?: boolean;
showCancel?: boolean;
showConfirm?: boolean;
confirmText?: string;
buttonStyle?: ButtonStyle;
buttonAlign?: 'center' | 'default';
skipCloseOnConfirm?: boolean;
style?: CSSProperties;
disableConfirm?: boolean;
buttonStyle?: ButtonStyle;
icon?: any;
closable?: boolean;
skipCloseOnConfirm?: boolean;
closeOnBackgroundClick?: boolean;
}

const CenteredModal = ({
onConfirm,
onClose,
content,
id,
openModal = false,
handleClose = () => {},
title,
closable,
icon = faExclamationTriangle,
confirmText = 'Confirm',
content,
showCancel = true,
showConfirm = true,
buttonStyle = 'bcgov',
buttonAlign = 'default',
skipCloseOnConfirm = false,
style = {},
onConfirm,
disableConfirm = false,
confirmText = 'Confirm',
buttonStyle = 'primary',
icon = faExclamationTriangle,
skipCloseOnConfirm = false,
closable,
closeOnBackgroundClick = true,
}: Props) => {
const [loading, setLoading] = useState(false);
const showButtons = showCancel || showConfirm;
let cancelButtonVariant = 'bcSecondary';
let confirmButtonVariant = 'bcPrimary';
let dataTestId = 'confirm-delete-' + kebabCase(title);
let dataTestIdCancel = 'cancel-' + kebabCase(title);

switch (buttonStyle) {
case 'bcgov':
break;
case 'custom':
cancelButtonVariant = 'secondary';
confirmButtonVariant = 'primary';
break;
case 'danger':
cancelButtonVariant = 'secondary';
confirmButtonVariant = 'danger';
break;
}

const handleConfirm = async () => {
setLoading(true);
if (onConfirm) await onConfirm();
setLoading(false);
if (!skipCloseOnConfirm) window.location.hash = '#';
};

const handleCancel = async () => {
if (onClose) onClose();
window.location.hash = '#';
if (!skipCloseOnConfirm) handleClose();
};

return (
<StyledModal id={id}>
<Header title={title} as="div">
{icon && <PaddedIcon icon={icon} title="Information" size="2x" style={{ paddingRight: '10px' }} />}
{title}
{closable && (
<Modal.Close onClick={handleCancel} title="exit">
<FontAwesomeIcon icon={faTimes} size="lg"></FontAwesomeIcon>
</Modal.Close>
)}
<StyledModal
show={openModal}
onHide={() => {
handleClose();
}}
dialogClassName="pg-modal-main"
id={id}
backdrop={closeOnBackgroundClick ? true : 'static'}
>
<Header>
<Modal.Title>
{icon && <PaddedIcon icon={icon} title="Information" size="2x" style={{ paddingRight: '10px' }} />}
{title}
</Modal.Title>
{closable && <FontAwesomeIcon icon={faTimes} size="lg" onClick={handleClose}></FontAwesomeIcon>}
</Header>
<Modal.Content style={style}>
<Modal.Body>
<ContentContainer>{content}</ContentContainer>
{showButtons && (
<ButtonContainer buttonAlign={buttonAlign}>
{showCancel && (
<Button variant={cancelButtonVariant} onClick={handleCancel} type="button" data-testid={dataTestIdCancel}>
<button className="secondary" onClick={handleClose} type="button" data-testid={dataTestIdCancel}>
Cancel
</Button>
</button>
)}
{showConfirm && (
<Button
<button
data-testid={dataTestId}
onClick={handleConfirm}
variant={confirmButtonVariant}
className={buttonStyle}
type="button"
className="text-center"
disabled={disableConfirm}
>
{loading ? (
<SpinnerGrid color="#FFF" height={18} width={50} wrapperClass="d-block" visible={loading} />
) : (
confirmText
)}
</Button>
</button>
)}
</ButtonContainer>
)}
</Modal.Content>
</Modal.Body>
</StyledModal>
);
};
Expand Down
Loading

0 comments on commit c19fbdc

Please sign in to comment.