mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-05-06 00:14:19 +01:00
Hide TTL in settings tab for Mongo API (#677)
* Hide ttl for mongo * Fix typo * Refine info message
This commit is contained in:
parent
3f8e394952
commit
2bccb7885f
@ -1,4 +1,13 @@
|
|||||||
import { ChoiceGroup, IChoiceGroupOption, Label, MessageBar, Stack, Text, TextField } from "office-ui-fabric-react";
|
import {
|
||||||
|
ChoiceGroup,
|
||||||
|
IChoiceGroupOption,
|
||||||
|
Label,
|
||||||
|
Link,
|
||||||
|
MessageBar,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextField,
|
||||||
|
} from "office-ui-fabric-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as ViewModels from "../../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../../../UserContext";
|
import { userContext } from "../../../../UserContext";
|
||||||
@ -61,17 +70,15 @@ export interface SubSettingsComponentProps {
|
|||||||
|
|
||||||
export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> {
|
export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> {
|
||||||
private shouldCheckComponentIsDirty = true;
|
private shouldCheckComponentIsDirty = true;
|
||||||
private ttlVisible: boolean;
|
|
||||||
private geospatialVisible: boolean;
|
private geospatialVisible: boolean;
|
||||||
private partitionKeyValue: string;
|
private partitionKeyValue: string;
|
||||||
private partitionKeyName: string;
|
private partitionKeyName: string;
|
||||||
|
|
||||||
constructor(props: SubSettingsComponentProps) {
|
constructor(props: SubSettingsComponentProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.ttlVisible = (this.props.container && !this.props.container.isPreferredApiCassandra()) || false;
|
|
||||||
this.geospatialVisible = userContext.apiType === "SQL";
|
this.geospatialVisible = userContext.apiType === "SQL";
|
||||||
this.partitionKeyValue = "/" + this.props.collection.partitionKeyProperty;
|
this.partitionKeyValue = "/" + this.props.collection.partitionKeyProperty;
|
||||||
this.partitionKeyName = this.props.container.isPreferredApiMongoDB() ? "Shard key" : "Partition key";
|
this.partitionKeyName = userContext.apiType === "Mongo" ? "Shard key" : "Partition key";
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
@ -171,7 +178,19 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
|||||||
): void =>
|
): void =>
|
||||||
this.props.onChangeFeedPolicyChange(ChangeFeedPolicyState[option.key as keyof typeof ChangeFeedPolicyState]);
|
this.props.onChangeFeedPolicyChange(ChangeFeedPolicyState[option.key as keyof typeof ChangeFeedPolicyState]);
|
||||||
|
|
||||||
private getTtlComponent = (): JSX.Element => (
|
private getTtlComponent = (): JSX.Element =>
|
||||||
|
userContext.apiType === "Mongo" ? (
|
||||||
|
<MessageBar
|
||||||
|
messageBarIconProps={{ iconName: "InfoSolid", className: "messageBarInfoIcon" }}
|
||||||
|
styles={{ text: { fontSize: 14 } }}
|
||||||
|
>
|
||||||
|
To enable time-to-live (TTL) for your collection/documents,
|
||||||
|
<Link href="https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-time-to-live" target="_blank">
|
||||||
|
create a TTL index
|
||||||
|
</Link>
|
||||||
|
.
|
||||||
|
</MessageBar>
|
||||||
|
) : (
|
||||||
<Stack {...titleAndInputStackProps}>
|
<Stack {...titleAndInputStackProps}>
|
||||||
<ChoiceGroup
|
<ChoiceGroup
|
||||||
id="timeToLive"
|
id="timeToLive"
|
||||||
@ -316,7 +335,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Stack {...subComponentStackProps}>
|
<Stack {...subComponentStackProps}>
|
||||||
{this.ttlVisible && this.getTtlComponent()}
|
{userContext.apiType !== "Cassandra" && this.getTtlComponent()}
|
||||||
|
|
||||||
{this.geospatialVisible && this.getGeoSpatialComponent()}
|
{this.geospatialVisible && this.getGeoSpatialComponent()}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user