Skip to content

Commit

Permalink
perf: mysql、mariadb显示高级选项
Browse files Browse the repository at this point in the history
  • Loading branch information
huailei000 committed May 6, 2023
1 parent 270e814 commit 233e8b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
import {Component, Input, OnInit, OnChanges, Output, EventEmitter} from '@angular/core';
import {ConnectMethod, ConnectOption} from '@app/model';
import {Component, Input, OnChanges, Output, EventEmitter} from '@angular/core';
import {ConnectMethod, ConnectOption, Protocol} from '@app/model';

@Component({
selector: 'elements-advanced-option',
templateUrl: './advanced-option.component.html',
styleUrls: ['./advanced-option.component.scss'],
})
export class ElementAdvancedOptionComponent implements OnInit, OnChanges {
export class ElementAdvancedOptionComponent implements OnChanges {
@Input() protocol: Protocol;
@Input() connectMethod: ConnectMethod;
@Input() accountSelected: any;
@Output() onOptionsChange = new EventEmitter<ConnectOption[]>();
public advancedOptions: ConnectOption[] = [];
public isShowAdvancedOption = false;
public needShowAutoCompletionProtocols: Array<string> = ['mysql', 'mariadb'];

constructor() {}

ngOnInit() {
const accountSelectedProtocol = this.accountSelected && this.accountSelected.hasOwnProperty('protocol') ? this.accountSelected.protocol : '';
ngOnChanges() {
this.advancedOptions = [
{
type: 'checkbox',
field: 'disableautohash',
hidden: () => {
return this.connectMethod.value === 'web_cli'
&& this.needShowAutoCompletionProtocols.includes(accountSelectedProtocol);
},
label: 'Disable auto completion',
value: false
}
];
}

ngOnChanges(changes) {
&& this.needShowAutoCompletionProtocols.includes(this.protocol.name);
},
label: 'Disable auto completion',
value: false
}
];
this.isShowAdvancedOption = this.advancedOptions.some(i => i.hidden());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ <h3>{{"Connect" | translate}} - {{ asset.name | truncatechars:30 }}</h3>
</elements-connect-method>

<elements-advanced-option
[protocol]="protocol"
[connectMethod]="connectMethod"
[accountSelected]="accountSelected"
(onOptionsChange)="onAdvancedOptionChanged($event)"
>
</elements-advanced-option>
Expand Down

0 comments on commit 233e8b8

Please sign in to comment.