Skip to content

Commit 6892b44

Browse files
taherkltaherklakashthawaitccVivekY1098manitgupta
authored
UI changes for check constraint support (#979)
* UI changes for check constraint support * removed url changed for testing * Check UI cmt (#29) * remove the block which will not execute * refactor the code 1. remove the unreachable code 2. remvoe the node-sql-parser package * refactor the code 1. rename the generateId method --------- Co-authored-by: Vivek Yadav <vivek.yadav@ollion.com> * updated the dist file and package.lock file * Develop (#36) * verification API and dump flow changes to support MySQL CHECK CONSTRAINTS (#978) (#30) * verification ap and dump flow changes * fixed IT issue * Check constraints verificartion api v2 (#24) * handled function not found * added unhandled error * updated the error msg --------- * fix IT issue * comment addressed (#27) * comment addressed 1. rename the functionNotFound 2. added condition to call verification api * spell checked --------- * refactor the DbDumpImpl struct (#28) * refactor the DbDumpImpl struct * remove the GenerateCheckConstrainstExprId method --------- * fixed if condition --------- Co-authored-by: Taher Lakdawala <78196491+taherkl@users.noreply.github.com> Co-authored-by: taherkl <taher.lakdawala@ollion.com> Co-authored-by: Vivek Yadav <vivek.yadav@ollion.com> Co-authored-by: Vivek Yadav <105432992+VivekY1098@users.noreply.github.com> * Replace ReadOnlyTransaction() with Single() (#984) (#35) Co-authored-by: Manit Gupta <manitgupta@google.com> --------- Co-authored-by: Taher Lakdawala <78196491+taherkl@users.noreply.github.com> Co-authored-by: Akash Thawait <aakash@ollion.com> Co-authored-by: taherkl <taher.lakdawala@ollion.com> Co-authored-by: Vivek Yadav <vivek.yadav@ollion.com> Co-authored-by: Manit Gupta <manitgupta@google.com> --------- Co-authored-by: taherkl <taher.lakdawala@ollion.com> Co-authored-by: Akash Thawait <aakash@ollion.com> Co-authored-by: Vivek Yadav <105432992+VivekY1098@users.noreply.github.com> Co-authored-by: Vivek Yadav <vivek.yadav@ollion.com> Co-authored-by: Manit Gupta <manitgupta@google.com>
1 parent 1a751d7 commit 6892b44

23 files changed

+973
-55
lines changed

ui/dist/ui/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

ui/dist/ui/main.7d3a46641d0b6df2.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/dist/ui/main.fec05b021cd4ee86.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

ui/dist/ui/polyfills.a7813c59798a2f34.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

ui/dist/ui/polyfills.c2c201edf5092294.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444
"karma-jasmine-html-reporter": "~2.1.0",
4545
"typescript": "^5.3.3"
4646
}
47-
}
47+
}

ui/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'
99
import { FormsModule } from '@angular/forms'
1010
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'
1111
import { MatChipsModule } from '@angular/material/chips'
12+
import { MatTooltipModule } from '@angular/material/tooltip';
1213

