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

Support for files_external customjs from apps #27683

Merged
merged 1 commit into from
May 10, 2017

Conversation

PVince81
Copy link
Contributor

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

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
Copy link
Contributor

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

PVince81 commented May 4, 2017

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

@davicente
Copy link
Contributor

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

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
Copy link
Contributor

Then it works

@PVince81 PVince81 force-pushed the external-customjs-appname branch from 3ee16af to 3947df7 Compare May 5, 2017 07:58
@PVince81
Copy link
Contributor Author

PVince81 commented May 5, 2017

Thanks for the feedback.

Rebased for CI

@PVince81 PVince81 merged commit 63cbca9 into master May 10, 2017
@PVince81 PVince81 deleted the external-customjs-appname branch May 10, 2017 14:49
@lock
Copy link

lock bot commented Aug 3, 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 Aug 3, 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.

Storage backend getCustomJS must support specifying app name
2 participants