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

enhancement: introduce theme processing #9133

Merged
merged 13 commits into from
May 29, 2024
Merged

Conversation

fschade
Copy link
Contributor

@fschade fschade commented May 10, 2024

Description

we've set up a flexible configuration system with the theme.json file, benefiting not just web clients but also those on mobile and desktop platforms.

when new customization options come into play, it can be tough for users who've already personalized their themes, possibly messing up the experience.

this challenge also affects developers and administrators, who then need to communicate extensively to introduce new theme properties.

to tackle this, i suggest an automatic injection of new properties/options into the user's theme.json file, ensuring a smooth merging of default and custom themes.

Basically thats exactly what this pr does, the themes get proccessed in the following order:

themeDefaults < baseTheme < brandingTheme

  • themeDefaults: contains all the default values, this is guaranteed to exist
  • baseTheme: contains the base theme from the theme fs, there is no guarantee that it exists
  • brandingTheme: contains the branding theme from the theme fs, there is no guarantee that it exists

which results in the final theme.json.

One of the benefits having it that way, is the ability to set specific json key values for the brandingTheme only, for example after a logo update.

{
	"clients": {
		"web": {
			"defaults": {
				"logo": {
					"login": "themes/_branding/49308105.jpeg",
					"topbar": "themes/_branding/49308105.jpeg"
				}
			}
		}
	},
	"common": { "logo": "themes/_branding/49308105.jpeg" }
}

we've decided to make it NOT backward compatible, the breaking change is that the user has to re-upload the custom logo, thats it. The previous approach copied the whole theme.json, therefore it contained ALL key value combinations which makes a backward comp fix nearly impossible and is not in relation to the required work.

Related Issue

How Has This Been Tested?

  • unit tests

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)
  • Technical debt
  • Tests only (no source changes)

Checklist:

Copy link

update-docs bot commented May 10, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@mmattel
Copy link
Contributor

mmattel commented May 13, 2024

Please consider adding a documentation in the web servcie readme.md

@fschade fschade marked this pull request as ready for review May 13, 2024 12:55
@fschade fschade requested a review from kulmann as a code owner May 13, 2024 12:55
services/web/README.md Outdated Show resolved Hide resolved
services/web/README.md Outdated Show resolved Hide resolved
services/web/README.md Outdated Show resolved Hide resolved
services/web/README.md Outdated Show resolved Hide resolved
@fschade fschade force-pushed the theme-in-ocis branch 2 times, most recently from 1585b92 to 874f2d4 Compare May 16, 2024 11:38
@fschade fschade requested a review from kobergj May 24, 2024 11:39
Copy link
Contributor

@micbar micbar left a comment

Choose a reason for hiding this comment

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

Small nitpicks, thumbs up for the rest.

services/web/README.md Outdated Show resolved Hide resolved
services/web/pkg/server/http/server.go Outdated Show resolved Hide resolved
services/web/pkg/theme/theme.go Outdated Show resolved Hide resolved
@micbar micbar requested a review from mmattel May 27, 2024 15:16
services/web/README.md Show resolved Hide resolved
Copy link

sonarcloud bot commented May 29, 2024

@fschade
Copy link
Contributor Author

fschade commented May 29, 2024

@individual-it, @saw-jan, the following test is flaky:

https://drone.owncloud.com/owncloud/ocis/35485/33/6 RED
https://drone.owncloud.com/owncloud/ocis/35487/33/6 GREEN

@fschade fschade enabled auto-merge (squash) May 29, 2024 13:47
@fschade fschade merged commit eb7c364 into owncloud:master May 29, 2024
4 checks passed
ownclouders pushed a commit that referenced this pull request May 29, 2024
* enhancement: introduce theme processing

* enhancement: introduce theme processing

* enhancement: add theme processing tests and changelog

* Update services/web/pkg/config/config.go

Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu>

* fix: ci findings

* Apply suggestions from code review

Co-authored-by: Martin <github@diemattels.at>

* enhancement: use the theme assets from web instead of having them inside the oCis repo (license clash Apache vs. AGPLv3)

* fix: golangci tagalign order

* fix: rename UnifiedRoleUploader to UnifiedRoleEditorLite

* fix: some typos

Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu>

* enhancement: export supported theme logo upload filetypes

* chore: bump reva

* fix: allow init func

---------

Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu>
Co-authored-by: Martin <github@diemattels.at>
@saw-jan
Copy link
Member

saw-jan commented May 30, 2024

@individual-it, @saw-jan, the following test is flaky:

https://drone.owncloud.com/owncloud/ocis/35485/33/6 RED
https://drone.owncloud.com/owncloud/ocis/35487/33/6 GREEN

Probably due to a race-condition. we have an open issue for this and trying to figure out the proper way to make it solid

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

Successfully merging this pull request may close these issues.

[ocis] Theme pre-processing and automatic injection of new theme options
5 participants