Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from ppvan/dev
Browse files Browse the repository at this point in the history
Work on new feature
  • Loading branch information
ppvan authored May 19, 2024
2 parents 0c3d478 + 9daa7f9 commit 9758ae5
Show file tree
Hide file tree
Showing 42 changed files with 1,607 additions and 512 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export

/build-aux

*.dot
*.flatpak
*.dot
me.ppvan.psequel.flatpak
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# This is just a file for me to type command faster, not the build file.

debug:
ninja -C build/ && G_MESSAGES_DEBUG=Psequel ./build/src/me.ppvan.psequel
rm -rf build/resources/gtk
ninja -C build/ && G_MESSAGES_DEBUG=Psequel ./build/src/psequel

clean:
rm -rf build/res
rm -rf build/resources

test:
ninja -C build/ && ./build/test/psequel-test

flatpak:
flatpak-builder build-aux/ me.ppvan.psequel.json --force-clean
flatpak-builder --install-deps-from=flathub build-aux/ me.ppvan.psequel.json --force-clean
flatpak build-export export build-aux
flatpak build-bundle export me.ppvan.psequel.flatpak --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
flatpak build-bundle export me.ppvan.psequel.flatpak me.ppvan.psequel --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

run:
G_MESSAGES_DEBUG=Psequel ./build/src/me.ppvan.psequel
G_MESSAGES_DEBUG=Psequel ./build/src/psequel
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,26 @@ If you use GNOME Builder or Flatpak, dependencies will be installed automaticall
- gio >= 2.74
- json-glib >= 1.6
- libadwaita >= 1.4
- postgres-libs >= 16.2
- libcsv >= 3.0
- postgres-libs >= 15.3
- libcsv >= 3.0 (built as subproject if missing)
- pgquery-vala

```
pg_dump -s --no-comments -t "actor" -O -x --dbname "user=postgres password=postgres port=5432 dbname=dvdrental"| grep -v '^$' | grep -v '^(--\s*|SET\s+\w+\s*=).*$'
SELECT pg_catalog.set_config('search_path', '', false);
CREATE TABLE public.actor (
actor_id integer DEFAULT nextval('public.actor_actor_id_seq'::regclass) NOT NULL,
first_name character varying(45) NOT NULL,
last_name character varying(45) NOT NULL,
last_update timestamp without time zone DEFAULT now() NOT NULL
);
ALTER TABLE ONLY public.actor
ADD CONSTRAINT actor_pkey PRIMARY KEY (actor_id);
CREATE INDEX idx_actor_last_name ON public.actor USING btree (last_name);
CREATE TRIGGER last_updated BEFORE UPDATE ON public.actor FOR EACH ROW EXECUTE FUNCTION public.last_updated();
```


