Skip to content

Commit

Permalink
fixing data source column removal
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Apr 7, 2024
1 parent 779bf22 commit c9f4c07
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export abstract class DataTemplateComponent implements OnInit, OnDestroy {
return null;
}
const splits = route.split('.');

return catalog.getEntityFromName(splits[0], splits[1]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<c-navbar class="position-sticky w-100 z-3 border-bottom" expand="lg">
<c-container fluid>
<a [routerLink]="'/'" cNavbarBrand>
<img ngSrc="assets/img/brand/logo.svg" alt="Polypheny Logo" height="50" width="200">
<img ngSrc="assets/img/brand/logo.svg" priority alt="Polypheny Logo" height="50" width="200">
</a>
<div class="ms-auto justify-content-end me-3" #collapseRef="cCollapse" navbar cCollapse>
<c-navbar-nav>
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/catalog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export class CatalogService {
}

private updateSnapshot(snapshot: LogicalSnapshotModel) {
if (snapshot && (this.snapshot && this.snapshot.id === snapshot.id)) {
return;
}

this.snapshot = snapshot;

this.namespaces.set(this.toIdMap(snapshot.namespaces));
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/querying/console/console.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class ConsoleComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this._leftSidebar.close();
this.subscriptions.unsubscribe();
this.websocket.close();
this.websocket.close(); // closes the websocket to the information manager so cleanup info pages
this._breadcrumb.hide();
window.onbeforeunload = null;
window.onkeydown = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<c-row class="row">

<c-col class="col-lg-12">
<h5>{{getTitle()}}</h5>
<h5>{{ getTitle() }}</h5>
</c-col>

<c-col class="col-lg-12">
Expand All @@ -14,164 +14,172 @@ <h5>{{getTitle()}}</h5>
<th>Type</th>
<th>Collection</th>
<th>Parameters</th>
<th *ngIf="entity().entityType !== EntityType.VIEW ">Default</th>
<th class="small-col"></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let col of columns(); let i = index"
[ngClass]="{'editing': editingCol === col.name}">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>
<span *ngIf="editingCol !== col.name">{{ col.name }}</span>
<i *ngIf="editingCol !== col.name" class="cil-pencil rename ms-2"
(click)="editingCol = col.name"></i>
<c-input-group sizing="sm"
*ngIf="editingCol === col.name"
style="max-width: 200px">
<input type="text" cFormControl [placeholder]="col.name" autofocus
(keyup.enter)="renameColumn(columnNameInput, col, columnNameInput.value, entity().entityType)"
#columnNameInput>
@for (col of columns(); track col.id; let i = $index) {
<tr [ngClass]="{'editing': editingCol === col.name}">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>
<span *ngIf="editingCol !== col.name">{{ col.name }}</span>
<i *ngIf="editingCol !== col.name" class="cil-pencil rename ms-2"
(click)="editingCol = col.name"></i>
<c-input-group sizing="sm"
*ngIf="editingCol === col.name"
style="max-width: 200px">
<input type="text" cFormControl [placeholder]="col.name" autofocus
(keyup.enter)="renameColumn(columnNameInput, col, columnNameInput.value, entity().entityType)"
#columnNameInput>

<button cButton size="sm" color="primary"
[disabled]="!validTableName(columnNameInput.value)"
(click)="renameColumn(columnNameInput,col,columnNameInput.value,entity().entityType)">rename
</button>
<button cButton size="sm" color="primary"
[disabled]="!validTableName(columnNameInput.value)"
(click)="renameColumn(columnNameInput,col,columnNameInput.value,entity().entityType)">
rename
</button>

</c-input-group>
</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{col.dataType}}</td>
<td>{{col.collectionsType}}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{_types.precisionPlaceholder( col.dataType )}}
: {{col.precision}}</span>
<span class="parameter" *ngIf="col.scale">scale: {{col.scale}}</span>
<span class="parameter" *ngIf="col.dimension !== -1">dimension: {{col.dimension}}</span>
<span class="parameter" *ngIf="col.cardinality !== -1">cardinality: {{col.cardinality}}</span>
</td>
<td *ngIf="placements != null && entity()?.entityType !== EntityType.VIEW">{{col.defaultValue}}</td>
<th class="small-col">
<app-delete-confirm *ngIf="(placements != null && entity()?.entityType !== EntityType.VIEW)"
(delete)="dropColumn(col)"></app-delete-confirm>
</th>
</tr>
<tr *ngFor="let col of getAddableColumns() | async" class="hidden-col"
[ngClass]="{'editing': editingCol === col.name}">
<ng-container *ngIf="editingCol !== col.name">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>{{col.name}}</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{col.dataType}}</td>
<td>{{col.collectionsType}}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{_types.precisionPlaceholder( col.dataType )}}
: {{col.precision}}</span>
<span class="parameter" *ngIf="col.scale">scale: {{col.scale}}</span>
<span class="parameter" *ngIf="col.dimension">dimension: {{col.dimension}}</span>
<span class="parameter" *ngIf="col.cardinality">cardinality: {{col.cardinality}}</span>
</td>
<td>{{col.defaultValue}}</td>
<th class="small-col"><i class="fa fa-eye add-col" (click)="editingCol = col.physicalName"></i></th>
</ng-container>
<ng-container *ngIf="editingCol === col.physicalName">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>
<input type="text" class="form-control form-control-sm" style="max-width: 250px"
[value]="col.name" placeholder="name" #newName
(keyup.enter)="addColumn(col, newName.value, newDefault.value)">
</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{col.dataType}}</td>
<td>{{col.collectionsType}}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{_types.precisionPlaceholder( col.dataType )}}
: {{col.precision}}</span>
<span class="parameter" *ngIf="col.scale">scale: {{col.scale}}</span>
<span class="parameter" *ngIf="col.dimension">dimension: {{col.dimension}}</span>
<span class="parameter" *ngIf="col.cardinality">cardinality: {{col.cardinality}}</span>
</td>
<td class="testing" [hidden]="!(placements != null && entity()?.entityType !== EntityType.VIEW)">
<input type="text" class="form-control form-control-sm" placeholder="default value"
style="max-width: 250px" #newDefault
(keyup.enter)="addColumn(col, newName.value, newDefault.value)">
</td>
<th class="small-col"><i class="fa fa-save add-col btn btn-primary btn-sm"
(click)="addColumn(col, newName.value, newDefault.value)"></i></th>
</ng-container>
</tr>
</tbody>
</table>
</c-col>

