mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-05-15 09:47:30 +01:00
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { ActionType, OpenCollectionTab, TabKind } from "Contracts/ActionContracts";
|
|
import React from "react";
|
|
import * as ViewModels from "../../Contracts/ViewModels";
|
|
import { useTabs } from "../../hooks/useTabs";
|
|
import { SettingsComponent } from "../Controls/Settings/SettingsComponent";
|
|
import TabsBase from "./TabsBase";
|
|
|
|
export class SettingsTabV2 extends TabsBase {
|
|
public render(): JSX.Element {
|
|
return <SettingsComponent settingsTab={this} />;
|
|
}
|
|
}
|
|
|
|
export class CollectionSettingsTabV2 extends SettingsTabV2 {
|
|
protected persistedState: OpenCollectionTab;
|
|
|
|
constructor(options: ViewModels.TabOptions) {
|
|
super(options);
|
|
this.persistedState = {
|
|
actionType: ActionType.OpenCollectionTab,
|
|
tabKind: TabKind.ScaleSettings,
|
|
databaseResourceId: options.collection.databaseId,
|
|
collectionResourceId: options.collection.id(),
|
|
};
|
|
}
|
|
|
|
public canDuplicate(): boolean {
|
|
return true;
|
|
}
|
|
|
|
public duplicateTab(): void {
|
|
const newTab = new CollectionSettingsTabV2({
|
|
tabKind: ViewModels.CollectionTabKind.CollectionSettingsV2,
|
|
title: this.tabTitle(),
|
|
tabPath: "",
|
|
collection: this.collection,
|
|
node: this.collection,
|
|
});
|
|
useTabs.getState().activateNewTab(newTab);
|
|
}
|
|
|
|
public onActivate(): void {
|
|
super.onActivate();
|
|
this.collection.selectedSubnodeKind(ViewModels.CollectionTabKind.CollectionSettingsV2);
|
|
}
|
|
}
|
|
|
|
export class DatabaseSettingsTabV2 extends SettingsTabV2 {
|
|
public onActivate(): void {
|
|
super.onActivate();
|
|
this.database.selectedSubnodeKind(ViewModels.CollectionTabKind.DatabaseSettingsV2);
|
|
}
|
|
}
|