Skip to content

Commit

Permalink
Update demo site home pages and login
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and kpsherva committed Jul 15, 2024
1 parent 1234327 commit 062c0e6
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 180 deletions.
18 changes: 16 additions & 2 deletions demo-invenioils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,24 @@ If this is not the desired behaviour, you can run the server with HTTP only by:
1. Changing REACT_APP_INVENIO_UI_URL and REACT_APP_INVENIO_REST_ENDPOINTS_BASE_URL variables in `ui/.env` file to run on `http` instead of `https`.
2. Running the server without specifying the certificate: `FLASK_ENV=development pipenv run invenio run`

To start the UI part, navigate to the `ui/` folder and run:
In a new terminal, start the celery worker. Make sure you are in the project folder (my-site) then run:

```console
npm i
celery -A invenio_app.celery worker -l INFO
```

To start the UI part:

Make sure you are using Node v18 or higher:

```console
node --version
```

Navigate to the `ui/` folder and run:

```console
npm install --legacy-peer-deps
npm start
```

Expand Down
6 changes: 2 additions & 4 deletions demo-invenioils/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@
# under the terms of the MIT License; see LICENSE file for more details.

docker-compose up -d
pipenv install
pipenv run invenio setup --verbose
pipenv run invenio collect -v
pipenv run invenio webpack buildall
invenio-cli install
invenio-cli services setup
4 changes: 2 additions & 2 deletions demo-invenioils/ui/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
REACT_APP_UI_ILS_VERSION=1.0.0-alpha.72
REACT_APP_INVENIO_VERSION=1.0.0rc1
REACT_APP_UI_ILS_VERSION=1.0.0-alpha.90
REACT_APP_INVENIO_VERSION=4.0.0rc1
REACT_APP_INVENIO_UI_URL=https://127.0.0.1:5000
REACT_APP_INVENIO_REST_ENDPOINTS_BASE_URL=https://127.0.0.1:5000/api
REACT_APP_OVERLAY_VERSION=1.0.0
Expand Down
8 changes: 8 additions & 0 deletions demo-invenioils/ui/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ module.exports = {
mode: 'file',
},
webpack: {
configure: webpackConfig => {
const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
({ constructor }) => constructor && constructor.name === 'ModuleScopePlugin' // Needed to skip the check of preventing from importing from outside of src/ and node_modules/ directory.
);

webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
return webpackConfig;
},
alias: {
// aliases for all peer dependencies to avoid double libraries
'@babel/runtime': path.resolve('./node_modules/@babel/runtime'),
Expand Down
32 changes: 15 additions & 17 deletions demo-invenioils/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "demo-invenioils",
"version": "1.0.0",
"version": "2.0.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@inveniosoftware/react-invenio-app-ils": "^1.0.0-alpha.75",
"@inveniosoftware/react-invenio-app-ils": "^1.0.0-alpha.90",
"@rjsf/core": "^2.5.0",
"@rjsf/semantic-ui": "^2.5.0",
"axios": "^0.21.0",
"ajv": "^8.0.0",
"ajv-keywords": "^5.0.0",
"axios": "^1.6.0",
"follow-redirects": "^1.14.7",
"formik": "^2.2.6",
"html5-qrcode": "^2.3.8",
"less": "^3.13.1",
"less-loader": "^5.0.0",
"lodash": "^4.17.15",
Expand All @@ -24,6 +27,7 @@
"react-overridable": "^0.0.3",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "^5.0.1",
"react-scroll": "^1.7.16",
"react-searchkit": "^2.0.0",
"react-show-more": "^2.0.0",
Expand All @@ -33,27 +37,21 @@
"redux-thunk": "^2.3.0",
"semantic-ui-calendar-react": "^0.15.3",
"semantic-ui-less": "^2.5.0",
"semantic-ui-react": "^2.1.1"
"semantic-ui-react": "^2.1.4"
},
"devDependencies": {
"@craco/craco": "^5.9.0",
"@semantic-ui-react/craco-less": "^1.2.1",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"prettier": "^1.19.1",
"react-scripts": "^3.4.1"
"@craco/craco": "^7.0.0",
"@inveniosoftware/eslint-config-invenio": "^2.0.0",
"@semantic-ui-react/craco-less": "^3.0.0"
},
"scripts": {
"start": "HOST=127.0.0.1 HTTPS=true craco start",
"build": "craco build",
"test": "craco test",
"lint": "eslint src/",
"eject": "craco eject",
"https_start": "HTTPS=true craco start"
"https_start": "HTTPS=true craco start",
"lint": "eslint src/ --ext .js --max-warnings=0",
"format": "prettier --write \"src/**/*.js\""
},
"eslintConfig": {
"env": {
Expand All @@ -77,6 +75,6 @@
]
},
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
}
}
1 change: 1 addition & 0 deletions demo-invenioils/ui/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const config = {
APP: {
LOGO_SRC: process.env.PUBLIC_URL + '/images/logo-invenio-ils.svg',
ENABLE_LOCAL_ACCOUNT_LOGIN: true,
ENABLE_SELF_CHECKOUT: true,
ENABLE_OAUTH_LOGIN: false,
OAUTH_PROVIDERS: null,
EMAILS_PREFILL: {
Expand Down
15 changes: 11 additions & 4 deletions demo-invenioils/ui/src/overridableMapping.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { ServicesInstallationSections } from './overridden/frontsite/Home/Sections/ServicesInstallationSections';
import { SectionDocsAndUsage } from './overridden/frontsite/Home/Sections/SectionDocsAndUsage';
import {
RightMenuItem,
RightMenuItemMobile,
} from './overridden/components/Menu';
import { LoginDocs } from './overridden/authentication/Login';
import { FeaturesRoute } from './overridden/routes/FrontsiteUrls';

export const overriddenCmps = {
'SectionsWrapper.servicesInstallationSections': ServicesInstallationSections,
'SectionInstallation.layout': SectionDocsAndUsage,
'SectionsWrapper.servicesInstallationSections': () => null,
'ILSMenu.RightMenuItems': RightMenuItem,
'ILSMenu.RightMenuItemsMobile': RightMenuItemMobile,
'Login.layout.extras': LoginDocs,
'FrontSite.CustomRoute': FeaturesRoute,
};
60 changes: 60 additions & 0 deletions demo-invenioils/ui/src/overridden/authentication/Login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import { Header, Label, List, Grid, Card, Divider } from 'semantic-ui-react';

export const LoginDocs = () => {
return (
<>
<Divider />
<Header size="medium" textAlign="center">
<Label circular size="huge" color="orange">
?
</Label>
{' '}
Test ILS demo instance
</Header>
<Grid centered>
<Grid.Row columns={2}>
<Grid.Column width={8}>
<Card fluid color="orange" className="install-card">
<Card.Content>
<Card.Header>As a Patron by logging in with</Card.Header>
<List>
<List.Item>
<List.Header>email: [email protected]</List.Header>
</List.Item>
<List.Item>
<List.Header>password: 123456</List.Header>
</List.Item>
</List>
</Card.Content>
</Card>
</Grid.Column>
<Grid.Column width={8}>
<Card fluid color="orange" className="install-card">
<Card.Content>
<Card.Header>As a Librarian by logging in with</Card.Header>
<List>
<List.Item>
<List.Header>email: [email protected]</List.Header>
</List.Item>
<List.Item>
<List.Header>password: 123456</List.Header>
</List.Item>
</List>
</Card.Content>
</Card>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<List>
<List.Header>Note:</List.Header>
<List.Item>
Email sending functionality is disabled for the demo instance.
</List.Item>
<List.Item>The demo data will be recreated periodically.</List.Item>
</List>
</Grid.Row>
</Grid>
</>
);
};
47 changes: 47 additions & 0 deletions demo-invenioils/ui/src/overridden/components/Menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Media } from '@inveniosoftware/react-invenio-app-ils';
import React from 'react';
import { Link } from 'react-router-dom';
import { Dropdown, Menu } from 'semantic-ui-react';
import { DemoFrontSiteRoutes } from '../routes/FrontsiteUrls';

export const RightMenuItem = () => {
return (
<>
<Menu.Item>
<Link to={DemoFrontSiteRoutes.features}>Features</Link>
</Menu.Item>
<Menu.Item>
<Link
to={{ pathname: 'https://invenioils.docs.cern.ch' }}
target="_blank"
rel="noreferrer"
>
Documentation
</Link>
</Menu.Item>
</>
);
};

export const RightMenuItemMobile = () => {
return (
<Media lessThan="computer">
<Dropdown item icon="help">
<Dropdown.Menu>
<Dropdown.Item as={Link} to={DemoFrontSiteRoutes.features}>
Features
</Dropdown.Item>
<Dropdown.Divider />
<Dropdown.Item
as={Link}
to={{ pathname: 'https://invenioils.docs.cern.ch' }}
target="_blank"
rel="noreferrer"
>
Documentation
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</Media>
);
};
Loading

0 comments on commit 062c0e6

Please sign in to comment.