Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: mysql、mariadb显示高级选项 #814

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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