<c-col class="col-lg-12" *ngIf="foreignKeys() && foreignKeys().length > 0">
<hr>
<h5>Foreign key</h5>
<table class="table table-hover table-striped">

<thead>
<tr>
<th>FK Name</th>
<th>Column Name</th>
<th>Target Table</th>
<th>Target Column</th>
<th>Update Enforcement</th>
<th>Delete Enforcement</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let fk of foreignKeys(); let i = index">
<td>{{fk.fkName}}</td>
<td>{{fk.sourceColumn}}</td>
<td>{{fk.targetTable}}</td>
<td>{{fk.targetColumn}}</td>
<td>{{fk.onUpdate}}</td>
<td>{{fk.onDelete}}</td>
</tr>
</c-input-group>
</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{ col.dataType }}</td>
<td>{{ col.collectionsType }}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{ _types.precisionPlaceholder(col.dataType) }}
: {{ col.precision }}</span>
<span class="parameter" *ngIf="col.scale">scale: {{ col.scale }}</span>
<span class="parameter" *ngIf="col.dimension !== -1">dimension: {{ col.dimension }}</span>
<span class="parameter"
*ngIf="col.cardinality !== -1">cardinality: {{ col.cardinality }}</span>
</td>
<th class="small-col">
<app-delete-confirm *ngIf="(placements != null && entity()?.entityType !== EntityType.VIEW)"
(delete)="dropColumn(col)"></app-delete-confirm>
</th>
</tr>
}
@for (col of getAddableColumns() | async; track col.id) {
<tr class="hidden-col" [ngClass]="{'editing': editingCol === col.name}">
<ng-container *ngIf="editingCol !== col.name">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>{{ col.name }}</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{ col.dataType }}</td>
<td>{{ col.collectionsType }}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{ _types.precisionPlaceholder(col.dataType) }}
: {{ col.precision }}</span>
<span class="parameter" *ngIf="col.scale">scale: {{ col.scale }}</span>
<span class="parameter" *ngIf="col.dimension">dimension: {{ col.dimension }}</span>
<span class="parameter"
*ngIf="col.cardinality">cardinality: {{ col.cardinality }}</span>
</td>
<td>{{ col.defaultValue }}</td>
<th class="small-col"><i class="fa fa-eye add-col" (click)="editingCol = col.name"></i></th>
</ng-container>
<ng-container *ngIf="editingCol === col.name">
<td class="small-col"><i class="icon-key" *ngIf="col.primary"></i></td>
<td>
<input type="text" class="form-control form-control-sm" style="max-width: 250px"
[value]="col.name" placeholder="name" #newName
(keyup.enter)="addColumn(col, newName.value, newDefault.value)">
</td>
<td><i class="fa fa-check" *ngIf="col.nullable"></i></td>
<td>{{ col.dataType }}</td>
<td>{{ col.collectionsType }}</td>
<td>
<span class="parameter" *ngIf="col.precision">{{ _types.precisionPlaceholder(col.dataType) }}
: {{ col.precision }}</span>
<span class="parameter" *ngIf="col.scale">scale: {{ col.scale }}</span>
<span class="parameter" *ngIf="col.dimension">dimension: {{ col.dimension }}</span>
<span class="parameter"
*ngIf="col.cardinality">cardinality: {{ col.cardinality }}</span>
</td>
<td class="testing"
[hidden]="!(placements != null && entity()?.entityType !== EntityType.VIEW)">
<input type="text" class="form-control form-control-sm" placeholder="default value"
style="max-width: 250px" #newDefault
(keyup.enter)="addColumn(col, newName.value, newDefault.value)">
</td>
<th class="small-col"><i class="fa fa-save add-col btn btn-primary btn-sm"
(click)="addColumn(col, newName.value, newDefault.value)"></i></th>
</ng-container>
</tr>
}
</tbody>
</table>
</c-col>
@if (foreignKeys() && foreignKeys().length > 0) {
<c-col class="col-lg-12">
<hr>
<h5>Foreign key</h5>
<table class="table table-hover table-striped">

<c-col class="col-lg-12" *ngIf="entity()?.entityType !== EntityType.VIEW">
<hr>
<h5>Source</h5>

<table class="table table-hover table-striped mt-3" *ngIf="columns()">
<thead>
<tr>
<th>Unique name</th>
<th>Adapter</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let store of getAdapters()()">
<td>{{store.name}}</td>
<td>{{store.adapterName}}</td>
</tr>
</tbody>
</table>
<thead>
<tr>
<th>FK Name</th>
<th>Column Name</th>
<th>Target Table</th>
<th>Target Column</th>
<th>Update Enforcement</th>
<th>Delete Enforcement</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let fk of foreignKeys(); let i = index">
<td>{{ fk.fkName }}</td>
<td>{{ fk.sourceColumn }}</td>
<td>{{ fk.targetTable }}</td>
<td>{{ fk.targetColumn }}</td>
<td>{{ fk.onUpdate }}</td>
<td>{{ fk.onDelete }}</td>
</tr>
</tbody>
</table>
</c-col>
}

