-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[NEW] WebDAV Integration (User file provider) #11679
Merged
sampaiodiego
merged 17 commits into
RocketChat:develop
from
karakayasemi:integrate-webdav
Sep 27, 2018
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5f1d9d6
create rocketchat webdav package for webdav integration
karakayasemi 01e8be1
add auth mechanism for webdav integration
karakayasemi 9d1f433
add foldar and go back icon for webdav file picker template
karakayasemi 5193315
add some love to webdav-integration templates
karakayasemi f6a6832
add integrations section to account ui, implement remove webdav account
karakayasemi fd517d1
fix typos, obey the coding standards
karakayasemi 7f41ee8
add save to webdav account feature
karakayasemi 2e21d58
Merge branch 'develop' into integrate-webdav
ggazzo e8cc066
some code style fixes
ggazzo 17f0707
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into pr/1…
ggazzo 452cf68
ui improvements
ggazzo 8704199
fix
ggazzo dd52ab1
fix review
ggazzo 8910dfa
Merge branch 'develop' into integrate-webdav
sampaiodiego c7eb0b8
Merge branch 'integrate-webdav' of github.com:karakayasemi/Rocket.Cha…
ggazzo e406332
Minimal code changes
sampaiodiego ad7b58f
Merge branch 'develop' into integrate-webdav
sampaiodiego File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,7 @@ rocketchat:[email protected] | |
rocketchat:[email protected] | ||
rocketchat:[email protected] | ||
rocketchat:[email protected] | ||
rocketchat:[email protected] | ||
rocketchat:[email protected] | ||
rocketchat:[email protected] | ||
[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/rocketchat-ui-account/client/accountIntegrations.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template name="accountIntegrations"> | ||
<section class="page-container page-home page-static"> | ||
{{> header sectionName="Integrations"}} | ||
|
||
<div class="content"> | ||
<form id="integrations" autocomplete="off"> | ||
<fieldset class="rc-form-legend"> | ||
<div class="section"> | ||
<h1>{{_ "WebDAV"}}</h1> | ||
<div class="section-content border-component-color"> | ||
<div class="input-line double-col"> | ||
<label for="webdav-accounts">{{_ "WebDAV_Accounts"}}</label> | ||
<div class="rc-select"> | ||
<select id="webdav-accounts" class="rc-select__element" style="text-transform: none" multiple> | ||
{{#each webdavAccounts}} | ||
<option value="{{this._id}}">{{getOptionValue this}}</option> | ||
{{/each}} | ||
</select> | ||
</div> | ||
<button class="rc-button rc-button--cancel webdav-account-remove"><span>{{_ "Remove"}}</span></button> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</section> | ||
</template> |
37 changes: 37 additions & 0 deletions
37
packages/rocketchat-ui-account/client/accountIntegrations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* global */ | ||
|
||
import toastr from 'toastr'; | ||
|
||
Template.accountIntegrations.onCreated(function() { | ||
this.subscribe('webdavAccounts'); | ||
}); | ||
|
||
Template.accountIntegrations.helpers({ | ||
webdavAccounts() { | ||
return RocketChat.models.WebdavAccounts.find().fetch(); | ||
}, | ||
getOptionValue(account) { | ||
return account.name || `${ account.username }@${ account.server_url.replace(/^https?\:\/\//i, '') }`; | ||
}, | ||
}); | ||
|
||
Template.accountIntegrations.events({ | ||
'click .webdav-account-remove'(e) { | ||
e.preventDefault(); | ||
const selectEl = document.getElementById('webdav-accounts'); | ||
const { options } = selectEl; | ||
const selectedOption = selectEl.value; | ||
const optionIndex = Array.from(options).findIndex((option) => option.value === selectedOption); | ||
|
||
Meteor.call('removeWebdavAccount', selectedOption, function(error) { | ||
if (error) { | ||
return toastr.error(t(error.error)); | ||
} | ||
|
||
toastr.success(t('webdav-account-removed')); | ||
modal.close(); | ||
}); | ||
|
||
selectEl.remove(optionIndex); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -653,6 +653,7 @@ Template.messageBox.onCreated(function() { | |
this.dataReply = new ReactiveVar(''); // if user is replying to a mssg, this will contain data of the mssg being replied to | ||
this.isMessageFieldEmpty = new ReactiveVar(true); | ||
this.sendIcon = new ReactiveVar(false); | ||
RocketChat.messageBox.emit('created', this); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we keep this? It is not being used anywhere but still there is some value. |
||
}); | ||
|
||
Meteor.startup(function() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# RocketChat WebDAV | ||
|
||
Package for RocketChat users to interact with WebDAV servers (Tested with ownCloud and Nextcloud). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* globals modal, RocketChat*/ | ||
|
||
Meteor.startup(function() { | ||
|
||
RocketChat.MessageAction.addButton({ | ||
id: 'webdav-upload', | ||
icon: 'upload', | ||
label: t('Save_To_Webdav'), | ||
condition: (message) => { | ||
if (RocketChat.models.Subscriptions.findOne({ rid: message.rid }) == null) { | ||
return false; | ||
} | ||
if (RocketChat.models.WebdavAccounts.findOne() == null) { | ||
return false; | ||
} | ||
if (!message.file) { | ||
return false; | ||
} | ||
|
||
return RocketChat.settings.get('Webdav_Integration_Enabled'); | ||
}, | ||
action() { | ||
const [, message] = this._arguments; | ||
const [attachment] = message.attachments; | ||
const { file } = message; | ||
const url = Meteor.absoluteUrl().concat(attachment.title_link.substring(1)); | ||
modal.open({ | ||
data: { | ||
message, | ||
attachment, | ||
file, | ||
url, | ||
}, | ||
title: t('Save_To_Webdav'), | ||
content: 'selectWebdavAccount', | ||
showCancelButton: true, | ||
showConfirmButton: false, | ||
closeOnCancel: true, | ||
html: true, | ||
}); | ||
}, | ||
order: 100, | ||
group: 'menu', | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template name="addWebdavAccount"> | ||
<form id="add-webdav" class="content-background-color color-primary-font-color"> | ||
<div class="fields"> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="serverURL"> | ||
<div class="rc-input__wrapper"> | ||
<input name="name" id="serverName" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Name_optional' }}" | ||
autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="serverURL"> | ||
<div class="rc-input__wrapper"> | ||
<input name="serverURL" id="serverURL" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Webdav_Server_URL' }}" | ||
autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="username"> | ||
<div class="rc-input__wrapper"> | ||
<input name="username" id="username" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Username' }}" autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="pass"> | ||
<div class="rc-input__wrapper"> | ||
<input name="pass" id="pass" type="password" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Password' }}" autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
</div> | ||
<div class="submit"> | ||
<button class="rc-button rc-button--primary"><span>{{btnAddNewServer}}</span></button> | ||
</div> | ||
</form> | ||
</template> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the other subscribe will always happen, there is no need to subscribe here.