-
Notifications
You must be signed in to change notification settings - Fork 37
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
Sensors To Show Edit form #1212
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
…orstoshow Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
The UX is amazing! ❤️ Please also show the entire asset ancestry for each sensor (like in the breadcrumb, including the organisation account) under an Asset property (next to ID and Unit), so they can be more easily distinguished. If it's trivial, let's also split off the account. For example,
Where Hint: use this method to fetch the breadcrumb contents. |
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 an issue with pre-existing data (in the sensors_to_show
attribute) not being loaded into this UI.
Let me know if you can reproduce that.
I'd like the "Edit" button next to the graph title, not below. Ideally no button (clicking the title means editing) but next to it is also fine (under it eats a lot of vertical space) |
Just checking: if |
Can you give some insight as to how this happened on your end? |
When you mean not loaded in the UI, do you mean in the edit form? or the graph/dashboard |
The graph loaded them, but the edit form (the one from this PR) did not. |
Signed-off-by: joshuaunity <[email protected]>
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 tested again and indeed the existing graphs load in the form! :)
Some things I'd like:
- Move the Edit button next to title
- How do I add a new graph?
- In the search, find sensors on the asset and public ones. I believe now it limits to the account of the user.
I've moved the button, you can check it out
To add sensors to the graph you just fetch the sensors by clicking on the
Should we modify the API by default to fetch only sensors from the specified asset (using the asset_id filter) and optionally include public sensors (using the include_public_assets filter)? |
ok, so you suggest the fetch sensor card should show these instead right |
No I meant to add a new graph - I did not see how to do that, maybe I overlooked it Maybe the API should by default search for sensors on that asset and public ones, not optionally. We can see how well that works ẃhen we use it. For Felix' request, maybe we want that breadcrumb in the search results as well as in the graph cards. |
Yes, exactly. |
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
In your screen-video I still see a call to the sensor API when you add a graph on the left, at the 4s mark. (I can't see your mouse pointer though, so I am assuming). But it is difficult to tell what happens. I looked at the code for Thanks for addressing the smaller items. Here are some things I just found:
|
I clicked on "Add Graph". When we spoke, you said that when the add graph is clicked, it should add a blank graph, and should also pre-select that graph. When a graph is selected(it shows the border), it fetches the available sensors so the user can add them instead of having to click on the card manually after "Add graph" to see the available sensors to add. |
This is correct we initially where, but now we don't anymore, I will refactor that |
Thanks. I see the appeal but I would suggest to get rid of that for now. It can be confusing and add too many API calls. |
Ok, so I should seize rendering that part(the right part) but leave the border highlight. Also when I click on another card that should still render the right side right? |
Signed-off-by: joshuaunity <[email protected]>
Why? I would leave the right side as-is. |
Wait, which of the comments was this reply for? |
About this one, which described automated updates to the sensor list on the right due to changes on the left: " When a graph is selected(it shows the border), it fetches the available sensors so the user can add them instead of having to click on the card manually after "Add graph" to see the available sensors to add." |
…tions Signed-off-by: joshuaunity <[email protected]>
…ple units Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
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 like the code!
But I know how I'd love it.
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: joshuaunity <[email protected]>
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.
This is working pretty sweet now.
Just a few comments, and one serious (but easily fixable) bug.
A question about sensor search: you use pagination, but if the sensor one wants is not on the first page, there is no way to get to the second page.
I don't believe we should add pagination here right now. Maybe we should remove the pagination for now?
Also, there is no way to do a search without entering a keyword or unit. Maybe we could start the dialogue with an initial complete search?
col.classList.add("col-12", "mb-1"); | ||
|
||
const sensorsUnits = []; | ||
const newItem = { |
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.
Please add a comment here, because a reader might not know why you do this. I believe you are handling both newer and older formats of sensors_to_show data here, right?
Should we still make an issue for the API always returning the latest format, as we discussed?
<label for="sensors_to_show" class="col-sm-6 control-label">Sensor Graphs: </label> | ||
|
||
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#sensorsToShowForm"> | ||
Edit Graph |
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.
Actually, "Edit Graphs"
</div> | ||
|
||
<div class="col-4"> | ||
<select class="form-select" aria-label="Default select example" |
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 one of the last commits, you removed id="unitsSelect"
from this select
tag, which stopped the sensor search from working. Adding it back fixed it for me.
So please add it back :)
</div> | ||
|
||
<div class="col-4"> | ||
<select class="form-select" aria-label="Default select example" |
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 guess "Default select example" does not need to be here?
</div> | ||
<h5 class="card-title pt-2"><b> Sensors: </b></h5> | ||
<div> | ||
${sensorsContent.length > 0 ? sensorsContent.join("") : "<i>Add sensors on the right side</i>"} |
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.
As without sensors, the graph is not shown, this should also be rendered in yellow (as the warning about differing units)
<button class="btn btn-danger btn-sm me-2" onclick="removeGraph(${index})">Remove</button> | ||
<button class="btn btn-secondary btn-sm me-2" onclick="moveGraphUp(${index})" ${index === 0 ? "disabled" : ""}>Move Up</button> | ||
<button class="btn btn-secondary btn-sm" onclick="moveGraphDown(${index})" ${index === data.length - 1 ? "disabled" : ""}>Move Down</button> |
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.
This does not work perfectly yet.
- I have three graphs.
- The second graph cannot move down, even if it is not last.
- I move the first downwards (to 2nd position), then it has the same problem.
sensorsUnits.push(sensorData.unit); | ||
|
||
return ` | ||
<div class="p-1 mb-3 border-bottom border-secondary"> |
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 find it visually a bit confusing that this "X" icon is top of the span
. It sits almost within the text, so the second row of text can be mistaken as a different thing, especially if there is only one sensor.
I could improve it by adding it as first element to the div
and adding float: right;
- but maybe you have a better idea.
Description
This PR introduces a feature that allows the
sensors_to_show
data for an asset to be edited directly from the UI via a form. This enhances the user experience by eliminating the need to modify the JSON directly.Look & Feel
How to test
edit asset
modal on the left side of the screenedit graph
Further Improvements
None
Related Items
This PR closes #1076