Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions AppConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export default class AppConstants {
static DASHBOARD_PATH = '/dashboard';

static YOUR_TASKS_PATH = '/your-tasks';

static YOUR_GROUP_TASKS_PATH = '/your-group-tasks';

static FORMS_PATH = '/forms';

static REPORTS_PATH = '/reports';

static REPORT_PATH = '/report';

static MESSAGES_PATH = '/messages';

static CALENDAR_PATH = '/calendar';

static SUBMIT_A_FORM = '/submit-a-form';

static TASK_PATH = '/task';

static SHIFT_PATH = '/shift';

static PROCEDURE_DIAGRAM_PATH = '/procedure-diagram';

static ONBOARD_USER_PATH = '/onboard-user';

static ONE_MINUTE = 60000;
}

export function DASHBOARD_PATH() {
return `/borrowing-centre`;
}
export function YOUR_TASKS_PATH() {
return `/your-tasks`;
}
export function YOUR_GROUP_TASKS_PATH() {
return `/your-group-tasks`;
}
export function FORMS_PATH() {
return `/forms`;
}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:14.8.0

ARG STORAGE_KEY

WORKDIR /app

RUN mkdir -p /app && \
chown -R node:node /app

ADD . /app/

RUN npm ci && npm run build

ENV NODE_ENV='production'

USER 1000

EXPOSE 8080

ENTRYPOINT exec node dist/server.js

18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# developer-interview-bundle
# developer-interview-task
A technical task for our developer interviews

Git bundle for our FE/Full-Stack Developer interviews
## Install dependencies
```
npm install
```

## Define and export variables in the `sample.env` file
```
source sample.env
```

## Start the server
```
npm start
```
46 changes: 46 additions & 0 deletions env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
keys:
- analytics:
site_id
url
- api:
cop_url
ref_url
- drone:
aws_access_key_id
aws_secret_access_key
public_token
- engine:
url
- keycloak:
realm
url
- kube:
namespace_private_cop
server
token
- nginx:
image
tag
- quay:
password
username
- protocol:
https
- report:
url
- slack:
webhook
- translation:
url
- whitelist
- www:
image
keycloak_access_role
keycloak_client_id
name
port
storage_key
ui_environment
ui_version
url
111 changes: 111 additions & 0 deletions index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import 'govuk-frontend/govuk/core/_typography.scss';
import { createBrowserHistory } from 'history';
import React from 'react';
import ReactDOM from 'react-dom';
import { Formio } from 'react-formio';
import { AppContainer } from 'react-hot-loader';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import 'rxjs';
import 'webpack-icons-installer/bootstrap';
import '../public/styles/app.scss';
import ScrollToTop from './core/components/ScrollToTop';
import configureStore from './core/store/configureStore';

const store = configureStore();
let kc = null;

Formio.use(gds);


const renderApp = (App, config) => {
// keycloak token refresh goes here:
//
// kc.onTokenExpired = () => {
// kc.updateToken().success(refreshed => {
// if (refreshed) {
// store.getState().keycloak = kc;
// }
// }).error(() => {
// kc.logout();
// });
// };

// keycloak authentication goes here:
// ... removed for practical test
//
const rootDocument = document.getElementById('root');
ReactDOM.render(
<Provider store={store}>
<div>
<AppContainer>
<Router history={createBrowserHistory()}>
<ScrollToTop>
<App />
</ScrollToTop>
</Router>
</AppContainer>
</div>
</Provider>,
rootDocument,
);
};
/*
const unavailable = () => {
const rootDocument = document.getElementById('root');
ReactDOM.render(
<Provider store={store}>
<div>
<AppContainer>
<BrowserRouter>
<div>
<Header />
<div className="container" style={{ height: '100vh' }}>
<UnavailablePage />
</div>
<Footer />
</div>
</BrowserRouter>
</AppContainer>
</div>
</Provider>,
rootDocument,
);
};

if (process.env.NODE_ENV === 'production') {
fetch('/api/config')
.then(response => {
if (response.ok) {
return response.json();
}
throw new Error(`Application configuration could not be loaded: ${response.status} ${response.statusMessage}`);
}).then(data => {
store.getState().appConfig = {
uiVersion: data.UI_VERSION,
uiEnvironment: data.UI_ENVIRONMENT,
operationalDataUrl: data.OPERATIONAL_DATA_URL,
workflowServiceUrl: data.WORKFLOW_SERVICE_URL,
translationServiceUrl: data.TRANSLATION_SERVICE_URL,
reportServiceUrl: data.REPORT_SERVICE_URL,
analyticsUrl: data.ANALYTICS_URL,
analyticsSiteId: data.ANALYTICS_SITE_ID,
};
renderApp(App, { formApi: { url: data.TRANSLATION_SERVICE_URL }});
}).catch(err => {
console.log('Unable to start application: ', err.message);
unavailable();
});
} else {
const authAccessRole = process.env.WWW_KEYCLOAK_ACCESS_ROLE;
store.getState().appConfig = {
uiVersion: process.env.WWW_UI_VERSION,
uiEnvironment: process.env.WWW_UI_ENVIRONMENT,
operationalDataUrl: process.env.API_COP_URI,
workflowServiceUrl: process.env.ENGINE_URI,
translationServiceUrl: process.env.TRANSLATION_URI,
reportServiceUrl: process.env.REPORT_URI
};
renderApp(App, { formApi: { url: process.env.TRANSLATION_URI }});
}
*/
1 change: 1 addition & 0 deletions non-master
Submodule non-master added at 93ef56
Loading