diff --git a/README.md b/README.md index 7ea7cbeb..2fca0aba 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,15 @@ Learn more about [cloud.gov](https://cloud.gov). ### Backend Server -- `Go` (version 1.9) +* `Go` (version 1.9) ### Front end application -- `Node` (version 6.x.x) -- `React` (version ^15.0.0) -- `Babel` (version ^6.x.x) -- `Karma` (version ^1.4.x) -- `Webpack` (version ^1.x.x) +* `Node` (version 6.x.x) +* `React` (version ^15.0.0) +* `Babel` (version ^6.x.x) +* `Karma` (version ^1.4.x) +* `Webpack` (version ^1.x.x) ## Setup Local Environment @@ -65,10 +65,10 @@ EOF ### Create a Client with UAAC -- Make sure [UAAC](https://github.com/cloudfoundry/cf-uaac) is installed. -- Target your UAA server. `uaac target ` -- Login with your current UAA account. `uaac token client get -s ` -- Create client account: +* Make sure [UAAC](https://github.com/cloudfoundry/cf-uaac) is installed. +* Target your UAA server. `uaac target ` +* Login with your current UAA account. `uaac token client get -s ` +* Create client account: ```bash uaac client add \ @@ -79,21 +79,21 @@ uaac client add \ -s ``` -- Unable to create an account still? Troubleshoot [here](https://docs.cloudfoundry.org/adminguide/uaa-user-management.html#creating-admin-users) +* Unable to create an account still? Troubleshoot [here](https://docs.cloudfoundry.org/adminguide/uaa-user-management.html#creating-admin-users) ### CI This project uses CircleCI. -- You will need to set up the credentials to deploy to the `dashboard-prod` and `dashboard-stage` spaces. - - In both spaces run: `cf create-service cloud-gov-service-account space-deployer dashboard-deployer`. - - You will get the link for that space's credentials by running `cf service dashboard-deployer`. - - You will need to set these [**secret**](https://circleci.com/docs/1.0/environment-variables/#setting-environment-variables-for-all-commands-without-adding-them-to-git) variables in the [CircleCI UI](https://circleci.com/gh/18F/cg-dashboard/edit#env-vars). - - `CF_USERNAME_PROD_SPACE` - The username for the `dashboard-prod` deployer - - `CF_PASSWORD_PROD_SPACE` - The password for the `dashboard-prod` deployer - - `CF_USERNAME_STAGE_SPACE` - The username for the `dashboard-stage` deployer - - `CF_PASSWORD_STAGE_SPACE` - The password for the `dashboard-stage` deployer -- If you fork this project for your own use, you will need to use the CircleCI CLI UI to set the variables. (If you're forking just to make a pull request, there's no need to do this.) +* You will need to set up the credentials to deploy to the `dashboard-prod` and `dashboard-stage` spaces. + * In both spaces run: `cf create-service cloud-gov-service-account space-deployer dashboard-deployer`. + * You will get the link for that space's credentials by running `cf service dashboard-deployer`. + * You will need to set these [**secret**](https://circleci.com/docs/1.0/environment-variables/#setting-environment-variables-for-all-commands-without-adding-them-to-git) variables in the [CircleCI UI](https://circleci.com/gh/18F/cg-dashboard/edit#env-vars). + * `CF_USERNAME_PROD_SPACE` - The username for the `dashboard-prod` deployer + * `CF_PASSWORD_PROD_SPACE` - The password for the `dashboard-prod` deployer + * `CF_USERNAME_STAGE_SPACE` - The username for the `dashboard-stage` deployer + * `CF_PASSWORD_STAGE_SPACE` - The password for the `dashboard-stage` deployer +* If you fork this project for your own use, you will need to use the CircleCI CLI UI to set the variables. (If you're forking just to make a pull request, there's no need to do this.) ### Optional features diff --git a/devtools/docker-setup.md b/devtools/docker-setup.md index 877d0447..96ee597c 100644 --- a/devtools/docker-setup.md +++ b/devtools/docker-setup.md @@ -173,17 +173,14 @@ Examples * Add dependency: `docker-compose run --rm frontend npm install --save` * Frontend unit tests: `docker-compose run --rm frontend npm run test-unit` -* Watch frontend unit tests: `docker-compose run --rm frontend npm run - watch-test-unit` -* Frontend functional tests (w/o visual debugging): `docker-compose run --rm - frontend npm run test-functional` +* Watch frontend unit tests: `docker-compose run --rm frontend npm run watch-test-unit` +* Frontend functional tests (w/o visual debugging): `docker-compose run --rm frontend npm run test-functional` For more possible commands, refer to the package.json. ##### Visual Debugging -Once the `frontend` service is up and running (via `docker-compose up -d -frontend`), you can use the docker-compose `exec` command to attach to the +Once the `frontend` service is up and running (via `docker-compose up -d frontend`), you can use the docker-compose `exec` command to attach to the existing container. While viewing the container via the HTML VNC Viewer (refer to the table above), you will see the container's Chrome browser open and execute the commands. @@ -192,8 +189,7 @@ Format: `docker-compose exec frontend bash -c ""` Examples: -* Frontend functional tests: `docker-compose exec frontend bash -c "npm run - test-functional"` +* Frontend functional tests: `docker-compose exec frontend bash -c "npm run test-functional"` ##### Updating the node version. @@ -208,8 +204,7 @@ Format: `docker-compose run --rm backend ` Examples: -* Add dependency: `docker-compose run --rm backend dep ensure -add - github.com/some/repo` +* Add dependency: `docker-compose run --rm backend dep ensure -add github.com/some/repo` * Run `./codecheck.sh`: `docker-compose run --rm backend ./codecheck.sh` #### UAA One-Offs diff --git a/devtools/manual-setup.md b/devtools/manual-setup.md index c2a33825..4e6ccf81 100644 --- a/devtools/manual-setup.md +++ b/devtools/manual-setup.md @@ -26,8 +26,7 @@ proper data. If you've never used environment variables before, you can run the following: `mkdir ~/.env && cp ./env.sample ~/.env/cg-dashboard` Then edit the file `~/.env/cg-dashboard` and provide the proper values. When you -want to set all the environment variables, just run `source -~/.env/cg-dashboard`. You'll have to do this every time you open a new shell. If +want to set all the environment variables, just run `source ~/.env/cg-dashboard`. You'll have to do this every time you open a new shell. If you work at 18F, ask a team member to send you the secret credentials. * `GOPATH`: The absolute path to your code directory, one level up from the root diff --git a/static_src/actions/user_actions.js b/static_src/actions/user_actions.js index edf6c7f5..72a1d022 100644 --- a/static_src/actions/user_actions.js +++ b/static_src/actions/user_actions.js @@ -291,9 +291,7 @@ const userActions = { } else { description = `An email invite was sent to ${email}. Their account ` + - `has been associated to this ${entity}, and their ${ - entity - } roles can ` + + `has been associated to this ${entity}, and their ${entity} roles can ` + "be controlled below."; } @@ -372,9 +370,7 @@ const userActions = { if (!user) { const err = new Error("User was not associated"); - const message = `The user ${userGuid} was not associated in ${ - entityGuid - }.`; + const message = `The user ${userGuid} was not associated in ${entityGuid}.`; return Promise.resolve(userActions.userInviteCreateError(err, message)); } diff --git a/static_src/stores/service_instance_store.js b/static_src/stores/service_instance_store.js index 11201118..151b58fb 100644 --- a/static_src/stores/service_instance_store.js +++ b/static_src/stores/service_instance_store.js @@ -57,9 +57,7 @@ const getFriendlyError = (error, errorMap) => { return errorMap[errorCode]; } - return `Error #${ - code - }. Please contact cloud.gov support for help troubleshooting this issue.`; + return `Error #${code}. Please contact cloud.gov support for help troubleshooting this issue.`; }; export class ServiceInstanceStore extends BaseStore { diff --git a/static_src/test/unit/actions/app_actions.spec.js b/static_src/test/unit/actions/app_actions.spec.js index 902229f9..2e1a4a19 100644 --- a/static_src/test/unit/actions/app_actions.spec.js +++ b/static_src/test/unit/actions/app_actions.spec.js @@ -109,9 +109,7 @@ describe("appActions", function() { }); describe("changeCurrentApp()", function() { - it("should dispatch a ui event of type app changed with guid", function( - done - ) { + it("should dispatch a ui event of type app changed with guid", function(done) { const appGuid = "testingAppGuid"; const expectedParams = { appGuid @@ -185,9 +183,7 @@ describe("appActions", function() { assertAction(spy, appActionTypes.APP_START, expectedParams); }); - it("should call cf api put app with state started to restart the app", function( - done - ) { + it("should call cf api put app with state started to restart the app", function(done) { const spy = sandbox.stub(cfApi, "putApp").returns(Promise.resolve()); sandbox.stub(appActions, "restarted").returns(Promise.resolve()); const expectedGuid = "asdfasd2vdamcdksa"; diff --git a/static_src/test/unit/actions/user_actions.spec.js b/static_src/test/unit/actions/user_actions.spec.js index 48a25cd7..274b4fe3 100644 --- a/static_src/test/unit/actions/user_actions.spec.js +++ b/static_src/test/unit/actions/user_actions.spec.js @@ -178,9 +178,7 @@ describe("userActions", function() { .returns(Promise.resolve({ guid: "" })); }); - it("calls receivedOrgSpacesToExtractSpaceUsers once when org has one space", function( - done - ) { + it("calls receivedOrgSpacesToExtractSpaceUsers once when org has one space", function(done) { orgSpaces = [orgSpace]; userActions .receivedOrgSpacesToExtractSpaceUsers(orgSpaces) @@ -188,9 +186,7 @@ describe("userActions", function() { expect(cfApi.fetchSpaceUserRoles).toHaveBeenCalledOnce(); }); - it("calls receivedOrgSpacesToExtractSpaceUsers three times when org has three spaces", function( - done - ) { + it("calls receivedOrgSpacesToExtractSpaceUsers three times when org has three spaces", function(done) { orgSpaces = [orgSpace, orgSpace, orgSpace]; userActions .receivedOrgSpacesToExtractSpaceUsers(orgSpaces) @@ -469,9 +465,7 @@ describe("userActions", function() { sandbox.stub(UserStore, "get").returns("org_user"); }); - it("should dispatch a view event of type create invite notification with false", function( - done - ) { + it("should dispatch a view event of type create invite notification with false", function(done) { description = "An email invite was sent to this@that.com. Their account has been associated to this space, and their space roles can be controlled below."; var expected = { @@ -485,9 +479,7 @@ describe("userActions", function() { done(); }); - it("should dispatch a view event of type create invite notification with true", function( - done - ) { + it("should dispatch a view event of type create invite notification with true", function(done) { description = "The cloud.gov account for this@that.com is now associated to this space. Control their space roles below."; var expected = { diff --git a/static_src/test/unit/stores/base_store.spec.js b/static_src/test/unit/stores/base_store.spec.js index 1936bc91..0c9682f4 100644 --- a/static_src/test/unit/stores/base_store.spec.js +++ b/static_src/test/unit/stores/base_store.spec.js @@ -306,9 +306,7 @@ describe("BaseStore", () => { }); }); - it("should update a single existing entity with the same guid ", function( - done - ) { + it("should update a single existing entity with the same guid ", function(done) { var updateA = { guid: existingEntityA.guid, name: "zzz", diff --git a/static_src/test/unit/util/cf_api.spec.js b/static_src/test/unit/util/cf_api.spec.js index 9240396e..24212851 100644 --- a/static_src/test/unit/util/cf_api.spec.js +++ b/static_src/test/unit/util/cf_api.spec.js @@ -86,9 +86,7 @@ describe("cfApi", function() { }); describe("postCreateNewUserWithGuid()", function() { - it("create a new user through a post request to cloud foundry", function( - done - ) { + it("create a new user through a post request to cloud foundry", function(done) { const userGuid = "fake-user-guid"; const expectedPayload = { guid: userGuid @@ -204,9 +202,7 @@ describe("cfApi", function() { }); describe("createRoute()", function() { - it("should POST to the versioned /routes endpoint with data", function( - done - ) { + it("should POST to the versioned /routes endpoint with data", function(done) { const domainGuid = "fake-domain-guid"; const spaceGuid = "fake-space-guid"; const host = "fake-host"; @@ -233,9 +229,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call routeActions.createdRoute with response data", function( - done - ) { + it("should call routeActions.createdRoute with response data", function(done) { const domainGuid = "fake-domain-guid"; const spaceGuid = "fake-space-guid"; const host = "fake-host"; @@ -262,9 +256,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call route actions create error on request failure", function( - done - ) { + it("should call route actions create error on request failure", function(done) { const spy = sandbox.stub(routeActions, "errorCreateRoute"); const stub = sandbox.stub(http, "post"); stub.returns(createPromise(true, fakeCFErrorRes)); @@ -277,9 +269,7 @@ describe("cfApi", function() { }); describe("deleteRoute()", function() { - it("should DELETE to the versioned /routes/:routeGuid endpoint with data", function( - done - ) { + it("should DELETE to the versioned /routes/:routeGuid endpoint with data", function(done) { const routeGuid = "fake-route-guid"; const spy = sandbox.stub(http, "delete"); spy.returns(Promise.resolve()); @@ -295,9 +285,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call routeActions.deletedRoute with response data", function( - done - ) { + it("should call routeActions.deletedRoute with response data", function(done) { const routeGuid = "fake-route-guid"; const stub = sandbox.stub(http, "delete"); const spy = sandbox.spy(routeActions, "deletedRoute"); @@ -314,9 +302,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call route actions error with guid on request failure", function( - done - ) { + it("should call route actions error with guid on request failure", function(done) { const spy = sandbox.stub(routeActions, "error"); const stub = sandbox.stub(http, "delete"); stub.returns(createPromise(true, fakeCFErrorRes)); @@ -337,9 +323,7 @@ describe("cfApi", function() { }); describe("fetchOne()", function() { - it("should call an http get request with the versioned url", function( - done - ) { + it("should call an http get request with the versioned url", function(done) { const stub = sandbox.stub(http, "get"); const expectedUrl = "/org/asldfkj"; @@ -354,9 +338,7 @@ describe("cfApi", function() { }); }); - it("should call the action with the response data on success", function( - done - ) { + it("should call the action with the response data on success", function(done) { const expected = { data: { metadata: { guid: "q39g08hgdih" } } }; const stub = sandbox.stub(http, "get"); const spy = sandbox.spy(); @@ -854,9 +836,7 @@ describe("cfApi", function() { }); describe("deleteUnboundServiceInstance()", function() { - it("should call http delete request on service route with service guid", function( - done - ) { + it("should call http delete request on service route with service guid", function(done) { var spy = sandbox.stub(http, "delete").returns(Promise.resolve()), expectedGuid = "yyasdflkjayybbaal1", expected = { guid: expectedGuid, url: "/" + expectedGuid }; @@ -1042,9 +1022,7 @@ describe("cfApi", function() { }); describe("deleteOrgUserCategory()", function() { - it("should call a http delete request on the org user with category ", function( - done - ) { + it("should call a http delete request on the org user with category ", function(done) { var spy = sandbox.stub(http, "delete").returns(Promise.resolve({})), expectedUserGuid = "zvmxncznv-9u8qwphu", expectedOrgGuid = "0291kdvakjbdfvhp", @@ -1069,9 +1047,7 @@ describe("cfApi", function() { }); describe("deleteOrgUserPermissions()", function() { - it("should call an http delete request on org user with permissions", function( - done - ) { + it("should call an http delete request on org user with permissions", function(done) { var spy = sandbox.stub(http, "delete").returns(Promise.resolve({})), expectedUserGuid = "zvmxncznv-9u8qwphu", expectedOrgGuid = "0291kdvakjbdfvhp", @@ -1107,9 +1083,7 @@ describe("cfApi", function() { }; moxios.stubOnce( "DELETE", - `/v2/organizations/${expectedOrgGuid}/${expectedApiKey}/${ - expectedUserGuid - }`, + `/v2/organizations/${expectedOrgGuid}/${expectedApiKey}/${expectedUserGuid}`, { status: 400, response: expectedResponse @@ -1313,9 +1287,7 @@ describe("cfApi", function() { }); describe("putAppRouteAssociation()", function() { - it("should PUT to the versioned /routes/:routeGuid/apps/:appGuid", function( - done - ) { + it("should PUT to the versioned /routes/:routeGuid/apps/:appGuid", function(done) { const appGuid = "fake-app-guid"; const routeGuid = "fake-route-guid"; @@ -1334,9 +1306,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call routeActions.associatedApp() with the routeGuid and appGuid", function( - done - ) { + it("should call routeActions.associatedApp() with the routeGuid and appGuid", function(done) { const appGuid = "fake-app-guid"; const routeGuid = "fake-route-guid"; @@ -1357,9 +1327,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call route actions error with guid on request failure", function( - done - ) { + it("should call route actions error with guid on request failure", function(done) { const spy = sandbox.stub(routeActions, "error"); const stub = sandbox.stub(http, "put"); stub.returns(createPromise(true, fakeCFErrorRes)); @@ -1396,9 +1364,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call routeActions.unassociatedApp() with the routeGuid and appGuid", function( - done - ) { + it("should call routeActions.unassociatedApp() with the routeGuid and appGuid", function(done) { const appGuid = "fake-app-guid"; const routeGuid = "fake-route-guid"; @@ -1419,9 +1385,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call route actions error with guid on request failure", function( - done - ) { + it("should call route actions error with guid on request failure", function(done) { const spy = sandbox.stub(routeActions, "error"); const stub = sandbox.stub(http, "delete"); stub.returns(createPromise(true, fakeCFErrorRes)); @@ -1442,9 +1406,7 @@ describe("cfApi", function() { }); describe("putRouteUpdate()", function() { - it("should call routeActions.updatedRoute() with the routeGuid and route", function( - done - ) { + it("should call routeActions.updatedRoute() with the routeGuid and route", function(done) { const routeGuid = "fake-route-guid"; const domainGuid = "fake-dommain-guid"; const spaceGuid = "fake-space-guid"; @@ -1477,9 +1439,7 @@ describe("cfApi", function() { .catch(done.fail); }); - it("should call route actions error with guid on request failure", function( - done - ) { + it("should call route actions error with guid on request failure", function(done) { const spy = sandbox.stub(routeActions, "error"); const stub = sandbox.stub(http, "put"); stub.returns(createPromise(true, fakeCFErrorRes)); diff --git a/static_src/test/unit/util/format_date.spec.js b/static_src/test/unit/util/format_date.spec.js index 5306faaf..9a7995ce 100644 --- a/static_src/test/unit/util/format_date.spec.js +++ b/static_src/test/unit/util/format_date.spec.js @@ -24,9 +24,7 @@ describe("formatDateTime", () => { output: "Jul 13 2015 09:02pm PDT" } ]) { - it(`should return a formatted datetime when given a valid value › ${ - val - }`, () => { + it(`should return a formatted datetime when given a valid value › ${val}`, () => { expect(formatDateTime(val, tz)).toEqual(output); }); } diff --git a/static_src/test/unit/util/uaa_api.spec.js b/static_src/test/unit/util/uaa_api.spec.js index 2fd2dd00..21dc5e19 100644 --- a/static_src/test/unit/util/uaa_api.spec.js +++ b/static_src/test/unit/util/uaa_api.spec.js @@ -59,9 +59,7 @@ describe("uaaApi", function() { }); describe("inviteUaaUser()", function() { - it("should make invite uaa request and receive proper payload", function( - done - ) { + it("should make invite uaa request and receive proper payload", function(done) { const email = "email@domain.com"; const expectedPayload = { email: "email@domain.com" }; const spy = sandbox.stub(http, "post");