-
Notifications
You must be signed in to change notification settings - Fork 951
Allow style customization in the documentation service #6235
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
base: main
Are you sure you want to change the base?
Allow style customization in the documentation service #6235
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6235 +/- ##
============================================
+ Coverage 74.46% 74.67% +0.21%
- Complexity 22234 22561 +327
============================================
Files 1963 1981 +18
Lines 82437 83275 +838
Branches 10764 10828 +64
============================================
+ Hits 61385 62188 +803
- Misses 15918 15931 +13
- Partials 5134 5156 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
ce4d1cc
to
37379c0
Compare
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.
Overall looks good, left only nits
core/src/main/java/com/linecorp/armeria/server/docs/DocService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
* @param url the input string to escape | ||
* @return the escaped string | ||
*/ | ||
private static String escapeForJavaScriptUrl(String url) { |
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.
Question) Would it make sense to use URLEncoder.encode(url, "UTF-8")
instead?
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.
Yes, it's definitely a more convenient method.
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.
--- Related: line#5900 **Motivation:** This change addresses feedback from multiple users requesting the ability to customize the appearance of the documentation service. The customizable elements now include: - Title - Browser tab title - Header bar background color - Color for the `GotoSelect` component - Buttons colors in the `Debug` component **Modifications:** Backend - In `DocServiceBuilder`, add a `Map` to store relevant data and a builder method for the documentation title. - In `DocService`, modify the constructor to include a new attribute. - In Static Nested `SpecificationLoader`, adjust the constructor and the `generateServiceSpecification` method. - In `ServiceSpecification`, create a private `Map` and add Getter and Setter methods. Frontend - In `lib/specification.tsx`, include a `Record<String, String>` attribute in the `SpecificationData` interface. - In `lib/colors.tsx`, add reusable method to validate color hex code. - In `containers/App/index.tsx`, retrieve the style settings and applied them to the app's title and header. - In `components/GotoSelect/index.tsx`, apply color using inline style. - In `containers/MethodPage/index.tsx`, apply the custom color styling. - In `containers/MethodPage/DebugPage.tsx`, apply custom button color styling via inline styles. **Result:** We can now customize the appearance of: - Title - Browser tab title - Header bar background color - Color for the `GotoSelect` component - Buttons colors in the `Debug` component
…pts` --- Related: line#5900 **Motivation:** This change addresses feedback from multiple users requesting the ability to customize the appearance of the documentation service. The customizable elements now include: - Header title - Header bar background color - Color for the `GotoSelect` component - Browser tab title - Browser tab favicon **Modifications:** Backend - In `DocServiceBuilder`, add a `Map` to store relevant data and a builder method for the documentation title. - In `DocService`, modify the constructor to include a new attribute. - In Static Nested `SpecificationLoader`, adjust the constructor and the `generateServiceSpecification` method. - In `ServiceSpecification`, create a private `Map` and add Getter and Setter methods. - In `DocServiceInjectedScriptsUtil`, add methods to generate customization scripts. - In `DocServiceInjectedScriptsUtilTest`, develop tests for the above logic. Frontend - In `lib/specification.tsx`, include a `Record<String, String>` attribute in the `SpecificationData` interface. - In `containers/App/index.tsx`, retrieve the title and apply it to the app's titles. Add JS hook class. - In `components/GotoSelect/index.tsx`, add JS hook class for custom behavior. **Result:** - Closes: line#5900 We can now customize the appearance of: - Header title - Header bar background color - Color for the `GotoSelect` component - Browser tab title - Browser tab favicon
37379c0
to
c25ee87
Compare
Related: #5900
Motivation:
This change addresses feedback from multiple users requesting the ability to customize the appearance of the documentation service. The customizable elements now include:
GotoSelect
componentDebug
componentModifications:
Backend
DocServiceBuilder
, add aMap
to store relevant data and a builder method for the documentation title.DocService
, modify the constructor to include a new attribute.SpecificationLoader
, adjust the constructor and thegenerateServiceSpecification
method.ServiceSpecification
, create a privateMap
and add Getter and Setter methods.Frontend
lib/specification.tsx
, include aRecord<String, String>
attribute in theSpecificationData
interface.lib/colors.tsx
, add reusable method to validate color hex code.containers/App/index.tsx
, retrieve the style settings and applied them to the app's title and header.components/GotoSelect/index.tsx
, apply color using inline style.containers/MethodPage/index.tsx
, apply the custom color styling.containers/MethodPage/DebugPage.tsx
, apply custom button color styling via inline styles.Result:
We can now customize the appearance of:
GotoSelect
componentDebug
componentMain view

Debug modal
