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

Admin page split #796

Merged
merged 46 commits into from
Aug 16, 2016
Merged

Admin page split #796

merged 46 commits into from
Aug 16, 2016

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Aug 9, 2016

To solve #712

This is not complete, yet, but in a working state with build-in settings and the LDAP one as a 3rd party app using this.

Right now it still does full-page loads, at least there's a route registered to fetch a desired section, needs to be implemented.

Screenshots:

spectacle bw8923

spectacle vr8923

Tasks left:

  • Catch legacy app that don't register admin settings in info.xml aka make "Additional Settings" work
  • Transform shipped apps
  • uh, tests 🔨
  • don't load app forms if they are disabled aka remove outdated registered settings
  • highlight current section in the sidebar
  • don't do a full page reload when switching sections (Admin page split #796 (comment))
  • reconsider DB indexes once every query is in place
  • cream on top (and too much for this PR, yet 10): search for settings (postponed)

Input already welcome @schiessle @jancborchardt and from others of course, too.

* interfaces for the Admin settings (IAdmin) and section (ISection)
* SettingsManager service
* example setup with LDAP app
@blizzz blizzz added the 2. developing Work in progress label Aug 9, 2016
@blizzz blizzz added this to the Nextcloud 11.0 milestone Aug 9, 2016
@mention-bot
Copy link

@blizzz, thanks for your PR! By analyzing the annotation information on this pull request, we identified @nickvergessen, @DeepDiver1975 and @LukasReschke to be potential reviewers

@schiessle
Copy link
Member

schiessle commented Aug 9, 2016

Just had a quick look, looks good from a technical point of view. Finally we can get rid of the settings-*.php files and work with proper classes which can also be tested. 🎉

I will try to transfer the monitoring app to a admin settings page tomorrow, that's the best way to test a new API 😃

@schiessle
Copy link
Member

Catch legacy app that don't register admin settings in info.xml aka make "Additional Settings" work

Is there a fall back for apps we can't adjust in time. We don't have to much time left and we also need to keep 3rdparty apps from the app store in mind.

@blizzz
Copy link
Member Author

blizzz commented Aug 9, 2016

Catch legacy app that don't register admin settings in info.xml aka make "Additional Settings" work

Is there a fall back for apps we can't adjust in time. We don't have to much time left and we also need to keep 3rdparty apps from the app store in mind.

The plan is to keep this old-style of collecting the forms supported by stashing them into "Additional Settings".

</field>

<index>
<name>admin_sections_id_index</name>
Copy link
Member

Choose a reason for hiding this comment

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

💣 💣 💣 💣 💣 💣 💣 💣 - already used in https://github.com/nextcloud/server/pull/796/files#diff-1d1f96f9afa7544b553d6441f7a3c167R2010, this will fail on many databases.

Copy link
Member

Choose a reason for hiding this comment

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

I guess this should be admin_settings_id_index?

Copy link
Member Author

Choose a reason for hiding this comment

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

@LukasReschke this should be admin_settings_id_index. Important catch! 🏆

@@ -0,0 +1,5 @@
<?php
Copy link
Member

Choose a reason for hiding this comment

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

What's this?

Copy link
Member Author

Choose a reason for hiding this comment

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

This file should not be there, commited by mistake

@@ -64,6 +64,8 @@
['name' => 'Certificate#removePersonalRootCertificate', 'url' => '/settings/personal/certificate/{certificateIdentifier}', 'verb' => 'DELETE'],
['name' => 'Certificate#addSystemRootCertificate', 'url' => '/settings/admin/certificate', 'verb' => 'POST'],
['name' => 'Certificate#removeSystemRootCertificate', 'url' => '/settings/admin/certificate/{certificateIdentifier}', 'verb' => 'DELETE'],
['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server']],
['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET'],
Copy link
Member

Choose a reason for hiding this comment

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

Used at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet

@LukasReschke
Copy link
Member

Went over the code quickly already, not a final review since WIP. But looks already pretty awesome 🚀

@blizzz
Copy link
Member Author

blizzz commented Aug 9, 2016

cc @BernhardPosselt you've shown interest on IRC recently

@LukasReschke
Copy link
Member

I'll test this by porting the SAML app. PR incoming as well.

*
* E.g.: 70
*/
public function getPriority();
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need getPriority() min ISection and in IAdmin?

Copy link
Member Author

Choose a reason for hiding this comment

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

One is to sort the Sections in the sidebar, the other to sort the settings forms within the selected section.

Copy link
Member

Choose a reason for hiding this comment

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

good point, forget that we can also group multiple settings from different apps in one section.

Probably just a typo, but we should unify it. Here it says "value between 0 and 100" and for the ISection it says "value between 0 and 99"

@schiessle
Copy link
Member

I run into a table not found exception when I just switched to this branch. Forget to increase version to trigger db update?

@schiessle
Copy link
Member

if I go to the sharing settings I get this error in the nextcloud.log:

