Skip to content

Commit 2d5623d

Browse files
authored
Improve SQL queries (#314)
* Testing posgresql contstraint query * Fix postgrasql relationship query * Improve MySQL structure query * Drop Granite.Settings in favor of GLib.Settings * Init action manager earlier, fix zoom button state * Initial implementation of the Granite Notebook * Limit the restorable Tabs to 1 * Add temp fix for gtk iamge button * Update tab indicator on query run * Enable silent error handling of query results * Show error message inline the query tab * Handle query errors per tab * Update version * Update screenshots
1 parent 2d2bb4e commit 2d5623d

14 files changed

+311
-81
lines changed
-71.2 KB
Loading
94.5 KB
Loading

data/com.github.alecaddd.sequeler.appdata.xml.in.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
<binary>@appid@</binary>
3838
</provides>
3939
<releases>
40+
<release version="0.7.6" date="2020-04-09">
41+
<description>
42+
<p>Query Tab Bonanza!</p>
43+
<ul>
44+
<li>Fix ORDER BY in PostgreSQL Relationship view.</li>
45+
<li>Improve MySQL structure view.</li>
46+
<li>Drop Granite.Settings in favor of GLib.Settings.</li>
47+
<li>Implement Granite.Notebook on the Query tab.</li>
48+
<li>Show query error messages inline.</li>
49+
</ul>
50+
</description>
51+
</release>
4052
<release version="0.7.5" date="2020-04-04">
4153
<description>
4254
<p>New features and improvements</p>
@@ -418,6 +430,9 @@
418430
<screenshot>
419431
<image>https://raw.githubusercontent.com/Alecaddd/sequeler/master/data/assets/screenshots/sequeler-screenshot3.png</image>
420432
</screenshot>
433+
<screenshot>
434+
<image>https://raw.githubusercontent.com/Alecaddd/sequeler/master/data/assets/screenshots/sequeler-screenshot4.png</image>
435+
</screenshot>
421436
</screenshots>
422437
<developer_name>Alessandro Castellani</developer_name>
423438
<launchable type="desktop-id">@[email protected]</launchable>

data/stylesheet.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,13 @@ infobar.inline revealer > box {
115115
background: #fff;
116116
color: #000;
117117
}
118+
119+
.query-error {
120+
background-color: alpha (@STRAWBERRY_300, 0.2);
121+
border: 1px solid @STRAWBERRY_500;
122+
border-radius: 4px;
123+
}
124+
125+
button.notebook-temp-fix image {
126+
color: @selected_fg_color;
127+
}

debian/changelog

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
com.github.alecaddd.sequeler (0.7.6) xenial; urgency=medium
2+
3+
* Fix ORDER BY in PostgreSQL Relationship view.
4+
* Improve MySQL structure view.
5+
* Drop Granite.Settings in favor of GLib.Settings.
6+
* Implement Granite.Notebook on the Query tab.
7+
* Show query error messages inline.
8+
9+
-- Alessandro Castellani <[email protected]> Thu, 09 Apr 2020 11:00:00 -0700
10+
111
com.github.alecaddd.sequeler (0.7.5) xenial; urgency=medium
212

313
* You can now duplicate connections.
414
* Sorting columns now works as expected by actually running the ORDER BY query.
515
* Quickly jump to a specific result page with the handy dandy pagination popover.
616
* Show Comment Column inside table structure view.
717

8-
-- Alessandro Castellani <[email protected]> Thu, 04 Apr 2020 11:00:00 -0700
18+
-- Alessandro Castellani <[email protected]> Sat, 04 Apr 2020 11:00:00 -0700
919

1020
com.github.alecaddd.sequeler (0.7.4) xenial; urgency=medium
1121

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# project name and programming language
22
project('com.github.alecaddd.sequeler', 'vala', 'c',
3-
version: '0.7.5')
3+
version: '0.7.6')
44

55
cc = meson.get_compiler('c')
66
m_dep = cc.find_library('m', required: true)

