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

More flexible widgets grid (allow finer control over height/width) #335

Closed
advance512 opened this issue Nov 9, 2014 · 12 comments
Closed
Labels

Comments

@advance512
Copy link

advance512 commented Nov 9, 2014

User should be able to control widget's placement, width and height

Current implementation

Currently editing a dashboard works as follow:

  1. When adding a widget you select its width: regular (half width) or double (full width). Height is set based on the content.
  2. When opening the "Edit Dashboard" dialog, you can rearrange the order of the widgets.

Edit Dashboard Dialog

Issues with the current approach:

  • You can't change widget size after placing it.
  • You can't change widget's height.
  • You can't control widget's width beyond the current two options.

Solution

To solve this we want to have a flexible (but still responsive) grid that the user can freely place and move widgets on.

  • Each visualization will define minimum width and height sizes (derived from the visualization type). This will be the default sizes for the widget when placed on the grid, but the user will be able to resize it to be larger (but not smaller) afterwards.
  • Once entering dashboard "edit mode", the user will be able to move around and resize the widgets in place instead of a dedicated UI.
  • We should probably change other behaviors in the UI (move add widget to be part of the edit mode, change dashboard title editing to be in place, etc), but we will leave it to second iteration after the grid behavior is implemented.

Technical Notes

  • We currently use angular-gridster to allow moving around the widgets in the Edit Dashboard dialog. Maybe we can use it for the grid or a similar library.
  • Currently the widget knows nothing about its placement, but only its size (width). The dashboard has a layout property, which is an array of arrays of widgets ids (each item in the array is a row/array of widgets). This is error prone and makes layout changes harder. If possible, it will be better if each widget retains its own placement information.
  • The API to update a widget currently supports only updating a textbox widget. We will need to extend it to support all widget types.
@arikfr arikfr changed the title Allow create Tall widgets and Double Tall widgets More flexible widgets grid (allow finer control over height/width) Nov 9, 2014
@arikfr
Copy link
Member

arikfr commented Nov 9, 2014

Related: #158

@arikfr arikfr added the Frontend label Nov 9, 2014
@arikfr
Copy link
Member

arikfr commented May 1, 2016

@pdfforge
Copy link

This is open for some time now, any plans on implementing this? We would love it!

@arikfr
Copy link
Member

arikfr commented Oct 1, 2017

As this feature is going to be implemented soon, I've updated the details. Feel free to comment.

@kravets-levko
Copy link
Collaborator

kravets-levko commented Oct 29, 2017

@arikfr Arik, I need your help with this issue. I implemented dashboard using angular-gridster, it works and looks nice, but I cannot save positions of widgets. I decided to use option property of widget to store size/position, but seems that it's not saved into database. I tried to look into backend code, but as far as I understand - it should just work, I didn't notice any special processing of options - it's just JSON-encoded/decoded and stored to DB. Do you have any idea what may be wrong?

P.S. I already pushed my code - so you can take a look if needed.

@arikfr
Copy link
Member

arikfr commented Oct 29, 2017

@kravets-levko cool! will take a look now. It's the dashboard-editor branch?

@kravets-levko
Copy link
Collaborator

kravets-levko commented Oct 29, 2017

@arikfr Yes. Thanks! I need to implement some minor things before it will be ready, but it would not make any sense while it's not saving data

@arikfr
Copy link
Member

arikfr commented Oct 29, 2017

@kravets-levko the WidgetResource.post handler was written to handle only text box widget updates, so it ignores all other fields. You can add the following line:

widget.options = json.dumps(widget_properties['options'])

Below this line:

widget.text = widget_properties['text']
.

When I did it, it still didn't work as expected, but I did see that it stores the values, so the issue is probably elsewhere.

If you open a pull request from your branch, I'll be able to commit this change (and future needed backend changes) directly to your branch.

@arikfr
Copy link
Member

arikfr commented Oct 29, 2017

I now realize that you're using demo.redash.io to test this. I will update it to have this change as well.

(Update: done)

@kravets-levko
Copy link
Collaborator

@arikfr I created PR, but don't merge it for now - I'll ping you when it will be ready. Another thing that I need to ask you - about defaults. Currently I set dashboard to have 3 columns (we can set any, it's up to you), and default dimensions for widgets are initialized from width/height (does not exist currently). As I understand, we should make some changes to backend so it will return default dimensions for widgets. So I'd like to talk about it, if it's possible.

@kravets-levko
Copy link
Collaborator

BTW - will you update demo.redash.io now or after merging my PR?

@arikfr
Copy link
Member

arikfr commented Oct 29, 2017

I updated demo.redash.io only with the API change.

I will answer the rest of the questions in the PR, to avoid spamming all the people subscribed to this issue :)

vabanin added a commit to vabanin/redash that referenced this issue Nov 13, 2017
* 'master' of https://github.com/getredash/redash: (95 commits)
  CR3
  In editing mode hide menu button and show remove button instead
  Fix: widget menu not visible on small widgets
  Fix widget auto-height behaviour
  Cleanup CSS
  CR2
  CR1
  getredash#335 Better dashboard editor
  CirlceCI: Docker build for release branches.
  Redshift: change default SSL mode to prefer.
  Update v3 CHANGELOG.
  Add Query Results to the default query runners list.
  Add: data source to run queries on top of query results.
  Fix getredash#1824: allow only user API key to be used with query refresh API.
  Disable fork button for those can't fork
  Fix: require full access to the data source to fork a query.
  Remove unused variables
  Fix getredash#1979: API key of one query could be used to get results of another one
  Copy parameters value when forking a query
  Save only the query id instead of query id and name
  ...
dairyo pushed a commit to KiiCorp/redash that referenced this issue Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants