Skip to content

Commit

Permalink
#747 add clean - mismatch, missing (delete rows only)
Browse files Browse the repository at this point in the history
  • Loading branch information
paigechoi committed Nov 19, 2018
1 parent 31a6d13 commit 232e974
Show file tree
Hide file tree
Showing 7 changed files with 731 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="ddp-wrap-popup2 ddp-types ddp-type-rulepop" style="display:block;" *ngIf="isShow" [ngStyle]="{'top':contextInfo.top, 'left':contextInfo.left}">
<ul class="ddp-list-popup" (clickOutside)="isShow = false">
<li *ngFor="let command of commandList">
<li *ngFor="let command of commandList" [ngClass]="{'ddp-disabled': command.disabled}">
<a href="javascript:" (click)="_selectCommand(command)">
<em class="{{command.iconClass}}"></em>
{{command.label}}
Expand All @@ -30,7 +30,7 @@
<div class="ddp-wrap-popup2" *ngIf="depth2.children && 0 < depth2.children.length">
<ul class="ddp-list-popup ddp-padd">
<li *ngFor="let depth3 of depth2.children" [ngClass]="{'ddp-disabled': depth3.disabled}">
<a href="javascript:" (click)="_selectCommand(depth3)">
<a href="javascript:" (click)="_selectCommand(depth3)" title="{{depth3.label}}">
{{depth3.label}}
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,24 @@ export class RuleContextMenuComponent extends AbstractComponent implements OnIni
{label : 'Before ..', value : 'before', command : 'move'},
{label : 'After ..', value : 'after', command : 'move'}
]
},
{label : 'Clean', value: 'clean', iconClass: 'ddp-icon-drop-clean' , command: 'clean', disabled : this.originalSelectedColIds.length > 1,
children : [
{label : 'Mismatch', value : 'mismatch', command : 'mismatch'
, children : [
{label : 'Delete rows', value : 'ismismatch', command : 'clean'},
{label : 'Replace with custom value', value : 'after', command : 'move'}
]
},
{label : 'Missing', value : 'last', command : 'move'
, children : [
{label : 'Delete rows', value : 'ismissing', command : 'clean'},
{label : 'Fill with custom value', value : 'after', command : 'move'}
]
},
]
}

];
this.isShow = true;
}
Expand Down Expand Up @@ -314,6 +331,43 @@ export class RuleContextMenuComponent extends AbstractComponent implements OnIni
break;
}
break;
case 'clean':
rule['ruleString'] = `delete row: `;
let res = [];
switch(command.value) {

case 'ismismatch':
// ismismatched(columnName,'column type with single quote surrounded')
columnNames.forEach((item) => {
if (item.indexOf(' ') > -1) {
res.push('ismismatched(' + '`' + item + '`' + `,'${this.contextInfo.columnType}')`);
} else {
res.push(`ismismatched(${item},'${this.contextInfo.columnType}')`)
}

});

rule['ruleString'] += res.join(' || ');

break;
case 'ismissing':

// delete row: isnull(c) || isnull(`space col`)
columnNames.forEach((item) => {

if (item.indexOf(' ') > -1) {
res.push('isnull(' + '`' + item + '`' + ')');
} else {
res.push(`isnull(${item})`)
}

});

rule['ruleString'] += res.join(' || ');

break;
}
break;
}
this.applyRuleEvent.emit(rule);
}
Expand Down

0 comments on commit 232e974

Please sign in to comment.