# Contributions
Contributions are welcome.
Expand Down
Binary file added me.ppvan.psequel.flatpak
Binary file not shown.
5 changes: 3 additions & 2 deletions me.ppvan.psequel.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app-id": "me.ppvan.psequel",
"runtime": "org.gnome.Platform",
"runtime-version": "45",
"runtime-version": "46",
"sdk": "org.gnome.Sdk",
"command": "psequel",
"finish-args": [
Expand Down Expand Up @@ -58,7 +58,8 @@
"build-commands": [
"./configure --prefix=/app --with-ssl=openssl",
"make -C src/include install",
"make -C src/interfaces/libpq install"
"make -C src/interfaces/libpq install",
"make -C src/bin/pg_dump install"
],
"sources": [
{
Expand Down
84 changes: 84 additions & 0 deletions resources/gtk/backup-dialog.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using Gtk 4.0;
using Adw 1;

template $PsequelBackupDialog: Adw.Dialog {
follows-content-size: true;
title: _("Back up database");
presentation-mode: floating;

styles [
"backup-dialog"
]

child: Adw.ToolbarView {
width-request: 600;

[top]
Adw.HeaderBar {}

content: Adw.Clamp {
maximum-size: 540;
margin-top: 16;

child: Box {
orientation: vertical;

Box {
orientation: vertical;
spacing: 16;

ListBox {
styles [
"boxed-list"
]

selection-mode: none;

Adw.ComboRow database_row {
title: _("Database");
subtitle: _("Database to backup");
model: bind template.viewmodel as <$PsequelConnectionViewModel>.connections;
}

Adw.ComboRow format_row {
title: _("Format");
subtitle: _("Output file format");
model: bind template.formats;
}

Adw.ComboRow section_row {
title: _("Export section");
subtitle: _("Export schema-only, data-only or both");
model: bind template.sections;
}

Adw.SwitchRow {
title: _("Override old schema");
subtitle: _("Output DROP than CREATE");
active: bind template.clean bidirectional;
}

Adw.SwitchRow {
title: _("Create database");
subtitle: _("Add CREATE DATABASE in output");
active: bind template.create bidirectional;
}
}

Gtk.Button run_button {
styles [
"suggested-action"
]

halign: end;
margin-bottom: 20;
label: _("_Back up");
valign: end;
use-underline: true;
clicked => $on_do_backup_click();
}
}
};
};
};
}
31 changes: 19 additions & 12 deletions resources/gtk/connection-view.blp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ menu primary_menu {

section {
item {
label: _("_Import");
label: _("_Back up database");
action: "win.backup";
}

item {
label: _("_Restore database");
action: "win.restore";
}
}

section {
item {
label: _("_Import connections");
action: "win.import";
}

item {
label: _("_Export");
label: _("_Export connections");
action: "win.export";
}
}
Expand Down Expand Up @@ -165,7 +177,7 @@ template $PsequelConnectionView: Adw.Bin {
valign: start;
hexpand: true;
vexpand: true;
maximum-size: 700;
maximum-size: 800;

child: Box {
orientation: vertical;
Expand Down Expand Up @@ -361,30 +373,29 @@ template $PsequelConnectionView: Adw.Bin {
activate => $on_switch_changed();
}
}

layout {
row: 5;
column: 3;
}
}

Box {

visible: bind ssl_switch.active;
orientation: vertical;

Entry cert_path {
editable: false;
can-focus: true;
placeholder-text: "SSL certificate-path";
primary-icon-name: "application-certificate-symbolic";
secondary-icon-name: "filemanager-app-symbolic";

icon-release => $on_cert_file_chooser();
secondary-icon-activatable: true;
changed => $on_text_changed();
activate => $on_cert_entry_activate();
}


layout {
row: 5;
column: 4;
Expand All @@ -397,12 +408,8 @@ template $PsequelConnectionView: Adw.Bin {
Box {
margin-top: 20;
margin-bottom: 10;

Label status_label {
label: "";
halign: start;
hexpand: true;
}
halign: end;
vexpand: true;

Box {
spacing: 8;
Expand Down
2 changes: 2 additions & 0 deletions resources/gtk/icons/copy-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions resources/gtk/restore-dialog.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using Gtk 4.0;
using Adw 1;

template $PsequelRestoreDialog: Adw.Dialog {
follows-content-size: true;
title: _("Restore database");
presentation-mode: floating;

styles [
"backup-dialog"
]

child: Adw.ToolbarView {
width-request: 600;

[top]
Adw.HeaderBar {}

content: Adw.Clamp {
maximum-size: 540;
margin-top: 16;

child: Box {
orientation: vertical;

Box {
orientation: vertical;
spacing: 16;

ListBox {
styles [
"boxed-list"
]

selection-mode: none;

Adw.ComboRow database_row {
title: _("Database");
subtitle: _("Database to restore");
model: bind template.viewmodel as <$PsequelConnectionViewModel>.connections;
}

Adw.ComboRow format_row {
title: _("Format");
subtitle: _("Input file format");
model: bind template.formats;
}

Adw.ComboRow section_row {
title: _("Restore section");
subtitle: _("Restore schema-only, data-only or both");
model: bind template.sections;
}

Adw.SwitchRow {
title: _("Override old schema");
subtitle: _("DROP old tables before restore");
active: bind template.clean bidirectional;
}

Adw.SwitchRow {
title: _("Create database");
subtitle: _("Add CREATE DATABASE before restore");
active: bind template.create bidirectional;
}
}

Gtk.Button run_button {
styles [
"suggested-action"
]

halign: end;
margin-bottom: 20;
label: _("Restore");
valign: end;
use-underline: true;
clicked => $on_do_restore_click();
}
}
};
};
};
}
19 changes: 17 additions & 2 deletions resources/gtk/schema-view.blp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ template $PsequelSchemaView: Adw.Bin {

Box {
spacing: 4;
margin-bottom: 2;
margin-bottom: 8;
margin-end: 2;
margin-start: 4;

Expand Down Expand Up @@ -382,7 +382,22 @@ template $PsequelSchemaView: Adw.Bin {
icon-name: "library-symbolic";
title: "Structure";

child: $PsequelTableGraph {};
child: Stack {
visible-child-name: bind template.view-mode;
transition-type: slide_left_right;

StackPage {
name: "table";

child: $PsequelTableStructureView {};
}

StackPage {
name: "view";

child: $PsequelViewStructureView {};
}
};
}

Adw.ViewStackPage {
Expand Down
Loading

0 comments on commit 9758ae5

Please sign in to comment.