{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowLinks at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#41","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowLinks at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#45","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowPublicUpload at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#47","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: enforceLinkPassword at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#51","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowPublicMailNotification at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#59","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowLinks at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#63","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowResharing at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#74","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowGroupSharing at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#79","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: onlyShareWithGroupMembers at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#84","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowMailNotification at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#89","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: allowShareDialogUserEnumeration at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#104","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}
{"reqId":"Ho2YP2oh2bf1gBTiY1Cx","remoteAddr":"::1","app":"PHP","message":"Undefined index: fileSharingSettings at \/home\/schiesbn\/repos\/nextcloud\/server\/master\/settings\/templates\/admin\/sharing.php#108","level":3,"time":"2016-08-10T11:37:29+00:00","method":"GET","url":"\/master\/index.php\/settings\/admin\/sharing","user":"admin"}

@schiessle
Copy link
Member

If I start with a complete fresh installation my app (ServerInfo) doesn't get added to the admin page. I first have to increase the version in the info.xml to run the update for the app at least once. New apps should be added directly.

@schiessle
Copy link
Member

If I change the priority, both in the IAdmin and the ISettings implementation and increase the version number in the info.xml the update will add the same app a second time to oc_admin_settings with the new priority. I would expect that it gets replaced.

In oc_admin_section nothing change, I still have only one entry with the previous priority. But maybe this is not needed anyway, see my question here #796 (comment)

@schiessle
Copy link
Member

Sorry for the many comments. But this was just the stuff I discovered while creating the admin page for the ServerInfo app. Beside that it was super easy and the API feels really good!

@blizzz
Copy link
Member Author

blizzz commented Aug 10, 2016

Currently working on switching from OCP\Template to TemplateResponse as return value form IAdmin, because it's nicer and already present in several apps. Changed user_ldap locally successful, now trying to adjust updatenotifications, where i somewhat struggle with autoloading yet.

UPDATE: done

* bump version to ensure tables are created
* make updatenotification app use settings api
* change IAdmin::render() to getForm() and change return type from Template to TemplateResponse
* adjust User_LDAP accordingly, as well as built-in forms
* add IDateTimeFormatter to AppFramework/DependencyInjection/DIContainer.php. This is important so that \OC::$server->query() is able to resolve the
constructor parameters. We should ensure that all OCP/* stuff that is available from \OC::$server is available here. Kudos to @LukasReschke
* make sure apps that have settings info in their info.xml are loaded before triggering adding the settings setup method
LukasReschke added a commit to nextcloud/user_saml that referenced this pull request Aug 10, 2016
Makes this page a single page as implemented in nextcloud/server#796
LukasReschke added a commit to nextcloud/user_saml that referenced this pull request Aug 10, 2016
Makes this page a single page as implemented in nextcloud/server#796
@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

This was done for the mail settings but a lot of other settings, including the sharing settings are mission... @blizzz am I right?

No, they are split up. Some parts are in Server, some are in Additional Setting. And Sharing settings are in Sharing.

@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

Just saw that this still happens:

@schiessle wrong link?

@schiessle
Copy link
Member

No, they are split up. Some parts are in Server, some are in Additional Setting. And Sharing settings are in Sharing.

yes, I was to fast and edited my comment right before you commented... Still it seems like we removed here setting parameters from the general admin page which we added in no other place. At least I discovered it for sharing and just at the moment for encryption: https://github.com/nextcloud/server/pull/796/files#diff-7ce542aade9c380d3b2e16162d559256L132 So the encryption settings no longer show the encryption modules.

@schiessle
Copy link
Member

schiessle commented Aug 16, 2016

@blizzz why do you still see the old link? 😕 Edited the post directly after I created it... This is the correct link: #796 (comment)

@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

@blizzz why do you still see the old link. Edited the post directly after I created it... This is the correct link: #796 (comment)

Glitch in the matrix?

@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

@schiessle thx for re-checking, will fix it.

@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

@schiessle done

@LukasReschke
Copy link
Member

Conflicts :)

@blizzz
Copy link
Member Author

blizzz commented Aug 16, 2016

Conflicts :)

✌️

@schiessle
Copy link
Member

looks good now 👍

@LukasReschke
Copy link
Member

LGTM

@LukasReschke LukasReschke merged commit 2d861c9 into master Aug 16, 2016
@LukasReschke LukasReschke deleted the implement_712 branch August 16, 2016 18:28
@LukasReschke
Copy link
Member

Oh. Backporting this is fun 😨 – So many conflicts…

@LukasReschke
Copy link
Member

Backport attempt at #894, let's see…

blizzz pushed a commit to nextcloud/user_saml that referenced this pull request Aug 17, 2016
Use new admin page module

Makes this page a single page as implemented in nextcloud/server#796

specify namespace for autoloader

IAdmin is now ISettings
GitHubUser4234 pushed a commit to GitHubUser4234/server that referenced this pull request Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants