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

Add url parameter which open a specific details tab right away #32152

Merged
merged 4 commits into from
Jul 31, 2018

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Jul 25, 2018

Description

This adds a url parameter to the files app which will open the details view and a specified tab for the given file in the scrollto parameter

Motivation and Context

We need to open the share tab via url directly. Needed by the office online integration

How Has This Been Tested?

Manually

Screenshots (if appropriate):

ezgif-3-aef97d1813

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

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

@DeepDiver1975 DeepDiver1975 added this to the development milestone Jul 25, 2018
@DeepDiver1975 DeepDiver1975 self-assigned this Jul 25, 2018
@DeepDiver1975 DeepDiver1975 requested a review from PVince81 July 25, 2018 09:44
@codecov
Copy link

codecov bot commented Jul 25, 2018

Codecov Report

Merging #32152 into master will decrease coverage by <.01%.
The diff coverage is 80%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #32152      +/-   ##
============================================
- Coverage      63.9%    63.9%   -0.01%     
- Complexity    18547    18548       +1     
============================================
  Files          1169     1169              
  Lines         69730    69732       +2     
  Branches       1267     1267              
============================================
+ Hits          44559    44560       +1     
- Misses        24802    24803       +1     
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.81% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.17% <80%> (-0.01%) 18548 <21> (+1)
Impacted Files Coverage Δ Complexity Δ
apps/files/lib/Controller/ViewController.php 90.47% <80%> (-0.56%) 26 <21> (+1)

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 d3ebca2...058eaa3. Read the comment docs.

@@ -87,6 +87,7 @@
fileActions: fileActions,
allowLegacyActions: true,
scrollTo: urlParams.scrollto,
details: urlParams.details,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest a more precise name for the option key like "detailTabId".
and the URL param could be "detail"

