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

Page Extension API #1288

Open
Rsl1122 opened this issue Jan 12, 2020 · 3 comments
Open

Page Extension API #1288

Rsl1122 opened this issue Jan 12, 2020 · 3 comments

Comments

@Rsl1122
Copy link
Collaborator

@Rsl1122 Rsl1122 commented Jan 12, 2020

Is your feature request related to a problem? Please describe.

It is not possible to add new pages or tabs to Plan via an API.

I would like to be able to..

  • Add new web request resolver to the Plan webserver
    • HTML
    • JavaScript
    • JSON
    • CSS
  • Add snippets to current pages
    • Javascript <script src=""></script> before and after Plan scripts run
    • Stylesheet
  • Have library functions for modifying Plan pages
    • Add a tab with name and icon
    • Generate html for an item with icon and data
    • Making a XMLHTTPRequest (to the Plan webserver)
@Rsl1122 Rsl1122 added the New Feature label Jan 12, 2020
@Rsl1122 Rsl1122 added this to Backlog (HIGH Priority) in Active Development Jan 13, 2020
@Rsl1122

This comment has been minimized.

Copy link
Collaborator Author

@Rsl1122 Rsl1122 commented Jan 22, 2020

Requirement analysis

for easier implementation. These requirements are initial and might be subject to change if new requirements are identified during development.

Feature 1: Webserver resolvers

As an API user I should be able to..

  • Resolve multiple depths of URI target (/depth/more/)
  • Get parameters from the URI (?param=value&param2=value2)
  • (Future-proofing) Have a permission that is needed for the page
    • (Future-proofing) Use existing permissions for pages
  • Return html file as a string (UTF-8)
  • Return js file as a string (UTF-8)
  • Return json as a string
    • Return objects as json string (using gson in the background)
  • Return css file as a string (UTF-8)
  • Make html/js/css file Customizable via Html Customization
    • Identify resources by file names (sanitized)
  • Return bytes with custom mime-type (for unsupported file types in the api)

Feature 2: Snippets to html

As an API user I should be able to..

  • Add a <script> source that runs before main script (in the html) runs
    • Load javascript dependencies with the source tags
    • Modify the page structure
  • Add a <script> that runs after main script (in the html) runs
    • load data via Plan webserver
  • Use ${playerName} and ${serverUUID} in script url parameters
  • Define the page the script is added to (Resolver)
    • (Undecided) Possibly by implementing this behavior middleware-like
  • Add a <link rel="stylesheet">
    • for style modifications

Feature 3: Javascript methods for easy modification

As an API user I should be able to..

  • Make a XMLHTTPRequest to the Plan webserver
    • Have a json callback
    • Have an XMLHTTPRequest callback (for non json)
  • Select a tab I wish to append content to
  • Append content to a tab
  • Select a card I wish to append content to
    • Append content to a table in specific position
    • Append content to a text-list in specific position
  • Add a new tab div with an id
  • Add a new navigation link to a tab id or URL
    • With an icon
    • Add a collapsible navigation block (with more links inside it)
  • Generate Plan-like html
    • Text with colored icon next to it
    • Table row
    • Colored button with an icon
  • Have a document with Plan-like html as a reference

Feature 4: Append javascript to other javascript files

As an API user I should be able to..

  • Append javascript to end of an existing javascript file
    • Have the appended javascript modifiable via Html Customization
    • Identify the appendage
@Rsl1122

This comment has been minimized.

Copy link
Collaborator Author

@Rsl1122 Rsl1122 commented Jan 22, 2020

Possible consideration: After implementing the API, try to duplicate the functionality of the current page resolvers using the API - This should ensure that the API is flexible for use.

@Rsl1122 Rsl1122 added the p: epic label Jan 22, 2020
Rsl1122 added a commit that referenced this issue Feb 9, 2020
Affects issues:
- #1288
@Rsl1122

This comment has been minimized.

Copy link
Collaborator Author

@Rsl1122 Rsl1122 commented Feb 12, 2020

Possible consideration: After implementing the API, try to duplicate the functionality of the current page resolvers using the API - This should ensure that the API is flexible for use.

Many Single-Responsibility-Principle violations were discovered right at the start, where some responses get html and do placeholder replacement, some generate content entriely inside Response classes and some funky stuff is going on.

The new system seems good combating for this with the ResponseBuilder class.
It's going to be a lot of work refactoring the response resolution, but in the end it will result in much more understandable code & behavior.

Rsl1122 added a commit that referenced this issue Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Active Development
  
Backlog (HIGH Priority)
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.