Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Integrate web app generator with event dashboard #5529

Merged
merged 4 commits into from
Nov 10, 2020

Conversation

dhruvjain99
Copy link
Contributor

@dhruvjain99 dhruvjain99 commented Nov 8, 2020

Fixes #5476

Short description of what this resolves:

  • Earlier generate web app button was not working
  • Redirect to web app generator in a new tab and fill and submit the form automatically by fetching details from the event dashboard

Changes proposed in this pull request:

  • Create redirection web app generator URL, pass it to views for the button to work
  • Include the redirection host for development and production environment in the environment config file
  • Update readme of local setup

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Nov 8, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/8mdkb0648
✅ Preview: https://open-event-frontend-git-ftr-intgerate-wsgen.eventyay.vercel.app

@codecov
Copy link

codecov bot commented Nov 8, 2020

Codecov Report

Merging #5529 (17ae6d1) into development (84027ee) will increase coverage by 0.63%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5529      +/-   ##
===============================================
+ Coverage        23.07%   23.71%   +0.63%     
===============================================
  Files              494      498       +4     
  Lines             5210     5255      +45     
  Branches            38       44       +6     
===============================================
+ Hits              1202     1246      +44     
  Misses            4003     4003              
- Partials             5        6       +1     
Impacted Files Coverage Δ
app/components/events/view/overview/event-apps.js 100.00% <100.00%> (ø)
app/utils/computed-helpers.js 19.56% <0.00%> (-1.72%) ⬇️
app/models/social-link.js 0.00% <0.00%> (ø)
app/components/forms/wizard/other-details-step.js 0.00% <0.00%> (ø)
app/components/public/sponsor-list.js
app/utils/dictionary/social-media.ts 100.00% <0.00%> (ø)
app/components/public/sponsor-list.ts 89.47% <0.00%> (ø)
app/components/widgets/forms/social-link-field.ts 75.00% <0.00%> (ø)
app/components/widgets/forms/link-field.ts 75.00% <0.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84027ee...17ae6d1. Read the comment docs.

- 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
@dhruvjain99
Copy link
Contributor Author

@iamareebjamal can you please review this PR?

@iamareebjamal iamareebjamal changed the title ftr: Integrate web app generator with event dashboard feat: Integrate web app generator with event dashboard Nov 8, 2020
@auto-label auto-label bot added the feature label Nov 8, 2020
export default class EventApps extends Component {
@computed('eventId')
get webAppGeneratorUrl() {
if (this.authManager.currentUser) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal, otherwise one test will fail in travis ci as it doesn't sign in to test this feature. I included this only after I found that failing case.
image
Travis CI build - https://travis-ci.com/github/fossasia/open-event-frontend/builds/199132180

Copy link
Member

@iamareebjamal iamareebjamal Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to set the email of the user in the test. Not checking the case is even worse. It may pass the test and break in production

if (this.authManager.currentUser) {
return `${ENV.appGenerator.webHost}/?email=${this.authManager.currentUser.email}&apiendpoint=${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/${this.eventId}`;
}
return '#';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you return a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we return ${ENV.appGenerator.webHost}/?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the check is removed, it won't be needed

export default class EventApps extends Component {}
export default class EventApps extends Component {
@computed('eventId')
get webAppGeneratorUrl() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indention error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal I think it is fine because it got automatically indented like this when I did git commit. Let me know how many spaces need to be included.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

@@ -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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noopener">{{t 'Generate Web App'}}</a>
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noopener noreferrer">{{t 'Generate Web App'}}</a>

torii: {}
torii: {},

appGenerator: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not appGenerator, it's webAppGenerator

torii: {},

appGenerator: {
webHost: process.env.WEB_APP_GENERATOR_HOST || (environment === 'production' ? 'https://open-event-wsgen.herokuapp.com' : 'https://open-event-wsgen-dev.herokuapp.com')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a nested field, just write it as webAppGeneratorUrl

Copy link
Contributor Author

@dhruvjain99 dhruvjain99 Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it nested because we have another button for the android app generator as well. Let me know if I need to make it flat. @iamareebjamal

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be another field

@@ -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.**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localhost:5000 is server URL, it'll conflict

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to change the port for wsgen? Shall I change to 3000? Let me know I'll include in the current PR for this feature in the wsgen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

.env.example Outdated
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default one is already specified in env and this is not a major component, please remove it from here

.env.example Outdated
FASTBOOT_DISABLED=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FASTBOOT_DISABLED=true
FASTBOOT_DISABLED=true

@@ -7,7 +7,7 @@
<button class="ui button">{{t 'Generate Android App'}}</button>
</div>
<div class="column eight wide center aligned">
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noopener">{{t 'Generate Web App'}}</a>
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noreferrer">{{t 'Generate Web App'}}</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noreferrer">{{t 'Generate Web App'}}</a>
<a href="{{this.webAppGeneratorUrl}}" target="_blank" class="ui button" rel="noopener noreferrer">{{t 'Generate Web App'}}</a>

…nerator 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
iamareebjamal
iamareebjamal previously approved these changes Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event Dashboard: Provide feature to directly generate web app from dashboard through an API
2 participants