@@ -2519,10 +2518,14 @@
this.$el.find('.mask').remove();
this.$table.removeClass('hidden');
},
scrollTo:function(file) {
scrollTo:function(file, detailsTab) {
Copy link
Contributor

Choose a reason for hiding this comment

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

see, here you called it detailsTab... call it detailsTabId

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

Looks fine, as discussed.

After renaming the vars you can move on to unit tests. Good luck 😄

@DeepDiver1975 DeepDiver1975 force-pushed the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch from f1fab2a to e97c96a Compare July 26, 2018 10:10
@DeepDiver1975
Copy link
Member Author

After renaming the vars you can move on to unit tests. Good luck smile

Teach me, master

@PVince81
Copy link
Contributor

argh, seems we don't have tests for scrollto either.

one idea is to add a new group of tests (in describe() block) in apps/files/tests/js/fileListSpec.js.
then:

  1. instantiate a new FileList (example here https://github.com/owncloud/core/blob/master/apps/files/tests/js/filelistSpec.js#L2139) and pass both scrollto and the new param
  2. register a dummy tab with overridden id like here https://github.com/owncloud/core/blob/master/apps/files/tests/js/detailsviewSpec.js#L70
  3. simulate passing time for the scroll action to do its thing (example mock clock here https://github.com/owncloud/core/blob/master/apps/files/tests/js/filelistSpec.js#L2296)
  4. then use the DOM with fileList.$el.find() to find the tab in question and see if it has the CSS class of being active (you can find which it is with DOM inspector)

@phil-davis
Copy link
Contributor

It looks like it wants a webUI acceptance test.

@DeepDiver1975 DeepDiver1975 changed the title [master] Add url parameter which open a specific details tab right away Add url parameter which open a specific details tab right away Jul 26, 2018
@DeepDiver1975
Copy link
Member Author

@PVince81 @phil-davis I'm lost .... ;-)

@PVince81 js test or web acceptance test? I see more value in web acceptance tests for this.

@phil-davis
Copy link
Contributor

I can make a webUI acceptance test. I will look this evening. I am doing a presentation on BDD and automated testing at a Pokhara developers meetup on Saturday, so implementing this will be a good little example that I can use.

You guys decide on the query parameter naming first (=requirements)!

@PVince81
Copy link
Contributor

fine by me, let's do the web UI acceptance test then

@phil-davis phil-davis self-assigned this Jul 26, 2018
@phil-davis
Copy link
Contributor

Assigned self to add webUI automated test.

@phil-davis phil-davis force-pushed the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch from e97c96a to a5ed65a Compare July 27, 2018 11:08
@phil-davis
Copy link
Contributor

webUI tests have been added to test direct browsing to the comments, share and versions tabs of a file in the top-level directory, and in a sub-folder. They pass locally for me, hopefully CI likes them.

@individual-it please review.

$this->featureContext->getCurrentUser(), $this->getCurrentFolderFilePath()
);
$this->visitPath(
$this->featureContext->getBaseUrl() . '/index.php/apps/files/?dir=' . $folderName . '&fileid=' . $fileId . '&details=' . $tabName
Copy link
Member

@individual-it individual-it Jul 27, 2018

Choose a reason for hiding this comment

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

  • a pretty long line
  • this can be put in the pageObject /index.php/apps/files/ is already in there

@phil-davis
Copy link
Contributor

phil-davis commented Jul 27, 2018

What does not work is trying to browse directly to open the share or comments tab of a folder:

http://172.17.0.1:8080/index.php/apps/files/?dir=/&fileid=2147506251&details=shareTabView

where 2147506251 is the file id of a folder that is in the top / directory of the user.

The UI redirects to open the folder.

But manually in the UI I can click "..." "Details" or "Sharing" for a folder and share the folder or make comments about the folder.

What is the requirement?

*/
public function isDetailsPanelVisible($tabName) {
try {
$visible = $this->findById($tabName)->isVisible();
Copy link
Member

Choose a reason for hiding this comment

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

you have to check here if findById() returns null because that line might explode with calling isVisible() on null

@DeepDiver1975
Copy link
Member Author

where 2147506251 is the file id of a folder that is in the top / directory of the

I need to have a look at this ..... THX for testing!

@phil-davis
Copy link
Contributor

@DeepDiver1975 if browsing directly to a folder's sharing details tab is a requirement, then I can easily add test scenarios for that that fail - and you can make it pass!

@DeepDiver1975
Copy link
Member Author

@DeepDiver1975 if browsing directly to a folder's sharing details tab is a requirement, then I can easily add test scenarios for that that fail - and you can make it pass!

I don't need it for my initial requirement - I need this only to work on files.
But I agree that it would be great to have this for folders as well ....... but I have no idea how to implement this.

@DeepDiver1975
Copy link
Member Author

Well - if the file id of a folder is in the url the folder itself is opened - opening any tab does not really work with this respect.

Notjhing to do from my pov

@phil-davis
Copy link
Contributor

As long as it is not a requirement, then no problem that you can't open the sharing details of a folder directly by URL.

I have some timing issue in the tests - mostly they fail on drone, probably because it does not wait long enough for the preview to get rendered in the details pane. And one of the checks in the test scenarios is that the preview is there. I will look at that...

@phil-davis phil-davis force-pushed the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch 2 times, most recently from e75a467 to a941a44 Compare July 30, 2018 09:58
@phil-davis
Copy link
Contributor

@individual-it please review webUI acceptance tests again.

@phil-davis phil-davis force-pushed the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch 2 times, most recently from 182127e to 5b9c682 Compare July 31, 2018 06:46
@phil-davis phil-davis force-pushed the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch from 5b9c682 to 058eaa3 Compare July 31, 2018 06:49
@individual-it
Copy link
Member

acceptance tests look fine 👍

@phil-davis
Copy link
Contributor

@PVince81 ready for your review again...

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@DeepDiver1975
Copy link
Member Author

THX @phil-davis @individual-it

@DeepDiver1975 DeepDiver1975 merged commit 8a811f5 into master Jul 31, 2018
@DeepDiver1975 DeepDiver1975 deleted the master-d1f28e5880af3e456b43e8e9dbc3fd6eff455ddd branch July 31, 2018 08:19
@DeepDiver1975
Copy link
Member Author

objections in backporting? Once we make wopi work with oc10 we will need this ...

@PVince81
Copy link
Contributor

raised documentation ticket: https://github.com/owncloud/documentation/issues/4331

@PVince81
Copy link
Contributor

@DeepDiver1975 please backport, it's a nice addition

@phil-davis
Copy link
Contributor

Backport stable10 #32202

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants