mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
customize loading status message (#23247)
* customize loading status message * Update extensions/mssql/src/ui/localizedConstants.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Update extensions/mssql/src/ui/localizedConstants.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -181,9 +181,9 @@ export abstract class PrincipalDialogBase<ObjectInfoType extends mssql.ObjectMan
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async searchForObjects(objectTypes: string[], schema: string = undefined): Promise<mssql.ObjectManagement.SearchResultItem[]> {
|
private async searchForObjects(objectTypes: string[], schema: string = undefined): Promise<mssql.ObjectManagement.SearchResultItem[]> {
|
||||||
this.updateLoadingStatus(true);
|
this.updateLoadingStatus(true, localizedConstants.LoadingObjectsText);
|
||||||
const result = await this.objectManagementService.search(this.contextId, objectTypes, undefined, schema);
|
const result = await this.objectManagementService.search(this.contextId, objectTypes, undefined, schema);
|
||||||
this.updateLoadingStatus(false);
|
this.updateLoadingStatus(false, localizedConstants.LoadingObjectsText, localizedConstants.LoadingObjectsCompletedText(result.length));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export abstract class DialogBase<DialogResult> {
|
|||||||
this._loadingComponent = view.modelBuilder.loadingComponent().withItem(this._formContainer).withProps({
|
this._loadingComponent = view.modelBuilder.loadingComponent().withItem(this._formContainer).withProps({
|
||||||
loading: true,
|
loading: true,
|
||||||
loadingText: uiLoc.LoadingDialogText,
|
loadingText: uiLoc.LoadingDialogText,
|
||||||
|
loadingCompletedText: uiLoc.LoadingDialogCompletedText,
|
||||||
showText: true,
|
showText: true,
|
||||||
CSSStyles: {
|
CSSStyles: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@@ -338,8 +339,10 @@ export abstract class DialogBase<DialogResult> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updateLoadingStatus(isLoading: boolean): void {
|
protected updateLoadingStatus(isLoading: boolean, loadingText: string = uiLoc.LoadingDialogText, loadingCompletedText: string = uiLoc.LoadingDialogCompletedText): void {
|
||||||
if (this._loadingComponent) {
|
if (this._loadingComponent) {
|
||||||
|
this._loadingComponent.loadingText = loadingText;
|
||||||
|
this._loadingComponent.loadingCompletedText = loadingCompletedText;
|
||||||
this._loadingComponent.loading = isLoading;
|
this._loadingComponent.loading = isLoading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ export const HelpText: string = localize('mssql.ui.helpText', "Help");
|
|||||||
export const YesText: string = localize('mssql.ui.yesText', "Yes");
|
export const YesText: string = localize('mssql.ui.yesText', "Yes");
|
||||||
export const OkText: string = localize('mssql.ui.OkText', "OK");
|
export const OkText: string = localize('mssql.ui.OkText', "OK");
|
||||||
export const LoadingDialogText: string = localize('mssql.ui.loadingDialog', "Loading dialog...");
|
export const LoadingDialogText: string = localize('mssql.ui.loadingDialog', "Loading dialog...");
|
||||||
|
export const LoadingDialogCompletedText: string = localize('mssql.ui.loadingDialog', "Loading dialog completed");
|
||||||
export const ScriptText: string = localize('mssql.ui.scriptText', "Script");
|
export const ScriptText: string = localize('mssql.ui.scriptText', "Script");
|
||||||
export const SelectText = localize('objectManagement.selectLabel', "Select");
|
export const SelectText = localize('objectManagement.selectLabel', "Select");
|
||||||
export const AddText = localize('objectManagement.addText', "Add…");
|
export const AddText = localize('objectManagement.addText', "Add…");
|
||||||
export const RemoveText = localize('objectManagement.removeText', "Remove");
|
export const RemoveText = localize('objectManagement.removeText', "Remove");
|
||||||
export const NoActionScriptedMessage: string = localize('mssql.ui.noActionScriptedMessage', "There is no action to be scripted.");
|
export const NoActionScriptedMessage: string = localize('mssql.ui.noActionScriptedMessage', "There is no action to be scripted.");
|
||||||
export const ScriptGeneratedText: string = localize('mssql.ui.scriptGenerated', "Script has been generated successfully. You can close the dialog to view it in the newly opened editor.")
|
export const ScriptGeneratedText: string = localize('mssql.ui.scriptGenerated', "Script has been generated successfully. You can close the dialog to view it in the newly opened editor.")
|
||||||
|
export const GeneratingScriptText: string = localize('mssql.ui.generatingScript', "Generating script...");
|
||||||
|
export const GeneratingScriptCompletedText: string = localize('mssql.ui.generatingScriptCompleted', "Script generated");
|
||||||
|
|
||||||
export function scriptError(error: string): string {
|
export function scriptError(error: string): string {
|
||||||
return localize('mssql.ui.scriptError', "An error occurred while generating the script. {0}", error);
|
return localize('mssql.ui.scriptError', "An error occurred while generating the script. {0}", error);
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
|||||||
await this.initializeUI();
|
await this.initializeUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override updateLoadingStatus(isLoading: boolean): void {
|
protected override updateLoadingStatus(isLoading: boolean, loadingText?: string, loadingCompletedText?: string): void {
|
||||||
super.updateLoadingStatus(isLoading);
|
super.updateLoadingStatus(isLoading, loadingText, loadingCompletedText);
|
||||||
this._helpButton.enabled = !isLoading;
|
this._helpButton.enabled = !isLoading;
|
||||||
this.dialogObject.okButton.enabled = this._scriptButton.enabled = isLoading ? false : this.isDirty;
|
this.dialogObject.okButton.enabled = this._scriptButton.enabled = isLoading ? false : this.isDirty;
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
|||||||
protected abstract generateScript(): Promise<string>;
|
protected abstract generateScript(): Promise<string>;
|
||||||
|
|
||||||
private async onScriptButtonClick(): Promise<void> {
|
private async onScriptButtonClick(): Promise<void> {
|
||||||
this.updateLoadingStatus(true);
|
this.updateLoadingStatus(true, localizedConstants.GeneratingScriptText, localizedConstants.GeneratingScriptCompletedText);
|
||||||
try {
|
try {
|
||||||
const isValid = await this.runValidation();
|
const isValid = await this.runValidation();
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
@@ -104,7 +104,7 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
|||||||
level: azdata.window.MessageLevel.Error
|
level: azdata.window.MessageLevel.Error
|
||||||
};
|
};
|
||||||
} finally {
|
} finally {
|
||||||
this.updateLoadingStatus(false);
|
this.updateLoadingStatus(false, localizedConstants.GeneratingScriptText, localizedConstants.GeneratingScriptCompletedText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default class GroupContainer extends ContainerBase<GroupLayout, GroupCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get header(): string {
|
public get header(): string {
|
||||||
return this._containerLayout?.header;
|
return this._containerLayout?.header ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasHeader(): boolean {
|
private hasHeader(): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user