mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Update generated ARM clients to latest version (#807)
This commit is contained in:
@@ -14,7 +14,7 @@ import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { userContext } from "../../../UserContext";
|
||||
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||
import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
||||
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
|
||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||
import Explorer from "../../Explorer";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { shallow } from "enzyme";
|
||||
import React from "react";
|
||||
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./IndexingPolicyComponent";
|
||||
import * as DataModels from "../../../../Contracts/DataModels";
|
||||
import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./IndexingPolicyComponent";
|
||||
|
||||
describe("IndexingPolicyComponent", () => {
|
||||
const initialIndexingPolicyContent: DataModels.IndexingPolicy = {
|
||||
automatic: false,
|
||||
indexingMode: "",
|
||||
indexingMode: "consistent",
|
||||
includedPaths: [],
|
||||
excludedPaths: [],
|
||||
};
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
import * as React from "react";
|
||||
import {
|
||||
DetailsList,
|
||||
DetailsListLayoutMode,
|
||||
Stack,
|
||||
IconButton,
|
||||
Text,
|
||||
SelectionMode,
|
||||
IColumn,
|
||||
IconButton,
|
||||
MessageBar,
|
||||
MessageBarType,
|
||||
SelectionMode,
|
||||
Separator,
|
||||
Spinner,
|
||||
SpinnerSize,
|
||||
Separator,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@fluentui/react";
|
||||
import * as React from "react";
|
||||
import { MongoIndex } from "../../../../../Utils/arm/generatedClients/cosmos/types";
|
||||
import { CollapsibleSectionComponent } from "../../../CollapsiblePanel/CollapsibleSectionComponent";
|
||||
import {
|
||||
addMongoIndexStackProps,
|
||||
customDetailsListStyles,
|
||||
mongoIndexingPolicyDisclaimer,
|
||||
mediumWidthStackStyles,
|
||||
subComponentStackProps,
|
||||
createAndAddMongoIndexStackProps,
|
||||
separatorStyles,
|
||||
customDetailsListStyles,
|
||||
indexingPolicynUnsavedWarningMessage,
|
||||
infoAndToolTipTextStyle,
|
||||
onRenderRow,
|
||||
mediumWidthStackStyles,
|
||||
mongoCompoundIndexNotSupportedMessage,
|
||||
mongoIndexingPolicyDisclaimer,
|
||||
onRenderRow,
|
||||
separatorStyles,
|
||||
subComponentStackProps,
|
||||
} from "../../SettingsRenderUtils";
|
||||
import { MongoIndex } from "../../../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||
import {
|
||||
MongoIndexTypes,
|
||||
AddMongoIndexProps,
|
||||
MongoIndexIdField,
|
||||
MongoNotificationType,
|
||||
getMongoIndexType,
|
||||
getMongoIndexTypeText,
|
||||
isIndexTransforming,
|
||||
MongoIndexIdField,
|
||||
MongoIndexTypes,
|
||||
MongoNotificationType,
|
||||
} from "../../SettingsUtils";
|
||||
import { AddMongoIndexComponent } from "./AddMongoIndexComponent";
|
||||
import { CollapsibleSectionComponent } from "../../../CollapsiblePanel/CollapsibleSectionComponent";
|
||||
import { IndexingPolicyRefreshComponent } from "../IndexingPolicyRefresh/IndexingPolicyRefreshComponent";
|
||||
import { AddMongoIndexComponent } from "./AddMongoIndexComponent";
|
||||
|
||||
export interface MongoIndexingPolicyComponentProps {
|
||||
mongoIndexes: MongoIndex[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import * as DataModels from "../../../Contracts/DataModels";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import { MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types";
|
||||
import * as DataModels from "../../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import { MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types";
|
||||
|
||||
const zeroValue = 0;
|
||||
export type isDirtyTypes = boolean | string | number | DataModels.IndexingPolicy;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ko from "knockout";
|
||||
import * as DataModels from "../../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import Explorer from "../../Explorer";
|
||||
import ko from "knockout";
|
||||
|
||||
export const container = new Explorer();
|
||||
|
||||
@@ -13,7 +13,7 @@ export const collection = ({
|
||||
analyticalStorageTtl: ko.observable<number>(undefined),
|
||||
indexingPolicy: ko.observable<DataModels.IndexingPolicy>({
|
||||
automatic: true,
|
||||
indexingMode: "default",
|
||||
indexingMode: "consistent",
|
||||
includedPaths: [],
|
||||
excludedPaths: [],
|
||||
}),
|
||||
|
||||
@@ -3619,7 +3619,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"automatic": true,
|
||||
"excludedPaths": Array [],
|
||||
"includedPaths": Array [],
|
||||
"indexingMode": "default",
|
||||
"indexingMode": "consistent",
|
||||
}
|
||||
}
|
||||
indexingPolicyContentBaseline={
|
||||
@@ -3627,7 +3627,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"automatic": true,
|
||||
"excludedPaths": Array [],
|
||||
"includedPaths": Array [],
|
||||
"indexingMode": "default",
|
||||
"indexingMode": "consistent",
|
||||
}
|
||||
}
|
||||
logIndexingPolicySuccessMessage={[Function]}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"
|
||||
import { configContext, Platform } from "../../ConfigContext";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import { SubscriptionType } from "../../Contracts/SubscriptionType";
|
||||
import { CollectionCreation, IndexingPolicies } from "../../Shared/Constants";
|
||||
import { CollectionCreation } from "../../Shared/Constants";
|
||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { userContext } from "../../UserContext";
|
||||
@@ -41,6 +41,40 @@ export interface AddCollectionPanelProps {
|
||||
databaseId?: string;
|
||||
}
|
||||
|
||||
const SharedDatabaseDefault: DataModels.IndexingPolicy = {
|
||||
indexingMode: "consistent",
|
||||
automatic: true,
|
||||
includedPaths: [],
|
||||
excludedPaths: [
|
||||
{
|
||||
path: "/*",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const AllPropertiesIndexed: DataModels.IndexingPolicy = {
|
||||
indexingMode: "consistent",
|
||||
automatic: true,
|
||||
includedPaths: [
|
||||
{
|
||||
path: "/*",
|
||||
indexes: [
|
||||
{
|
||||
kind: "Range",
|
||||
dataType: "Number",
|
||||
precision: -1,
|
||||
},
|
||||
{
|
||||
kind: "Range",
|
||||
dataType: "String",
|
||||
precision: -1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
excludedPaths: [],
|
||||
};
|
||||
|
||||
export interface AddCollectionPanelState {
|
||||
createNewDatabase: boolean;
|
||||
newDatabaseId: string;
|
||||
@@ -955,14 +989,14 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
||||
const partitionKey: DataModels.PartitionKey = partitionKeyString
|
||||
? {
|
||||
paths: [partitionKeyString],
|
||||
kind: Constants.BackendDefaults.partitionKeyKind,
|
||||
kind: "Hash",
|
||||
version: partitionKeyVersion,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const indexingPolicy: DataModels.IndexingPolicy = this.state.enableIndexing
|
||||
? IndexingPolicies.AllPropertiesIndexed
|
||||
: IndexingPolicies.SharedDatabaseDefault;
|
||||
? AllPropertiesIndexed
|
||||
: SharedDatabaseDefault;
|
||||
|
||||
const telemetryData = {
|
||||
database: {
|
||||
|
||||
@@ -193,7 +193,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
||||
}
|
||||
}
|
||||
|
||||
public abstract onSaveClick: () => Promise<any>;
|
||||
public abstract onSaveClick: () => void;
|
||||
public abstract onUpdateClick: () => Promise<any>;
|
||||
|
||||
public onDiscard = (): Q.Promise<any> => {
|
||||
@@ -205,16 +205,6 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
||||
return Q();
|
||||
};
|
||||
|
||||
public onSaveOrUpdateClick(): Promise<any> {
|
||||
if (this.saveButton.visible()) {
|
||||
return this.onSaveClick();
|
||||
} else if (this.updateButton.visible()) {
|
||||
return this.onUpdateClick();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
protected getTabsButtons(): CommandButtonComponentProps[] {
|
||||
const buttons: CommandButtonComponentProps[] = [];
|
||||
const label = "Save";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Resource, TriggerDefinition, TriggerOperation, TriggerType } from "@azure/cosmos";
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import { createTrigger } from "../../Common/dataAccess/createTrigger";
|
||||
import { updateTrigger } from "../../Common/dataAccess/updateTrigger";
|
||||
@@ -7,6 +6,7 @@ import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types";
|
||||
import Trigger from "../Tree/Trigger";
|
||||
import ScriptTabBase from "./ScriptTabBase";
|
||||
import template from "./TriggerTab.html";
|
||||
@@ -30,12 +30,12 @@ export default class TriggerTab extends ScriptTabBase {
|
||||
super.buildCommandBarOptions();
|
||||
}
|
||||
|
||||
public onSaveClick = (): Promise<TriggerDefinition & Resource> => {
|
||||
return this._createTrigger({
|
||||
public onSaveClick = (): void => {
|
||||
this._createTrigger({
|
||||
id: this.id(),
|
||||
body: this.editorContent(),
|
||||
triggerOperation: this.triggerOperation() as TriggerOperation,
|
||||
triggerType: this.triggerType() as TriggerType,
|
||||
triggerOperation: this.triggerOperation() as SqlTriggerResource["triggerOperation"],
|
||||
triggerType: this.triggerType() as SqlTriggerResource["triggerType"],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -50,8 +50,8 @@ export default class TriggerTab extends ScriptTabBase {
|
||||
return updateTrigger(this.collection.databaseId, this.collection.id(), {
|
||||
id: this.id(),
|
||||
body: this.editorContent(),
|
||||
triggerOperation: this.triggerOperation() as TriggerOperation,
|
||||
triggerType: this.triggerType() as TriggerType,
|
||||
triggerOperation: this.triggerOperation() as SqlTriggerResource["triggerOperation"],
|
||||
triggerType: this.triggerType() as SqlTriggerResource["triggerType"],
|
||||
})
|
||||
.then(
|
||||
(createdResource) => {
|
||||
@@ -117,7 +117,7 @@ export default class TriggerTab extends ScriptTabBase {
|
||||
}
|
||||
}
|
||||
|
||||
private _createTrigger(resource: TriggerDefinition): Promise<TriggerDefinition & Resource> {
|
||||
private _createTrigger(resource: SqlTriggerResource): void {
|
||||
this.isExecutionError(false);
|
||||
this.isExecuting(true);
|
||||
const startKey: number = TelemetryProcessor.traceStart(Action.CreateTrigger, {
|
||||
@@ -125,7 +125,8 @@ export default class TriggerTab extends ScriptTabBase {
|
||||
tabTitle: this.tabTitle(),
|
||||
});
|
||||
|
||||
return createTrigger(this.collection.databaseId, this.collection.id(), resource)
|
||||
resource.body = String(resource.body); // Ensure trigger body is converted to string
|
||||
createTrigger(this.collection.databaseId, this.collection.id(), resource)
|
||||
.then(
|
||||
(createdResource) => {
|
||||
this.tabTitle(createdResource.id);
|
||||
|
||||
@@ -18,6 +18,7 @@ import { UploadDetailsRecord } from "../../Contracts/ViewModels";
|
||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { userContext } from "../../UserContext";
|
||||
import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types";
|
||||
import { logConsoleInfo } from "../../Utils/NotificationConsoleUtils";
|
||||
import Explorer from "../Explorer";
|
||||
import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient";
|
||||
@@ -962,7 +963,9 @@ export default class Collection implements ViewModels.Collection {
|
||||
|
||||
public loadTriggers(): Promise<any> {
|
||||
return readTriggers(this.databaseId, this.id()).then((triggers) => {
|
||||
const triggerNodes: ViewModels.TreeNode[] = triggers.map((trigger) => new Trigger(this.container, this, trigger));
|
||||
const triggerNodes: ViewModels.TreeNode[] = triggers.map(
|
||||
(trigger: SqlTriggerResource | TriggerDefinition) => new Trigger(this.container, this, trigger)
|
||||
);
|
||||
const otherNodes = this.children().filter((node) => node.nodeKind !== "Trigger");
|
||||
const allNodes = otherNodes.concat(triggerNodes);
|
||||
this.children(allNodes);
|
||||
|
||||
Reference in New Issue
Block a user