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

Remove jQuery #497

Merged
merged 17 commits into from
Jan 15, 2021
Merged

Conversation

seyfeb
Copy link
Collaborator

@seyfeb seyfeb commented Jan 11, 2021

As NC is dropping the support for the global jQuery and including the library within our app seems to be a bit of an overkill, I replaced the jQuery ajax calls by @nextcloud/axios and switched to plain JS in some places.

Closes #475

@seyfeb seyfeb force-pushed the maintenance/removeJQuery branch from a4ddaa0 to 7d6ec6c Compare January 11, 2021 14:26
@christianlupus christianlupus marked this pull request as draft January 11, 2021 16:20
@seyfeb seyfeb force-pushed the maintenance/removeJQuery branch from fa28721 to ccd0695 Compare January 11, 2021 22:50
@christianlupus
Copy link
Collaborator

As far as I see the tests are running well on your fork. If this is true, you might well mark this PR as ready for review (hopefully triggering the tasts here as well).

@seyfeb seyfeb force-pushed the maintenance/removeJQuery branch from 0c1be68 to 1476b9a Compare January 14, 2021 13:23
@codecov
Copy link

codecov bot commented Jan 14, 2021

Codecov Report

Merging #497 (5639257) into master (9de5f9c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #497   +/-   ##
========================================
  Coverage      0.87%   0.87%           
  Complexity      436     436           
========================================
  Files            14      14           
  Lines          1375    1375           
========================================
  Hits             12      12           
  Misses         1363    1363           
Flag Coverage Δ Complexity Δ
integration 0.00% <ø> (ø) 0.00 <ø> (ø)
unittests 0.87% <ø> (ø) 0.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@seyfeb seyfeb marked this pull request as ready for review January 14, 2021 13:32
Copy link
Collaborator

@christianlupus christianlupus left a comment

Choose a reason for hiding this comment

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

I did not test all cases (especially not all failure cases) as it is quite cumbersome to do so. Looks good in general, a few changes I marked (some are only comments of course).

src/components/AppNavi.vue Show resolved Hide resolved
src/components/AppNavi.vue Show resolved Hide resolved
src/components/AppNavi.vue Outdated Show resolved Hide resolved
src/components/AppNavi.vue Show resolved Hide resolved
src/components/AppNavi.vue Show resolved Hide resolved
src/components/AppControls.vue Show resolved Hide resolved
src/components/EditInputGroup.vue Outdated Show resolved Hide resolved
Comment on lines 199 to 250
if ($this.$store.state.recipe.recipeInstructions) {
$this.instructions = Object.values($this.$store.state.recipe.recipeInstructions)
}

if ($this.$store.state.recipe.keywords) {
$this.keywords = String($this.$store.state.recipe.keywords).split(',')
}

if ($this.$store.state.recipe.cookTime) {
let cookT = $this.$store.state.recipe.cookTime.match(/PT(\d+?)H(\d+?)M/)
$this.timerCook = { hours: parseInt(cookT[1]), minutes: parseInt(cookT[2]) }
}

if ($this.$store.state.recipe.prepTime) {
let prepT = $this.$store.state.recipe.prepTime.match(/PT(\d+?)H(\d+?)M/)
$this.timerPrep = { hours: parseInt(prepT[1]), minutes: parseInt(prepT[2]) }
}

if ($this.$store.state.recipe.totalTime) {
let totalT = $this.$store.state.recipe.totalTime.match(/PT(\d+?)H(\d+?)M/)
$this.timerTotal = { hours: parseInt(totalT[1]), minutes: parseInt(totalT[2]) }
}

if ($this.$store.state.recipe.tool) {
$this.tools = $this.$store.state.recipe.tool
}

if ($this.$store.state.recipe.dateCreated) {
let date = $this.parseDateTime($this.$store.state.recipe.dateCreated)
$this.dateCreated = (date != null ? date.format('L, LT').toString() : null)
}

if ($this.$store.state.recipe.dateModified) {
let date = $this.parseDateTime($this.$store.state.recipe.dateModified)
$this.dateModified = (date != null ? date.format('L, LT').toString() : null)
}
if ($this.$store.state.recipe.nutrition) {
if ( $this.$store.state.recipe.nutrition instanceof Array) {
$this.$store.state.recipe.nutrition = {}
}
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be well suited for a computed property from the recipe data itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes. what do you think is better: a recipe object as a computed property or a computed property for each recipe part (ingredients, dateModified, etc.)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume both are similarly useful. Personally, I assume a single property with an object might be simpler to use if we think what might (or might not) be able to extend/abstract the component.

@@ -175,11 +174,11 @@ import AppMain from './components/AppMain'
Vue.prototype.t = window.t

// Start the app once document is done loading
$(document).ready(function () {
document.addEventListener("DOMContentLoaded", function(event) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am unsure if this really needed. It will most probably not cause issues but I found nowhere the requirement documented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Me neither. We could remove this and try if it still works

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's see what comes out from my question. I fear it will be more of unstable behavior and less of no function at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That’s what I would expect, too. Good idea to ask in the vue forum!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I already asked in the Discourse app but there was only an uncertain statement given.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

funny how nobody seems to know

seyfeb added 17 commits January 15, 2021 19:55
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
…n in app controls

Signed-off-by: Sebastian Fey <info@sebastianfey.de>
…n in app index and app navi

Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
…dit input group. Fixed pasting content without newline in input group

Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Added @nextcloud/auth

Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
@christianlupus christianlupus force-pushed the maintenance/removeJQuery branch from 0cfb693 to 57045ea Compare January 15, 2021 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single pasted tool/instruction/ingredient is not saved
2 participants