Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ee84b1d
First MAXIV commit
hormiai76 Jul 14, 2022
3c41261
Initial commit
hormiai76 Jan 30, 2023
bdbabf5
Configure SAST in `.gitlab-ci.yml`, creating this file if it does not…
hormiai76 Jan 30, 2023
64d7284
first maxiv commit
hormiai76 Jan 30, 2023
948fdf0
Merge remote-tracking branch 'upstream/main' into maxiv
hormiai76 Mar 2, 2023
d08bf5b
Merge branch 'main' into 'maxiv'
hormiai76 Mar 2, 2023
db28a7c
Merge branch 'maxiv'
hormiai76 Mar 2, 2023
e149657
Using harbor in the dockerfile
hormiai76 Mar 2, 2023
0d24590
Merge branch 'using_harbor' into 'develop'
hormiai76 Mar 2, 2023
8e7050b
Adding curl to fix npm install error
hormiai76 Mar 2, 2023
d083720
Merge branch 'using_harbor' into 'main'
hormiai76 Mar 2, 2023
ce3e575
Merge branch 'using_harbor' into 'develop'
hormiai76 Mar 2, 2023
33250e1
Removing JAVA label from the login form
hormiai76 Mar 13, 2023
d037c2d
WIP: new Dockerfile
hormiai76 Mar 14, 2023
2d36b32
WIP: new Dockerfile
hormiai76 Mar 14, 2023
817f55b
Merge branch 'main' of github.com:ispyb/py-ispyb-ui
hormiai76 Mar 14, 2023
ed00c2a
Merge branch 'main' into maxiv_login_fix
hormiai76 Mar 14, 2023
b15c319
redirect to the home after logout
hormiai76 Mar 15, 2023
09671a5
reset package*.json files
hormiai76 Mar 15, 2023
eeefe9e
Merge branch 'maxiv_login_fix' into 'develop'
hormiai76 Mar 15, 2023
7d0fb22
removing unnecessary class
hormiai76 Mar 15, 2023
65649cd
Merge branch 'main' into develop
hormiai76 Mar 15, 2023
5466584
Update README.md
hormiai76 Apr 20, 2023
9a763ab
Merge branch 'main' into develop
hormiai76 May 29, 2023
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules
node_modules
.idea/
.vscode/
12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
include:
- project: 'kits-maxiv/cfg-maxiv-gitlabci'
file: '/Docker.gitlab-ci.yml'

variables:
IMAGE_NAME: $CI_PROJECT_NAME
DOCKERFILE: "./Dockerfile"
DOCKER_REGISTRY_LOGIN: $HARBOR_IMS_ROBOT_USER
DOCKER_REGISTRY_PASSWORD: $HARBOR_IMS_ROBOT_PASS
MAJOR_TAG: $CI_COMMIT_TAG

38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM harbor.maxiv.lu.se/dockerhub/library/node:18-bullseye-slim as build-step

#RUN apk --no-cache add curl
RUN apt-get -y update; apt-get -y install curl

# set working directory
#RUN mkdir /usr/app
WORKDIR /usr/app
#COPY ./public /usr/app/public
#COPY ./src /usr/app/src
COPY ./ /usr/app/

ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

# install and cache app dependencies
#COPY package.json /usr/app/package.json
#COPY package-lock.json /usr/app/package-lock.json
RUN npm install -g npm
RUN npm install

# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/app/node_modules/.bin:$PATH

ENV REACT_APP_ISPYB_ENV MAXIV
EXPOSE 3000
CMD ["npm", "start"]


#RUN npm run build --max-old-space-size=4096
#
# Deploy container.
#FROM docker.io/nginxinc/nginx-unprivileged:1-alpine
#
#COPY docker/config/default.conf /etc/nginx/conf.d/
#
#COPY --from=build-step /usr/app/build/ /usr/share/nginx/html/

27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3.6"
networks:
traefik-network:
external: true

services:
py-ispyb-ui:
build:
args:
- NODE_ENV=development
context: .
environment:
- NODE_ENV=development
container_name: py-ispyb-ui
labels:
- "traefik.backend=py-ispyb-ui-localhost"
- "traefik.frontend.rule=Host:py-ispyb-ui.localhost"
- "traefik.docker.network=traefik-network"
- "traefik.port=3000"
volumes:
- ./src:/usr/app/src
- ./public:/usr/app/public
networks:
- traefik-network
ports:
- 5000:5000

