diff --git a/ui/src/app/components/object-detail/object-detail.component.html b/ui/src/app/components/object-detail/object-detail.component.html index 9016548bf..ff8860fae 100644 --- a/ui/src/app/components/object-detail/object-detail.component.html +++ b/ui/src/app/components/object-detail/object-detail.component.html @@ -166,6 +166,15 @@

+ + Default Value + +
+ {{ element.get('srcDefaultValue').value }} +
+ +
+ + + Default Value + +
+ {{ element.get('spDefaultValue').value }} +
+ +
+ diff --git a/ui/src/app/components/object-detail/object-detail.component.scss b/ui/src/app/components/object-detail/object-detail.component.scss index e0c181acb..dbc584020 100644 --- a/ui/src/app/components/object-detail/object-detail.component.scss +++ b/ui/src/app/components/object-detail/object-detail.component.scss @@ -211,7 +211,7 @@ min-width: 100px; } - .mat-column-srcIsNotNull, + .mat-column-srcDefaultValue, .mat-column-srcDatabase, .mat-column-srcIndexOrder { border-right: 1px solid #cdcccd; @@ -222,6 +222,13 @@ border-left: 1px solid #cdcccd; } + .trimmed-text { + width: 200px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .sp-datatype-data-cells { display: flex; flex-direction: row; diff --git a/ui/src/app/components/object-detail/object-detail.component.spec.ts b/ui/src/app/components/object-detail/object-detail.component.spec.ts index ee55de297..b0e300917 100644 --- a/ui/src/app/components/object-detail/object-detail.component.spec.ts +++ b/ui/src/app/components/object-detail/object-detail.component.spec.ts @@ -73,6 +73,8 @@ describe('ObjectDetailComponent', () => { srcIsPk: true, spIsNotNull: true, srcIsNotNull: true, + srcDefaultValue: '', + spDefaultValue: '', srcId: '1', spId: '1', srcColMaxLength: 50, @@ -97,6 +99,8 @@ describe('ObjectDetailComponent', () => { srcIsPk: false, spIsNotNull: false, srcIsNotNull: false, + srcDefaultValue: '', + spDefaultValue: '', srcId: '2', spId: '2', srcColMaxLength: 50, diff --git a/ui/src/app/components/object-detail/object-detail.component.ts b/ui/src/app/components/object-detail/object-detail.component.ts index 59043493e..7a7ccaefc 100644 --- a/ui/src/app/components/object-detail/object-detail.component.ts +++ b/ui/src/app/components/object-detail/object-detail.component.ts @@ -90,9 +90,9 @@ export class ObjectDetailComponent implements OnInit { } } - srcDisplayedColumns = ['srcOrder', 'srcColName', 'srcDataType', 'srcColMaxLength', 'srcIsPk', 'srcIsNotNull'] + srcDisplayedColumns = ['srcOrder', 'srcColName', 'srcDataType', 'srcColMaxLength', 'srcIsPk', 'srcIsNotNull', 'srcDefaultValue'] - spDisplayedColumns = ['spColName', 'spDataType', 'spColMaxLength', 'spIsPk', 'spIsNotNull', 'dropButton'] + spDisplayedColumns = ['spColName', 'spDataType', 'spColMaxLength', 'spIsPk', 'spIsNotNull', 'spDefaultValue', 'dropButton'] displayedFkColumns = [ 'srcName', 'srcColumns', @@ -172,8 +172,8 @@ export class ObjectDetailComponent implements OnInit { }) pkObj: IPrimaryKey = {} as IPrimaryKey dataTypesWithColLen: string[] = ColLength.DataTypes - spColspan : number = 6 - srcColspan : number = 6 + spColspan : number = 7 + srcColspan : number = 7 ngOnChanges(changes: SimpleChanges): void { this.fkData = changes['fkData']?.currentValue || this.fkData @@ -258,6 +258,7 @@ export class ObjectDetailComponent implements OnInit { srcDataType: new FormControl(row.srcDataType), srcIsPk: new FormControl(row.srcIsPk), srcIsNotNull: new FormControl(row.srcIsNotNull), + srcDefaultValue: new FormControl(row.srcDefaultValue), srcColMaxLength: new FormControl(row.srcColMaxLength), srcAutoGen: new FormControl(row.srcAutoGen), spOrder: new FormControl(row.srcOrder), @@ -268,6 +269,7 @@ export class ObjectDetailComponent implements OnInit { spDataType: new FormControl(row.spDataType), spIsPk: new FormControl(row.spIsPk), spIsNotNull: new FormControl(row.spIsNotNull), spId: new FormControl(row.spId), + spDefaultValue: new FormControl(row.spDefaultValue), srcId: new FormControl(row.srcId), spColMaxLength: new FormControl(row.spColMaxLength, [ Validators.required]), @@ -309,6 +311,7 @@ export class ObjectDetailComponent implements OnInit { srcDataType: new FormControl(col.srcDataType), srcIsPk: new FormControl(col.srcIsPk), srcIsNotNull: new FormControl(col.srcIsNotNull), + srcDefaultValue: new FormControl(col.srcDefaultValue), srcColMaxLength: new FormControl(col.srcColMaxLength), srcAutoGen: new FormControl(col.srcAutoGen), spOrder: new FormControl(col.spOrder), @@ -316,6 +319,7 @@ export class ObjectDetailComponent implements OnInit { spDataType: new FormControl(col.spDataType), spIsPk: new FormControl(col.spIsPk), spIsNotNull: new FormControl(col.spIsNotNull), + spDefaultValue: new FormControl(col.spDefaultValue), spId: new FormControl(col.spId), srcId: new FormControl(col.srcId), spColMaxLength: new FormControl(col.spColMaxLength), @@ -345,6 +349,7 @@ export class ObjectDetailComponent implements OnInit { srcDataType: new FormControl(col.srcDataType), srcIsPk: new FormControl(col.srcIsPk), srcIsNotNull: new FormControl(col.srcIsNotNull), + srcDefaultValue: new FormControl(col.srcDefaultValue), srcColMaxLength: new FormControl(col.srcColMaxLength), srcAutoGen: new FormControl(col.srcAutoGen), spOrder: new FormControl(col.srcOrder), @@ -354,6 +359,7 @@ export class ObjectDetailComponent implements OnInit { ), spIsPk: new FormControl(col.srcIsPk), spIsNotNull: new FormControl(col.srcIsNotNull), + spDefaultValue: new FormControl(col.srcDefaultValue), spColMaxLength: new FormControl(droppedColumnSpMaxLength), spAutoGen: new FormControl(col.spAutoGen) }) diff --git a/ui/src/app/model/conv.ts b/ui/src/app/model/conv.ts index 8d4380f53..78de6ab17 100644 --- a/ui/src/app/model/conv.ts +++ b/ui/src/app/model/conv.ts @@ -62,6 +62,7 @@ export interface IColumn { Ignored: IIgnored Id: string AutoGen: AutoGen + DefaultValue: IDefaultValue } export interface IIgnored { @@ -152,6 +153,12 @@ export interface IColumnDef { NotNull: boolean Comment: string AutoGen: IAutoGen + DefaultValue: IDefaultValue +} + +export interface IDefaultValue { + IsPresent: boolean + Value: string } export interface IType { diff --git a/ui/src/app/model/edit-table.ts b/ui/src/app/model/edit-table.ts index df8a4a00b..1782caca9 100644 --- a/ui/src/app/model/edit-table.ts +++ b/ui/src/app/model/edit-table.ts @@ -10,6 +10,8 @@ export default interface IColumnTabData { srcIsPk: boolean spIsNotNull: boolean srcIsNotNull: boolean + srcDefaultValue: string + spDefaultValue: string srcId: string spId: string srcColMaxLength: Number | string | undefined diff --git a/ui/src/app/services/conversion/conversion.service.ts b/ui/src/app/services/conversion/conversion.service.ts index 2ab80a104..dc5a01928 100644 --- a/ui/src/app/services/conversion/conversion.service.ts +++ b/ui/src/app/services/conversion/conversion.service.ts @@ -320,6 +320,8 @@ export class ConversionService { srcIsPk: srcPks ? srcPks.map((pk) => pk.ColId).indexOf(colId) !== -1 : false, spIsNotNull: spannerColDef && spTableName ? spannerColDef.NotNull : false, srcIsNotNull: data.SrcSchema[tableId].ColDefs[colId].NotNull, + srcDefaultValue: data.SrcSchema[tableId].ColDefs[colId].DefaultValue.Value, + spDefaultValue: spannerColDef && spannerColDef.DefaultValue.IsPresent ? spannerColDef.DefaultValue.Value : '', srcId: colId, spId: spannerColDef ? colId : '', spColMaxLength: spannerColDef?.T.Len != 0 ? (spannerColDef?.T.Len != spColMax ? spannerColDef?.T.Len: 'MAX') : '', @@ -351,6 +353,8 @@ export class ConversionService { srcIsPk: false, spIsNotNull: spColumn.NotNull, srcIsNotNull: false, + srcDefaultValue: '', + spDefaultValue: spColumn.DefaultValue.Value, srcId: '', spId: colId, srcColMaxLength: '',