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

136 Sort explorer objects by name #141

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
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
14 changes: 7 additions & 7 deletions src/providers/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getSources(schema: String): Promise<Array<Node>> {
const sources: Promise<Array<Node>> = new Promise((res, rej) => {
this.query("SELECT id, name, owner_id FROM mz_sources WHERE schema_id = $1", [schema]).then((results) => {
this.query("SELECT id, name, owner_id FROM mz_sources WHERE schema_id = $1 ORDER BY name", [schema]).then((results) => {
let sources = results.map(({ id, name, owner_id: ownerId }) => {
return new View(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -176,7 +176,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getSinks(schema: String): Promise<Array<Node>> {
const sinks: Promise<Array<Node>> = new Promise((res, rej) => {
this.query("SELECT id, name, owner_id FROM mz_sinks WHERE schema_id = $1", [schema]).then((results) => {
this.query("SELECT id, name, owner_id FROM mz_sinks WHERE schema_id = $1 ORDER BY name", [schema]).then((results) => {
let sinks = results.map(({ id, name, owner_id: ownerId }) => {
return new View(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -189,7 +189,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getViews(schema: String): Promise<Array<Node>> {
const views: Promise<Array<Node>> = new Promise((res, rej) => {
this.query("SELECT id, name, owner_id FROM mz_views WHERE schema_id = $1", [schema]).then((results) => {
this.query("SELECT id, name, owner_id FROM mz_views WHERE schema_id = $1 ORDER BY name", [schema]).then((results) => {
let views = results.map(({ id, name, owner_id: ownerId }) => {
return new View(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -202,7 +202,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getMaterializedViews(schema: String): Promise<Array<Node>> {
const materializedViews: Promise<Array<Node>> = new Promise((res, rej) => {
this.query("SELECT id, name, owner_id, cluster_id FROM mz_materialized_views WHERE schema_id = $1", [schema]).then((results) => {
this.query("SELECT id, name, owner_id, cluster_id FROM mz_materialized_views WHERE schema_id = $1 ORDER BY name", [schema]).then((results) => {
let materializedViews = results.map(({ id, name, owner_id: ownerId }) => {
return new MaterializedView(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -215,7 +215,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getTables(schema: String): Promise<Array<Node>> {
const tables: Promise<Array<Node>> = new Promise((res, rej) => {
this.query("SELECT id, name, owner_id FROM mz_tables WHERE schema_id = $1", [schema]).then((results) => {
this.query("SELECT id, name, owner_id FROM mz_tables WHERE schema_id = $1 ORDER BY name", [schema]).then((results) => {
let tables = results.map(({ id, name, owner_id: ownerId }) => {
return new Table(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -228,7 +228,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getSchemas(database: String): Promise<Array<Schema>> {
return new Promise((res, rej) => {
this.query("SELECT id, name, database_id, owner_id FROM mz_schemas WHERE database_id = $1", [database]).then((results) => {
this.query("SELECT id, name, database_id, owner_id FROM mz_schemas WHERE database_id = $1 ORDER BY name", [database]).then((results) => {
const schemas = results.map(({ id, name, owner_id: ownerId }) => {
return new Schema(name, vscode.TreeItemCollapsibleState.Collapsed, { id, name, ownerId });
});
Expand All @@ -239,7 +239,7 @@ export default class DatabaseTreeProvider implements vscode.TreeDataProvider<Nod

private async getColumns(id: String): Promise<Array<Column>> {
return new Promise((res, rej) => {
this.query("SELECT name, type FROM mz_columns WHERE id = $1", [id]).then((results) => {
this.query("SELECT name, type FROM mz_columns WHERE id = $1 ORDER BY name", [id]).then((results) => {
const columns = results.map(({ name, type }) => {
return new Column(name, vscode.TreeItemCollapsibleState.None, { id: name, type });
});
Expand Down