diff --git a/demo-invenioils/README.md b/demo-invenioils/README.md index 8195d51..ed5ba65 100644 --- a/demo-invenioils/README.md +++ b/demo-invenioils/README.md @@ -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 ``` diff --git a/demo-invenioils/setup.sh b/demo-invenioils/setup.sh index 1e485ab..e328fe6 100755 --- a/demo-invenioils/setup.sh +++ b/demo-invenioils/setup.sh @@ -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 diff --git a/demo-invenioils/ui/.env b/demo-invenioils/ui/.env index 3ac6baa..085d56e 100644 --- a/demo-invenioils/ui/.env +++ b/demo-invenioils/ui/.env @@ -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 diff --git a/demo-invenioils/ui/craco.config.js b/demo-invenioils/ui/craco.config.js index f29ea19..1d8d176 100644 --- a/demo-invenioils/ui/craco.config.js +++ b/demo-invenioils/ui/craco.config.js @@ -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'), diff --git a/demo-invenioils/ui/package.json b/demo-invenioils/ui/package.json index cc56309..1d6ddb9 100644 --- a/demo-invenioils/ui/package.json +++ b/demo-invenioils/ui/package.json @@ -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", @@ -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", @@ -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": { @@ -77,6 +75,6 @@ ] }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } } diff --git a/demo-invenioils/ui/src/config.js b/demo-invenioils/ui/src/config.js index e2f6d09..a73cacc 100644 --- a/demo-invenioils/ui/src/config.js +++ b/demo-invenioils/ui/src/config.js @@ -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: { diff --git a/demo-invenioils/ui/src/overridableMapping.js b/demo-invenioils/ui/src/overridableMapping.js index 6bc9841..0f2b240 100644 --- a/demo-invenioils/ui/src/overridableMapping.js +++ b/demo-invenioils/ui/src/overridableMapping.js @@ -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, }; diff --git a/demo-invenioils/ui/src/overridden/authentication/Login.js b/demo-invenioils/ui/src/overridden/authentication/Login.js new file mode 100644 index 0000000..a870dc7 --- /dev/null +++ b/demo-invenioils/ui/src/overridden/authentication/Login.js @@ -0,0 +1,60 @@ +import React from 'react'; +import { Header, Label, List, Grid, Card, Divider } from 'semantic-ui-react'; + +export const LoginDocs = () => { + return ( + <> + +
+ + {' '} + Test ILS demo instance +
+ + + + + + As a Patron by logging in with + + + email: patron1@test.ch + + + password: 123456 + + + + + + + + + As a Librarian by logging in with + + + email: librarian@test.ch + + + password: 123456 + + + + + + + + + Note: + + Email sending functionality is disabled for the demo instance. + + The demo data will be recreated periodically. + + + + + ); +}; diff --git a/demo-invenioils/ui/src/overridden/components/Menu.js b/demo-invenioils/ui/src/overridden/components/Menu.js new file mode 100644 index 0000000..d42da07 --- /dev/null +++ b/demo-invenioils/ui/src/overridden/components/Menu.js @@ -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 ( + <> + + Features + + + + Documentation + + + + ); +}; + +export const RightMenuItemMobile = () => { + return ( + + + + + Features + + + + Documentation + + + + + ); +}; diff --git a/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/SectionDocsAndUsage.js b/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/SectionDocsAndUsage.js deleted file mode 100644 index 0acc6b8..0000000 --- a/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/SectionDocsAndUsage.js +++ /dev/null @@ -1,137 +0,0 @@ -import React from 'react'; -import { - Card, - Container, - Header, - Label, - List, - Grid, - Divider, -} from 'semantic-ui-react'; - -export const SectionDocsAndUsage = () => { - return ( - - - -
- Documentation and usage -
- - - - - - -
- {' '} - Test ILS demo instance -
- - - - - - As a patron by logging in with - - - - email: patron1@test.ch - - - - password: 123456 - - - - - As a librarian by logging in with - - - - email: librarian@test.ch - - - - password: 123456 - - - - - Note: - - - Email sending functionality is disabled for - the demo instance. - - - The demo data will be recreated - periodically. - - - - - - - -
-
- - -
- {' '} - Checkout docs and code -
- - - - InvenioILS{' '} - - documentation - - . - - - - Demo InvenioILS{' '} - - source code - - . - - - - InvenioILS{' '} - - backend source code - - . - - - InvenioILS{' '} - - frontend source code - - . - - - -
-
-
-
-
-
-
-
-
- ); -}; diff --git a/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/ServicesInstallationSections.js b/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/ServicesInstallationSections.js deleted file mode 100644 index 5d0d8d0..0000000 --- a/demo-invenioils/ui/src/overridden/frontsite/Home/Sections/ServicesInstallationSections.js +++ /dev/null @@ -1,14 +0,0 @@ -import { - SectionServices, - SectionInstallation, -} from '@inveniosoftware/react-invenio-app-ils'; -import React from 'react'; - -export const ServicesInstallationSections = () => { - return ( - <> - - - - ); -}; diff --git a/demo-invenioils/ui/src/overridden/frontsite/pages/Features.js b/demo-invenioils/ui/src/overridden/frontsite/pages/Features.js new file mode 100644 index 0000000..2651e46 --- /dev/null +++ b/demo-invenioils/ui/src/overridden/frontsite/pages/Features.js @@ -0,0 +1,44 @@ +import React from 'react'; +import { List, Header, Container } from 'semantic-ui-react'; +import { SectionServices } from '@inveniosoftware/react-invenio-app-ils'; + +export const Features = () => { + return ( + + + +
+ Checkout the following links to know more about the features and + customizations in InvenioILS! +
+ + + InvenioILS{' '} + documentation. + + + Demo InvenioILS{' '} + + source code + + . + + + InvenioILS{' '} + + backend source code + + . + + + InvenioILS{' '} + + frontend source code + + . + + +
+
+ ); +}; diff --git a/demo-invenioils/ui/src/overridden/routes/FrontsiteUrls.js b/demo-invenioils/ui/src/overridden/routes/FrontsiteUrls.js new file mode 100644 index 0000000..a51d6e4 --- /dev/null +++ b/demo-invenioils/ui/src/overridden/routes/FrontsiteUrls.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Route } from 'react-router-dom'; +import { Features } from '../frontsite/pages/Features'; + +export const DemoFrontSiteRoutes = { + features: `/features`, +}; + +export const FeaturesRoute = () => { + return ( + + ); +};