Skip to content

Commit

Permalink
ftr: Integrate web app generator with event dashboard
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dhruvjain99 committed Nov 8, 2020
1 parent 84027ee commit 001ed94
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion app/components/events/view/overview/event-apps.js
Original file line number Diff line number Diff line change
@@ -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 '#';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<button class="ui button">{{t 'Generate Android App'}}</button>
</div>
<div class="column eight wide center aligned">
<button class="ui button">{{t 'Generate Web App'}}</button>
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noopener">{{t 'Generate Web App'}}</a>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/templates/events/view/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@sort_by={{this.sort_by}}
@sort_dir={{this.sort_dir}}
@filterOptions={{this.filterOptions}} />
<Events::View::Overview::EventApps />
<Events::View::Overview::EventApps @eventId={{this.model.event.id}} />
</div>
<div class="eight wide column">
<Events::View::Overview::GeneralInfo @data={{this.model}} />
Expand Down
6 changes: 5 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 2 additions & 0 deletions docs/installation/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 001ed94

Please sign in to comment.