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

Support for files_external customjs from apps #27683

Merged
merged 1 commit into from May 10, 2017

Conversation

Projects
None yet
2 participants
@PVince81
Member

PVince81 commented Apr 19, 2017

Description

Related Issue

Fixes #27682

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

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)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@davicente please test

@PVince81 PVince81 added this to the 10.0.1 milestone Apr 19, 2017

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 May 4, 2017

Member

Tested as follows:

  1. Check out the files_external_ftp app
  2. Patch it:
diff --git a/js/test.js b/js/test.js
new file mode 100644
index 0000000..3c1510b
--- /dev/null
+++ b/js/test.js
@@ -0,0 +1 @@
+console.log('loaded!');
diff --git a/lib/Backend/FTP.php b/lib/Backend/FTP.php
index 2b5b112..ffa7835 100644
--- a/lib/Backend/FTP.php
+++ b/lib/Backend/FTP.php
@@ -34,6 +34,7 @@ class FTP extends Backend {
                        ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
                        ->setStorageClass('\OCA\Files_external_ftp\Storage\FTP')
                        ->setText($l->t('FTP (Fly)'))
+                       ->setCustomJS(['files_external_ftp', 'test'])
                        ->addParameters([
                                (new DefinitionParameter('username', $l->t('Username'))),
                                (new DefinitionParameter('password', $l->t('Password')))
  1. Enable the app
  2. Go to storages panel and check browser console

With this PR the console shows "loaded!"

@davicente not sure why it didn't work in your case.

@jvillafanez @DeepDiver1975 review ?

Member

PVince81 commented May 4, 2017

Tested as follows:

  1. Check out the files_external_ftp app
  2. Patch it:
diff --git a/js/test.js b/js/test.js
new file mode 100644
index 0000000..3c1510b
--- /dev/null
+++ b/js/test.js
@@ -0,0 +1 @@
+console.log('loaded!');
diff --git a/lib/Backend/FTP.php b/lib/Backend/FTP.php
index 2b5b112..ffa7835 100644
--- a/lib/Backend/FTP.php
+++ b/lib/Backend/FTP.php
@@ -34,6 +34,7 @@ class FTP extends Backend {
                        ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
                        ->setStorageClass('\OCA\Files_external_ftp\Storage\FTP')
                        ->setText($l->t('FTP (Fly)'))
+                       ->setCustomJS(['files_external_ftp', 'test'])
                        ->addParameters([
                                (new DefinitionParameter('username', $l->t('Username'))),
                                (new DefinitionParameter('password', $l->t('Password')))
  1. Enable the app
  2. Go to storages panel and check browser console

With this PR the console shows "loaded!"

@davicente not sure why it didn't work in your case.

@jvillafanez @DeepDiver1975 review ?

@davicente

This comment has been minimized.

Show comment
Hide comment
@davicente

davicente May 4, 2017

Member

@PVince81 if I remember well, it was because I didn't use the exact name "files_onedrive" for the app. Then it worked fine

Member

davicente commented May 4, 2017

@PVince81 if I remember well, it was because I didn't use the exact name "files_onedrive" for the app. Then it worked fine

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 May 4, 2017

Member

Can you retest with this PR ? Then we can merge it.

Member

PVince81 commented May 4, 2017

Can you retest with this PR ? Then we can merge it.

@davicente

This comment has been minimized.

Show comment
Hide comment
@davicente

davicente May 4, 2017

Member

I have tested with js/onedrive.js and js/test.js

Working: With js/onedrive.js and ->setCustomJS(['files_onedrive', 'onedrive']); in the backend

Not working: With js/test.js and ->setCustomJS(['files_onedrive', 'test']); in the backend
The file is loaded, but failes because it doesn't get the value of this variable:
var clientId = $tr.find('.configuration [data-parameter="client_id"]').val();
I don't know if it helps you or if it's my problem

Member

davicente commented May 4, 2017

I have tested with js/onedrive.js and js/test.js

Working: With js/onedrive.js and ->setCustomJS(['files_onedrive', 'onedrive']); in the backend

Not working: With js/test.js and ->setCustomJS(['files_onedrive', 'test']); in the backend
The file is loaded, but failes because it doesn't get the value of this variable:
var clientId = $tr.find('.configuration [data-parameter="client_id"]').val();
I don't know if it helps you or if it's my problem

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 May 4, 2017

Member

This PR is only about actually loading the JS file. If it's loaded then it fits its purpose.

If the JS file code itself has problems for whatever reason, it is not related to this PR which only opens the door.

Member

PVince81 commented May 4, 2017

This PR is only about actually loading the JS file. If it's loaded then it fits its purpose.

If the JS file code itself has problems for whatever reason, it is not related to this PR which only opens the door.

@davicente

This comment has been minimized.

Show comment
Hide comment
@davicente

davicente May 4, 2017

Member

Then it works

Member

davicente commented May 4, 2017

Then it works

@PVince81

This comment has been minimized.

Show comment
Hide comment
@PVince81

PVince81 May 5, 2017

Member

Thanks for the feedback.

Rebased for CI

Member

PVince81 commented May 5, 2017

Thanks for the feedback.

Rebased for CI

@PVince81 PVince81 merged commit 63cbca9 into master May 10, 2017

3 of 4 checks passed

continuous-integration/jenkins/pr-head This commit cannot be built
Details
Scrutinizer No new issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@PVince81 PVince81 deleted the external-customjs-appname branch May 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment