sqlitebrowser / dbhub.io

A "Cloud" for SQLite databases. Collaborative development for your data. 😊
https://dbhub.io
GNU Affero General Public License v3.0
372 stars 39 forks source link

Request: Add "View" view #93

Closed mercury233 closed 1 year ago

mercury233 commented 7 years ago

Now my database is hard to read in page because it have too much columns. image

Can we use the "View" feature of sqlite to make it easier to read? image

justinclift commented 7 years ago

Ahhh, that's a good idea.

If you're ok to email me or upload a database with an example view, I'll take some time today to try and get that working. :smile:

mercury233 commented 7 years ago

https://db4s-beta.dbhub.io/mercury233/pre-release.cdb?branch=master&commit=da7d5c38f724aea786ce3cc494f3305644c03c714ad6ca8f6537b7d6150e812c is uploaded

justinclift commented 7 years ago

Thanks, got it. :smile:

justinclift commented 7 years ago

@mercury233 It should work now. :smile:

    https://db4s-beta.dbhub.io/mercury233/pre-release.cdb

justinclift commented 7 years ago

Note - it's only a first attempt (in ba3054273c7a573cebffa35fcaccc89569d9cd24), but it should function ok. Most of the wording in the UI that says "Table" or "Tables" will probably need changing to be "Table/View" or "Tables/Views"... but that can come later. :smile:

mercury233 commented 7 years ago

I've updated the database, but the view don't update when i refresh the page, unless I select the view in list again. image image

BTW, I think there should be an option to make texts render as raw text, so the line breaks will work. And I'm glad to see the XSS filter works well

justinclift commented 7 years ago

I've updated the database, but the view don't update when i refresh the page, unless I select the view in list again.

Oh. That's means there's a bug in the way we're pulling data out of cache. I can disable the cache for now to "make it work", but I'll need to investigate in more depth to find out a proper solution. I'll get that disabling done in a few minutes.

Also, I changed the display so it doesn't force all of the columns to the same width. Now desc should take up the most room on the page. I'm not sure if that's better or not... if you don't like it, let me know and I'll change it back. :smile:

justinclift commented 7 years ago

Ahhh... actually I know what the problem is. At the moment when a database is uploaded using DB4S, memcache doesn't get told about it so uses old data.

Working on a fix now. :smile:

mercury233 commented 7 years ago

It looks much better now, thanks! what about custom css

justinclift commented 7 years ago

Custom CSS?

I need more details. :smile:

mercury233 commented 7 years ago

Yes, so I can decide how wide the second column should be, and more.

justinclift commented 7 years ago

Hmmm, it's a good suggestion, but I think it would be difficult to implement at the moment.

We'd probably need to add some kind of form or field or "something" :wink: to the settings page, which lets a person pick settings for displaying their tables/views. That's probably a few days worth of development time.

Unless I am making it more complicated than it needs to be? If there's a simpler way, I'm open to suggestions. :smile:

justinclift commented 7 years ago

@mercury233 Sort and paging now work for views too. eg clicking on a column header, or the arrows to go up/down/etc.

mercury233 commented 7 years ago
.table>thead>tr>th:nth-child(2) {
    width: 20em;
}
.table>tbody>tr>td:nth-child(3) {
    font-size: 12px;
}

I guess one field to post CSS like this, and one class for the main table, should be enough for me.

mercury233 commented 7 years ago

Anyway, custom css can change the page entirely, and will have much security problem, so it is just a idea...

justinclift commented 7 years ago

Ahhh. That's probably do-able, but not today. :smile:

You're right we need to be careful with it. The code we use for stripping out potential XSS (and similar) is "bluemonday". We configure it with a few slightly custom rules so it doesn't strip out AngularJS tags from tables.

At a guess, we'll need to work out what "acceptable" custom CSS should be, then update our bluemonday configuration to allow that too. In theory that would work without opening up security problems. :smile:

chrisjlocke commented 7 years ago

Isn't that what codeMonkey or some development tools in a browswer can do? Adjust the CSS 'on the fly'?

justinclift commented 7 years ago

Sure, but this is a different thing. @mercury233's idea is to have some kind of thing in the settings page for a database which lets custom css be defined, and that gets sent out with the rest of the page when people view a database. Thus customised looking views.

The concept sounds both useful and decent. Implementing it could be a bit tricky, as we need to make sure that if people add dodgy custom CSS (eg for cross site scripting or whatever), that it doesn't work.

That means we need the server side part to recognise dodgy CSS and barf on it. Or at least have a white list of acceptable CSS and only accept that. Otherwise we end up serving up potentially malicious code... (!)

Browser side development tools don't really fit into that particular equation, apart from the person figuring out what css they want to include in the first place. And well... anyone that wants custom CSS (at first) will need to be familiar with it already. :smile:

justinclift commented 7 years ago

BTW, I think there should be an option to make texts render as raw text, so the line breaks will work.

Ahhh, I missed that. I'll investigate this today too. It should be possible. :smile:

justinclift commented 7 years ago

@mercury233 Line breaks should be displayed ok now. :smile:

justinclift commented 1 year ago

Closing this, as view support was added ages ago. :smile: