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

feat(postgres): improve wing console ui #238

Merged
merged 4 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions containers/api.w
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ pub struct ContainerOpts {

pub struct WorkloadProps extends ContainerOpts {

}

pub interface IWorkload {

}
12 changes: 8 additions & 4 deletions postgres/lib.w
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,19 @@ pub class Database {
let sim = new DatabaseSim(props);
this.connection = sim.connection;
this.inner = sim;
new ui.ValueField("Port", sim.port) as "port";

new ui.Field("Connection", inflight () => {
return "postgresql://{sim.connection.user}:{sim.connection.password}@localhost:{sim.port}/{sim.connection.database}";
}, link: true) as "connection";

nodeof(sim).hidden = true;
} elif target == "tf-aws" {
let tfawsParams = RequiredTFAwsProps.fromJson(app.parameters.read(schema: RequiredTFAwsProps.schema()));
if tfawsParams.postgresEngine == "rds" {
let aurora = new DatabaseRDS(props);
this.connection = aurora.connection;
this.inner = aurora;

} elif tfawsParams.postgresEngine == "neon" {
let neon = new DatabaseNeon(props);
this.connection = neon.connection;
Expand Down Expand Up @@ -284,7 +290,7 @@ class DatabaseRDS impl IDatabase {
}

class DatabaseSim impl IDatabase {
port: str;
pub port: str;

pub connection: ConnectionOptions;

Expand Down Expand Up @@ -323,8 +329,6 @@ class DatabaseSim impl IDatabase {
port: this.port,
ssl: false,
};

new ui.ValueField("Postgres Port", this.port);
}

pub inflight connectionOptions(): ConnectionOptions {
Expand Down
4 changes: 2 additions & 2 deletions postgres/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/postgres",
"version": "0.1.5",
"version": "0.1.6",
"description": "Postgres support for Wing",
"repository": {
"type": "git",
Expand Down
Loading