Skip to content

Commit 7d847e5

Browse files
authored
Merge pull request #72 from topcoder-platform/dev
Roles management - part 1
2 parents 58a880c + 96ff8e9 commit 7d847e5

31 files changed

+1325
-630
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![CircleCI](https://circleci.com/gh/topcoder-platform/admin-app.svg?style=svg)](https://circleci.com/gh/topcoder-platform/admin-app)
12
# support-admin-app
23
Support application
34

@@ -27,32 +28,36 @@ The following configuration parameters are available:
2728

2829
| Name | Description |
2930
|--------------------------|---------------------------------|
30-
| ES_PROJECT_API_URL | URL of the ES project API |
3131
| API_URL | URL of the topcoder API |
32-
| WORK_API_URL | URL of the topcoder work API |
3332
| ADMIN_TOOL_URL | URL of the admin tool API |
3433
| API_VERSION_PATH | Version of the API |
35-
| AUTH0_CLIENT_ID | Client ID for Auth0 |
36-
| AUTH0_DOMAIN | Domain for Auth0 authentication |
37-
| AUTH0_TOKEN_NAME | Auth0 token name |
38-
| AUTH0_REFRESH_TOKEN_NAME | Auth0 refresh token name |
34+
| COOKIES_SECURE | If true the cookies set by this App will only be transmitted over secure protocols like https. |
35+
| AUTH_URL | Url of Topcoder auth form |
36+
| ACCOUNTS_CONNECTOR_URL | Url to TC account connector |
37+
| JWT_V3_NAME | jwt V3 cookie name |
38+
| JWT_V2_NAME | jwt V2 cookie name |
3939

4040
## Start the Application
4141

42+
As application uses Topcoder authorization we have to run it on the one of allowed domains. For development purposes we can use `local.topcoder-dev.com:3000`. So before run we have to add into `hosts` file the line `127.0.0.1 local.topcoder-dev.com`. Be aware, that we also have to run on the port `3000` to be able to authorize when run locally.
43+
4244
Simply execute the following command to start the app in development mode (with browsersync)
4345
```
4446
npm install
45-
npm start
46-
```
47-
Application will be hosted and running at http://locahost:3000
48-
49-
To build the application to be hosted on a real webserver run:
50-
```
51-
npm run build
47+
gulp build
48+
gulp serve
5249
```
50+
Application will be hosted and running at http://local.topcoder-dev.com:3000.
5351

5452
## Execute E2E Tests
5553

54+
Before executing the end-to-end (e2e) protractor tests, these environment variables should be set:
55+
56+
| Name | Description | Default Value |
57+
| --- | --- | --- |
58+
| BUILD_ENV | Deployment configuration to be tested by e2e tests. | See [Configuration](#configuration) for possible values. Defaults to `dev`. |
59+
| TEST_PORT | Port from which to serve the app for e2e tests. | Defaults to `3000`. |
60+
5661
```npm test```
5762

5863
## Fallback instruction in case the npm scripts fail

bower.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
"angular-sanitize": "~1.4.4",
1010
"angular-resource": "~1.4.4",
1111
"angular-ui-router": "~0.2.13",
12-
"bootstrap": "~3.3.5",
13-
"angular-bootstrap": "0.12.x",
1412
"angular": "~1.4.4",
1513
"PACE": "https://github.com/HubSpot/pace.git#~1.0.2",
1614
"metisMenu": "~2.0.2",
@@ -23,17 +21,16 @@
2321
"a0-angular-storage": "~0.0.11",
2422
"angular-jwt": "~0.0.9",
2523
"angular-footable": "~1.0.3",
26-
"appirio-tech-ng-auth": "git://github.com/appirio-tech/ng-auth.git#3.2.10",
27-
"appirio-tech-ng-login-reg": "0.x.x",
28-
"appirio-tech-ng-api-services": "0.x.x",
2924
"angular-clipboard": "~1.2.1",
3025
"lodash": "~4.2.0",
3126
"angular-moment": "~1.0.0-beta.3",
3227
"moment": "~2.11.2",
3328
"moment-timezone": "~0.5.0",
3429
"ng-file-model": "https://github.com/mistralworks/ng-file-model.git#fd1889b28e279944012919574bbcaaf45c1540d6",
30+
"bootstrap": "~3.3.5",
3531
"angular-bootstrap-multiselect": "*",
36-
"bootstrap-ui-datetime-picker": "^2.4.0"
32+
"bootstrap-ui-datetime-picker": "^2.4.0",
33+
"angular-bootstrap": "^2.5.0"
3734
},
3835
"overrides": {
3936
"bootstrap": {

circle.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,38 @@
22
machine:
33
node:
44
version: 6.8.1
5-
5+
66
# Add some environment variables
77
environment:
8-
CIRCLE_ENV: dev
9-
8+
109
## Customize dependencies
1110
dependencies:
1211
pre:
1312
- curl -s https://raw.githubusercontent.com/chronogolf/circleci-google-chrome/master/use_chrome_stable_version.sh | bash
1413

1514
override:
15+
- rm -rf bower_components
1616
- npm install
1717

18+
post:
19+
- ./node_modules/gulp/bin/gulp.js clean
20+
- ./node_modules/gulp/bin/gulp.js build
21+
- ./node_modules/gulp/bin/gulp.js publish
22+
1823
compile:
1924
override:
20-
- npm run build
21-
25+
## - npm run build
26+
2227
test:
2328
override:
2429
- npm run test
30+
31+
deployment:
32+
prod:
33+
branch: master
34+
commands:
35+
- ./deploy.sh PROD admin.topcoder.com
36+
dev:
37+
branch: dev
38+
commands:
39+
- ./deploy.sh DEV admin.topcoder-dev.com

config.json

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
{
22
"local": {
3-
"ES_PROJECT_API_URL": "http://127.0.0.1:8553",
43
"API_URL" : "https://127.0.0.1:8443",
5-
"WORK_API_URL" : "https://127.0.0.1:8443",
64
"ADMIN_TOOL_URL" : "http://localhost:8080/api/v2",
75
"API_VERSION_PATH" : "v3",
8-
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
9-
"AUTH0_DOMAIN" : "127.0.0.1:8443",
10-
"AUTH0_TOKEN_NAME" : "userJWTToken",
11-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
6+
"COOKIES_SECURE": false,
7+
"AUTH_URL": "https://accounts.topcoder-dev.com/member",
8+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-dev.com/connector.html",
9+
"JWT_V3_NAME": "v3jwt",
10+
"JWT_V2_NAME": "tcjwt"
1211
},
1312
"dev": {
14-
"ES_PROJECT_API_URL": "https://internal-api.topcoder-dev.com",
1513
"API_URL" : "https://api.topcoder-dev.com",
16-
"WORK_API_URL" : "https://api-work.topcoder-dev.com",
1714
"ADMIN_TOOL_URL" : "https://api.topcoder-dev.com/v2",
1815
"API_VERSION_PATH" : "v3",
19-
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
20-
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
21-
"AUTH0_TOKEN_NAME" : "userJWTToken",
22-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
16+
"COOKIES_SECURE": false,
17+
"AUTH_URL": "https://accounts.topcoder-dev.com/member",
18+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-dev.com/connector.html",
19+
"JWT_V3_NAME": "v3jwt",
20+
"JWT_V2_NAME": "tcjwt"
2321
},
2422
"qa": {
25-
"ES_PROJECT_API_URL": "https://internal-api.topcoder-qa.com",
2623
"API_URL" : "https://api.topcoder-qa.com",
27-
"WORK_API_URL" : "https://api-work.topcoder-qa.com",
2824
"ADMIN_TOOL_URL" : "https://api.topcoder-qa.com/v2",
2925
"API_VERSION_PATH" : "v3",
30-
"AUTH0_CLIENT_ID" : "EVOgWZlCtIFlbehkq02treuRRoJk12UR",
31-
"AUTH0_DOMAIN" : "topcoder-qa.auth0.com",
32-
"AUTH0_TOKEN_NAME" : "userJWTToken",
33-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
26+
"COOKIES_SECURE": false,
27+
"AUTH_URL": "https://accounts.topcoder-qa.com/member",
28+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-qa.com/connector.html",
29+
"JWT_V3_NAME": "v3jwt",
30+
"JWT_V2_NAME": "tcjwt"
3431
},
3532
"prod": {
3633
"API_URL" : "https://api.topcoder.com",
37-
"WORK_API_URL" : "https://api-work.topcoder.com",
38-
"ES_PROJECT_API_URL": "https://internal-api.topcoder.com",
3934
"ADMIN_TOOL_URL" : "https://api.topcoder.com/v2",
4035
"API_VERSION_PATH" : "v3",
41-
"AUTH0_CLIENT_ID" : "6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P",
42-
"AUTH0_DOMAIN" : "topcoder.auth0.com",
43-
"AUTH0_TOKEN_NAME" : "userJWTToken",
44-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
36+
"COOKIES_SECURE": false,
37+
"AUTH_URL": "https://accounts.topcoder.com/member",
38+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder.com/connector.html",
39+
"JWT_V3_NAME": "v3jwt",
40+
"JWT_V2_NAME": "tcjwt"
4541
}
4642
}

deploy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
4+
echo "Deploying to S3"
5+
ENV=$1
6+
BUCKET_URL=$2
7+
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV}_AWS_ACCESS_KEY_ID")
8+
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV}_AWS_SECRET_ACCESS_KEY")
9+
10+
# aws s3 sync dist s3://${BUCKET_URL} --acl public-read --delete
11+
AWS_BUCKET=$BUCKET_URL AWS_KEY=$AWS_ACCESS_KEY_ID AWS_SECRET=$AWS_SECRET_ACCESS_KEY ./node_modules/.bin/gulp publish

e2e/dashboard.spec.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
'use strict';
22

33
describe('The dashboard view', function () {
4-
var page;
54
var mainPage;
5+
var testPort = process.env.TEST_PORT || 3000;
66

77
beforeEach(function () {
8-
browser.get('http://localhost:3000/');
9-
page = require('./login.po');
8+
browser.get('http://localhost:' + testPort + '/');
109
mainPage = require('./main.po');
11-
page.usernameInput.sendKeys('amy_admin');
12-
page.passwordInput.sendKeys('topcoder1');
13-
page.loginButton.click();
14-
});
15-
16-
it('should find members', function() {
17-
mainPage.searchHandleInput.sendKeys('sah2ed');
18-
mainPage.searchButton.click();
19-
expect(mainPage.users.count()).toBe(1);
20-
expect(mainPage.users.get(0).element(by.cssContainingText('td', 'sah2ed')).getText()).toBe('sah2ed');
2110
});
2211
});

e2e/login.po.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

e2e/login.spec.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

gulp/server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function browserSyncInit(baseDir, files, browser) {
2727
middleware: middleware,
2828
routes: routes
2929
},
30-
browser: browser
30+
browser: browser,
31+
host: 'local.topcoder-dev.com',
32+
open: 'external'
3133
});
3234
}
3335

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"gulp-useref": "~1.0.2",
3434
"http-proxy": "~1.7.0",
3535
"jasmine-core": "^2.5.2",
36-
"jshint":"~2.9.4",
36+
"jshint": "~2.9.4",
3737
"jshint-stylish": "~1.0.0",
3838
"main-bower-files": "~2.13.1",
3939
"protractor": "~5.1.1",
@@ -46,8 +46,9 @@
4646
},
4747
"scripts": {
4848
"postinstall": "bower install --config.interactive=false",
49+
"clean": "gulp clean",
4950
"build": "gulp build",
50-
"start": "gulp serve",
51+
"start": "gulp publish",
5152
"test": "gulp protractor"
5253
}
5354
}

0 commit comments

Comments
 (0)