Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[PROD] 1.0 - Initial merge to master #33

Merged
merged 86 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
67d9d39
feat: basic code with Work Periods
MadOPcode May 29, 2021
2f30d6f
Fixed bugs and lint errors.
MadOPcode May 29, 2021
1af326f
Create config.yml
nkumar-topcoder May 29, 2021
0d97f1b
Re-enabled react-hooks/exhaustive-deps rule and added hook dependencies.
MadOPcode May 29, 2021
5f43380
Removed global styles.
MadOPcode May 29, 2021
5ce23f5
Additional fixes
MadOPcode May 29, 2021
a6def7c
Added redirect to /taas-admin/work-periods
MadOPcode May 29, 2021
debf5a3
Added/corrected docs for components.
MadOPcode May 29, 2021
981e1dd
[skip ci]
nkumar-topcoder May 30, 2021
33eafdf
[skip ci]
nkumar-topcoder May 30, 2021
380c860
[skip ci]
nkumar-topcoder May 30, 2021
ae6b62e
Merge pull request #2 from topcoder-platform/feature/basic-work-periods
nkumar-topcoder May 30, 2021
02187ae
Update config.yml
nkumar-topcoder May 30, 2021
6526a26
Update Dockerfile
nkumar-topcoder May 30, 2021
51d1949
permission to build.sh
May 30, 2021
d3a1243
Added ESLint's plugin:react/recommended, enabled no-unused-vars rule …
MadOPcode May 30, 2021
ed1a759
Removed manually created SVG JSX. Inlined some SVGs as data URIs.
MadOPcode May 30, 2021
37dd7cb
Commented out payment status section in sidebar.
MadOPcode May 30, 2021
8f1e481
Changed default port to 8502 in server.js
MadOPcode May 30, 2021
6e27cfc
Minor fix in pagination styles for small screens.
MadOPcode May 30, 2021
2f24a70
Fixed: user handle link used Work Period id instead of Resource Booki…
MadOPcode May 30, 2021
b6881f5
Prevented wrapping of team name, payment status and start/end dates.
MadOPcode May 31, 2021
2f1efee
Fixed: navigating using pagination caused duplicate request.
MadOPcode May 31, 2021
04ff2a1
Made buttons in Pagination component appear/disappear in a more UX-fr…
MadOPcode May 31, 2021
2949cba
Merge pull request #3 from MadOPcode/feature/basic-work-periods
maxceem May 31, 2021
619afe5
fix: user RB.memberRate to show weekly rate
maxceem May 31, 2021
1b6a1c7
Merge pull request #4 from topcoder-platform/feature/basic-work-periods
maxceem May 31, 2021
f0d74d5
Fixed positioning of WeekPicker month/year dropdown menus.
MadOPcode May 31, 2021
9301723
Merge branch 'topcoder-platform:feature/basic-work-periods' into feat…
MadOPcode May 31, 2021
4293f60
Refactored Work Period's weekly rate formatting.
MadOPcode May 31, 2021
2d6d1b9
fix: RB handle URL
maxceem May 31, 2021
9a16a34
fix: TaaS App base URL path
maxceem Jun 1, 2021
257d1e7
Merge branch 'dev' into feature/basic-work-periods
maxceem Jun 2, 2021
ea3f665
Merge pull request #14 from topcoder-platform/feature/basic-work-periods
maxceem Jun 2, 2021
6686d4f
fix: rename button
maxceem Jun 2, 2021
a40d901
chore: fix comment
maxceem Jun 2, 2021
11926a9
Added user roles' check. Fixed missing digits after decimal point in …
MadOPcode Jun 2, 2021
5e37631
Fixed: incorrect prop-types for LoadingIndicator.
MadOPcode Jun 3, 2021
6444a67
Merge pull request #15 from MadOPcode/dev
maxceem Jun 3, 2021
57d1f09
Fixed inaccurate Prop Types in several components.
MadOPcode Jun 3, 2021
b02e33f
Merge branch 'dev' of github.com:MadOPcode/micro-frontends-taas-admin…
MadOPcode Jun 3, 2021
2ab7f0b
Merge pull request #18 from MadOPcode/dev
maxceem Jun 3, 2021
54b371c
feat: show Resource Bookings in placed status only
maxceem Jun 3, 2021
7e53e8e
fix: lint
maxceem Jun 3, 2021
5e6c585
Implemented working period details
MadOPcode Jun 8, 2021
f3f641c
Fixed: failed periods' rows not highlighted in red
MadOPcode Jun 12, 2021
bfdc589
Merge pull request #19 from MadOPcode/feature/work-periods-part-2
maxceem Jun 13, 2021
d42eeba
Fixed: issues with search-handle field.
MadOPcode Jun 13, 2021
e816a74
Fixed: weird error caused by Redirect component.
MadOPcode Jun 13, 2021
b7cf7f0
Final fixes
MadOPcode Jun 14, 2021
4bb578f
Enabled filtering by payment status.
MadOPcode Jun 14, 2021
d59521f
Minor fix: excess brackets were causing an error while loading job name.
MadOPcode Jun 14, 2021
785ada9
Implemented loading of project names.
MadOPcode Jun 14, 2021
f8ca0ff
Merge pull request #20 from topcoder-platform/feature/work-periods-pa…
maxceem Jun 14, 2021
47920ce
Implemented payments processing for all periods.
MadOPcode Jun 14, 2021
cb25463
Merge branch 'topcoder-platform:feature/work-periods-part-2' into fea…
MadOPcode Jun 14, 2021
593f99e
Merge pull request #21 from MadOPcode/feature/work-periods-part-2
maxceem Jun 14, 2021
1438415
Merge pull request #22 from topcoder-platform/feature/work-periods-pa…
maxceem Jun 14, 2021
aa0d642
Completely removed 'Lock Working Days' code.
MadOPcode Jun 14, 2021
94daee3
Removed falsy or empty-array values from query object sent to /work-p…
MadOPcode Jun 14, 2021
8f76a67
Merge branch 'topcoder-platform:feature/work-periods-part-2' into fea…
MadOPcode Jun 14, 2021
a89442b
Refactored function that sends query to /work-period-payments/query.
MadOPcode Jun 14, 2021
b9672c7
Merge branch 'feature/work-periods-part-2' of github.com:MadOPcode/mi…
MadOPcode Jun 14, 2021
455f75d
Fixed: inconsistent periods' selection state
MadOPcode Jun 14, 2021
e052725
Fixed: prop-types' warnings.
MadOPcode Jun 14, 2021
6494822
Minor improvements in ProjectName component
MadOPcode Jun 14, 2021
56f9c68
Fixed: checkboxes in sidebar overlaid search field suggestions' list.
MadOPcode Jun 15, 2021
f38a304
Avoiding processing periods using query when page size is large enough.
MadOPcode Jun 15, 2021
85f052d
Additional modifications
MadOPcode Jun 15, 2021
ceef619
Minor change: removed unneeded object property.
MadOPcode Jun 15, 2021
aebce9b
Merge pull request #23 from MadOPcode/feature/work-periods-part-2
maxceem Jun 16, 2021
459aa2c
fix: remove extra ":"
maxceem Jun 16, 2021
2429789
fix: lint
maxceem Jun 16, 2021
681485b
feat: changed warning color
maxceem Jun 16, 2021
961b1a4
Merge pull request #24 from topcoder-platform/feature/work-periods-pa…
maxceem Jun 16, 2021
4b30af8
fix: various improvements
maxceem Jun 16, 2021
ca1e676
fix: in-progress status
maxceem Jun 16, 2021
2930211
feat: change partially-complete label color
maxceem Jun 16, 2021
1b97295
Renamed workingDays property.
MadOPcode Jun 16, 2021
d4906a0
Fixed: dropdowns inside periods' details overlaid week picker calendar.
MadOPcode Jun 17, 2021
98064cf
Refactored handling of working days.
MadOPcode Jun 17, 2021
4b8dbf2
Added 'Total Paid' column.
MadOPcode Jun 17, 2021
c5c670f
Implemented period data updating from server.
MadOPcode Jun 17, 2021
729841d
Merge pull request #31 from MadOPcode/feature/work-periods-part-2
maxceem Jun 17, 2021
c228666
Merge branch 'dev' into feature/work-periods-part-2
maxceem Jun 17, 2021
9726e18
Merge pull request #32 from topcoder-platform/feature/work-periods-pa…
maxceem Jun 17, 2021
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
88 changes: 88 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
version: 2
defaults: &defaults
docker:
- image: circleci/python:2.7-stretch-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
sudo apt install jq
sudo pip install awscli --upgrade
sudo pip install docker-compose
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
restore_cache_settings_for_build: &restore_cache_settings_for_build
key: docker-node-modules-{{ checksum "package-lock.json" }}

