From 001ed944fc6a2370d25533d97e66416b87c8db57 Mon Sep 17 00:00:00 2001 From: Dhruv Jain Date: Sun, 8 Nov 2020 19:53:39 +0530 Subject: [PATCH] ftr: Integrate web app generator with event dashboard - Earlier generate web app button was not working - Redirect to web app generator in a new tab and fill and submit form automatically by fetching details from the event dashboard - Create redirection web app generator url, pass it to views for button to work - Include the redirection host for development and production environment in environment config file - Update readme of local setup --- .env.example | 1 + app/components/events/view/overview/event-apps.js | 12 +++++++++++- .../components/events/view/overview/event-apps.hbs | 2 +- app/templates/events/view/index.hbs | 2 +- config/environment.js | 6 +++++- docs/installation/local.md | 2 ++ 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 593212e19da..bd7359214a5 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,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 diff --git a/app/components/events/view/overview/event-apps.js b/app/components/events/view/overview/event-apps.js index d2f219176ba..1b5ad6d8c55 100644 --- a/app/components/events/view/overview/event-apps.js +++ b/app/components/events/view/overview/event-apps.js @@ -1,7 +1,17 @@ import classic from 'ember-classic-decorator'; import { classNames } from '@ember-decorators/component'; import Component from '@ember/component'; +import { computed } from '@ember/object'; +import ENV from 'open-event-frontend/config/environment'; @classic @classNames('ui', 'fluid', 'card') -export default class EventApps extends Component {} +export default class EventApps extends Component { + @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 '#'; + } +} diff --git a/app/templates/components/events/view/overview/event-apps.hbs b/app/templates/components/events/view/overview/event-apps.hbs index 8304064fa12..b6d363b162e 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'}}
diff --git a/app/templates/events/view/index.hbs b/app/templates/events/view/index.hbs index 09627e023ff..4a8c89d4a33 100644 --- a/app/templates/events/view/index.hbs +++ b/app/templates/events/view/index.hbs @@ -11,7 +11,7 @@ @sort_by={{this.sort_by}} @sort_dir={{this.sort_dir}} @filterOptions={{this.filterOptions}} /> - +
diff --git a/config/environment.js b/config/environment.js index 727eb14625f..736127a36e2 100644 --- a/config/environment.js +++ b/config/environment.js @@ -64,7 +64,11 @@ module.exports = function(environment) { hostWhitelist: [/.+/] }, - torii: {} + torii: {}, + + appGenerator: { + webHost: 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 8ca02623a2f..a75ae455013 100644 --- a/docs/installation/local.md +++ b/docs/installation/local.md @@ -34,6 +34,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.** ## Running / Development * `yarn start`