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

feat(settings): add admin & user setting iframe #4373

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

codewithvk
Copy link
Contributor

  • Resolves: #
  • Target version: main

Summary

TODO

  • ...

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

@codewithvk codewithvk force-pushed the private/codewithvk/cool_setting_iframe branch from 62c98ce to 104c780 Compare January 7, 2025 17:02
@codewithvk codewithvk marked this pull request as draft January 7, 2025 17:04
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Some early feedback, general approach seems good 👍

$wopi = $this->tokenManager->generateWopiToken($fileId, null, $adminUserId);

$coolBaseUrl = $this->appConfig->getCollaboraUrlPublic();
$adminSettingsWopiSrc = $coolBaseUrl . '/browser/admin-settings.html?';
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this would be an URL that can be obtained from the discovery endpoint of Collabora, could be a separate app element for settings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to my TODO, will fix it before merging PR.

lib/TokenManager.php Outdated Show resolved Hide resolved
lib/Db/WopiMapper.php Outdated Show resolved Hide resolved
lib/Controller/DocumentController.php Outdated Show resolved Hide resolved
lib/Controller/DocumentController.php Outdated Show resolved Hide resolved
@codewithvk codewithvk force-pushed the private/codewithvk/cool_setting_iframe branch from 905e1e2 to cc91ef8 Compare January 11, 2025 18:22
@codewithvk
Copy link
Contributor Author

Related serverside PR : nextcloud/server#50145

@pedropintosilva
Copy link
Contributor

@codewithvk @juliusknorr thanks. Probably worth to create a separated PR for the vue conversion, right?

@codewithvk codewithvk force-pushed the private/codewithvk/cool_setting_iframe branch from c042023 to 5e11402 Compare January 20, 2025 10:56
@codewithvk codewithvk marked this pull request as ready for review January 21, 2025 12:34

This comment was marked as spam.

@elzody
Copy link
Contributor

elzody commented Jan 22, 2025

In order to resolve the failing tests, you should do the following:

  1. Make sure all the new files (and existing files, even) have the SPDX reuse header at the top
  2. Run composer run cs:fix to address formatting and styling issues, etc.
  3. Run composer run psalm -- --no-cache which will inform you of errors which should be fixed

Signed-off-by: codewithvk <[email protected]>
Signed-off-by: codewithvk <[email protected]>
Signed-off-by: codewithvk <[email protected]>
…y of user and system settings.

Note: We will delete this commit/code after the entire prototype is ready. Reviewers can ignore this commit during the review process.
Signed-off-by: codewithvk <[email protected]>
TODO: We should try to centralize the path everywhere so that a change in one place updates it everywhere!
Signed-off-by: codewithvk <[email protected]>
- Implement dynamic routing for settings files, enabling URLs structured as /settings/{type}/{category}/{filename}.
- Support various setting types (e.g. userconfigs, sharedconfigs) and categories (e.g. autotext, wordbook) so that multiple files can be stored for each category.
- Ensure proper URL parsing and directory handling for uploading and retrieving files via the WOPI interface.

Signed-off-by: codewithvk <[email protected]>
Signed-off-by: codewithvk <[email protected]>
@codewithvk codewithvk force-pushed the private/codewithvk/cool_setting_iframe branch from 5e11402 to bf5a8bf Compare January 23, 2025 05:54
Signed-off-by: codewithvk <[email protected]>
@codewithvk codewithvk changed the title WIP: Admin setting iframe Admin & User setting iframe Jan 23, 2025
@codewithvk codewithvk changed the title Admin & User setting iframe feat(settings): add admin & user setting iframe Jan 23, 2025
@codewithvk
Copy link
Contributor Author

codewithvk commented Jan 23, 2025

In order to resolve the failing tests, you should do the following:

  1. Make sure all the new files (and existing files, even) have the SPDX reuse header at the top
  2. Run composer run cs:fix to address formatting and styling issues, etc.
  3. Run composer run psalm -- --no-cache which will inform you of errors which should be fixed

@elzody We could have one psalm error because we need to merge PR :nextcloud/server#50145 before.. I fixed other errors...Also could you please run CI - as I don't have access to run CI.

@@ -34,6 +34,17 @@
</em>
</p>

<!-- user settings iframe -->
<div id="user-cool-frame-section" class="section">
<h2>{{ t('richdocuments', 'Collabora User Settings') }}</h2>
Copy link
Member

Choose a reason for hiding this comment

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

We should call this differently as we want to remove the duplicate word "settings" from all seections we have (ref #4351)

Copy link
Contributor

Choose a reason for hiding this comment

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

How it looks now:
nextcloud local_index php_settings_user_richdocuments (1) (1)

I have discussed with Vivek that we should also remove Collabora since it's part of Office settings section.

If we also remove settings (even thought I do see "Personal settings" in the #4351 you have referenced) then we either replace it with something such as "preferences" or - and I think better - we simply remove that h2 completely and let the headings in the iframe being h2 (so, autotext and workbook will become upper level which probably makes more sense)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedropintosilva Thanks for adding a screenshot :)

@juliusknorr
Copy link
Member

@codewithvk Can you also add some screenshots of how this looks in the settings page for review of @marcoambrosini as designer?

@codewithvk
Copy link
Contributor Author

@juliusknorr @elzody I'm not able to figure out why wopi integration for db test broken, any idea?

@codewithvk
Copy link
Contributor Author

Modified bit of UI of iframe

nextcloud local_index php_settings_user_richdocuments (2)
cc: @marcoambrosini @juliusknorr @pedropintosilva

@pedropintosilva
Copy link
Contributor

pedropintosilva commented Jan 24, 2025

Modified bit of UI of iframe

nextcloud local_index php_settings_user_richdocuments (2) cc: @marcoambrosini @juliusknorr @pedropintosilva

Awesome, much better, thanks!

I think We can still make it more clear in terms of the elements and their relation. What I mean is that right now the "Upload AutoText/Wordbook" buttons seem that they are referring to the list of files (which is not the case, those files were already uploaded). Best to clarify the main action by renaming it to "Add new AutoText" / "Add new Wordbook" but that seems a bit too long (specially when considering translations) -> so, what about "New AutoText" and "New Wordbook". I have noticed that in https://nextcloud-vue-components.netlify.app/#/Components/App%20containers/NcAppNavigation?id=ncappnavigationnewitem that sometimes they use the additional plus icon as a prefix (Maybe we could use it? @jancborchardt , @marcoambrosini )

try {
$categories = [];
$folder = $this->appData->getFolder($type);
$directories = $folder->getFullDirectoryListing();
Copy link
Member

Choose a reason for hiding this comment

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

Sorry I missed that the server change was also required, but we cannot get that in for 31 anymore due to API freeze.

However you can directly access it by injecting IRootFolder and then fetching the path directly from it

		$instanceId = $this->config->getSystemValue('instanceid', null);

		if ($instanceId === null) {

		}

		return $this->rootFolder->get('appdata_' . $instanceId . '/richdocuments/your-path');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@juliusknorr Is it safe to access the rootFolder from a security perspective?

May be for now we can do it as it seems we don't have other options.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that is fine, the server API that you have would do similar calls

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

Successfully merging this pull request may close these issues.

4 participants