mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 10:51:30 +00:00
Compare commits
2 Commits
eslint/Not
...
users/srna
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55837db65b | ||
|
|
9f27cb95b9 |
@@ -307,18 +307,11 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo
|
|||||||
|
|
||||||
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
||||||
const label = "New " + getDatabaseName();
|
const label = "New " + getDatabaseName();
|
||||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
onCommandClick: () =>
|
onCommandClick: () =>
|
||||||
useSidePanel
|
useSidePanel.getState().openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={container} />),
|
||||||
.getState()
|
|
||||||
.openSidePanel(
|
|
||||||
"New " + getDatabaseName(),
|
|
||||||
<AddDatabasePanel explorer={container} buttonElement={newDatabaseButton} />
|
|
||||||
),
|
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: true,
|
hasPopup: true,
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneFor
|
|||||||
|
|
||||||
export interface AddDatabasePaneProps {
|
export interface AddDatabasePaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
buttonElement?: HTMLElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
||||||
explorer: container,
|
explorer: container,
|
||||||
buttonElement,
|
|
||||||
}: AddDatabasePaneProps) => {
|
}: AddDatabasePaneProps) => {
|
||||||
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
||||||
let throughput: number;
|
let throughput: number;
|
||||||
@@ -79,7 +77,6 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
|||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
};
|
};
|
||||||
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
||||||
buttonElement.focus();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
|||||||
@@ -307,23 +307,16 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
|||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
title: "New " + getDatabaseName(),
|
title: "New " + getDatabaseName(),
|
||||||
description: undefined,
|
description: undefined,
|
||||||
onClick: () => this.openAddDatabasePanel(),
|
onClick: () =>
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={this.container} />),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private openAddDatabasePanel() {
|
|
||||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
|
||||||
useSidePanel
|
|
||||||
.getState()
|
|
||||||
.openSidePanel(
|
|
||||||
"New " + getDatabaseName(),
|
|
||||||
<AddDatabasePanel explorer={this.container} buttonElement={newDatabaseButton} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
||||||
return {
|
return {
|
||||||
iconSrc: NotebookIcon,
|
iconSrc: NotebookIcon,
|
||||||
|
|||||||
@@ -202,14 +202,21 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
|
|
||||||
let updateQuery = `UPDATE ${collection.databaseId}.${collection.id()}`;
|
let updateQuery = `UPDATE ${collection.databaseId}.${collection.id()}`;
|
||||||
let isPropertyUpdated = false;
|
let isPropertyUpdated = false;
|
||||||
|
let isFirstPropertyToUpdate = true;
|
||||||
for (let property in newEntity) {
|
for (let property in newEntity) {
|
||||||
if (
|
if (
|
||||||
!originalDocument[property] ||
|
!originalDocument[property] ||
|
||||||
newEntity[property]._.toString() !== originalDocument[property]._.toString()
|
newEntity[property]._.toString() !== originalDocument[property]._.toString()
|
||||||
) {
|
) {
|
||||||
updateQuery += this.isStringType(newEntity[property].$)
|
let propertyQuerySegment = this.isStringType(newEntity[property].$)
|
||||||
? ` SET ${property} = '${newEntity[property]._}',`
|
? `${property} = '${newEntity[property]._}',`
|
||||||
: ` SET ${property} = ${newEntity[property]._},`;
|
: `${property} = ${newEntity[property]._},`;
|
||||||
|
// Only add the "SET" keyword once
|
||||||
|
if (isFirstPropertyToUpdate) {
|
||||||
|
propertyQuerySegment = " SET " + propertyQuerySegment;
|
||||||
|
isFirstPropertyToUpdate = false;
|
||||||
|
}
|
||||||
|
updateQuery += propertyQuerySegment;
|
||||||
isPropertyUpdated = true;
|
isPropertyUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user