</c-col>
@if (entity()?.entityType !== EntityType.VIEW) {
<c-col class="col-lg-12">
<hr>
<h5>Source</h5>

<table class="table table-hover table-striped mt-3" *ngIf="columns()">
<thead>
<tr>
<th>Unique name</th>
<th>Adapter</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let store of getAdapters()()">
<td>{{ store.name }}</td>
<td>{{ store.adapterName }}</td>
</tr>
</tbody>
</table>

<c-col class="col-lg-12" *ngIf="placements != null && entity()?.entityType === EntityType.VIEW">
<hr>
<h5>Underlying Tables</h5>
</c-col>
}
@if (placements != null && entity()?.entityType === EntityType.VIEW) {
<c-col class="col-lg-12">
<hr>
<h5>Underlying Tables</h5>

<table class="table table-hover table-striped mt-3" *ngIf="columns()">
<thead>
<tr>
<th>Table</th>
<th>Columns</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let table of underlyingTables() | keyvalue">
<td>{{table.key}}</td>
<td>{{table.value.join( ", " )}}</td>
</tr>
</tbody>
</table>
<table cTable hover striped class="mt-3" *ngIf="columns()">
<thead>
<tr>
<th>Table</th>
<th>Columns</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let table of underlyingTables() | keyvalue">
<td>{{ table.key }}</td>
<td>{{ table.value.join(", ") }}</td>
</tr>
</tbody>
</table>

</c-col>
</c-col>
}
</c-row>
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ export class EditSourceColumnsComponent implements OnInit, OnDestroy {
}

dropColumn(col: UiColumnDefinition) {
console.log(col);
const oldColumn = new ColumnRequest(this.entity().id, col);
console.log(oldColumn);
this._crud.dropColumn(oldColumn).subscribe({
next: (res: RelationalResult) => {
if (res.error) {
Expand Down

0 comments on commit c9f4c07

Please sign in to comment.