src/Layouts/DataBaseView.vala

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {
2727
public Sequeler.Layouts.Views.Structure structure;
2828
public Sequeler.Layouts.Views.Content content;
2929
public Sequeler.Layouts.Views.Relations relations;
30-
public Sequeler.Layouts.Views.Query query;
30+
public Granite.Widgets.DynamicNotebook query;
31+
32+
private Sequeler.Layouts.Views.Query tab_to_restore;
3133

3234
public Gtk.MenuButton font_style;
3335

@@ -98,7 +100,9 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {
98100
zoom_out_button.action_name = Sequeler.Services.ActionManager.ACTION_PREFIX + Sequeler.Services.ActionManager.ACTION_ZOOM_OUT;
99101
zoom_out_button.tooltip_markup = Granite.markup_accel_tooltip ({"<Control>minus"}, _("Zoom Out"));
100102

101-
var zoom_default_button = new Gtk.Button.with_label ("100%");
103+
var zoom_default_button = new Gtk.Button.with_label (
104+
"%.0f%%".printf (window.action_manager.get_current_font_size () * 10)
105+
);
102106
zoom_default_button.action_name = Sequeler.Services.ActionManager.ACTION_PREFIX + Sequeler.Services.ActionManager.ACTION_ZOOM_DEFAULT;
103107
zoom_default_button.tooltip_markup = Granite.markup_accel_tooltip ({"<Control>0"}, _("Zoom 1:1"));
104108

@@ -164,17 +168,13 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {
164168

165169
view_options.add (font_style);
166170

167-
// Content View buttons
168-
// Structure View buttons
169-
// Relations View buttons
170-
171171
toolbar.attach (view_options, 1, 0, 1, 1);
172172

173173
stack = new Gtk.Stack ();
174174
structure = new Sequeler.Layouts.Views.Structure (window);
175175
content = new Sequeler.Layouts.Views.Content (window);
176176
relations = new Sequeler.Layouts.Views.Relations (window);
177-
query = new Sequeler.Layouts.Views.Query (window);
177+
query = get_query_notebook ();
178178

179179
stack.add_named (structure, "Structure");
180180
stack.add_named (content, "Content");
@@ -203,17 +203,71 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {
203203

204204
color_button_dark.clicked.connect (() => {
205205
Sequeler.settings.style_scheme = "solarized-dark";
206-
query.update_color_style ();
206+
(query.current.page as Layouts.Views.Query).update_color_style ();
207207
});
208208

209209
color_button_light.clicked.connect (() => {
210210
Sequeler.settings.style_scheme = "solarized-light";
211-
query.update_color_style ();
211+
(query.current.page as Layouts.Views.Query).update_color_style ();
212212
});
213213

214214
color_button_white.clicked.connect (() => {
215215
Sequeler.settings.style_scheme = "classic";
216-
query.update_color_style ();
216+
(query.current.page as Layouts.Views.Query).update_color_style ();
217+
});
218+
}
219+
220+
private Granite.Widgets.DynamicNotebook get_query_notebook () {
221+
var notebook = new Granite.Widgets.DynamicNotebook ();
222+
notebook.add_button_tooltip = _("Create a new Query Tab");
223+
notebook.expand = true;
224+
notebook.allow_restoring = true;
225+
notebook.max_restorable_tabs = 1;
226+
227+
var first_page = new Sequeler.Layouts.Views.Query (window);
228+
var first_tab = new Granite.Widgets.Tab (
229+
_("Query"), new ThemedIcon ("user-offline"), first_page
230+
);
231+
first_page.update_tab_indicator.connect ((status) => {
232+
var icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
233+
first_tab.icon = icon;
217234
});
235+
notebook.insert_tab (first_tab, 0);
236+
237+
notebook.new_tab_requested.connect (() => {
238+
var new_page = new Sequeler.Layouts.Views.Query (window);
239+
var new_tab = new Granite.Widgets.Tab (
240+
_("Query %i").printf (notebook.n_tabs), new ThemedIcon ("user-offline"), new_page
241+
);
242+
new_page.update_tab_indicator.connect ((status) => {
243+
var icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
244+
new_tab.icon = icon;
245+
});
246+
notebook.insert_tab (new_tab, notebook.n_tabs - 1);
247+
});
248+
249+
notebook.close_tab_requested.connect ((tab) => {
250+
if (notebook.n_tabs == 1) {
251+
var new_page = new Sequeler.Layouts.Views.Query (window);
252+
var new_tab = new Granite.Widgets.Tab (
253+
_("Query"), new ThemedIcon ("user-offline"), new_page
254+
);
255+
notebook.insert_tab (new_tab, notebook.n_tabs - 1);
256+
}
257+
tab_to_restore = tab.page as Sequeler.Layouts.Views.Query;
258+
tab.restore_data = tab.label;
259+
return true;
260+
});
261+
262+
notebook.tab_restored.connect ((label, data, icon) => {
263+
var tab = new Granite.Widgets.Tab (label, icon, tab_to_restore);
264+
tab_to_restore.update_tab_indicator.connect ((status) => {
265+
var update_icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
266+
tab.icon = update_icon;
267+
});
268+
notebook.insert_tab (tab, notebook.n_tabs - 1);
269+
});
270+
271+
return notebook;
218272
}
219273
}

0 commit comments

Comments
 (0)