-
Notifications
You must be signed in to change notification settings - Fork 14
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
Preliminary frontend work #13
Conversation
87a4cad
to
2046e8c
Compare
|
|
Rebased. Will require adjustments to be able to work with the updated endpoint structure. |
This "uri" approach is a nightmare. Backbone (and potentially other frameworks) assume that if the id is known, then the object already exists. I have used the "uri" as id so it always uses the "update" internal method instead of "create" and tries to PROPPATCH instead of MKCOL. I think we'll still need to use the actual internal id field as the backbone id, and the uri is only used for the path. I'll try that approach then. |
|
|
f12b48d
to
61b0149
Compare
So I finally have a solution, but it required me to write custom model and collections specifically for Webdav. This would make it reusable in the future. See owncloud/core#27119. The frontend now works, you can now:
|
9899c96
to
059007d
Compare
This is now ready for review. Note that this core PR is still required to test this: owncloud/core#27119 (make sure to run Everything is squashed into two commits: Please review @felixheidecke @jvillafanez @DeepDiver1975 @VicDeo @IljaN |
... and if you're wondering why I used At least we could say this is a POC that could be used for demoing the functionality. |
ah of course, unit tests cannot pass until owncloud/core#27119 from core is merged |
css/app.css
Outdated
/* FIXME: integrate with core styles */ | ||
#customgroups .sidebar .close { | ||
position: absolute; | ||
top: 0; |
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.
indentation
customGroupsTitle: t('customgroups', 'Custom Groups') | ||
})); | ||
|
||
this.$groupsContainer = this.$('.groups-container').removeClass('icon-loading'); |
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.
I'm not sure if this.$('.groups-container')
is a good idea. This is confusing for me.
If it's for marking the variable as a jquery object, I'd rather use a name to reflect that, for example "this.jqueryGroupsContainer"
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.
this.$('.groups-container')
is a Backbone View shortcut for this.$el.find('.groups-container')
As for this.$groupsContainer
the $
sign is a convention that already tells that this attribute is a jQuery object, just like this.$el
.
Hope that makes sense.
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.
👍
js/App.js
Outdated
|
||
_onSelectGroup: function(group) { | ||
this.$membersContainer.empty(); | ||
var state = { |
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.
Is this variable used? The scope should be limited to this function and it isn't used here.
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.
forgot to kill it...
js/GroupsView.js
Outdated
this, | ||
'_onSubmitCreationForm', | ||
'_onRenameGroup', | ||
'_onDeleteGroup' |
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.
include the _onSelect
function?
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.
actually I'll remove them all because backbone auto-binds when specified in the "events" block
// TODO: lock row during save | ||
model.save({ | ||
displayName: newName | ||
}); |
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.
I guess the function should return true if it's renamed properly
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.
no, this is a jquery event handler and the return value indicates whether bubbling is needed (or something like this).
Actually we don't need to return because we already call ev.preventDefault();
at the top.
I'll still add add return false;
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.
👍
js/templates/list.handlebars
Outdated
@@ -0,0 +1,27 @@ | |||
<form name="customGroupsCreationForm"> | |||
<div> | |||
<input |
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.
I'd rather "oneline" this if it fits. There is only one variable attribute.
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.
ok. now it has 134 columns 😉
</div> | ||
<table class="grid"> | ||
<thead> | ||
<th></th> |
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.
What is the purpose of these empty headers?
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.
This header is for the avatar column
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.
maybe an HTML comment here to make sure these header are in use? Just looking exclusively at the file it seems they can be deleted.
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.
nah... will only do if I need to retouch this PR or next time I come around this place
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.
an experienced HTML dev would know that one does not simply remove an empty "th" or "td" because that would mess up the layout 😉
*/ | ||
public function index() { | ||
// TODO: cache or add to info.xml ? | ||
$modules = json_decode(file_get_contents(__DIR__ . '/../../js/modules.json')); |
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.
I guess this "modules.json" file is used in more places, otherwise it would be better to hardcode the modules here.
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.
The second usage is in the unit tests, that's why I wanted a separate file... I'm still longing for a proper portable way to load JS files for OC apps.
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.
let's discuss in #34
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.
👍
@@ -91,7 +91,8 @@ public function initialize(\Sabre\DAV\Server $server) { | |||
$this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; | |||
$ns = '{' . self::NS_OWNCLOUD . '}'; | |||
$this->server->resourceTypeMapping[MembershipNode::class] = $ns . 'customgroups-membership'; | |||
$this->server->resourceTypeMapping[GroupsCollection::class] = $ns . 'customgroups-group'; | |||
$this->server->resourceTypeMapping[GroupsCollection::class] = $ns . 'customgroups-groups'; |
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.
"customgroups-groups" or "customgroups-group"? Is this intended?
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.
This is intended, but not specifically for the frontend work... just a "pass-by" fix.
"customgroups-groups" plural is for GroupsCollection as the collection is a list of groups, so "groups".
The next item GroupMemberShipCollection is actually a single group, so it has the type "customgroups-group" singular.
Still, thanks for spotting
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.
👍
@@ -36,7 +36,6 @@ class MembershipNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { | |||
|
|||
const PROPERTY_ROLE = '{http://owncloud.org/ns}role'; | |||
const PROPERTY_USER_ID = '{http://owncloud.org/ns}user-id'; | |||
const PROPERTY_GROUP_URI = '{http://owncloud.org/ns}group-uri'; |
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.
Any reason to remove this? Mainly to confirm this isn't accidental
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.
The property isn't used at all in this node.
It was a copy-paste from another node I believe so I removed it.
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.
👍
I've also seen that the windows prompts aren't translatable... I think that we should make them translatable in order to merge this, so we can change that part at any time. Otherwise we might need to rush to change the implementation if this is merged. |
I haven't reviewed the tests yet.... 😓 |
When adding new users to custom group there is no autocomplete in the textfield. This will come after this PR or it is a bug here? |
When editing a member role, just a click on the pencil change member's role. Feels a bit unexpected, I think it should be a dropdown with the options admin or member. |
You mean the native window.prompt ? We need to replace these anyway... I put these here to save some dev time. They definitely need a better replacement. (separately) |
@SergioBertolinSG I've raised them separately:
|
Addressed all review comments and squashed the fixes into the last commit. Note that I also renamed the unit tests from CustomGroupsCollection to GroupsCollection now. @jvillafanez another check ? |
Yes. My point is that I don't know how much time we have to change them. If we make their text translatable, we could release the app. It's ugly, nobody likes it, but it's usable. We can improve the app later. (I'm refering to the windows prompts, not the app itself 😄 ) |
We definitely shouldn't release the final app with the ugly window prompts. |
Preliminary work for the frontend.
This extends the Makefile significantly and adds the following: