mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 20:10:11 -04:00
Add database settings tab (#24260)
This commit is contained in:
@@ -7,6 +7,7 @@ import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { EOL } from 'os';
|
||||
import * as uiLoc from '../ui/localizedConstants';
|
||||
import { IconPathHelper } from '../iconHelper';
|
||||
|
||||
export const DefaultLabelWidth = 150;
|
||||
export const DefaultInputWidth = 300;
|
||||
@@ -130,10 +131,16 @@ export abstract class DialogBase<DialogResult> {
|
||||
return errors.length === 0;
|
||||
}
|
||||
|
||||
protected createLabelInputContainer(label: string, component: azdata.Component, required: boolean = false): azdata.FlexContainer {
|
||||
const labelComponent = this.modelView.modelBuilder.text().withProps({ width: DefaultLabelWidth, value: label, requiredIndicator: required, CSSStyles: { 'padding-right': '10px' } }).component();
|
||||
const container = this.modelView.modelBuilder.flexContainer().withLayout({ flexFlow: 'horizontal', flexWrap: 'nowrap', alignItems: 'center' }).withItems([labelComponent], { flex: '0 0 auto' }).component();
|
||||
container.addItem(component, { flex: '1 1 auto' });
|
||||
protected createLabelInputContainer(label: string, component: azdata.Component | azdata.Component[], required: boolean = false): azdata.FlexContainer {
|
||||
let container: azdata.FlexContainer = undefined;
|
||||
if (Array.isArray(component)) {
|
||||
const labelComponent = this.modelView.modelBuilder.text().withProps({ width: DefaultLabelWidth - 40, value: label, requiredIndicator: required, CSSStyles: { 'padding-right': '10px' } }).component();
|
||||
container = this.modelView.modelBuilder.flexContainer().withItems([labelComponent, ...component], { CSSStyles: { 'margin-right': '5px', 'margin-bottom': '10px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
} else {
|
||||
const labelComponent = this.modelView.modelBuilder.text().withProps({ width: DefaultLabelWidth, value: label, requiredIndicator: required, CSSStyles: { 'padding-right': '10px' } }).component();
|
||||
container = this.modelView.modelBuilder.flexContainer().withLayout({ flexFlow: 'horizontal', flexWrap: 'nowrap', alignItems: 'center' }).withItems([labelComponent], { flex: '0 0 auto' }).component();
|
||||
container.addItem(component, { flex: '1 1 auto' });
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
@@ -371,6 +378,24 @@ export abstract class DialogBase<DialogResult> {
|
||||
}).withItems(items, { flex: '0 0 auto' }).component();
|
||||
}
|
||||
|
||||
protected createHorizontalContainer(header: string, items: azdata.Component[]): azdata.FlexContainer {
|
||||
return this.modelView.modelBuilder.flexContainer().withItems(items, { CSSStyles: { 'margin-right': '5px', 'margin-bottom': '10px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
}
|
||||
|
||||
protected createBrowseButton(handler: () => Promise<void>, enabled: boolean = true): azdata.ButtonComponent {
|
||||
const button = this.dialogObject.modelView.modelBuilder.button().withProps({
|
||||
ariaLabel: 'browse',
|
||||
iconPath: IconPathHelper.folder,
|
||||
width: '18px',
|
||||
height: '20px',
|
||||
enabled: enabled
|
||||
}).component();
|
||||
this.disposables.push(button.onDidClick(async () => {
|
||||
await handler();
|
||||
}));
|
||||
return button;
|
||||
}
|
||||
|
||||
protected createRadioButton(label: string, groupName: string, checked: boolean, handler: (checked: boolean) => Promise<void>, enabled: boolean = true): azdata.RadioButtonComponent {
|
||||
const radio = this.modelView.modelBuilder.radioButton().withProps({
|
||||
label: label,
|
||||
|
||||
Reference in New Issue
Block a user