mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-05 18:47:41 +00:00
Compare commits
4 Commits
user/t-tom
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fe9e209ac | ||
|
|
759a4ca5cf | ||
|
|
9078878f44 | ||
|
|
139a9cb22c |
@@ -1,23 +0,0 @@
|
||||
@import "./Common/Constants";
|
||||
|
||||
.chat {
|
||||
display: grid;
|
||||
justify-content: right;
|
||||
padding: 10px;
|
||||
|
||||
.chatButton {
|
||||
margin: 0 45px 15px 0;
|
||||
border: 10px;
|
||||
min-height: 44px;
|
||||
|
||||
&:focus {
|
||||
outline: 0px;
|
||||
}
|
||||
|
||||
>span {
|
||||
font-size: 17px;
|
||||
font-family: @DataExplorerFont;
|
||||
color: @AccentLow;
|
||||
}
|
||||
}
|
||||
}
|
||||
18557
package-lock.json
generated
18557
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
"@azure/cosmos": "3.16.2",
|
||||
"@azure/cosmos-language-service": "0.0.5",
|
||||
"@azure/identity": "1.2.1",
|
||||
"@azure/ms-rest-nodeauth": "3.0.7",
|
||||
"@azure/ms-rest-nodeauth": "3.1.1",
|
||||
"@azure/msal-browser": "2.14.2",
|
||||
"@babel/plugin-proposal-class-properties": "7.12.1",
|
||||
"@babel/plugin-proposal-decorators": "7.12.12",
|
||||
@@ -47,7 +47,6 @@
|
||||
"@types/node-fetch": "2.5.7",
|
||||
"applicationinsights": "1.8.0",
|
||||
"bootstrap": "3.4.1",
|
||||
"botframework-webchat": "4.14.1",
|
||||
"canvas": "file:./canvas",
|
||||
"clean-webpack-plugin": "3.0.0",
|
||||
"clipboard-copy": "4.0.1",
|
||||
@@ -128,7 +127,6 @@
|
||||
"@types/react-notification-system": "0.2.39",
|
||||
"@types/react-redux": "7.1.7",
|
||||
"@types/react-splitter-layout": "3.0.1",
|
||||
"@types/react-youtube": "7.10.0",
|
||||
"@types/sanitize-html": "1.27.2",
|
||||
"@types/sinon": "2.3.3",
|
||||
"@types/styled-components": "5.1.1",
|
||||
@@ -234,4 +232,4 @@
|
||||
"prettier": {
|
||||
"printWidth": 120
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +299,7 @@ export function createMongoCollectionWithProxy(
|
||||
db: params.databaseId,
|
||||
coll: params.collectionId,
|
||||
pk: shardKey,
|
||||
offerThroughput: params.offerThroughput,
|
||||
offerThroughput: params.autoPilotMaxThroughput || params.offerThroughput,
|
||||
cd: params.createNewDatabase,
|
||||
st: params.databaseLevelThroughput,
|
||||
is: !!shardKey,
|
||||
@@ -309,7 +309,6 @@ export function createMongoCollectionWithProxy(
|
||||
rg: userContext.resourceGroup,
|
||||
dba: databaseAccount.name,
|
||||
isAutoPilot: !!params.autoPilotMaxThroughput,
|
||||
autoPilotThroughput: params.autoPilotMaxThroughput?.toString(),
|
||||
};
|
||||
|
||||
const endpoint = getFeatureEndpointOrDefault("createCollectionWithProxy");
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
allowedJunoOrigins,
|
||||
allowedMongoBackendEndpoints,
|
||||
allowedMsalRedirectEndpoints,
|
||||
validateEndpoint
|
||||
validateEndpoint,
|
||||
} from "Utils/EndpointValidation";
|
||||
|
||||
export enum Platform {
|
||||
@@ -190,4 +190,3 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
||||
}
|
||||
|
||||
export { configContext };
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import { IIconProps } from '@fluentui/react';
|
||||
import { PrimaryButton } from '@fluentui/react/lib/Button';
|
||||
import { AuthType } from 'AuthType';
|
||||
import { SupportPaneComponent } from 'Explorer/Controls/SupportPaneComponent/SupportPaneComponent';
|
||||
import Explorer from 'Explorer/Explorer';
|
||||
import { useSidePanel } from 'hooks/useSidePanel';
|
||||
import * as React from 'react';
|
||||
import { userContext } from 'UserContext';
|
||||
|
||||
export interface ChatButtonProps {
|
||||
container: Explorer;
|
||||
}
|
||||
|
||||
const chatIcon: IIconProps = { iconName: 'ChatSolid', style: { marginRight: 10 } };
|
||||
|
||||
|
||||
|
||||
|
||||
export const ChatButtonAction: React.FunctionComponent<ChatButtonProps> = props => {
|
||||
const { container } = props;
|
||||
if (userContext.authType === AuthType.AAD && userContext.features.enableChatbot) {
|
||||
return (
|
||||
<PrimaryButton className={"chatButton"} iconProps={chatIcon} onClick={() => {
|
||||
useSidePanel
|
||||
.getState()
|
||||
.openSidePanel(
|
||||
"Chat Assistant (Beta)",
|
||||
<SupportPaneComponent
|
||||
directLineToken={container.conversationToken()}
|
||||
userToken={userContext.authorizationToken}
|
||||
subId={userContext.subscriptionId}
|
||||
rg={userContext.resourceGroup}
|
||||
accName={userContext.databaseAccount.name}
|
||||
/>
|
||||
);
|
||||
}}>
|
||||
<span> Help? </span>
|
||||
</PrimaryButton>
|
||||
);
|
||||
}
|
||||
return <div></div>
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* React component for Command button component.
|
||||
*/
|
||||
import { Icon, IIconStyles } from "@fluentui/react";
|
||||
import * as React from "react";
|
||||
import CollapseChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
||||
import { KeyCodes } from "../../../Common/Constants";
|
||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import * as StringUtils from "../../../Utils/StringUtils";
|
||||
|
||||
/**
|
||||
* Options for this component
|
||||
*/
|
||||
@@ -243,7 +243,6 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
||||
if (this.props.children && this.props.children.length > 0) {
|
||||
contentClassName += " hasHiddenItems";
|
||||
}
|
||||
const iconButtonStyles: Partial<IIconStyles> = { root: { marginBottom: -3 } };
|
||||
|
||||
return (
|
||||
<div className="commandButtonReact">
|
||||
@@ -260,18 +259,7 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
||||
onClick={(e: React.MouseEvent<HTMLSpanElement>) => this.commandClickCallback(e)}
|
||||
>
|
||||
<div className={contentClassName}>
|
||||
if (this.props.iconName){" "}
|
||||
{
|
||||
<div>
|
||||
<Icon
|
||||
styles={iconButtonStyles}
|
||||
className="panelInfoIcon"
|
||||
iconName={this.props.iconName}
|
||||
ariaLabel="ChatBot"
|
||||
/>
|
||||
</div>
|
||||
}{" "}
|
||||
else {<img className="commandIcon" src={this.props.iconSrc} alt={this.props.iconAlt} />}
|
||||
<img className="commandIcon" src={this.props.iconSrc} alt={this.props.iconAlt} />
|
||||
{CommandButtonComponent.renderLabel(this.props)}
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { Activity } from "botframework-directlinejs";
|
||||
import ReactWebChat from "botframework-webchat";
|
||||
import React from "react";
|
||||
import * as _ from "underscore";
|
||||
|
||||
const BotFramework = require('botframework-webchat');
|
||||
|
||||
export interface SupportPaneComponentProps {
|
||||
directLineToken: string;
|
||||
userToken: string;
|
||||
subId: string;
|
||||
rg: string;
|
||||
accName: string;
|
||||
}
|
||||
|
||||
export class SupportPaneComponent extends React.Component<SupportPaneComponentProps> {
|
||||
private readonly userId: string = _.uniqueId();
|
||||
|
||||
constructor(props: SupportPaneComponentProps) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
const styleOptions = {
|
||||
bubbleBackground: "rgba(0, 0, 255, .1)",
|
||||
bubbleFromUserBackground: "rgba(0, 255, 0, .1)",
|
||||
suggestedActionLayout: 'flow',
|
||||
markdownRespectCRLF: true,
|
||||
};
|
||||
|
||||
const directLine = BotFramework.createDirectLine({ token: this.props.directLineToken });
|
||||
const dl = {
|
||||
...directLine,
|
||||
postActivity: (activity: Activity) => {
|
||||
activity.channelData.token = this.props.userToken;
|
||||
activity.channelData.subId = this.props.subId;
|
||||
activity.channelData.rg = this.props.rg;
|
||||
activity.channelData.accName = this.props.accName;
|
||||
|
||||
return directLine.postActivity(activity);
|
||||
},
|
||||
};
|
||||
|
||||
return <ReactWebChat directLine={dl} userID={this.userId} styleOptions={styleOptions} />;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Link } from "@fluentui/react/lib/Link";
|
||||
import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility";
|
||||
import { configContext } from "ConfigContext";
|
||||
import { IGalleryItem } from "Juno/JunoClient";
|
||||
import * as ko from "knockout";
|
||||
import React from "react";
|
||||
@@ -35,7 +34,6 @@ import { userContext } from "../UserContext";
|
||||
import { getCollectionName, getUploadName } from "../Utils/APITypeUtils";
|
||||
import { update } from "../Utils/arm/generatedClients/cosmos/databaseAccounts";
|
||||
import { listByDatabaseAccount } from "../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
|
||||
import { getAuthorizationHeader } from "../Utils/AuthorizationUtils";
|
||||
import { stringToBlob } from "../Utils/BlobUtils";
|
||||
import { isCapabilityEnabled } from "../Utils/CapabilityUtils";
|
||||
import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils";
|
||||
@@ -87,12 +85,6 @@ export default class Explorer {
|
||||
// Notebooks
|
||||
public notebookManager?: NotebookManager;
|
||||
|
||||
public conversationToken: ko.Observable<string>;
|
||||
public userToken: ko.Observable<string>;
|
||||
public subId: ko.Observable<string>;
|
||||
public rg: ko.Observable<string>;
|
||||
public accName: ko.Observable<string>;
|
||||
|
||||
private _isInitializingNotebooks: boolean;
|
||||
private notebookToImport: {
|
||||
name: string;
|
||||
@@ -114,10 +106,6 @@ export default class Explorer {
|
||||
|
||||
this.queriesClient = new QueriesClient(this);
|
||||
|
||||
this.conversationToken = ko.observable<string>();
|
||||
|
||||
this.generateConversationToken();
|
||||
|
||||
useSelectedNode.subscribe(() => {
|
||||
// Make sure switching tabs restores tabs display
|
||||
this.isTabsContentExpanded(false);
|
||||
@@ -467,30 +455,6 @@ export default class Explorer {
|
||||
useDialog.getState().openDialog(resetConfirmationDialogProps);
|
||||
}
|
||||
|
||||
private async generateConversationToken() {
|
||||
const url = `${configContext.JUNO_ENDPOINT}/api/chatbot/bot${userContext.databaseAccount.id}/conversationToken`;
|
||||
const authorizationHeader = getAuthorizationHeader();
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
[Constants.HttpHeaders.authorization]: authorizationHeader.token,
|
||||
Accept: "application/json",
|
||||
[Constants.HttpHeaders.contentType]: "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(await response.json());
|
||||
}
|
||||
|
||||
const tokenResponse: { conversationId: string; token: string; expires_in: number } = await response.json();
|
||||
this.conversationToken(tokenResponse?.token);
|
||||
if (tokenResponse?.expires_in) {
|
||||
setTimeout(() => this.generateConversationToken(), (tokenResponse?.expires_in - 1000) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private async _containsDefaultNotebookWorkspace(databaseAccount: DataModels.DatabaseAccount): Promise<boolean> {
|
||||
if (!databaseAccount) {
|
||||
return false;
|
||||
|
||||
@@ -26,7 +26,6 @@ import { userContext } from "../../../UserContext";
|
||||
import { getCollectionName, getDatabaseName } from "../../../Utils/APITypeUtils";
|
||||
import { isRunningOnNationalCloud } from "../../../Utils/CloudUtils";
|
||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||
import { SupportPaneComponent } from "../../Controls/SupportPaneComponent/SupportPaneComponent";
|
||||
import Explorer from "../../Explorer";
|
||||
import { useNotebook } from "../../Notebook/useNotebook";
|
||||
import { OpenFullScreen } from "../../OpenFullScreen";
|
||||
@@ -196,35 +195,6 @@ export function createControlCommandBarButtons(container: Explorer): CommandButt
|
||||
const showOpenFullScreen =
|
||||
configContext.platform === Platform.Portal && !isRunningOnNationalCloud() && userContext.apiType !== "Gremlin";
|
||||
|
||||
if (userContext.authType === AuthType.AAD && userContext.features.enableChatbot) {
|
||||
const label = "Chat Assistant";
|
||||
const supportPaneButton: CommandButtonComponentProps = {
|
||||
iconName: "ChatBot",
|
||||
iconAlt: label,
|
||||
onCommandClick: () => {
|
||||
useSidePanel
|
||||
.getState()
|
||||
.openSidePanel(
|
||||
"Chat Assistant (Beta)",
|
||||
<SupportPaneComponent
|
||||
directLineToken={container.conversationToken()}
|
||||
userToken={userContext.authorizationToken}
|
||||
subId={userContext.subscriptionId}
|
||||
rg={userContext.resourceGroup}
|
||||
accName={userContext.databaseAccount.name}
|
||||
/>
|
||||
);
|
||||
},
|
||||
commandButtonLabel: null,
|
||||
ariaLabel: label,
|
||||
tooltipText: label,
|
||||
hasPopup: true,
|
||||
disabled: false,
|
||||
className: "fonticoncustom",
|
||||
};
|
||||
buttons.push(supportPaneButton);
|
||||
}
|
||||
|
||||
if (showOpenFullScreen) {
|
||||
const label = "Open Full Screen";
|
||||
const fullScreenButton: CommandButtonComponentProps = {
|
||||
|
||||
@@ -42,10 +42,6 @@
|
||||
width: 18px;
|
||||
color: rgb(0, 120, 212);
|
||||
}
|
||||
.fonticoncustom {
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.status {
|
||||
position: relative;
|
||||
display: block;
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
color: @SelectionHigh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// CSS Dependencies
|
||||
import { initializeIcons } from "@fluentui/react";
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import { ChatButtonAction } from "Explorer/Controls/ChatButton/ChatButtonComponent";
|
||||
import { QuickstartCarousel } from "Explorer/Tutorials/QuickstartCarousel";
|
||||
import { QuickstartTutorial } from "Explorer/Tutorials/QuickstartTutorial";
|
||||
import { useCarousel } from "hooks/useCarousel";
|
||||
@@ -18,7 +17,6 @@ import "../externals/jquery.typeahead.min.js";
|
||||
import "../images/CosmosDB_rgb_ui_lighttheme.ico";
|
||||
import "../images/favicon.ico";
|
||||
import hdeConnectImage from "../images/HdeConnectCosmosDB.svg";
|
||||
import "../less/chat.less";
|
||||
import "../less/documentDB.less";
|
||||
import "../less/forms.less";
|
||||
import "../less/infobox.less";
|
||||
@@ -105,9 +103,6 @@ const App: React.FunctionComponent = () => {
|
||||
<Tabs explorer={explorer} />
|
||||
</div>
|
||||
{/* Collections Tree and Tabs - End */}
|
||||
<div className="chat">
|
||||
<ChatButtonAction container={explorer} />
|
||||
</div>
|
||||
<div
|
||||
className="dataExplorerErrorConsoleContainer"
|
||||
role="contentinfo"
|
||||
@@ -116,7 +111,6 @@ const App: React.FunctionComponent = () => {
|
||||
>
|
||||
<NotificationConsole />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<SidePanel />
|
||||
<Dialog />
|
||||
|
||||
@@ -29,9 +29,6 @@ export type Features = {
|
||||
readonly mongoProxyEndpoint?: string;
|
||||
readonly mongoProxyAPIs?: string;
|
||||
readonly enableThroughputCap: boolean;
|
||||
readonly enableNewQuickstart: boolean;
|
||||
readonly enableChatbot?: boolean;
|
||||
|
||||
|
||||
// can be set via both flight and feature flag
|
||||
autoscaleDefault: boolean;
|
||||
@@ -93,8 +90,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
||||
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
||||
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
||||
enableThroughputCap: "true" === get("enablethroughputcap"),
|
||||
enableNewQuickstart: "true" === get("enablenewquickstart"),
|
||||
enableChatbot: "true" === get("enablechatbot"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user