stitch-ui
Version:
40 lines (36 loc) • 984 B
JavaScript
import React from "react";
import { Record, List } from "immutable";
import ActionEditRules from "../services/default/components/ActionEditRules";
export default class AvailableService extends Record({
type: "",
actions: List(),
description: "",
displayName: "",
displayNameLong: "",
defaultTab: "",
incomingWebhooks: false,
configEditor: null,
rulesEditor: ActionEditRules,
ruleCompleter: null,
argsCompleter: null,
incomingWebhookOptionsEditor: null,
defaultIncomingWebhook: null,
icon: <span />,
hideAdd: false,
hideSidebar: false
}) {
getLongDisplayName() {
return this.displayNameLong || this.displayName;
}
getConfigEditor(props) {
if (!this.configEditor) {
return null;
}
return React.createElement(this.configEditor, props);
}
getRulesEditor(props) {
const outProps = props;
outProps.actions = this.actions.map(a => a.name).toArray();
return React.createElement(this.rulesEditor, outProps);
}
}