mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-28 22:24:23 +00:00
Migrate Trigger tab to React (#855)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
committed by
GitHub
parent
af71a96d54
commit
914c372f5b
36
src/Explorer/Tabs/TriggerTab.tsx
Normal file
36
src/Explorer/Tabs/TriggerTab.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { TriggerDefinition } from "@azure/cosmos";
|
||||
import React from "react";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types";
|
||||
import Trigger from "../Tree/Trigger";
|
||||
import ScriptTabBase from "./ScriptTabBase";
|
||||
import { TriggerTabContent } from "./TriggerTabContent";
|
||||
|
||||
export default class TriggerTab extends ScriptTabBase {
|
||||
public onSaveClick: () => void;
|
||||
public onUpdateClick: () => Promise<void>;
|
||||
public collection: ViewModels.Collection;
|
||||
public node: Trigger;
|
||||
public triggerType: ViewModels.Editable<string>;
|
||||
public triggerOperation: ViewModels.Editable<string>;
|
||||
public triggerOptions: ViewModels.ScriptTabOption;
|
||||
|
||||
constructor(options: ViewModels.ScriptTabOption) {
|
||||
super(options);
|
||||
super.onActivate.bind(this);
|
||||
this.triggerOptions = options;
|
||||
}
|
||||
|
||||
addNodeInCollection(createdResource: TriggerDefinition | SqlTriggerResource): void {
|
||||
this.node = this.collection.createTriggerNode(createdResource);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<TriggerTabContent
|
||||
{...this}
|
||||
addNodeInCollection={(createdResource) => this.addNodeInCollection(createdResource)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user