-
Notifications
You must be signed in to change notification settings - Fork 122
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
Dynamic path pages #119
base: master
Are you sure you want to change the base?
Dynamic path pages #119
Conversation
…figuring sub-resources pages
I agree, it shouldn't be part of the As for where sub resources should be placed, I think that it would make sense to have in the same level as Another option is to have them in both Is that make sense? WDYT? |
Oh you mean like this:
Actually that would be great yes. It makes more sense, would make a "sub-menu" feature possible and also allow going deep in the sub-resources like |
I guess it's more about doing a
|
Maybe the |
As for the |
Yes, agreed. |
So, like this ?
|
Yes, and:
|
Ah, but what would be the difference from a resource defined at the app level and on at the page level then ? |
Maybe you want a resource to be accessible on for a specific page because it's not relevant for other pages? Then RESTool will look for the resource in the page level, and fallback to the app level. |
I'm not sure I see what you mean since, for now, every resource has a unique So, right now, a resource detail page would look like this: I am not a css expert and even a worse UI designer. So I only attempted to make something not too awful, but I will definitely need some help to have the right idea if this direction suits you. It also involves the addition of the "go to details" button under the action column like so: Let me know what you think @dsternlicht . |
@laudibert I'm not sure I understand the flow. Let's try to create a user story for that feature, maybe then thing would make more sense? Also, I added some comments to the PR. |
Ah ? In a commit you mean ? I don't see them right now. The code is far from being ready now, a lot a refactoring has to be done.
Sure, I'll try to do that as soon as I have a bit of time. |
@@ -120,6 +120,12 @@ | |||
"methods": { | |||
"$ref": "#/definitions/methods" | |||
}, | |||
"subResourcePages": { |
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.
Shouldn't it be resources
?
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, the schema is just not up to date yet.
src/common/models/config.model.ts
Outdated
id: string | ||
name: string | ||
description: string | ||
resources: IConfigResourcePage[] |
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.
Can a IConfigDetailPage
also have resources
?
@@ -5,17 +5,25 @@ import HttpService from '../services/http.service'; | |||
export interface IAppContext { | |||
config: IConfig | null | |||
activePage: IConfigPage | null | |||
activeItem: any | null |
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.
Maybe activeResource
?
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.
The logic was that activeItem
is the item
on which the details are being displayed. resource
refers to classroom
within /classrooms/:id/student
, while item
refers to the actual instance of a classroom
resource.
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.
Got it.
src/components/table/table.comp.tsx
Outdated
@@ -71,6 +72,12 @@ export const Table = ({ items, fields, callbacks, customActions, customLabels }: | |||
} | |||
<td> | |||
<div className="actions-wrapper"> | |||
{ | |||
callbacks.details && |
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 do we need the details
at all? why not simply using the getSingle
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.
Well here it's because the button redirects you to the details page of the item. While put
and delete
actually act on the item, the detail button takes you out of the page.
So I thought using get
would be confusing. But I guess so is details
. Either get
to be consistent with the method used behind or goToDetails
to be explicit ?
Sorry, forgot to publish the comments 🙃 |
Ok, so before I get into an acutal User Story, here are the steps of what led me to implement that The first requirement I brought up in #115 basically was : how can we display 1 to n and n to n relationships on RESTool ? RESTful APIs implement this through sub-resources like so: RESTool allows you to display root resources very easily, but what about sub-resources ? You suggested that a link to the actual sub-resource could be generated via As I did that and we discussed it further, it seemed clear that the links via There came the idea of association all sub-resources of one resource page within itself and the idea that one item could have its own page reachable via a 🔍 button. The reasoning behind the detail page is the following:
That being said, all sub-resources pages would be shown through detail pages, which makes sense as per definition, a sub-resource is always reached after selecting one item of the its parent resource. Another solution, I guess, could be to only show links of those sub-resources in the detail page rather than directly having tabs showing the sub resources. But the fact remains that that when you show Sorry for the long text, tell me if you get what I'm talking about and what you think about this. Then I can write a proper User Story if need be @dsternlicht. |
Alrighty then. Thanks for clearing that out! So a few decisions to make here:
|
As sub-resources only come from a parent item like
Well it all depends on the UX that is decided really. Whether a sub-resource is displayed as a full page (where ate we on the menu when that happens?) or as a tab (or anything like that) within a item details. Or both possibility.
I think |
I don't have other ideas than the tab one, but I'm not good at UI/UX, do you have any in mind?
That's a good question. The thing is that a
This depends a lot on answers to previous questions :D |
|
|
Ok. So a sub-resource definition, however we choose to call it, should be able to turn into a full page or a tab in a detail page. Question about the page case, what shows on the menu when the internal link brings us to a sub-resource page ?
I don't know if a resource should be associated with a Also, does the 🔍 button appear automatically when Maybe then we need to find a way to differentiate the activation of the current
Alright, anything you think I should change about the looks/style though?
Actually, put into that perspective, I think |
The original page.
Why? Maybe a field in
I think it's ok. If
Not at the moment. Maybe I'll change afterward.
I agree. |
What would that do? If a resource type field in |
Oh. If you put it that way.. :) |
No but it's just I didn't know what you had in mind. Actually, maybe it can generate a link to the sub-resource page? That would solve the "internal url" thing. |
That's actually what I meant. |
@laudibert What's the status of this PR? |
@dsternlicht It's still ongoing, I'm having trouble finding time those days. I am planning on writing up a full status later today. |
No worries :) |
… description in config schema
Work (still) in progress. What is done:
What is left to do:
One other thing. For now, adding a sub-resource from a detail page is not supported. Meaning if you are on the I am not sure if it should or how it should be done in term of display. What do you think @dsternlicht ? |
That would be great.
Hmmm so you'll only be able to view the items but not to edit/create them? |
@laudibert are we ready? what's left? |
@dsternlicht no, sorry for the long delay. It has been hard to find enough time to finish this lately. I have added an example with the open API of TVMAZE website. And while doing tests on everything, I found some things that I fixed but I am having trouble with some bugs. In particular, there is a bug navigating with the "Next page" and "Previous page" buttons of the browser. I ended up starting to write some unit tests hoping it will help me find what is going wrong as I cannot put my finger on it. I will push what I have not pushed yet if you mind to take a look. |
…es using TVMAZE api, fixed error when a object is null within a data extraction, resized images for details page, added first unit test for button component (as a starter) and updated packages to enable unit tests.
So current known bugs are :
|
So this isn't an actual bug but more a misuse in the sample I wrote as I was referring a the url |
Greetings everyone, was this feature ever implemented? |
Nope, it was never completed by @laudibert :( |
Working on PR for #115
First step into dealing with n to n relationships. The app now allows you to have path variables within pages
"id"
.For now, a field of type
url
has to be shown within a row/card to be able to navigate to the sub-resource (with the help ofdataTransform
of course). The problem is that theurl
type will make it that the link will open a new tab, this could be fixed by adding a new type likepath
orinternalUrl
that could generate a link that does not open in another tab.However, it feels like this sort of access to sub-resources could also be done through a button like
customActions
do, what do you think ? The only weird thing being that accessing sub-resources is quite standard in RESTfull APIs and not custom. And the button would be a link to another page rather than a form or an API call.Also, now sub-resources pages are in the same place than other pages but it feels like they could be in a different array like
subResourcesPages
or something. For now the implementation does not require them to be separated but in the end they might end up having special properties like the fact that they will never be shown in the menu for example ? And also that their title and description should be able to be built dynamically with the name/label of the parent resource. For example for"id": "classroom/:id/students"
would have a title like"title": "Students of ${classroomName}"
. This kind of feature does not make sense for a "root" resource though. Thus separating pages and sub-resources pages.What do you think ?
P.S. Sorry for the long text 😅