From 4d6886b7ec81f3e746feb0ea57f7b3af6d9951e1 Mon Sep 17 00:00:00 2001 From: Dhruv Jain Date: Tue, 10 Nov 2020 12:28:12 +0530 Subject: [PATCH] ref: Indentation, pass authManager and eventId in test, make webAppGenerator env variable flat instead of nested, replace noopener with noreferrer in rel, update local docs for changes in env variables, remove webAppGenerator from env.example as it is not a major integration --- .env.example | 3 +-- app/components/events/view/overview/event-apps.js | 7 ++----- .../components/events/view/overview/event-apps.hbs | 2 +- config/environment.js | 4 +--- docs/installation/local.md | 3 ++- .../components/events/view/overview/event-apps-test.js | 7 ++++++- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index bd7359214a5..755e63ac807 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,4 @@ GOOGLE_API_KEY="Sample Key" API_HOST=https://open-event-api-dev.herokuapp.com MAP_DISPLAY=embed -FASTBOOT_DISABLED=true -WEB_APP_GENERATOR_HOST=https://open-event-wsgen-dev.herokuapp.com \ No newline at end of file +FASTBOOT_DISABLED=true \ No newline at end of file diff --git a/app/components/events/view/overview/event-apps.js b/app/components/events/view/overview/event-apps.js index 1b5ad6d8c55..428fc2d1197 100644 --- a/app/components/events/view/overview/event-apps.js +++ b/app/components/events/view/overview/event-apps.js @@ -7,11 +7,8 @@ import ENV from 'open-event-frontend/config/environment'; @classic @classNames('ui', 'fluid', 'card') export default class EventApps extends Component { - @computed('eventId') + @computed('eventId') get webAppGeneratorUrl() { - if (this.authManager.currentUser) { - return `${ENV.appGenerator.webHost}/?email=${this.authManager.currentUser.email}&apiendpoint=${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/${this.eventId}`; - } - return '#'; + return `${ENV.webAppGenerator}/?email=${this.authManager.currentUser.email}&apiendpoint=${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/${this.eventId}`; } } diff --git a/app/templates/components/events/view/overview/event-apps.hbs b/app/templates/components/events/view/overview/event-apps.hbs index b6d363b162e..405bfcb6c34 100644 --- a/app/templates/components/events/view/overview/event-apps.hbs +++ b/app/templates/components/events/view/overview/event-apps.hbs @@ -7,7 +7,7 @@
- {{t 'Generate Web App'}} + {{t 'Generate Web App'}}
diff --git a/config/environment.js b/config/environment.js index 736127a36e2..155ba89da63 100644 --- a/config/environment.js +++ b/config/environment.js @@ -66,9 +66,7 @@ module.exports = function(environment) { torii: {}, - appGenerator: { - webHost: process.env.WEB_APP_GENERATOR_HOST || (environment === 'production' ? 'https://open-event-wsgen.herokuapp.com' : 'https://open-event-wsgen-dev.herokuapp.com') - } + webAppGenerator: process.env.WEB_APP_GENERATOR_HOST || (environment === 'production' ? 'https://open-event-wsgen.herokuapp.com' : 'https://open-event-wsgen-dev.herokuapp.com') }; if (environment === 'production') { diff --git a/docs/installation/local.md b/docs/installation/local.md index a75ae455013..2ec297dc45b 100644 --- a/docs/installation/local.md +++ b/docs/installation/local.md @@ -35,7 +35,8 @@ brew link --force gettext - By default, the `.env.example` file specifies the `API_HOST` as `https://open-event-api-dev.herokuapp.com` which is a test deployment of the open-event-server. If you intend to work on just the frontend, this is sufficient. **If however, you intend to work on issues which involve both the frontend and the backend, you must have the [open-event-server](https://github.com/fossasia/open-event-server) already up and running. Please install and set it up first before changing the URL for `API_HOST` to `http://localhost:5000` and proceeding to run the frontend.** -- By default, the `.env.example` file specifies the `WEB_APP_GENERATOR_HOST` as `https://open-event-wsgen-dev.herokuapp.com` which is a test deployment of the open-event-wsgen. If you intend to work on just the frontend, this is sufficient. **If however, you intend to work on issues which involve both the frontend and the website generator, you must have the [open-event-wsgen](https://github.com/fossasia/open-event-wsgen) already up and running. Please install and set it up first before changing the URL for `WEB_APP_GENERATOR_HOST` to `http://localhost:5000` and proceeding to run the frontend.** +- By default, the `environment.js` file specifies the `webAppGenerator` as `https://open-event-wsgen-dev.herokuapp.com` which is a test deployment of the open-event-wsgen. If you intend to work on just the frontend, this is sufficient. **If however, you intend to work on issues which involve both the frontend and the website generator, you must have the [open-event-wsgen](https://github.com/fossasia/open-event-wsgen) already up and running. Please install and set it up first before creating a constant URL for `WEB_APP_GENERATOR_HOST` to `http://localhost:5000` in .env and proceeding to run the frontend.** + ## Running / Development * `yarn start` diff --git a/tests/integration/components/events/view/overview/event-apps-test.js b/tests/integration/components/events/view/overview/event-apps-test.js index b942b155f35..fd98473a7c8 100644 --- a/tests/integration/components/events/view/overview/event-apps-test.js +++ b/tests/integration/components/events/view/overview/event-apps-test.js @@ -2,12 +2,17 @@ import { hbs } from 'ember-cli-htmlbars'; import { module, test } from 'qunit'; import { setupIntegrationTest } from 'open-event-frontend/tests/helpers/setup-integration-test'; import { render } from '@ember/test-helpers'; +import EmberObject from '@ember/object'; module('Integration | Component | events/view/overview/event apps', function(hooks) { setupIntegrationTest(hooks); + const currentUser = EmberObject.create({ email: 'test1@gmail.com' }); + const authManager = EmberObject.create({ currentUser }); test('it renders', async function(assert) { - await render(hbs`{{events/view/overview/event-apps}}`); + this.set('authManager', authManager); + this.set('eventId', 'e123'); + await render(hbs`{{events/view/overview/event-apps authManager=authManager eventId=eventId}}`); assert.ok(this.element.innerHTML.trim().includes('Apps')); }); });