1314
import { AppComponent } from './app.component'
1415
import { HeaderComponent } from './components/header/header.component'
@@ -113,7 +114,8 @@ import { AddNewSequenceComponent } from './components/add-new-sequence/add-new-s
113114
MatRadioModule,
114115
ClipboardModule,
115116
MatProgressSpinnerModule,
116-
MatChipsModule
117+
MatChipsModule,
118+
MatTooltipModule,
117119
],
118120
providers: [
119121
{

ui/src/app/components/direct-connection/direct-connection.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class DirectConnectionComponent implements OnInit {
9898
localStorage.setItem(PersistedFormValues.IsConnectionSuccessful, "true")
9999
this.clickEvent.closeDatabaseLoader()
100100
},
101-
error: (e) => {
101+
error: (e) => {
102102
this.isTestConnectionSuccessful = false
103103
this.snackbarService.openSnackBar(e.error, 'Close')
104104
localStorage.setItem(PersistedFormValues.IsConnectionSuccessful, "false")

ui/src/app/components/object-detail/object-detail.component.html

Lines changed: 140 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ <h3 class="title">
169169
<ng-container matColumnDef="srcDefaultValue" *ngIf="mySqlSource">
170170
<th mat-header-cell class="table_header" *matHeaderCellDef>Default Value</th>
171171
<td mat-cell *matCellDef="let element">
172-
<div
173-
class="trimmed-text"
174-
matTooltip="{{ element.get('srcDefaultValue').value }}"
172+
<div
173+
class="trimmed-text"
174+
matTooltip="{{ element.get('srcDefaultValue').value }}"
175175
matTooltipPosition="above">
176176
{{ element.get('srcDefaultValue').value }}
177177
</div>
178178
</td>
179-
</ng-container>
180-
179+
</ng-container>
180+
181181
<tr mat-header-row *matHeaderRowDef="['srcDatabase']"></tr>
182182
<tr mat-header-row *matHeaderRowDef="srcDisplayedColumns"></tr>
183183
<tr mat-row [ngClass]="{ 'scr-column-data-edit-mode': isEditMode }"
@@ -281,7 +281,7 @@ <h3 class="title">
281281
</ng-container>
282282
</mat-select>
283283
</mat-form-field>
284-
</ng-container>
284+
</ng-container>
285285
<ng-container *ngIf="!isEditMode">
286286
<p>{{ element.get('spAutoGen').value.Name !== '' ? element.get('spAutoGen').value.Name : 'None' }}</p>
287287
</ng-container>
@@ -409,7 +409,7 @@ <h3 class="title">
409409
<div class="pk-tab-container">
410410
<table mat-table [dataSource]="pkDataSource">
411411
<ng-container matColumnDef="srcDatabase">
412-
<th mat-header-cell class="db_name" *matHeaderCellDef colspan="5">{{ srcDbName }}</th>
412+
<th mat-header-cell class="db_name" *matHeaderCellDef colspan="6">{{ srcDbName }}</th>
413413
</ng-container>
414414

415415
<ng-container matColumnDef="spDatabase">
@@ -769,6 +769,127 @@ <h3 class="title">
769769
</div>
770770
</mat-tab>
771771

772+
<mat-tab>
773+
<ng-template mat-tab-label>
774+
<span>CHECK CONSTRAINTS</span>
775+
</ng-template>
776+
<div class="cc-tab-container">
777+
<table mat-table [dataSource]="ccDataSource">
778+
<ng-container matColumnDef="srcDatabase">
779+
<th mat-header-cell class="db_name" *matHeaderCellDef [attr.colspan]="3">{{ srcDbName }}</th>
780+
</ng-container>
781+
782+
<ng-container matColumnDef="spDatabase">
783+
<th mat-header-cell *matHeaderCellDef class="db_name" [attr.colspan]="4" >
784+
<div class="spanner_edit-button">
785+
<span>Spanner</span>
786+
<div *ngIf="
787+
!isCcEditMode &&
788+
currentObject!.isSpannerNode &&
789+
!currentObject.isDeleted
790+
">
791+
<button mat-stroked-button color="primary" (click)="toggleCcEdit()">
792+
<mat-icon class="edit-icon">edit</mat-icon>
793+
EDIT
794+
</button>
795+
</div>
796+
</div>
797+
</th>
798+
</ng-container>
799+
800+
<ng-container matColumnDef="srcSno">
801+
<th class="table_header" mat-header-cell *matHeaderCellDef>S. No.</th>
802+
<td mat-cell *matCellDef="let element" >
803+
<span *ngIf="element.get('srcSno').value != 0">
804+
{{ element.get('srcSno').value }}
805+
</span>
806+
</td>
807+
</ng-container>
808+
809+
<ng-container matColumnDef="srcConstraintName">
810+
<th class="table_header" mat-header-cell *matHeaderCellDef>Constraint Name</th>
811+
<td mat-cell *matCellDef="let element">
812+
{{ element.get('srcConstraintName').value }}
813+
</td>
814+
815+
</ng-container>
816+
817+
<ng-container matColumnDef="srcCondition">
818+
<th class="table_header" mat-header-cell *matHeaderCellDef>Condition</th>
819+
<td mat-cell *matCellDef="let element" matTooltip="{{ element.get('srcCondition').value }}"
820+
matTooltipPosition="above" class="overflow-cell">
821+
822+
{{ element.get('srcCondition').value }}
823+
</td>
824+
</ng-container>
825+
826+
<ng-container matColumnDef="spSno">
827+
<th mat-header-cell class="table_header" *matHeaderCellDef>S. No.</th>
828+
<td mat-cell *matCellDef="let element">
829+
{{ element.get('spSno').value }}
830+
</td>
831+
</ng-container>
832+
833+
<ng-container matColumnDef="spConstraintName">
834+
<th class="table_header" mat-header-cell *matHeaderCellDef>Constraint Name</th>
835+
<td mat-cell *matCellDef="let element">
836+
<div *ngIf="isCcEditMode">
837+
<input
838+
matInput
839+
class="name_input"
840+
type="text"
841+
[formControl]="element.get('spConstraintName')"
842+
matTooltip="No special characters allowed except underscore."
843+
/>
844+
</div>
845+
<p *ngIf="!isCcEditMode">{{ element.get('spConstraintName').value }}</p>
846+
</td>
847+
</ng-container>
848+
849+
<ng-container matColumnDef="spConstraintCondition">
850+
<th class="table_header" mat-header-cell *matHeaderCellDef>Condition</th>
851+
<td mat-cell *matCellDef="let element" >
852+
<div *ngIf="isCcEditMode">
853+
<textarea name="spConstraintCondition" matInput
854+
class="condition_input" [formControl]="element.get('spConstraintCondition')"
855+
matTooltip="Enter valid clause for CHECK constraints" id="spConstraintCondition"></textarea>
856+
</div>
857+
<p *ngIf="!isCcEditMode" matTooltip="{{ element.get('spConstraintCondition').value }}"
858+
matTooltipPosition="above" class="overflow-cell">{{ element.get('spConstraintCondition').value }}</p>
859+
</td>
860+
</ng-container>
861+
862+
<ng-container matColumnDef="dropButton">
863+
<th mat-header-cell class="table_header" *matHeaderCellDef></th>
864+
<td mat-cell *matCellDef="let element" [ngClass]="{ 'drop-button-left-border': isCcEditMode }">
865+
<div class="actions" *ngIf="
866+
isCcEditMode && currentObject!.isSpannerNode
867+
">
868+
<mat-icon [matMenuTriggerFor]="menu">more_vert</mat-icon>
869+
<mat-menu #menu="matMenu" xPosition="before">
870+
<button [disabled]="!isCcEditMode" mat-menu-item (click)="dropCc(element)">
871+
<span>Remove constraint</span>
872+
</button>
873+
</mat-menu>
874+
</div>
875+
</td>
876+
</ng-container>
877+
878+
<tr mat-header-row *matHeaderRowDef="['srcDatabase', 'spDatabase']"></tr>
879+
<tr mat-header-row *matHeaderRowDef="displayedCCColumns"></tr>
880+
<tr mat-row *matRowDef="let row; columns: displayedCCColumns"></tr>
881+
</table>
882+
883+
<div *ngIf="isCcEditMode" class="add-cc-column">
884+
<button mat-button color="primary" class="add-column-btn" type="button" (click)="addCcColumn()">
885+
<mat-icon>add</mat-icon>
886+
Add Constraint
887+
</button>
888+
</div>
889+
890+
</div>
891+
</mat-tab>
892+
772893
<mat-tab *ngIf="currentObject!.isSpannerNode && !currentObject!.isDeleted">
773894
<ng-template mat-tab-label>
774895
<span>SQL</span>
@@ -929,7 +1050,7 @@ <h3 class="title">
9291050
</ng-container>
9301051
</div>
9311052
</td>
932-
</ng-container>
1053+
</ng-container>
9331054
<ng-container matColumnDef="spSkipRangeMin">
9341055
<th mat-header-cell class="table_header" *matHeaderCellDef>Skip Range Min</th>
9351056
<td mat-cell *matCellDef="let element">
@@ -980,7 +1101,7 @@ <h3 class="title">
9801101
<tr mat-header-row *matHeaderRowDef="sequenceDisplayedColumns"></tr>
9811102
<tr mat-row class="sequence-data-row" *matRowDef="let row; columns: sequenceDisplayedColumns"></tr>
9821103
</table>
983-
1104+
9841105
</div>
9851106

9861107
<div class="save-edits">
@@ -1004,6 +1125,15 @@ <h3 class="title">
10041125
CANCEL
10051126
</button>
10061127
</div>
1128+
<div class="save-button" *ngIf="isCcEditMode && (interleaveParentName !== null ? currentTabIndex === 4:currentTabIndex === 3)">
1129+
<button mat-raised-button color="primary" (click)="saveCc()" [disabled]="!ccArray.valid" >
1130+
SAVE & CONVERT
1131+
</button>
1132+
<button class="cancel-button" mat-raised-button color="primary" (click)="toggleCcEdit()"
1133+
*ngIf="currentObject!.isSpannerNode">
1134+
CANCEL
1135+
</button>
1136+
</div>
10071137
<div class="save-button" *ngIf="isFkEditMode && currentTabIndex === 2">
10081138
<button mat-raised-button color="primary" (click)="saveFk()">SAVE & CONVERT</button>
10091139
<button class="cancel-button" mat-raised-button color="primary" (click)="toggleFkEdit()"
@@ -1028,4 +1158,4 @@ <h3 class="title">
10281158
</button>
10291159
</div>
10301160
</div>
1031-
</div>
1161+
</div>

0 commit comments

Comments
 (0)