Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ozone Features (initializer + SAML SSO role's) #1275

Merged
merged 18 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ jobs:

- name: Build OpenELIS-Global2
run: mvn clean install -Dspotless.check.skip=true

21 changes: 11 additions & 10 deletions .github/workflows/frontend-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ on:

env:
DOCKER_NAME: ${{ vars.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-frontend

jobs:

jobs:
build-prod-frontend-image:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -38,8 +37,7 @@ jobs:
with:
context: ./frontend
file: ./frontend/Dockerfile.prod
push: false

push: false

build-and-run-qa-tests:
runs-on: ubuntu-latest
Expand All @@ -50,12 +48,8 @@ jobs:
repository: ${{github.repository}}
submodules: recursive

- name: Run OpenELS image
run: docker compose -f build.docker-compose.yml up -d

- name: Sleep for 2 minutes
run: sleep 2m
shell: bash
- name: Run OpenELIS image
run: docker compose -f build.docker-compose.yml up -d --build --wait --wait-timeout 600

- name: Set up Node.js
uses: actions/setup-node@v3
Expand All @@ -73,3 +67,10 @@ jobs:
- name: Run Frontend Qa Workflow
run: npx cypress run –headless
working-directory: frontend

- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
# Only show last 100 lines of each
tail: "100"
33 changes: 17 additions & 16 deletions .github/workflows/publish-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,12 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
mozzy11 marked this conversation as resolved.
Show resolved Hide resolved
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache-test
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache-test,mode=max
# cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache,mode=max
build-args: SKIP_SPOTLESS=true

build-and-push-test-image-frontend:
Expand Down Expand Up @@ -186,25 +185,21 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache-test
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache-test,mode=max
# cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max

run-e2e-qa:
needs:
[build-and-push-test-image-backend, build-and-push-test-image-frontend]
runs-on: ubuntu-latest
steps:
- name: Sleep for 2 minutes
run: sleep 2m
shell: bash

- name: Checkout OpenELIS-Global2
uses: actions/checkout@v4
with:
repository: ${{github.repository}}

- name: Run OpenELS image
run: docker compose -f test.docker-compose.yml up -d
- name: Run OpenELIS image
run: docker compose -f test.docker-compose.yml up -d --build --wait --wait-timeout 300

- name: Cypress run
uses: cypress-io/github-action@v6
Expand All @@ -214,6 +209,13 @@ jobs:
CYPRESS_STARTUP_WAIT_MILLISECONDS: 300000
CYPRESS_VIDEO: false

- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
# Only show last 100 lines of each
tail: "100"

build-and-push-image-backend:
needs: [run-e2e-qa]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -251,13 +253,12 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache-prod
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache-prod,mode=max
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache,mode=max
build-args: SKIP_SPOTLESS=true

build-and-push-image-frontend:
Expand Down Expand Up @@ -300,5 +301,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache-prod
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache-prod,mode=max
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ RUN groupadd tomcat; \
chmod g-w,o-rwx $CATALINA_HOME/conf/logging.properties; \
chmod g-w,o-rwx $CATALINA_HOME/conf/server.xml; \
chmod g-w,o-rwx $CATALINA_HOME/conf/tomcat-users.xml; \
chmod g-w,o-rwx $CATALINA_HOME/conf/web.xml
chmod g-w,o-rwx $CATALINA_HOME/conf/web.xml; \
mkdir -p /var/lib/openelis-global/logs/; \
chown -R tomcat_admin:tomcat /var/lib/openelis-global/logs/;\
mkdir -p /var/lib/openelis-global/properties/; \
chown -R tomcat_admin:tomcat /var/lib/openelis-global/properties/;


COPY install/openelis_healthcheck.sh /healthcheck.sh
RUN chown tomcat_admin:tomcat /healthcheck.sh; \
Expand Down
16 changes: 13 additions & 3 deletions build.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ services:
networks:
default:
ipv4_address: 172.20.1.121

environment:
- DEFAULT_PW=adminADMIN!
- TZ=Africa/Nairobi
Expand All @@ -64,10 +63,18 @@ services:
secrets:
- source: datasource.password
- source: common.properties
healthcheck:
test: ["CMD", "/healthcheck.sh"]
timeout: 10s
interval: 30s
retries: 3
start_period: 2m

fhir.openelis.org:
container_name: external-fhir-api
image: hapiproject/hapi:v6.6.0-tomcat
build:
context: ./fhir
dockerfile: ./Dockerfile
depends_on:
- database
- certs
Expand Down Expand Up @@ -110,8 +117,11 @@ services:
- CHOKIDAR_USEPOLLING=true
tty: true


proxy:
image: nginx:1.15-alpine
build:
context: ./nginx-proxy
dockerfile: ./Dockerfile
container_name: openelisglobal-proxy
ports:
- 80:80
Expand Down
102 changes: 65 additions & 37 deletions frontend/src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import config from "../config.json";
import "./Style.css";
import qs from "qs";
import { FormattedMessage, injectIntl } from "react-intl";
import { HardwareSecurityModule } from "@carbon/icons-react";
import {
Form,
Section,
Expand Down Expand Up @@ -30,7 +31,7 @@ function Login(props) {
const firstInput = createRef();

useEffect(() => {
firstInput.current.focus();
firstInput?.current?.focus();

const interval = setInterval(() => {
checkLogin();
Expand Down Expand Up @@ -129,6 +130,26 @@ function Login(props) {
});
};

const renderOauthButtons = () => {
return (
<span id="oauth-buttons">
{configurationProperties?.oauthUrls?.map((url) => (
<Button
key={url.key}
type="button"
renderIcon={HardwareSecurityModule}
onClick={() => {
console.log(url);
window.location.href = config.serverBaseUrl + "/" + url.value;
}}
>
<FormattedMessage id="label.button.login.sso" />
</Button>
))}
</span>
);
};

return (
<>
<div className="loginPageContent">
Expand Down Expand Up @@ -167,45 +188,50 @@ function Login(props) {
<FormattedMessage id="login.title" />
</Heading>
</FormLabel>
<TextInput
id="loginName"
invalidText={props.intl.formatMessage({
id: "login.msg.username.missing",
})}
labelText={props.intl.formatMessage({
id: "login.msg.username",
})}
hideLabel={true}
placeholder={props.intl.formatMessage({
id: "login.msg.username",
})}
autoComplete="off"
ref={firstInput}
/>
<TextInput.PasswordInput
id="password"
invalidText={props.intl.formatMessage({
id: "login.msg.password.missing",
})}
labelText={props.intl.formatMessage({
id: "login.msg.password",
})}
hideLabel={true}
placeholder={props.intl.formatMessage({
id: "login.msg.password",
})}
/>
<Button type="submit" disabled={!isValid}>
<FormattedMessage id="label.button.submit" />
<Loading
small={true}
withOverlay={false}
className={submitting ? "show" : "hidden"}
/>
</Button>
{configurationProperties?.useFormLogin == "true" && (
<>
<TextInput
id="loginName"
invalidText={props.intl.formatMessage({
id: "login.msg.username.missing",
})}
labelText={props.intl.formatMessage({
id: "login.msg.username",
})}
hideLabel={true}
placeholder={props.intl.formatMessage({
id: "login.msg.username",
})}
autoComplete="off"
ref={firstInput}
/>
<TextInput.PasswordInput
id="password"
invalidText={props.intl.formatMessage({
id: "login.msg.password.missing",
})}
labelText={props.intl.formatMessage({
id: "login.msg.password",
})}
hideLabel={true}
placeholder={props.intl.formatMessage({
id: "login.msg.password",
})}
/>
<Button type="submit" disabled={!isValid}>
<FormattedMessage id="label.button.login" />
<Loading
small={true}
withOverlay={false}
className={submitting ? "show" : "hidden"}
/>
</Button>
</>
)}
{configurationProperties?.useSaml == "true" && (
<Button
type="button"
renderIcon={HardwareSecurityModule}
onClick={() => {
const POPUP_HEIGHT = 700;
const POPUP_WIDTH = 600;
Expand All @@ -227,6 +253,8 @@ function Login(props) {
<FormattedMessage id="label.button.login.sso" />
</Button>
)}
{configurationProperties?.useOauth == "true" &&
renderOauthButtons()}
</Stack>
</Form>
)}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@
"notification.login.generic.error": "Error while attempting login",
"notification.login.syntax.error": "Error while attempting login - Could not parse response to JSON",
"notification.response.syntax.error": "Error - Could not parse response to JSON",
"label.button.login.sso": "SSO Login",
"label.button.login.sso": "Single Sign On",
"label.button.login": "Login",
"menu.billing.title": "Billing Menu Management",
"menu.billing.address": "Billing URL",
"menu.billing.active": "Billing Menu Active",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@
"labNumber.format.new": "Nouveau format",
"labNumber.format.current": "Format actuel",
"validation.label.nonconform": "= L'échantillon ou la commande est non conforme ou le test a été rejeté",
"label.button.login.sso": "L'authentification unique",
"label.button.login": "Se Connector",
"menu.billing.title": "Gestion du menu de facturation",
"menu.billing.address": "Adresse de facturation",
"menu.billing.active": "Menu de facturation Actif",
Expand Down
Loading
Loading