mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 23:16:56 +00:00
Remove Dialog Adapter (#446)
This commit is contained in:
parent
2d2d8b6efe
commit
6c90ef2e62
@ -1,5 +1,5 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Dialog, DialogType, DialogFooter, IDialogProps } from "office-ui-fabric-react/lib/Dialog";
|
import { Dialog as FluentDialog, DialogType, DialogFooter, IDialogProps } from "office-ui-fabric-react/lib/Dialog";
|
||||||
import { IButtonProps, PrimaryButton, DefaultButton } from "office-ui-fabric-react/lib/Button";
|
import { IButtonProps, PrimaryButton, DefaultButton } from "office-ui-fabric-react/lib/Button";
|
||||||
import { ITextFieldProps, TextField } from "office-ui-fabric-react/lib/TextField";
|
import { ITextFieldProps, TextField } from "office-ui-fabric-react/lib/TextField";
|
||||||
import { Link } from "office-ui-fabric-react/lib/Link";
|
import { Link } from "office-ui-fabric-react/lib/Link";
|
||||||
@ -50,7 +50,7 @@ const DIALOG_TITLE_FONT_SIZE = "17px";
|
|||||||
const DIALOG_TITLE_FONT_WEIGHT = 400;
|
const DIALOG_TITLE_FONT_WEIGHT = 400;
|
||||||
const DIALOG_SUBTEXT_FONT_SIZE = "15px";
|
const DIALOG_SUBTEXT_FONT_SIZE = "15px";
|
||||||
|
|
||||||
export class DialogComponent extends React.Component<DialogProps, {}> {
|
export class Dialog extends React.Component<DialogProps> {
|
||||||
constructor(props: DialogProps) {
|
constructor(props: DialogProps) {
|
||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ export class DialogComponent extends React.Component<DialogProps, {}> {
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog {...dialogProps}>
|
<FluentDialog {...dialogProps}>
|
||||||
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
{choiceGroupProps && <ChoiceGroup {...choiceGroupProps} />}
|
||||||
{textFieldProps && <TextField {...textFieldProps} />}
|
{textFieldProps && <TextField {...textFieldProps} />}
|
||||||
{linkProps && (
|
{linkProps && (
|
||||||
@ -104,7 +104,7 @@ export class DialogComponent extends React.Component<DialogProps, {}> {
|
|||||||
<PrimaryButton {...primaryButtonProps} />
|
<PrimaryButton {...primaryButtonProps} />
|
||||||
{secondaryButtonProps && <DefaultButton {...secondaryButtonProps} />}
|
{secondaryButtonProps && <DefaultButton {...secondaryButtonProps} />}
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</Dialog>
|
</FluentDialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* This adapter is responsible to render the Dialog React component
|
|
||||||
* If the component signals a change through the callback passed in the properties, it must render the React component when appropriate
|
|
||||||
* and update any knockout observables passed from the parent.
|
|
||||||
*/
|
|
||||||
import * as React from "react";
|
|
||||||
import { DialogComponent, DialogProps } from "./DialogComponent";
|
|
||||||
import { ReactAdapter } from "../../../Bindings/ReactBindingHandler";
|
|
||||||
|
|
||||||
export class DialogComponentAdapter implements ReactAdapter {
|
|
||||||
public parameters: ko.Observable<DialogProps>;
|
|
||||||
|
|
||||||
public renderComponent(): JSX.Element {
|
|
||||||
return <DialogComponent {...this.parameters()} />;
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,7 +23,7 @@ import {
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
||||||
import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
||||||
import { DialogComponent, DialogProps } from "../DialogReactComponent/DialogComponent";
|
import { Dialog, DialogProps } from "../Dialog";
|
||||||
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
||||||
import "./GalleryViewerComponent.less";
|
import "./GalleryViewerComponent.less";
|
||||||
import { HttpStatusCodes } from "../../../Common/Constants";
|
import { HttpStatusCodes } from "../../../Common/Constants";
|
||||||
@ -196,7 +196,7 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
|
|||||||
<div className="galleryContainer">
|
<div className="galleryContainer">
|
||||||
<Pivot {...pivotProps}>{pivotItems}</Pivot>
|
<Pivot {...pivotProps}>{pivotItems}</Pivot>
|
||||||
|
|
||||||
{this.state.dialogProps && <DialogComponent {...this.state.dialogProps} />}
|
{this.state.dialogProps && <Dialog {...this.state.dialogProps} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
|||||||
import { NotebookClientV2 } from "../../Notebook/NotebookClientV2";
|
import { NotebookClientV2 } from "../../Notebook/NotebookClientV2";
|
||||||
import { NotebookComponentBootstrapper } from "../../Notebook/NotebookComponent/NotebookComponentBootstrapper";
|
import { NotebookComponentBootstrapper } from "../../Notebook/NotebookComponent/NotebookComponentBootstrapper";
|
||||||
import NotebookReadOnlyRenderer from "../../Notebook/NotebookRenderer/NotebookReadOnlyRenderer";
|
import NotebookReadOnlyRenderer from "../../Notebook/NotebookRenderer/NotebookReadOnlyRenderer";
|
||||||
import { DialogComponent, DialogProps, TextFieldProps } from "../DialogReactComponent/DialogComponent";
|
import { Dialog, DialogProps, TextFieldProps } from "../Dialog";
|
||||||
import { NotebookMetadataComponent } from "./NotebookMetadataComponent";
|
import { NotebookMetadataComponent } from "./NotebookMetadataComponent";
|
||||||
import "./NotebookViewerComponent.less";
|
import "./NotebookViewerComponent.less";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
@ -179,7 +179,7 @@ export class NotebookViewerComponent
|
|||||||
hidePrompts: this.props.hidePrompts,
|
hidePrompts: this.props.hidePrompts,
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{this.state.dialogProps && <DialogComponent {...this.state.dialogProps} />}
|
{this.state.dialogProps && <Dialog {...this.state.dialogProps} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,8 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"changeFeedPolicy": [Function],
|
"changeFeedPolicy": [Function],
|
||||||
"conflictResolutionPolicy": [Function],
|
"conflictResolutionPolicy": [Function],
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_addSynapseLinkDialogProps": [Function],
|
|
||||||
"_closeModalDialog": [Function],
|
"_closeModalDialog": [Function],
|
||||||
"_closeSynapseLinkModalDialog": [Function],
|
"_closeSynapseLinkModalDialog": [Function],
|
||||||
"_dialogProps": [Function],
|
|
||||||
"_isAfecFeatureRegistered": [Function],
|
"_isAfecFeatureRegistered": [Function],
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_isSystemDatabasePredicate": [Function],
|
"_isSystemDatabasePredicate": [Function],
|
||||||
@ -677,9 +675,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"addDatabaseText": [Function],
|
"addDatabaseText": [Function],
|
||||||
"addSynapseLinkDialog": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"addTableEntityPane": AddTableEntityPane {
|
"addTableEntityPane": AddTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -786,6 +781,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"clickHostedAccountSwitch": [Function],
|
"clickHostedAccountSwitch": [Function],
|
||||||
"clickHostedDirectorySwitch": [Function],
|
"clickHostedDirectorySwitch": [Function],
|
||||||
|
"closeDialog": undefined,
|
||||||
"closeSidePanel": undefined,
|
"closeSidePanel": undefined,
|
||||||
"collapsedResourceTreeWidth": 36,
|
"collapsedResourceTreeWidth": 36,
|
||||||
"collectionCreationDefaults": Object {
|
"collectionCreationDefaults": Object {
|
||||||
@ -841,9 +837,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"deleteDatabaseText": [Function],
|
"deleteDatabaseText": [Function],
|
||||||
"dialogComponentAdapter": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"editTableEntityPane": EditTableEntityPane {
|
"editTableEntityPane": EditTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -1004,6 +997,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"onToggleKeyDown": [Function],
|
"onToggleKeyDown": [Function],
|
||||||
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
@ -1267,10 +1261,8 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
container={
|
container={
|
||||||
Explorer {
|
Explorer {
|
||||||
"_addSynapseLinkDialogProps": [Function],
|
|
||||||
"_closeModalDialog": [Function],
|
"_closeModalDialog": [Function],
|
||||||
"_closeSynapseLinkModalDialog": [Function],
|
"_closeSynapseLinkModalDialog": [Function],
|
||||||
"_dialogProps": [Function],
|
|
||||||
"_isAfecFeatureRegistered": [Function],
|
"_isAfecFeatureRegistered": [Function],
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_isSystemDatabasePredicate": [Function],
|
"_isSystemDatabasePredicate": [Function],
|
||||||
@ -1916,9 +1908,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"addDatabaseText": [Function],
|
"addDatabaseText": [Function],
|
||||||
"addSynapseLinkDialog": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"addTableEntityPane": AddTableEntityPane {
|
"addTableEntityPane": AddTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -2025,6 +2014,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"clickHostedAccountSwitch": [Function],
|
"clickHostedAccountSwitch": [Function],
|
||||||
"clickHostedDirectorySwitch": [Function],
|
"clickHostedDirectorySwitch": [Function],
|
||||||
|
"closeDialog": undefined,
|
||||||
"closeSidePanel": undefined,
|
"closeSidePanel": undefined,
|
||||||
"collapsedResourceTreeWidth": 36,
|
"collapsedResourceTreeWidth": 36,
|
||||||
"collectionCreationDefaults": Object {
|
"collectionCreationDefaults": Object {
|
||||||
@ -2080,9 +2070,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"deleteDatabaseText": [Function],
|
"deleteDatabaseText": [Function],
|
||||||
"dialogComponentAdapter": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"editTableEntityPane": EditTableEntityPane {
|
"editTableEntityPane": EditTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -2243,6 +2230,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"onToggleKeyDown": [Function],
|
"onToggleKeyDown": [Function],
|
||||||
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
@ -2519,10 +2507,8 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"changeFeedPolicy": [Function],
|
"changeFeedPolicy": [Function],
|
||||||
"conflictResolutionPolicy": [Function],
|
"conflictResolutionPolicy": [Function],
|
||||||
"container": Explorer {
|
"container": Explorer {
|
||||||
"_addSynapseLinkDialogProps": [Function],
|
|
||||||
"_closeModalDialog": [Function],
|
"_closeModalDialog": [Function],
|
||||||
"_closeSynapseLinkModalDialog": [Function],
|
"_closeSynapseLinkModalDialog": [Function],
|
||||||
"_dialogProps": [Function],
|
|
||||||
"_isAfecFeatureRegistered": [Function],
|
"_isAfecFeatureRegistered": [Function],
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_isSystemDatabasePredicate": [Function],
|
"_isSystemDatabasePredicate": [Function],
|
||||||
@ -3168,9 +3154,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"addDatabaseText": [Function],
|
"addDatabaseText": [Function],
|
||||||
"addSynapseLinkDialog": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"addTableEntityPane": AddTableEntityPane {
|
"addTableEntityPane": AddTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -3277,6 +3260,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"clickHostedAccountSwitch": [Function],
|
"clickHostedAccountSwitch": [Function],
|
||||||
"clickHostedDirectorySwitch": [Function],
|
"clickHostedDirectorySwitch": [Function],
|
||||||
|
"closeDialog": undefined,
|
||||||
"closeSidePanel": undefined,
|
"closeSidePanel": undefined,
|
||||||
"collapsedResourceTreeWidth": 36,
|
"collapsedResourceTreeWidth": 36,
|
||||||
"collectionCreationDefaults": Object {
|
"collectionCreationDefaults": Object {
|
||||||
@ -3332,9 +3316,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"deleteDatabaseText": [Function],
|
"deleteDatabaseText": [Function],
|
||||||
"dialogComponentAdapter": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"editTableEntityPane": EditTableEntityPane {
|
"editTableEntityPane": EditTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -3495,6 +3476,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"onToggleKeyDown": [Function],
|
"onToggleKeyDown": [Function],
|
||||||
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
@ -3758,10 +3740,8 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
container={
|
container={
|
||||||
Explorer {
|
Explorer {
|
||||||
"_addSynapseLinkDialogProps": [Function],
|
|
||||||
"_closeModalDialog": [Function],
|
"_closeModalDialog": [Function],
|
||||||
"_closeSynapseLinkModalDialog": [Function],
|
"_closeSynapseLinkModalDialog": [Function],
|
||||||
"_dialogProps": [Function],
|
|
||||||
"_isAfecFeatureRegistered": [Function],
|
"_isAfecFeatureRegistered": [Function],
|
||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_isSystemDatabasePredicate": [Function],
|
"_isSystemDatabasePredicate": [Function],
|
||||||
@ -4407,9 +4387,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"addDatabaseText": [Function],
|
"addDatabaseText": [Function],
|
||||||
"addSynapseLinkDialog": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"addTableEntityPane": AddTableEntityPane {
|
"addTableEntityPane": AddTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -4516,6 +4493,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
},
|
},
|
||||||
"clickHostedAccountSwitch": [Function],
|
"clickHostedAccountSwitch": [Function],
|
||||||
"clickHostedDirectorySwitch": [Function],
|
"clickHostedDirectorySwitch": [Function],
|
||||||
|
"closeDialog": undefined,
|
||||||
"closeSidePanel": undefined,
|
"closeSidePanel": undefined,
|
||||||
"collapsedResourceTreeWidth": 36,
|
"collapsedResourceTreeWidth": 36,
|
||||||
"collectionCreationDefaults": Object {
|
"collectionCreationDefaults": Object {
|
||||||
@ -4571,9 +4549,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"visible": [Function],
|
"visible": [Function],
|
||||||
},
|
},
|
||||||
"deleteDatabaseText": [Function],
|
"deleteDatabaseText": [Function],
|
||||||
"dialogComponentAdapter": DialogComponentAdapter {
|
|
||||||
"parameters": [Function],
|
|
||||||
},
|
|
||||||
"editTableEntityPane": EditTableEntityPane {
|
"editTableEntityPane": EditTableEntityPane {
|
||||||
"addButtonLabel": "Add Property",
|
"addButtonLabel": "Add Property",
|
||||||
"attributeNameLabel": "Property Name",
|
"attributeNameLabel": "Property Name",
|
||||||
@ -4734,6 +4709,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"onRefreshResourcesClick": [Function],
|
"onRefreshResourcesClick": [Function],
|
||||||
"onSwitchToConnectionString": [Function],
|
"onSwitchToConnectionString": [Function],
|
||||||
"onToggleKeyDown": [Function],
|
"onToggleKeyDown": [Function],
|
||||||
|
"openDialog": undefined,
|
||||||
"openSidePanel": undefined,
|
"openSidePanel": undefined,
|
||||||
"provideFeedbackEmail": [Function],
|
"provideFeedbackEmail": [Function],
|
||||||
"queriesClient": QueriesClient {
|
"queriesClient": QueriesClient {
|
||||||
|
@ -40,8 +40,7 @@ import { configContext, Platform, updateConfigContext } from "../ConfigContext";
|
|||||||
import { ConsoleData, ConsoleDataType } from "./Menus/NotificationConsole/NotificationConsoleComponent";
|
import { ConsoleData, ConsoleDataType } from "./Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { decryptJWTToken, getAuthorizationHeader } from "../Utils/AuthorizationUtils";
|
import { decryptJWTToken, getAuthorizationHeader } from "../Utils/AuthorizationUtils";
|
||||||
import { DefaultExperienceUtility } from "../Shared/DefaultExperienceUtility";
|
import { DefaultExperienceUtility } from "../Shared/DefaultExperienceUtility";
|
||||||
import { DialogComponentAdapter } from "./Controls/DialogReactComponent/DialogComponentAdapter";
|
import { DialogProps, TextFieldProps } from "./Controls/Dialog";
|
||||||
import { DialogProps, TextFieldProps } from "./Controls/DialogReactComponent/DialogComponent";
|
|
||||||
import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane";
|
import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane";
|
||||||
import { ExplorerMetrics } from "../Common/Constants";
|
import { ExplorerMetrics } from "../Common/Constants";
|
||||||
import { ExplorerSettings } from "../Shared/ExplorerSettings";
|
import { ExplorerSettings } from "../Shared/ExplorerSettings";
|
||||||
@ -111,6 +110,8 @@ export interface ExplorerParams {
|
|||||||
setInProgressConsoleDataIdToBeDeleted: (id: string) => void;
|
setInProgressConsoleDataIdToBeDeleted: (id: string) => void;
|
||||||
openSidePanel: (headerText: string, panelContent: JSX.Element) => void;
|
openSidePanel: (headerText: string, panelContent: JSX.Element) => void;
|
||||||
closeSidePanel: () => void;
|
closeSidePanel: () => void;
|
||||||
|
closeDialog: () => void;
|
||||||
|
openDialog: (props: DialogProps) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Explorer {
|
export default class Explorer {
|
||||||
@ -250,6 +251,8 @@ export default class Explorer {
|
|||||||
public isSynapseLinkUpdating: ko.Observable<boolean>;
|
public isSynapseLinkUpdating: ko.Observable<boolean>;
|
||||||
public memoryUsageInfo: ko.Observable<DataModels.MemoryUsageInfo>;
|
public memoryUsageInfo: ko.Observable<DataModels.MemoryUsageInfo>;
|
||||||
public notebookManager?: any; // This is dynamically loaded
|
public notebookManager?: any; // This is dynamically loaded
|
||||||
|
public openDialog: ExplorerParams["openDialog"];
|
||||||
|
public closeDialog: ExplorerParams["closeDialog"];
|
||||||
|
|
||||||
private _panes: ContextualPaneBase[] = [];
|
private _panes: ContextualPaneBase[] = [];
|
||||||
private _isSystemDatabasePredicate: (database: ViewModels.Database) => boolean = (database) => false;
|
private _isSystemDatabasePredicate: (database: ViewModels.Database) => boolean = (database) => false;
|
||||||
@ -263,10 +266,6 @@ export default class Explorer {
|
|||||||
|
|
||||||
// React adapters
|
// React adapters
|
||||||
private commandBarComponentAdapter: CommandBarComponentAdapter;
|
private commandBarComponentAdapter: CommandBarComponentAdapter;
|
||||||
private dialogComponentAdapter: DialogComponentAdapter;
|
|
||||||
private _dialogProps: ko.Observable<DialogProps>;
|
|
||||||
private addSynapseLinkDialog: DialogComponentAdapter;
|
|
||||||
private _addSynapseLinkDialogProps: ko.Observable<DialogProps>;
|
|
||||||
private selfServeLoadingComponentAdapter: SelfServeLoadingComponentAdapter;
|
private selfServeLoadingComponentAdapter: SelfServeLoadingComponentAdapter;
|
||||||
|
|
||||||
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
private static readonly MaxNbDatabasesToAutoExpand = 5;
|
||||||
@ -277,6 +276,8 @@ export default class Explorer {
|
|||||||
this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted;
|
this.setInProgressConsoleDataIdToBeDeleted = params?.setInProgressConsoleDataIdToBeDeleted;
|
||||||
this.openSidePanel = params?.openSidePanel;
|
this.openSidePanel = params?.openSidePanel;
|
||||||
this.closeSidePanel = params?.closeSidePanel;
|
this.closeSidePanel = params?.closeSidePanel;
|
||||||
|
this.closeDialog = params?.closeDialog;
|
||||||
|
this.openDialog = params?.openDialog;
|
||||||
|
|
||||||
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
@ -905,7 +906,6 @@ export default class Explorer {
|
|||||||
this.notebookManager = new notebookManagerModule.default();
|
this.notebookManager = new notebookManagerModule.default();
|
||||||
this.notebookManager.initialize({
|
this.notebookManager.initialize({
|
||||||
container: this,
|
container: this,
|
||||||
dialogProps: this._dialogProps,
|
|
||||||
notebookBasePath: this.notebookBasePath,
|
notebookBasePath: this.notebookBasePath,
|
||||||
resourceTree: this.resourceTree,
|
resourceTree: this.resourceTree,
|
||||||
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
refreshCommandBarButtons: () => this.refreshCommandBarButtons(),
|
||||||
@ -973,32 +973,7 @@ export default class Explorer {
|
|||||||
featureSubcription.dispose();
|
featureSubcription.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._dialogProps = ko.observable<DialogProps>({
|
|
||||||
isModal: false,
|
|
||||||
visible: false,
|
|
||||||
title: undefined,
|
|
||||||
subText: undefined,
|
|
||||||
primaryButtonText: undefined,
|
|
||||||
secondaryButtonText: undefined,
|
|
||||||
onPrimaryButtonClick: undefined,
|
|
||||||
onSecondaryButtonClick: undefined,
|
|
||||||
});
|
|
||||||
this.dialogComponentAdapter = new DialogComponentAdapter();
|
|
||||||
this.dialogComponentAdapter.parameters = this._dialogProps;
|
|
||||||
this.mostRecentActivity = new MostRecentActivity.MostRecentActivity(this);
|
this.mostRecentActivity = new MostRecentActivity.MostRecentActivity(this);
|
||||||
|
|
||||||
this._addSynapseLinkDialogProps = ko.observable<DialogProps>({
|
|
||||||
isModal: false,
|
|
||||||
visible: false,
|
|
||||||
title: undefined,
|
|
||||||
subText: undefined,
|
|
||||||
primaryButtonText: undefined,
|
|
||||||
secondaryButtonText: undefined,
|
|
||||||
onPrimaryButtonClick: undefined,
|
|
||||||
onSecondaryButtonClick: undefined,
|
|
||||||
});
|
|
||||||
this.addSynapseLinkDialog = new DialogComponentAdapter();
|
|
||||||
this.addSynapseLinkDialog.parameters = this._addSynapseLinkDialogProps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public openEnableSynapseLinkDialog(): void {
|
public openEnableSynapseLinkDialog(): void {
|
||||||
@ -1060,7 +1035,7 @@ export default class Explorer {
|
|||||||
TelemetryProcessor.traceCancel(Action.EnableAzureSynapseLink);
|
TelemetryProcessor.traceCancel(Action.EnableAzureSynapseLink);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this._addSynapseLinkDialogProps(addSynapseLinkDialogProps);
|
this.openDialog(addSynapseLinkDialogProps);
|
||||||
TelemetryProcessor.traceStart(Action.EnableAzureSynapseLink);
|
TelemetryProcessor.traceStart(Action.EnableAzureSynapseLink);
|
||||||
|
|
||||||
// TODO: return result
|
// TODO: return result
|
||||||
@ -1496,6 +1471,7 @@ export default class Explorer {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetConfirmationDialogProps: DialogProps = {
|
const resetConfirmationDialogProps: DialogProps = {
|
||||||
isModal: true,
|
isModal: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
@ -1506,7 +1482,7 @@ export default class Explorer {
|
|||||||
onPrimaryButtonClick: this._resetNotebookWorkspace,
|
onPrimaryButtonClick: this._resetNotebookWorkspace,
|
||||||
onSecondaryButtonClick: this._closeModalDialog,
|
onSecondaryButtonClick: this._closeModalDialog,
|
||||||
};
|
};
|
||||||
this._dialogProps(resetConfirmationDialogProps);
|
this.openDialog(resetConfirmationDialogProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _containsDefaultNotebookWorkspace(databaseAccount: DataModels.DatabaseAccount): Promise<boolean> {
|
private async _containsDefaultNotebookWorkspace(databaseAccount: DataModels.DatabaseAccount): Promise<boolean> {
|
||||||
@ -1570,13 +1546,11 @@ export default class Explorer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private _closeModalDialog = () => {
|
private _closeModalDialog = () => {
|
||||||
this._dialogProps().visible = false;
|
this.closeDialog();
|
||||||
this._dialogProps.valueHasMutated();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private _closeSynapseLinkModalDialog = () => {
|
private _closeSynapseLinkModalDialog = () => {
|
||||||
this._addSynapseLinkDialogProps().visible = false;
|
this.closeDialog();
|
||||||
this._addSynapseLinkDialogProps.valueHasMutated();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public findSelectedDatabase(): ViewModels.Database {
|
public findSelectedDatabase(): ViewModels.Database {
|
||||||
@ -2080,7 +2054,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public showOkModalDialog(title: string, msg: string): void {
|
public showOkModalDialog(title: string, msg: string): void {
|
||||||
this._dialogProps({
|
this.openDialog({
|
||||||
isModal: true,
|
isModal: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
title,
|
title,
|
||||||
@ -2103,7 +2077,7 @@ export default class Explorer {
|
|||||||
textFieldProps?: TextFieldProps,
|
textFieldProps?: TextFieldProps,
|
||||||
isPrimaryButtonDisabled?: boolean
|
isPrimaryButtonDisabled?: boolean
|
||||||
): void {
|
): void {
|
||||||
this._dialogProps({
|
this.openDialog({
|
||||||
isModal: true,
|
isModal: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
title,
|
title,
|
||||||
@ -2437,7 +2411,7 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.type === NotebookContentItemType.Directory && item.children && item.children.length > 0) {
|
if (item.type === NotebookContentItemType.Directory && item.children && item.children.length > 0) {
|
||||||
this._dialogProps({
|
this.openDialog({
|
||||||
isModal: true,
|
isModal: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
title: "Unable to delete file",
|
title: "Unable to delete file",
|
||||||
|
@ -18,7 +18,6 @@ import { contents } from "rx-jupyter";
|
|||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { MemoryUsageInfo } from "../../Contracts/DataModels";
|
import { MemoryUsageInfo } from "../../Contracts/DataModels";
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { DialogProps } from "../Controls/DialogReactComponent/DialogComponent";
|
|
||||||
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter";
|
||||||
import { PublishNotebookPaneAdapter } from "../Panes/PublishNotebookPaneAdapter";
|
import { PublishNotebookPaneAdapter } from "../Panes/PublishNotebookPaneAdapter";
|
||||||
import { getFullName } from "../../Utils/UserUtils";
|
import { getFullName } from "../../Utils/UserUtils";
|
||||||
@ -31,7 +30,6 @@ import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
|||||||
export interface NotebookManagerOptions {
|
export interface NotebookManagerOptions {
|
||||||
container: Explorer;
|
container: Explorer;
|
||||||
notebookBasePath: ko.Observable<string>;
|
notebookBasePath: ko.Observable<string>;
|
||||||
dialogProps: ko.Observable<DialogProps>;
|
|
||||||
resourceTree: ResourceTreeAdapter;
|
resourceTree: ResourceTreeAdapter;
|
||||||
refreshCommandBarButtons: () => void;
|
refreshCommandBarButtons: () => void;
|
||||||
refreshNotebookList: () => void;
|
refreshNotebookList: () => void;
|
||||||
@ -181,10 +179,8 @@ export default class NotebookManager {
|
|||||||
multiline: true,
|
multiline: true,
|
||||||
defaultValue: commitMsg,
|
defaultValue: commitMsg,
|
||||||
rows: 3,
|
rows: 3,
|
||||||
onChange: (_, newValue: string) => {
|
onChange: (_: unknown, newValue: string) => {
|
||||||
commitMsg = newValue;
|
commitMsg = newValue;
|
||||||
this.params.dialogProps().primaryButtonDisabled = !commitMsg;
|
|
||||||
this.params.dialogProps.valueHasMutated();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
!commitMsg
|
!commitMsg
|
||||||
|
18
src/Main.tsx
18
src/Main.tsx
@ -69,6 +69,7 @@ import { useSidePanel } from "./hooks/useSidePanel";
|
|||||||
import { NotificationConsoleComponent } from "./Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
import { NotificationConsoleComponent } from "./Explorer/Menus/NotificationConsole/NotificationConsoleComponent";
|
||||||
import { PanelContainerComponent } from "./Explorer/Panes/PanelContainerComponent";
|
import { PanelContainerComponent } from "./Explorer/Panes/PanelContainerComponent";
|
||||||
import { SplashScreen } from "./Explorer/SplashScreen/SplashScreen";
|
import { SplashScreen } from "./Explorer/SplashScreen/SplashScreen";
|
||||||
|
import { Dialog, DialogProps } from "./Explorer/Controls/Dialog";
|
||||||
|
|
||||||
initializeIcons();
|
initializeIcons();
|
||||||
|
|
||||||
@ -78,6 +79,17 @@ const App: React.FunctionComponent = () => {
|
|||||||
//TODO: Refactor so we don't need to pass the id to remove a console data
|
//TODO: Refactor so we don't need to pass the id to remove a console data
|
||||||
const [inProgressConsoleDataIdToBeDeleted, setInProgressConsoleDataIdToBeDeleted] = useState("");
|
const [inProgressConsoleDataIdToBeDeleted, setInProgressConsoleDataIdToBeDeleted] = useState("");
|
||||||
|
|
||||||
|
const [dialogProps, setDialogProps] = useState<DialogProps>();
|
||||||
|
const [showDialog, setShowDialog] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const openDialog = (props: DialogProps) => {
|
||||||
|
setDialogProps(props);
|
||||||
|
setShowDialog(true);
|
||||||
|
};
|
||||||
|
const closeDialog = () => {
|
||||||
|
setShowDialog(false);
|
||||||
|
};
|
||||||
|
|
||||||
const { isPanelOpen, panelContent, headerText, openSidePanel, closeSidePanel } = useSidePanel();
|
const { isPanelOpen, panelContent, headerText, openSidePanel, closeSidePanel } = useSidePanel();
|
||||||
|
|
||||||
const explorerParams: ExplorerParams = {
|
const explorerParams: ExplorerParams = {
|
||||||
@ -86,6 +98,8 @@ const App: React.FunctionComponent = () => {
|
|||||||
setInProgressConsoleDataIdToBeDeleted,
|
setInProgressConsoleDataIdToBeDeleted,
|
||||||
openSidePanel,
|
openSidePanel,
|
||||||
closeSidePanel,
|
closeSidePanel,
|
||||||
|
openDialog,
|
||||||
|
closeDialog,
|
||||||
};
|
};
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
const explorer = useKnockoutExplorer(config?.platform, explorerParams);
|
const explorer = useKnockoutExplorer(config?.platform, explorerParams);
|
||||||
@ -355,9 +369,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
<KOCommentIfStart if="isCopyNotebookPaneEnabled" />
|
<KOCommentIfStart if="isCopyNotebookPaneEnabled" />
|
||||||
<div data-bind="react: copyNotebookPaneAdapter" />
|
<div data-bind="react: copyNotebookPaneAdapter" />
|
||||||
<KOCommentEnd />
|
<KOCommentEnd />
|
||||||
{/* Global access token expiration dialog - End */}
|
{showDialog && <Dialog {...dialogProps} />}
|
||||||
<div data-bind="react: dialogComponentAdapter" />
|
|
||||||
<div data-bind="react: addSynapseLinkDialog" />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
} from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
||||||
import Explorer from "../Explorer/Explorer";
|
import Explorer from "../Explorer/Explorer";
|
||||||
import { IChoiceGroupOption, IChoiceGroupProps, IProgressIndicatorProps } from "office-ui-fabric-react";
|
import { IChoiceGroupOption, IChoiceGroupProps, IProgressIndicatorProps } from "office-ui-fabric-react";
|
||||||
import { TextFieldProps } from "../Explorer/Controls/DialogReactComponent/DialogComponent";
|
import { TextFieldProps } from "../Explorer/Controls/Dialog";
|
||||||
import { getErrorMessage, getErrorStack, handleError } from "../Common/ErrorHandlingUtils";
|
import { getErrorMessage, getErrorStack, handleError } from "../Common/ErrorHandlingUtils";
|
||||||
import { HttpStatusCodes } from "../Common/Constants";
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../Shared/Telemetry/TelemetryProcessor";
|
import { trace, traceFailure, traceStart, traceSuccess } from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
Loading…
Reference in New Issue
Block a user