save_cache_settings: &save_cache_settings
key: docker-node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules

builddeploy_steps: &builddeploy_steps
- checkout
- setup_remote_docker
- run: *install_dependency
- run: *install_deploysuite
#- restore_cache: *restore_cache_settings_for_build
- run:
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
- run:
name: Running build-var.
command: |
source buildenvvar
./build.sh ${APPNAME}
#- save_cache: *save_cache_settings
- deploy:
name: Running MasterScript.
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}

jobs:
# Build & Deploy against development backend
"build-dev":
<<: *defaults
environment:
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "micro-frontends-taas-admin-app"
steps: *builddeploy_steps

"build-prod":
<<: *defaults
environment:
DEPLOY_ENV: "PROD"
LOGICAL_ENV: "prod"
APPNAME: "micro-frontends-taas-admin-app"
steps: *builddeploy_steps

workflows:
version: 2
build:
jobs:
# Development builds are executed on "develop" branch only.
- "build-dev":
context: org-global
filters:
branches:
only:
- dev

# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
context: org-global
filters:
branches:
only: master
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/decls
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"react-important-stuff",
"plugin:prettier/recommended"
],
"parser": "babel-eslint",
"rules": {
"no-unused-vars": "warn"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# macOS cache files
.DS_Store
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.22.1
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gitignore
.prettierignore
yarn.lock
yarn-error.log
package-lock.json
dist
coverage
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
160 changes: 158 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,158 @@
# taas-admin-app
taas-admin-app for managing taas administrative activities
# Topcoder TaaS Admin Micro-app

This is a [single-spa](https://single-spa.js.org/) example React microapp.

> NOTE. This application have been configured to be run as child app of a single-spa application. So while this app can be deployed and run independently, we would need some frame [single-spa](https://single-spa.js.org/) which would load it. While technically we can achieve running this app as standalone app it's strongly not recommended by the author of the `single-spa` approach, see this [GitHub Issue](https://github.com/single-spa/single-spa/issues/640) for details.

## Requirements

- node - v10.22.1
- npm - v6.14.6

## Technology Stack

- React 16.12
- Router via [Reach Router](https://reach.tech/router/)
- CSS Modules with SCSS
- [React Inline SVG](https://github.com/airbnb/babel-plugin-inline-react-svg)
- We use **Redux Store** for storing page data if we need to edit it. Otherwise we can use local state.
- [react-redux-toastr](https://www.npmjs.com/package/react-redux-toastr) for success/error popups in the bottom left corner.

## Config

For available variables config which depend on the running environment (`APPENV=dev` or `APPENV=prod`), please refer to `config/dev.js` and `config/prod.js`.

For application constants which don't depend on the running environment use `src/constants/index.js`.

## NPM Commands

| Command | Description |
| --------------------- | ----------------------------------------------------------------- |
| `npm start` | Run server which serves production ready build from `dist` folder |
| `npm run dev` | Run app in the development mode |
| `npm run dev-https` | Run app in the development mode using HTTPS protocol |
| `npm run build` | Build app for production and puts files to the `dist` folder |
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
| `npm run lint` | Check code for lint errors |
| `npm run format` | Format code using prettier |
| `npm run test` | Run unit tests |
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
| `npm run coverage` | Generate test code coverage report |

## Deployment to Production

- `npm i` - install dependencies
- `npm build` - build code to `dist/` folder
- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`.

### Deploying to Heroku

Make sure you have [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) installed and you have a Heroku account. And then inside the project folder run the next commands:

- If there is not Git repository initiated yet, create a repo and commit all the files:
- `git init`
- `git add .`
- `git commit -m 'initial commit'`
- `heroku apps:create` - create Heroku app
- `git push heroku master` - push changes to Heroku and trigger deploying
- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-micro-frontends-teams.js` to load this micro-app.

## How to run Locally for Development

TaaS Admin App is done using Single SPA micro-frontend architecture https://single-spa.js.org/. So to start it, we would also have to run Frame App and Navbar App. Here I would show the steps to run locally everything we need.

### Local Authentication

First of all, to authenticate locally we have to run a local authentication service.

- Clone this repository into `taas-admin-app`.
- Inside the folder `taas-admin-app/auth-local` run `npm start`.
- You would need npm 5+ for it. This would start a local sever on port 5000 which could be used for local Authentication.

### Local Domain

Some config files are using domain `local.topcoder-dev.com`. You can change it to `localhost` in all the configs of each repo mentioned below. Or on your local machine, update file `/etc/hosts` add the line `127.0.0.1 local.topcoder-dev.com`. This file has another path on Windows.

### Run Applications

1. Run **Frame** App:

```sh
git clone https://github.com/topcoder-platform/micro-frontends-frame.git
cd micro-frontends-frame
# inside folder "micro-frontends-frame" run:

nvm use # or make sure to use Node 10
npm i # to install dependencies

# set environment variables:

export APPMODE="development"
export APPENV="local-multi"

npm run local-server

# this would start frame server on http://localhost:3000
```

open one more terminal window in the same folder and run:

```sh
# set environment variables:

export APPMODE="development"
export APPENV="local-multi"

npm run local-client

# this host frame client code on http://localhost:8080
```

2. Run **Navbar** micro-app:

```sh
git clone https://github.com/topcoder-platform/micro-frontends-navbar-app.git
cd micro-frontends-navbar-app
```

Update in file `micro-frontends-navbar-app/config/dev.js` values for `ACCOUNTS_APP_CONNECTOR` and `AUTH` to `http://localhost:5000` so Navbar app which handles authentication uses our local Authentication service.

```sh
# inside folder "micro-frontends-navbar-app" run:

nvm use # or make sure to use Node 10
npm i # to install dependencies

npm run dev

# this host navbar app as http://localhost:3001/navbar/topcoder-micro-frontends-navbar-app.js
```

3. Run **TaaS Admin** micro-app:

```sh
# inside folder "taas-admin-app" run:

nvm use # or make sure to use Node 10
npm i # to install dependencies

npm run dev

# this hosts TaaS Admin App as http://localhost:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js
```

4. Now we have to update the `micro-frontends-frame` app to show our local version of TaaS Admin App, instead of remote one. Update file `micro-frontends-frame/config/micro-frontends-config-local.json`:

```js
// replace line
"@topcoder/micro-frontends-taas-admin-app": "https://platform.topcoder-dev.com/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js",

// with line:
"@topcoder/micro-frontends-taas-admin-app": "http://localhost:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js",
```

- Now open in the browser http://localhost:8080/taas-admin.
- If you are not logged-in yet, you should be redirected to the login page.
- If you cannot see the application and redirect doesn't happen, make sure that file "http://local.topcoder-dev.com:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js" is loaded successfully in the Network tab.

Congratulations, you successfully run the project. If you had some issue, please, try to go through README of https://github.com/topcoder-platform/micro-frontends-frame and https://github.com/topcoder-platform/micro-frontends-navbar-app.
11 changes: 11 additions & 0 deletions auth-local/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1. Run any static files server inside this directory, for example:
- `npx http-server . -p 5000`
- `php -S localhost:5000`
2. Run your application on http://localhost:3000.
3. Now you can open http://localhost:5000 in browser and click login (wait it a little bit, it may take time to redirect you). After you login, you should be redirected back to http://localhost:3000

PS. You may also download latest version of `setupAuth0WithRedirect.js` file from here - https://github.com/topcoder-platform/tc-auth-lib/blob/dev/web-assets/js/setupAuth0WithRedirect.js




18 changes: 18 additions & 0 deletions auth-local/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>

<head>
<title>Auth0</title>
<meta charset="utf-8" />
<script language="javascript" type="text/javascript" src="./setupAuth0WithRedirect.js"></script>
</head>

<body>
Loaded...redirecting to auth0.(see browser console log)
<script>
window.onload = authSetup;
</script>
<a href="?retUrl=http://localhost:3000" >Login</a>
</body>

</html>
11 changes: 11 additions & 0 deletions auth-local/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "login-locally",
"version": "1.0.0",
"description": "Run any static files server inside this directory.",
"scripts": {
"start": "npx http-server . -p 5000"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Loading