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

Make debug UI background layers configurable with new file debug-ui-config.json #6295

Merged
merged 17 commits into from
Dec 9, 2024

Conversation

leonardehrenfried
Copy link
Member

Summary

Introduces a new file for configuring the debug UI (debug-ui-config.json) and adds the ability to configure the background layers.

The UI for selecting the background map looks like this:

image

Issue

Closes #6275

Unit tests

Added a few.

Documentation

I added a new configuration page for the new config file and updated a few existing places.

Changelog

Autogenerated.

Bumping the serialization version id

No.

cc @fpurcell

@leonardehrenfried leonardehrenfried requested a review from a team as a code owner December 2, 2024 14:07
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 70.40816% with 29 lines in your changes missing coverage. Please review.

Project coverage is 69.79%. Comparing base (27b18bd) to head (20696c1).
Report is 30 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...opentripplanner/standalone/config/ConfigModel.java 0.00% 10 Missing ⚠️
...entripplanner/apis/vectortiles/DebugStyleSpec.java 84.84% 5 Missing ⚠️
...tripplanner/standalone/config/OtpConfigLoader.java 0.00% 4 Missing ⚠️
...entripplanner/standalone/config/DebugUiConfig.java 91.42% 3 Missing ⚠️
.../vectortiles/GraphInspectorVectorTileResource.java 0.00% 2 Missing ⚠️
...tripplanner/apis/vectortiles/model/TileSource.java 66.66% 1 Missing ⚠️
...ripplanner/framework/application/OtpFileNames.java 50.00% 0 Missing and 1 partial ⚠️
...nner/standalone/config/configure/ConfigModule.java 0.00% 1 Missing ⚠️
...ner/standalone/configure/ConstructApplication.java 0.00% 1 Missing ⚠️
...standalone/server/DefaultServerRequestContext.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #6295   +/-   ##
==========================================
  Coverage      69.79%   69.79%           
- Complexity     17786    17798   +12     
==========================================
  Files           2017     2019    +2     
  Lines          76042    76126   +84     
  Branches        7781     7786    +5     
==========================================
+ Hits           53073    53132   +59     
- Misses         20264    20288   +24     
- Partials        2705     2706    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@t2gran
Copy link
Member

t2gran commented Dec 2, 2024

What should the debug UI be named? In the UI it is called "OTP Debug Client" and here it is called "Debug UI" - We should settle on one name. The name "OTP Debug Client" is taking up too much space. So I suggested to shorten it to just "OTP Debug" - In the UI repeating "UI" or "client" is redundant.

So, maybe use "OTP Debug UI" in doc, "OTP Debug" as title in UI and "debug-ui-config.json" ?

@testower
Copy link
Contributor

testower commented Dec 3, 2024

I'm wondering if this is a little misleading? The debug-ui-config.json doesn't seem to directly configure the debug UI does it? I mean the debug UI code doesn't read the config file. Rather, the config file is read by the OTP application, and it configures some behavior related to the map style endpoint.

I guess my question is, do we want to use this config file also to configure other aspects of the debug UI or just the map styles?

@leonardehrenfried
Copy link
Member Author

We are planning to expand its role to cover other aspects of the debug UI.

@testower
Copy link
Contributor

testower commented Dec 3, 2024

We are planning to expand its role to cover other aspects of the debug UI.

I see, then we are looking at a way to serve this config file directly to the debug UI at runtime, since it then obviously can't be compiled into the static assets. Will it be available via a public endpoint in OTP?

@leonardehrenfried
Copy link
Member Author

I see, then we are looking at a way to serve this config file directly to the debug UI at runtime, since it then obviously can't be compiled into the static assets. Will it be available via a public endpoint in OTP?

There are no concrete plans yet but I also imagine an endpoint from which the debug UI gets the configuration values at runtime.

@testower
Copy link
Contributor

testower commented Dec 3, 2024

I'm ok with this change. My only two cents is that since we are introducing the concept configuration for the debug ui, it seems strange that we don't have a mechanism for the debug ui to fetch it. I suppose it can wait for some actual use case for that.

testower
testower previously approved these changes Dec 3, 2024
@leonardehrenfried
Copy link
Member Author

leonardehrenfried commented Dec 3, 2024

We thought about using router-config.json for this particular case, but a Gitter poll showed that almost everyone preferred a separate file for it.

@@ -14,6 +13,7 @@
import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber;
import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop;
import org.opentripplanner.service.vehiclerental.street.StreetVehicleRentalLink;
import org.opentripplanner.standalone.config.debuguiconfig.BackgroundTileLayer;
Copy link
Member

Choose a reason for hiding this comment

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

config.debuguiconfig seems like a bit of repetition (however the same repetition seems to be done for other configs as well for some reason). Perhaps config.debugui/debugclient)

Copy link
Member Author

Choose a reason for hiding this comment

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

For go or bad, I want to follow the previous naming pattern.

If we can agree to a new structure, I'm happy to make a follow up.

@@ -0,0 +1,107 @@
package org.opentripplanner.standalone.config;
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we put this inside the debugui package inside the config package (same question for other configs)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea and have just followed the pattern that was there before.

I would like to separate refactoring from the feature development. If we can come to an agreement how the packages should be structured I'm happy to change it in a follow up PR.

/**
* This class is an object representation of the 'debug-ui-config.json'.
*/
public class DebugUiConfig implements Serializable {
Copy link
Member

Choose a reason for hiding this comment

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

Is this something we want to serialize? Isn't it enough to read this in at run time? Also, should we have some common interface/class for configs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed Serializable: 8395345

I would love to refactor this class, but I request to do it in a separate PR.

@leonardehrenfried
Copy link
Member Author

What should the debug UI be named? In the UI it is called "OTP Debug Client" and here it is called "Debug UI" - We should settle on one name. The name "OTP Debug Client" is taking up too much space. So I suggested to shorten it to just "OTP Debug" - In the UI repeating "UI" or "client" is redundant.

So, maybe use "OTP Debug UI" in doc, "OTP Debug" as title in UI and "debug-ui-config.json" ?

I agree with this and have removed the word "UI" from the UI where it is indeed redundant.

@binh-dam-ibigroup
Copy link
Contributor

So I suggested to shorten it to just "OTP Debug" - In the UI repeating "UI" or "client" is redundant.

How about "OTP Debugger"?

});
select.onchange = () => {
const layerId = select.value;
console.log(select.value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor, but this console.log doesn't seem necessary

Copy link
Contributor

@testower testower left a comment

Choose a reason for hiding this comment

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

I would prefer no console.log, but otherwise ok

@leonardehrenfried leonardehrenfried merged commit 1438c98 into opentripplanner:dev-2.x Dec 9, 2024
6 checks passed
t2gran pushed a commit that referenced this pull request Dec 9, 2024
@leonardehrenfried leonardehrenfried deleted the background-tiles branch December 9, 2024 09:19
@leonardehrenfried
Copy link
Member Author

I removed the console.log on dev-2.x: 0079a16

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.

Configurable background map layers for debug UI
5 participants