-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[ZEPPELIN-6085] Add configuration option for setting the default UI #4824
Conversation
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 have made some comments on the Java class. I don't know if the changes are possible in the Java script frontends. Aren't the URLs to other elements (images, CSS etc.) fixed during the building of the frontends?
zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
Outdated
Show resolved
Hide resolved
zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
Outdated
Show resolved
Hide resolved
@Reamer In the initial code I wrote, I added code on the server side to insert a From reviewing the frontend code, my assumption is that most of the resources are set with relative paths, or they dynamically generate absolute paths based on each app's path, so there didn't seem to be an issue. However, upon reconsideration, I thought explicitly specifying the |
Additionally, I missed this part earlier, but for the So, I made additional modifications to ensure this part changes according to the app's path. |
It includes various types of code :-) Thank you for your work. I'll test it sooner than later. |
…operly at runtime
86e158c
to
bd701ac
Compare
I've rebased this branch and added documentation for configuring the default Ui on the |
zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
Outdated
Show resolved
Hide resolved
zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
Outdated
Show resolved
Hide resolved
@@ -905,6 +910,10 @@ public boolean isPrometheusMetricEnabled() { | |||
return getBoolean(ConfVars.ZEPPELIN_METRIC_ENABLE_PROMETHEUS); | |||
} | |||
|
|||
public DEFAULT_UI getDefaultUi() { | |||
return DEFAULT_UI.valueOf(getString(ConfVars.ZEPPELIN_DEFAULT_UI).toUpperCase()); |
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 happens if I pass neither new
nor classic
as a configuration value at this point?
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.
If neither new nor classic is provided as a configuration value, the valueOf() method will throw an IllegalArgumentException during server startup.
I based this behavior on the getRunMode() method, which similarly doesn't handle exceptions for invalid input.
Should we add more graceful error handling 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.
Does it mean that we set the configuration as an empty value? It would be proper to throw an exception for the case.
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.
@jongyoul If the value is empty, getString()
will return default value (new
) and if an invalid value (neither new
nor classic
) is provided, it will throw an exception.
Do you think it is not appropriate to provide a default value for an empty value in this configuration?
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.
In my opinion, the exception and the termination of the start in the event of incorrect configuration is acceptable.
@@ -44,6 +43,14 @@ <h1 class="brand-title" style="display: none">Zeppelin</h1> | |||
"HTML-CSS": { availableFonts: ["TeX"] }, | |||
messageStyle: "none" | |||
} | |||
const origin = window.location.origin; |
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.
Why is this needed?
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.
MathJax resolves its dependency URLs based on its configuration.
Previously, it was loading its dependency files from the root URL (the default UI app URL), regardless of whether it was being served from the default UI or the /next
UI.
Since both apps included MathJax as a dependency, this didn't cause any issues, but I felt it was more appropriate for MathJax to load its dependencies from the correct app-specific paths.
So, I updated th MathJax configurations to ensure it resolves URLs relative to the correct app.
@@ -17,7 +17,6 @@ | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<link rel="icon" href="./assets/images/zeppelin.png" type="image/x-icon"> | |||
<title>Zeppelin</title> | |||
<base href="/"> |
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.
You take this out in the new UI, which I understand. Where is the place in the old UI?
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.
@Reamer Both the old and new UIs are served from their respective sub-paths (depending on the configuration, either /
, /new
, or /classic
), and as I understand it, the trailing part of the URL after #/...
is treated as an anchor and ignored.
Therefore, without the base tag, static resources should be correctly fetched from the appropriate web app serving path, since the src
attributes for those resources are set using relative paths.
I verified this in the browser, and everything worked as expected.
Given this, I believe neither app requires a base tag. In fact the old UI didn't have one to begin with.
I understand your question as asking where the base tag is in the old UI, so I've responded accordingly.
However, if I misunderstood your point, please feel free to clarify.
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 looked at the code and it might work. Tests would of course be nice, but are difficult to implement at such a high level to test this small feature.
I have not tested manually myself and take your word for it.
### What is this PR for? This PR introduces a new configuration option `zeppelin.default.ui` to set the default UI for Zeppelin. The available options for this setting are `new` and `classic`. By default, the value is set to `new`, meaning the new UI will be served at the root path (`"/"`), while the classic UI will be available at `"/classic"`. If the configuration is set to `classic`, the classic UI will be served at `"/"`, and the new UI at `"/new"`. ### What type of PR is it? Improvement ### Todos * [ ] - Task ### What is the Jira issue? * Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/6085 * Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533] ### How should this be tested? - Testing the `new` option : - Set the `zeppelin.default.ui` config to `new` (the default). - Verify that the new UI is served at the root (`"/"`) and the classic UI is available at `"/classic"`. - Verify that navigating between pages works without any issue. - Verify that the UI switching button works properly in both UIs. - Testing `classic` option : - Similar steps as the above, except the new UI is served at `"/classic"` and the classic UI is available at the root (`"/"`) ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? Yes, documentation for the new configuration option has been added. Closes #4824 from tbonelee/add-default-ui-config. Signed-off-by: Jongyoul Lee <[email protected]> (cherry picked from commit 00b7c55) Signed-off-by: Jongyoul Lee <[email protected]>
What is this PR for?
This PR introduces a new configuration option
zeppelin.default.ui
to set the default UI for Zeppelin.The available options for this setting are
new
andclassic
.By default, the value is set to
new
, meaning the new UI will be served at the root path ("/"
), while the classic UI will be available at"/classic"
.If the configuration is set to
classic
, the classic UI will be served at"/"
, and the new UI at"/new"
.What type of PR is it?
Improvement
Todos
What is the Jira issue?
How should this be tested?
new
option :zeppelin.default.ui
config tonew
(the default)."/"
) and the classic UI is available at"/classic"
.classic
option :"/classic"
and the classic UI is available at the root ("/"
)Screenshots (if appropriate)
Questions: