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

Load and display quick actions #3573

Merged
merged 1 commit into from
Jun 9, 2020
Merged

Load and display quick actions #3573

merged 1 commit into from
Jun 9, 2020

Conversation

LukasHirt
Copy link
Contributor

@LukasHirt LukasHirt commented Jun 4, 2020

Description

Adding an extension point into files apps for quick actions.
By creating and exporting object called quickActions, developers can define an action which will be then displayed in the files list.

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Open tasks:

  • Add acceptance tests

@LukasHirt LukasHirt added the Category:Enhancement Add new functionality label Jun 4, 2020
@LukasHirt LukasHirt self-assigned this Jun 4, 2020
@LukasHirt LukasHirt marked this pull request as ready for review June 4, 2020 11:55
@LukasHirt LukasHirt added this to To review in oCIS Sprint 20-11 Jun 4, 2020
@PVince81 PVince81 added this to In progress in oCIS Sprint 20-12 via automation Jun 8, 2020
@kulmann kulmann moved this from In progress to To review in oCIS Sprint 20-12 Jun 9, 2020
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Looks good! Just some small things.

@@ -25,6 +25,7 @@
"@babel/preset-env": "^7.6.0",
"@babel/register": "^7.6.0",
"babel-loader": "^8.0.6",
"copy-to-clipboard": "^3.3.1",
Copy link
Member

Choose a reason for hiding this comment

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

We already have vue-clipboard2 in core. The lib you chose looks like it's adopted by a broader community, but on first glance I couldn't decide for one. However, we should only use one library, otherwise we increase the bundle size without a good reason. Probably best to leave this as is (or use the one we already have in core) and write a technical debt ticket for quick research on which clipboard lib we want to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that vue-clipboard2 cannot be used here when "just" importing the bundle. It needs to be initialised in the Vue instance. This would mean that we'd need to pass it as part of the context to the handler function and since this is not a feature which would be used that often probably, it felt wrong to have it in there.

But you're absolutely right, having two bundles for one feature is ugly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, it would make sense IMO to use the new bundle instead of vue-clipboard2. The advantage of the latter is the ready-to-use Vue directive. With the new bundle, we'd need to either use methods then or create our own directive. If you'd be fine with this change I would go ahead and replace it. I'd do this in separate PR though not to mix different parts of the app in one PR.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, fully agree. And having it in a separate PR makes more sense. 👍

icon: 'link',
handler: ctx => {
// FIXME: Translate name
const params = { name: 'Quick action link' }
Copy link
Member

Choose a reason for hiding this comment

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

Does const params = { name: $gettext('Quick action link') } not work here for translation? Or just forgotten / overlooked?

Copy link
Contributor Author

@LukasHirt LukasHirt Jun 9, 2020

Choose a reason for hiding this comment

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

Unfortunately no. $gettext function implemented in this file is only a dummy function which ensures that strings will be exported by the easygettext but not translated. That is done via the vue-gettext which is initialised in the Vue instance.

I thought we had a ticket about this but cannot find it now (only this similar one about translations in themes #1942 ). I'll try to look a bit more and if I won't find it, I'll open a new one.

Copy link
Member

Choose a reason for hiding this comment

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

👍

changelog/unreleased/load-and-display-quick-actions Outdated Show resolved Hide resolved
apps/files/src/components/FileList.vue Show resolved Hide resolved
@LukasHirt
Copy link
Contributor Author

LukasHirt commented Jun 9, 2020

@kulmann I tried to address your comments and pushed a new commit with few changes - added the missing "an" in changelog, moved quick actions to own file to make the default.js file a bit cleaner and passed store into context to give more flexibility to devs and to clean a bit up the quick actions component. Pls re-review.

@LukasHirt LukasHirt requested a review from kulmann June 9, 2020 10:35
@LukasHirt LukasHirt mentioned this pull request Jun 9, 2020
7 tasks
To provide a quick way of executing certain actions, we have implemented quick actions.
Every extension can define own quick action by creating an object called quickActions and exporting it.
Quick actions are then displayed in the actions column inside of the files list.
@LukasHirt LukasHirt merged commit 089184d into master Jun 9, 2020
oCIS Sprint 20-12 automation moved this from To review to Done Jun 9, 2020
@LukasHirt LukasHirt deleted the feature/quick-actions branch June 9, 2020 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Enhancement Add new functionality
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants