Skip to content

Commit

Permalink
Improve SQL queries (#314)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Alecaddd authored Apr 10, 2020
1 parent 2d2bb4e commit 2d5623d
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 81 deletions.
Binary file modified data/assets/screenshots/sequeler-screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/assets/screenshots/sequeler-screenshot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions data/com.github.alecaddd.sequeler.appdata.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
<binary>@appid@</binary>
</provides>
<releases>
<release version="0.7.6" date="2020-04-09">
<description>
<p>Query Tab Bonanza!</p>
<ul>
<li>Fix ORDER BY in PostgreSQL Relationship view.</li>
<li>Improve MySQL structure view.</li>
<li>Drop Granite.Settings in favor of GLib.Settings.</li>
<li>Implement Granite.Notebook on the Query tab.</li>
<li>Show query error messages inline.</li>
</ul>
</description>
</release>
<release version="0.7.5" date="2020-04-04">
<description>
<p>New features and improvements</p>
Expand Down Expand Up @@ -418,6 +430,9 @@
<screenshot>
<image>https://raw.githubusercontent.com/Alecaddd/sequeler/master/data/assets/screenshots/sequeler-screenshot3.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/Alecaddd/sequeler/master/data/assets/screenshots/sequeler-screenshot4.png</image>
</screenshot>
</screenshots>
<developer_name>Alessandro Castellani</developer_name>
<launchable type="desktop-id">@[email protected]</launchable>
Expand Down
10 changes: 10 additions & 0 deletions data/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ infobar.inline revealer > box {
background: #fff;
color: #000;
}

.query-error {
background-color: alpha (@STRAWBERRY_300, 0.2);
border: 1px solid @STRAWBERRY_500;
border-radius: 4px;
}

button.notebook-temp-fix image {
color: @selected_fg_color;
}
12 changes: 11 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
com.github.alecaddd.sequeler (0.7.6) xenial; urgency=medium

* Fix ORDER BY in PostgreSQL Relationship view.
* Improve MySQL structure view.
* Drop Granite.Settings in favor of GLib.Settings.
* Implement Granite.Notebook on the Query tab.
* Show query error messages inline.

-- Alessandro Castellani <[email protected]> Thu, 09 Apr 2020 11:00:00 -0700

com.github.alecaddd.sequeler (0.7.5) xenial; urgency=medium

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# project name and programming language
project('com.github.alecaddd.sequeler', 'vala', 'c',
version: '0.7.5')
version: '0.7.6')

cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: true)
Expand Down
74 changes: 64 additions & 10 deletions src/Layouts/DataBaseView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {
public Sequeler.Layouts.Views.Structure structure;
public Sequeler.Layouts.Views.Content content;
public Sequeler.Layouts.Views.Relations relations;
public Sequeler.Layouts.Views.Query query;
public Granite.Widgets.DynamicNotebook query;

private Sequeler.Layouts.Views.Query tab_to_restore;

public Gtk.MenuButton font_style;

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

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

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

view_options.add (font_style);

// Content View buttons
// Structure View buttons
// Relations View buttons

toolbar.attach (view_options, 1, 0, 1, 1);

stack = new Gtk.Stack ();
structure = new Sequeler.Layouts.Views.Structure (window);
content = new Sequeler.Layouts.Views.Content (window);
relations = new Sequeler.Layouts.Views.Relations (window);
query = new Sequeler.Layouts.Views.Query (window);
query = get_query_notebook ();

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

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

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

color_button_white.clicked.connect (() => {
Sequeler.settings.style_scheme = "classic";
query.update_color_style ();
(query.current.page as Layouts.Views.Query).update_color_style ();
});
}

private Granite.Widgets.DynamicNotebook get_query_notebook () {
var notebook = new Granite.Widgets.DynamicNotebook ();
notebook.add_button_tooltip = _("Create a new Query Tab");
notebook.expand = true;
notebook.allow_restoring = true;
notebook.max_restorable_tabs = 1;

var first_page = new Sequeler.Layouts.Views.Query (window);
var first_tab = new Granite.Widgets.Tab (
_("Query"), new ThemedIcon ("user-offline"), first_page
);
first_page.update_tab_indicator.connect ((status) => {
var icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
first_tab.icon = icon;
});
notebook.insert_tab (first_tab, 0);

notebook.new_tab_requested.connect (() => {
var new_page = new Sequeler.Layouts.Views.Query (window);
var new_tab = new Granite.Widgets.Tab (
_("Query %i").printf (notebook.n_tabs), new ThemedIcon ("user-offline"), new_page
);
new_page.update_tab_indicator.connect ((status) => {
var icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
new_tab.icon = icon;
});
notebook.insert_tab (new_tab, notebook.n_tabs - 1);
});

notebook.close_tab_requested.connect ((tab) => {
if (notebook.n_tabs == 1) {
var new_page = new Sequeler.Layouts.Views.Query (window);
var new_tab = new Granite.Widgets.Tab (
_("Query"), new ThemedIcon ("user-offline"), new_page
);
notebook.insert_tab (new_tab, notebook.n_tabs - 1);
}
tab_to_restore = tab.page as Sequeler.Layouts.Views.Query;
tab.restore_data = tab.label;
return true;
});

notebook.tab_restored.connect ((label, data, icon) => {
var tab = new Granite.Widgets.Tab (label, icon, tab_to_restore);
tab_to_restore.update_tab_indicator.connect ((status) => {
var update_icon = status ? new ThemedIcon ("user-available") : new ThemedIcon ("dialog-error");
tab.icon = update_icon;
});
notebook.insert_tab (tab, notebook.n_tabs - 1);
});

return notebook;
}
}
Loading

0 comments on commit 2d5623d

Please sign in to comment.