Skip to content

Commit

Permalink
Merge branch 'backend-refactor'
Browse files Browse the repository at this point in the history
* backend-refactor: (48 commits)
  add completer email as a description
  Fixed builds to use node_modules versions of dependencies such as angular-cli
  Changed favicon to use ReDBox branding
  Tweaks to runForDev to run compliation and installation tasks as node user
  Updated API docs to reflect newly added APIs
  Fixed TS compile issue.
  Added remaining API endpoints, added more tests. Removed file-based storage service.
  Added list datastreams
  Removed Nginx from dev docker-compose.yml as its not required. Referenced correct redbox-portal tag
  Updated postman tests. Added tests for new APIs
  Added Record Types and Forms API endpoints
  Added search related REST API calls
  Added transition workflow API endpoint.
  Added further User Management REST API Endpoints
  Added record delete record API endpoint. Added interactive flag for runForDev. Renamed SOLR jobs. Bumped MongoStorage version.
  Removed the requirement to pass an errorResponse object to apiFail. Useful for unexpected errors.
  Fixed typescript issues with respose models Added Create User API endpoint
  Added solr to developer docker-compose.yml as it's now required Added models to help standardise for API responses
  Updated Mocha test run to force exit after test run is complete
  Fixed: added missing SOLR fields.
  ...

# Conflicts:
#	README.md
#	package-lock.json
#	package.json
#	test/postman/test-collection.json
#	typescript/api/controllers/DashboardController.ts
#	typescript/api/controllers/RecordController.ts
#	typescript/api/services/RecordsService.ts
  • Loading branch information