22 changes: 22 additions & 0 deletions docker/config/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 8080;
server_name localhost;

real_ip_header X-Forwarded-For;

set_real_ip_from 0.0.0.0/0;

location / {
root /usr/share/nginx/html;
index index.html index.htm;

try_files $uri $uri/ /index.html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@
"last 1 safari version"
]
}
}
}
2 changes: 1 addition & 1 deletion src/components/Auth/Login/LoginJava.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function LoginJava() {
</Row>
)}
<Form.Group as={Row} className="mb-2">
<Form.Label column>Username JAVA</Form.Label>
<Form.Label column>Username</Form.Label>
<Col md={12} lg={8}>
<Form.Control
type="text"
Expand Down
7 changes: 6 additions & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Suspense } from 'react';
import { Link, NavLink, Outlet } from 'react-router-dom';
import { Link, NavLink, Outlet, useNavigate } from 'react-router-dom';
import { useController } from 'rest-hooks';
import { Navbar, NavDropdown, Container, Nav, Button } from 'react-bootstrap';
import { PersonBadge } from 'react-bootstrap-icons';
Expand All @@ -13,6 +13,8 @@ import { ActiveProposal } from './ActiveProposal';
import { Footer } from './Footer';
import Loading from './Loading';



function PersonMenu() {
const currentUser = useCurrentUser();
return (
Expand All @@ -38,11 +40,14 @@ function PersonMenu() {
export function Logout() {
const { clearToken } = useAuth();
const { resetEntireStore } = useController();
const navigate = useNavigate();

return (
<Button
onClick={() => {
clearToken();
resetEntireStore();
navigate("/");
}}
>
Logout
Expand Down
2 changes: 2 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DEFAULT } from './default';
import { ESRF } from './esrf';
import { MAXIV } from './maxiv';
import { NETLIFY } from './netlify';

const ISPYB_ENV = process.env.REACT_APP_ISPYB_ENV;
Expand All @@ -8,6 +9,7 @@ console.log(ISPYB_ENV);
const getSitesConfig = () => {
if (ISPYB_ENV === undefined) return DEFAULT;
if (ISPYB_ENV.toLowerCase().includes('esrf')) return ESRF;
if (ISPYB_ENV.toLowerCase().includes('maxiv')) return MAXIV;
if (ISPYB_ENV.toLowerCase().includes('netlify')) return NETLIFY;
return DEFAULT;
};
Expand Down
22 changes: 22 additions & 0 deletions src/config/maxiv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { SiteConfig } from 'config/definitions/sites';

export const MAXIV: SiteConfig[] = [
{
name: 'MAXIV-java',
description: 'For MX/EM',
javaName: 'MAXIV',
host: 'https://ispyb.maxiv.lu.se',
apiPrefix: '/ispyb/ispyb-ws/rest',
javaMode: true,
javaConfig: {
techniques: {
MX: {
beamlines: [
{ name: 'BioMAX', sampleChangerType: 'FlexHCDDual' },
{ name: 'MicroMAX', sampleChangerType: 'FlexHCDUnipuckPlate' },
],
},
},
},
},
];
3 changes: 3 additions & 0 deletions src/legacy/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useAuth } from 'hooks/useAuth';
import { NavLink } from 'react-router-dom';

export function JavaHeader() {

return (
<>
<Navbar.Toggle aria-controls="main-navbar" />
Expand All @@ -19,6 +20,7 @@ export function JavaHeader() {

<Nav>
<PersonMenu />
<Logout/>
</Nav>
</Navbar.Collapse>
</>
Expand All @@ -38,6 +40,7 @@ function PersonMenu() {
id="admin-nav-dropdown"
align="end"
>
<NavDropdown.Header><div className='new-line'>{javaPerson?.roles.join('\n\r')}</div></NavDropdown.Header>
<Logout />
<NavDropdown.ItemText>
<small
Expand Down
1 change: 1 addition & 0 deletions src/scss/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ html {
#pageDropDown {
background-color: $pagination !important;
}