Browse Source

Clear import-export (Safari)

pull/2578/head
Vladyslav_Prykhodko 6 years ago
parent
commit
fca2dd6213
  1. 25
      ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.html
  2. 3
      ui-ngx/src/app/modules/home/components/import-export/import-export.models.ts
  3. 4
      ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.html
  4. 20
      ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.ts

25
ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.html

@ -16,7 +16,7 @@
-->
<form>
<mat-toolbar fxLayout="row" color="primary">
<mat-toolbar color="primary">
<h2 translate>{{ importTitle }}</h2>
<span fxFlex></span>
<div [tb-help]="'entitiesImport'"></div>
@ -44,13 +44,11 @@
</tb-file-input>
</fieldset>
</form>
<div fxLayout="row">
<span fxFlex></span>
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="20px">
<button mat-button
style="margin-right: 20px;"
[disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-button mat-raised-button
<button mat-raised-button
[disabled]="(isLoading$ | async) || selectFileFormGroup.invalid || !selectFileFormGroup.dirty"
color="primary"
(click)="nextStep(2)">{{ 'action.continue' | translate }}</button>
@ -62,7 +60,7 @@
<fieldset [disabled]="isLoading$ | async" fxLayout="column">
<mat-form-field class="mat-block">
<mat-label translate>import.csv-delimiter</mat-label>
<mat-select required matInput formControlName="delim">
<mat-select required formControlName="delim">
<mat-option *ngFor="let delimiter of delimiters" [value]="delimiter.key">
{{ delimiter.value }}
</mat-option>
@ -78,16 +76,15 @@
</div>
</fieldset>
</form>
<div fxLayout="row">
<div fxLayout="row" fxLayoutGap="20px">
<button mat-button
[disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button>
<span fxFlex></span>
<button mat-button
style="margin-right: 20px;"
[disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-button mat-raised-button
<button mat-raised-button
[disabled]="(isLoading$ | async)"
color="primary"
(click)="nextStep(3)">{{ 'action.continue' | translate }}</button>
@ -98,16 +95,15 @@
<ng-template matStepLabel>{{ 'import.stepper-text.column-type' | translate }}</ng-template>
<tb-table-columns-assignment formControlName="columnsParam" [entityType]="entityType"></tb-table-columns-assignment>
</form>
<div fxLayout="row">
<div fxLayout="row" fxLayoutGap="20px">
<button mat-button
[disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button>
<span fxFlex></span>
<button mat-button
style="margin-right: 20px;"
[disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-button mat-raised-button
<button mat-raised-button
[disabled]="(isLoading$ | async) || columnTypesFormGroup.invalid || !columnTypesFormGroup.dirty"
color="primary"
(click)="nextStep(4)">{{ 'action.continue' | translate }}</button>
@ -131,9 +127,8 @@
{{ translate.instant('import.message.error-entities', {count: this.statistical.error.entity}) }}
</p>
</div>
<div fxLayout="row">
<span fxFlex></span>
<button mat-button mat-raised-button
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="20px">
<button mat-raised-button
[disabled]="(isLoading$ | async)"
color="primary"
(click)="nextStep(6)">{{ 'action.ok' | translate }}</button>

3
ui-ngx/src/app/modules/home/components/import-export/import-export.models.ts

@ -17,9 +17,6 @@
import { Widget, WidgetType } from '@app/shared/models/widget.models';
import { DashboardLayoutId } from '@shared/models/dashboard.models';
import { WidgetsBundle } from '@shared/models/widgets-bundle.model';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { ActionType } from '@shared/models/audit-log.models';
import { RuleChain, RuleChainMetaData } from '@shared/models/rule-chain.models';
export interface ImportWidgetResult {
widget: Widget;

4
ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.html

@ -15,7 +15,7 @@
limitations under the License.
-->
<mat-table [dataSource]="dataSource">
<table mat-table [dataSource]="dataSource">
<ng-container matColumnDef="order">
<mat-header-cell *matHeaderCellDef style="min-width: 40px; max-width: 40px; width: 40px"></mat-header-cell>
<mat-cell *matCellDef="let column; let i = index">
@ -52,5 +52,5 @@
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let column; columns: displayedColumns;"></mat-row>
</mat-table>
</table>
<mat-divider></mat-divider>

20
ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.ts

@ -19,8 +19,12 @@ import { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, Va
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityType } from '@shared/models/entity-type.models';
import { CsvColumnParam, ImportEntityColumnType, importEntityColumnTypeTranslations,
importEntityObjectColumns } from '@home/components/import-export/import-export.models';
import {
CsvColumnParam,
ImportEntityColumnType,
importEntityColumnTypeTranslations,
importEntityObjectColumns
} from '@home/components/import-export/import-export.models';
import { BehaviorSubject, Observable } from 'rxjs';
import { CollectionViewer, DataSource } from '@angular/cdk/collections';
@ -51,8 +55,6 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce
displayedColumns = ['order', 'sampleData', 'type', 'key'];
importEntityColumnType = ImportEntityColumnType;
columnTypes: AssignmentColumnType[] = [];
columnTypesTranslations = importEntityColumnTypeTranslations;
@ -138,12 +140,10 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce
}
public isColumnTypeDiffers(columnType: ImportEntityColumnType): boolean {
return columnType !== ImportEntityColumnType.name &&
columnType !== ImportEntityColumnType.type &&
columnType !== ImportEntityColumnType.label &&
columnType !== ImportEntityColumnType.accessToken &&
columnType !== ImportEntityColumnType.isGateway &&
columnType !== ImportEntityColumnType.description;
return columnType === ImportEntityColumnType.clientAttribute ||
columnType === ImportEntityColumnType.sharedAttribute ||
columnType === ImportEntityColumnType.serverAttribute ||
columnType === ImportEntityColumnType.timeseries;
}
private columnValid(column: CsvColumnParam): boolean {

Loading…
Cancel
Save