andrewbrazzatti committed Feb 2, 2021
2 parents 42647ad + d94f48b commit 9cac48a
Show file tree
Hide file tree
Showing 72 changed files with 6,479 additions and 2,737 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,4 @@ typescript/api/controllers/**/*.js
typescript/api/services/**/*.js
assets/angular
api/core/*.js
dev
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM node:12.16.0
ENV node_env production
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin
VOLUME ["/opt/redbox-portal/","/attachments","/publication","/opt/hooks"]
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update && \
apt-get install --no-install-recommends -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && rm -rf /var/lib/apt/lists/*

COPY . /opt/redbox-portal/
RUN echo "Australia/Brisbane" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
COPY --chown=node:node . /opt/redbox-portal/
USER node
CMD NODE_ENV=$node_env node app.js
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@ Requirements:

- Node 12.16.0
Development requires Docker. Run `./runForDev.sh install jit` at least once.

- Docker

Run `./runForDev.sh install jit`

It will
- Pull qcifengineering/redbox-portal from docker hub (If a local copy does not exist)
- Compile backend
- Compile frontend
- Then start docker-compose

Open http://localhost:1500 to start browsing

### Build local docker image

Run `./dockerlocal_dev.sh`

It will
- Build a local docker image of qcifengineering/redbox-portal:latest
66 changes: 33 additions & 33 deletions angular/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,72 @@ help:

build-frontend:
@echo "Building local_auth"
ng build -a=0 --extract-css true
node_modules/.bin/ng build -a=0 --extract-css true
@echo "Building dashboard"
ng build -a=1 --extract-css true
node_modules/.bin/ng build -a=1 --extract-css true
@echo "Building record_search"
ng build -a=2 --extract-css true
node_modules/.bin/ng build -a=2 --extract-css true
@echo "Building transfer_owner"
ng build -a=3 --extract-css true
node_modules/.bin/ng build -a=3 --extract-css true
@echo "Building report"
ng build -a=4 --extract-css true
node_modules/.bin/ng build -a=4 --extract-css true
@echo "Building manageRoles"
ng build -a=5 --extract-css true
node_modules/.bin/ng build -a=5 --extract-css true
@echo "Building manageUsers"
ng build -a=6 --extract-css true
node_modules/.bin/ng build -a=6 --extract-css true
@echo "Building export"
ng build -a=7 --extract-css true
node_modules/.bin/ng build -a=7 --extract-css true
@echo "Building userProfile"
ng build -a=8 --extract-css true
node_modules/.bin/ng build -a=8 --extract-css true
@echo "Building dmp"
ng build -a=9 --extract-css true
node_modules/.bin/ng build -a=9 --extract-css true
@echo "Building workspace_list"
ng build -a=10 --extract-css true
node_modules/.bin/ng build -a=10 --extract-css true

build-frontend-prod:
@echo "Building local_auth"
ng build -a=0 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=0 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building dashboard"
ng build -a=1 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=1 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building record_search"
ng build -a=2 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=2 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building transfer_owner"
ng build -a=3 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=3 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building report"
ng build -a=4 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=4 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building manageRoles"
ng build -a=5 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=5 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building manageUsers"
ng build -a=6 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=6 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building export"
ng build -a=7 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=7 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building userProfile"
ng build -a=8 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=8 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building dmp"
ng build -a=9 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=9 --prod --build-optimizer --output-hashing=none --extract-css true
@echo "Building workspace_list"
ng build -a=10 --prod --build-optimizer --output-hashing=none --extract-css true
node_modules/.bin/ng build -a=10 --prod --build-optimizer --output-hashing=none --extract-css true

build-frontend-prod-sourcemaps:
@echo "Building local_auth"
ng build -a=0 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=0 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building dashboard"
ng build -a=1 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=1 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building record_search"
ng build -a=2 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=2 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building transfer_owner"
ng build -a=3 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=3 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building report"
ng build -a=4 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=4 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building manageRoles"
ng build -a=5 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=5 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building manageUsers"
ng build -a=6 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=6 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building export"
ng build -a=7 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=7 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building userProfile"
ng build -a=8 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=8 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building dmp"
ng build -a=9 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=9 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
@echo "Building workspace_list"
ng build -a=10 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
node_modules/.bin/ng build -a=10 --prod --build-optimizer --output-hashing=none --sourcemaps=true --extract-css true
2 changes: 2 additions & 0 deletions angular/shared/form/html-event.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { SimpleComponent } from './field-simple.component';
import { FieldBase } from './field-base';
import { NotInFormField } from './field-simple';
import * as _ from "lodash";
declare var jQuery: any;

/**
* Handles low-level event handling. Warning: for data changes, etc. please use the field-level subscribe-publish model.
*
Expand Down
1 change: 1 addition & 0 deletions angular/transfer_owner/app/transfer_owner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export class TransferOwnerComponent extends LoadableComponent {
fieldNames: ['text_full_name', 'storage_id', {'email': 'Email[0]'}, {'full_name_honorific': 'text_full_name_honorific'}, {'given_name': 'text_given_name'}, {'family_name': 'text_family_name'}, {'honorific': 'Honorific[0]'}, {'full_name_family_name_first': 'dc_title'}, {'username': 'username'} ],
searchFields: 'text_full_name',
titleFieldArr: ['text_full_name'],
titleCompleterDescription: 'Email',
vocabId: 'Parties AND repository_name:People',
editMode: true,
placeHolder: this.translationService.t('transfer-ownership-researcher-name'),
Expand Down
Binary file added assets/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/favicon.ico
Binary file not shown.
27 changes: 27 additions & 0 deletions config/agendaQueue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports.agendaQueue = {
// options: {
// see: https://github.com/agenda/agenda#configuring-an-agenda
// }
// e.g. :
// jobs: [
// {
// name: 'sampleJob',
// fnName: 'agendaqueueservice.sampleFunctionToDemonstrateHowToDefineAJobFunction',
// schedule: {
// method: 'every',
// intervalOrSchedule: '1 minute',
// data: 'sample log string'
// }
// }
// ]
jobs: [
{
name: 'SolrSearchService-CreateOrUpdateIndex',
fnName: 'solrsearchservice.solrAddOrUpdate'
},
{
name: 'SolrSearchService-DeleteFromIndex',
fnName: 'solrsearchservice.solrDelete'
}
]
};
5 changes: 4 additions & 1 deletion config/datastores.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports.datastores = {
mongodb: {
adapter: require('sails-mongo'),
url: 'mongodb://localhost:27017/redbox-portal'
},
redboxStorage: {
adapter: require('sails-mongo'),
url: 'mongodb://mongodb:27017/redbox-storage'
}

};
2 changes: 1 addition & 1 deletion config/emailnotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports.emailnotification = {
send: {method: 'post', url: "/api/v1/messaging/emailnotification"}
},
settings: {
enabled: true,
enabled: false,
from: "noreply@redbox",
templateDir: "views/emailTemplates/"
},
Expand Down
3 changes: 3 additions & 0 deletions config/queue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports.queue = {
serviceName: 'agendaqueueservice'
}
56 changes: 52 additions & 4 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,13 @@ module.exports.routes = {
csrf: false
},
'get /:branding/:portal/api/records/metadata/:oid': 'webservice/RecordController.getMeta',
'get /:branding/:portal/api/records/list': 'webservice/RecordController.listRecords',
'get /:branding/:portal/api/records/list': 'webservice/RecordController.listRecords',
'get /:branding/:portal/api/records/objectmetadata/:oid': 'webservice/RecordController.getObjectMeta',
'delete /:branding/:portal/api/records/metadata/:oid': {
controller: 'webservice/RecordController',
action: 'deleteRecord',
csrf: false
},
'post /:branding/:portal/api/records/permissions/edit/:oid': {
controller: 'webservice/RecordController',
action: 'addUserEdit',
Expand All @@ -268,18 +273,61 @@ module.exports.routes = {
action: 'addDataStreams',
csrf: false
},
'get /:branding/:portal/api/records/datastreams/:oid': 'webservice/RecordController.getDataStream',
'put /:branding/:portal/api/records/datastreams/:oid': {
controller: 'webservice/RecordController',
action: 'listDatastreams',
csrf: false
},
'delete /:branding/:portal/api/records/permissions/view/:oid': {
controller: 'webservice/RecordController',
action: 'removeUserView',
csrf: false
},
'post /:branding/:portal/api/records/permissions/editRole/:oid': {
controller: 'webservice/RecordController',
action: 'addRoleEdit',
csrf: false
},
'delete /:branding/:portal/api/records/permissions/editRole/:oid': {
controller: 'webservice/RecordController',
action: 'removeRoleEdit',
csrf: false
},
'post /:branding/:portal/api/records/permissions/viewRole/:oid': {
controller: 'webservice/RecordController',
action: 'addRoleView',
csrf: false
},
'delete /:branding/:portal/api/records/permissions/viewRole/:oid': {
controller: 'webservice/RecordController',
action: 'removeRoleView',
csrf: false
},
'get /:branding/:portal/api/records/permissions/:oid': 'webservice/RecordController.getPermissions',
'get /:branding/:portal/api/records/datastreams/:oid': 'webservice/RecordController.getDataStream',
'post /:branding/:portal/api/records/workflow/step/:targetStep/:oid': {
controller: 'webservice/RecordController',
action: 'transitionWorkflow',
csrf: false
},
'get /:branding/:portal/api/users': 'webservice/UserManagementController.listUsers',
'get /:branding/:portal/api/users/find': 'webservice/UserManagementController.getUser',
'get /:branding/:portal/api/users/get': 'webservice/UserManagementController.getUser',
'put /:branding/:portal/api/users': 'webservice/UserManagementController.createUser',
'post /:branding/:portal/api/users': 'webservice/UserManagementController.updateUser',
'get /:branding/:portal/api/users/token/generate': 'webservice/UserManagementController.generateAPIToken',
'get /:branding/:portal/api/users/token/revoke': 'webservice/UserManagementController.revokeAPIToken',
'get /:branding/:portal/api/roles': 'webservice/UserManagementController.listSystemRoles',


'get /:branding/:portal/api/search': 'webservice/SearchController.search',
'get /:branding/:portal/api/search/index': 'webservice/SearchController.index',

'get /:branding/:portal/api/users': 'webservice/UserManagementController.listUsers',
'get /:branding/:portal/api/users/find': 'webservice/UserManagementController.findUser',
'get /:branding/:portal/api/forms/get': 'webservice/FormManagementController.getForm',
'get /:branding/:portal/api/forms': 'webservice/FormManagementController.listForms',

'get /:branding/:portal/api/recordtypes/get': 'webservice/RecordTypeController.getRecordType',
'get /:branding/:portal/api/recordtypes': 'webservice/RecordTypeController.listRecordTypes',

'post /:branding/:portal/api/sendNotification': {
controller: 'EmailController',
Expand Down
3 changes: 3 additions & 0 deletions config/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports.search = {
serviceName: 'solrsearchservice'
};
Loading

0 comments on commit 9cac48a

Please sign in to comment.