|
|
|
@ -22,8 +22,7 @@ import { EntityType } from '@shared/models/entity-type.models'; |
|
|
|
import { |
|
|
|
CsvColumnParam, |
|
|
|
ImportEntityColumnType, |
|
|
|
importEntityColumnTypeTranslations, |
|
|
|
importEntityObjectColumns |
|
|
|
importEntityColumnTypeTranslations |
|
|
|
} from '@home/components/import-export/import-export.models'; |
|
|
|
import { BehaviorSubject, Observable } from 'rxjs'; |
|
|
|
import { CollectionViewer, DataSource } from '@angular/cdk/collections'; |
|
|
|
@ -117,7 +116,9 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce |
|
|
|
case EntityType.EDGE: |
|
|
|
this.columnTypes.push( |
|
|
|
{ value: ImportEntityColumnType.routingKey }, |
|
|
|
{ value: ImportEntityColumnType.secret } |
|
|
|
{ value: ImportEntityColumnType.secret }, |
|
|
|
{ value: ImportEntityColumnType.serverAttribute }, |
|
|
|
{ value: ImportEntityColumnType.timeseries } |
|
|
|
); |
|
|
|
break; |
|
|
|
} |
|
|
|
@ -143,8 +144,6 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce |
|
|
|
const isSelectType = this.columns.findIndex((column) => column.type === ImportEntityColumnType.type) > -1; |
|
|
|
const isSelectLabel = this.columns.findIndex((column) => column.type === ImportEntityColumnType.label) > -1; |
|
|
|
const isSelectDescription = this.columns.findIndex((column) => column.type === ImportEntityColumnType.description) > -1; |
|
|
|
const isSelectRoutingKey = this.columns.findIndex((column) => column.type === ImportEntityColumnType.routingKey) > -1; |
|
|
|
const isSelectSecret = this.columns.findIndex((column) => column.type === ImportEntityColumnType.secret) > -1; |
|
|
|
const hasInvalidColumn = this.columns.findIndex((column) => !this.columnValid(column)) > -1; |
|
|
|
|
|
|
|
this.valid = isSelectName && isSelectType && !hasInvalidColumn; |
|
|
|
@ -167,14 +166,16 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const routingKeyColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.routingKey); |
|
|
|
if (routingKeyColumnType) { |
|
|
|
routingKeyColumnType.disabled = isSelectRoutingKey; |
|
|
|
} |
|
|
|
const secretColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.secret); |
|
|
|
if (secretColumnType) { |
|
|
|
secretColumnType.disabled = isSelectSecret; |
|
|
|
if (this.entityType === EntityType.EDGE) { |
|
|
|
const isSelectRoutingKey = this.columns.findIndex((column) => column.type === ImportEntityColumnType.routingKey) > -1; |
|
|
|
const isSelectSecret = this.columns.findIndex((column) => column.type === ImportEntityColumnType.secret) > -1; |
|
|
|
|
|
|
|
this.valid = this.valid && isSelectSecret && isSelectRoutingKey; |
|
|
|
|
|
|
|
this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.routingKey).disabled = isSelectRoutingKey; |
|
|
|
this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.secret).disabled = isSelectSecret; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.propagateChange) { |
|
|
|
this.propagateChange(this.columns); |
|
|
|
} else { |
|
|
|
@ -190,7 +191,7 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce |
|
|
|
} |
|
|
|
|
|
|
|
private columnValid(column: CsvColumnParam): boolean { |
|
|
|
if (!importEntityObjectColumns.includes(column.type)) { |
|
|
|
if (this.isColumnTypeDiffers(column.type)) { |
|
|
|
return column.key && column.key.trim().length > 0; |
|
|
|
} else { |
|
|
|
return true; |
|
|
|
|