fix lint.

This commit is contained in:
Simon Larsen
2023-02-07 15:36:06 +00:00
parent 1d7e0d28c2
commit fb7d5bc18a
36 changed files with 1127 additions and 947 deletions

View File

@@ -336,7 +336,7 @@ export default class BaseModel extends BaseEntity {
return Boolean(
tableColumnType.type === TableColumnType.Entity ||
tableColumnType.type === TableColumnType.EntityArray
tableColumnType.type === TableColumnType.EntityArray
);
}
@@ -474,10 +474,10 @@ export default class BaseModel extends BaseEntity {
return Boolean(
userPermissions &&
PermissionHelper.doesPermissionsIntersect(
modelPermissions,
userPermissions
)
PermissionHelper.doesPermissionsIntersect(
modelPermissions,
userPermissions
)
);
}
}

View File

@@ -88,4 +88,4 @@ enum IconProp {
Bolt = 'Bolt',
}
export default IconProp;
export default IconProp;

View File

@@ -5,7 +5,6 @@ export interface EnableWorkflowOn {
read: boolean;
}
export default (enableWorkflowOn: EnableWorkflowOn) => {
return (ctr: Function) => {
ctr.prototype.enableWorkflowOn = enableWorkflowOn;

View File

@@ -17,12 +17,12 @@ export enum ComponentInputType {
Query = 'Query',
BaseModel = 'BaseModel',
BaseModelArray = 'BaseModelArray',
JSONArray = 'JSONArray'
JSONArray = 'JSONArray',
}
export enum ComponentType {
Trigger = 'Trigger',
Component = 'Component'
Component = 'Component',
}
export interface Port {
@@ -35,7 +35,7 @@ export interface Argument {
name: string;
description: string;
required: boolean;
type: ComponentInputType,
type: ComponentInputType;
id: string;
isAdvanced?: boolean | undefined;
}
@@ -59,4 +59,4 @@ export default interface Component {
returnValues: Array<ReturnValue>;
inPorts: Array<Port>;
outPorts: Array<Port>;
}
}

View File

@@ -1,10 +1,9 @@
import Component from './Component';
import LogComponents from './Components/Log';
import APIComponents from './Components/API';
import ScheduleComponents from './Components/Schedule';
import SlackComponents from './Components/Slack';
import ConditionComponents from './Components/Slack';
import ConditionComponents from './Components/Condition';
import JsonComponents from './Components/JSON';
import JavaScriptComponents from './Components/JavaScript';
@@ -15,8 +14,7 @@ const components: Array<Component> = [
...SlackComponents,
...ConditionComponents,
...JsonComponents,
...JavaScriptComponents
...JavaScriptComponents,
];
export default components;
export default components;

View File

@@ -4,321 +4,368 @@ import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'api-get',
title: "API Get (JSON)",
category: "API",
description: "Send Get API Request and get JSON Response",
title: 'API Get (JSON)',
category: 'API',
description: 'Send Get API Request and get JSON Response',
iconProp: IconProp.Globe,
type: ComponentType.Component,
arguments: [{
id: "url",
name: "URL",
description: "URL to send request to",
type: ComponentInputType.URL,
required: true
}, {
id: "request-body",
name: "Request Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: true
}, {
id: "query-string",
name: "Query String",
description: "Send query string params",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
}, {
id: "request-headers",
name: "Request Headers",
description: "Request headers to send",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
},],
returnValues: [{
id: "error",
name: "Error",
description: "Error, if there is any.",
type: ComponentInputType.Text,
required: false
},
{
id: "status",
name: "Response Status",
description: "Response Status (200, for example)",
type: ComponentInputType.Number,
required: false
},
{
id: "response-headers",
name: "Response Headers",
description: "Response Headers for this request",
type: ComponentInputType.StringDictionary,
required: false
},
{
id: "response-body",
name: "Response Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
},
arguments: [
{
id: 'url',
name: 'URL',
description: 'URL to send request to',
type: ComponentInputType.URL,
required: true,
},
{
id: 'request-body',
name: 'Request Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: true,
},
{
id: 'query-string',
name: 'Query String',
description: 'Send query string params',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
{
id: 'request-headers',
name: 'Request Headers',
description: 'Request headers to send',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
],
returnValues: [
{
id: 'error',
name: 'Error',
description: 'Error, if there is any.',
type: ComponentInputType.Text,
required: false,
},
{
id: 'status',
name: 'Response Status',
description: 'Response Status (200, for example)',
type: ComponentInputType.Number,
required: false,
},
{
id: 'response-headers',
name: 'Response Headers',
description: 'Response Headers for this request',
type: ComponentInputType.StringDictionary,
required: false,
},
{
id: 'response-body',
name: 'Response Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the message is successfully posted',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error',
},
],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the message is successfully posted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error'
}]
},
{
id: 'api-post',
title: "API Post (JSON)",
category: "API",
description: "Send a POST Request and get JSON Response",
title: 'API Post (JSON)',
category: 'API',
description: 'Send a POST Request and get JSON Response',
iconProp: IconProp.Globe,
type: ComponentType.Component,
arguments: [{
id: "url",
name: "URL",
description: "URL to send request to",
type: ComponentInputType.URL,
required: true
}, {
id: "request-body",
name: "Request Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
}, {
id: "query-string",
name: "Query String",
description: "Send query string params",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
}, {
id: "request-headers",
name: "Request Headers",
description: "Request headers to send",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
},],
returnValues: [{
id: "error",
name: "Error",
description: "Error, if there is any.",
type: ComponentInputType.Text,
required: false
},
{
id: "status",
name: "Response Status",
description: "Response Status (200, for example)",
type: ComponentInputType.Number,
required: false
},
{
id: "response-headers",
name: "Response Headers",
description: "Response Headers for this request",
type: ComponentInputType.StringDictionary,
required: false
},
{
id: "response-body",
name: "Response Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
},
arguments: [
{
id: 'url',
name: 'URL',
description: 'URL to send request to',
type: ComponentInputType.URL,
required: true,
},
{
id: 'request-body',
name: 'Request Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
{
id: 'query-string',
name: 'Query String',
description: 'Send query string params',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
{
id: 'request-headers',
name: 'Request Headers',
description: 'Request headers to send',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
],
returnValues: [
{
id: 'error',
name: 'Error',
description: 'Error, if there is any.',
type: ComponentInputType.Text,
required: false,
},
{
id: 'status',
name: 'Response Status',
description: 'Response Status (200, for example)',
type: ComponentInputType.Number,
required: false,
},
{
id: 'response-headers',
name: 'Response Headers',
description: 'Response Headers for this request',
type: ComponentInputType.StringDictionary,
required: false,
},
{
id: 'response-body',
name: 'Response Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the message is successfully posted',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error',
},
],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the message is successfully posted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error'
}]
},
{
id: 'api-patch',
title: "API Patch (JSON)",
category: "API",
description: "Send a PATCH Request and get JSON Response",
title: 'API Patch (JSON)',
category: 'API',
description: 'Send a PATCH Request and get JSON Response',
iconProp: IconProp.Globe,
type: ComponentType.Component,
arguments: [{
id: "url",
name: "URL",
description: "URL to send request to",
type: ComponentInputType.URL,
required: true
}, {
id: "request-body",
name: "Request Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
}, {
id: "query-string",
name: "Query String",
description: "Send query string params",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
}, {
id: "request-headers",
name: "Request Headers",
description: "Request headers to send",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
},],
returnValues: [{
id: "error",
name: "Error",
description: "Error, if there is any.",
type: ComponentInputType.Text,
required: false
},
{
id: "status",
name: "Response Status",
description: "Response Status (200, for example)",
type: ComponentInputType.Number,
required: false
},
{
id: "response-headers",
name: "Response Headers",
description: "Response Headers for this request",
type: ComponentInputType.StringDictionary,
required: false
},
{
id: "response-body",
name: "Response Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
},
arguments: [
{
id: 'url',
name: 'URL',
description: 'URL to send request to',
type: ComponentInputType.URL,
required: true,
},
{
id: 'request-body',
name: 'Request Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
{
id: 'query-string',
name: 'Query String',
description: 'Send query string params',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
{
id: 'request-headers',
name: 'Request Headers',
description: 'Request headers to send',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
],
returnValues: [
{
id: 'error',
name: 'Error',
description: 'Error, if there is any.',
type: ComponentInputType.Text,
required: false,
},
{
id: 'status',
name: 'Response Status',
description: 'Response Status (200, for example)',
type: ComponentInputType.Number,
required: false,
},
{
id: 'response-headers',
name: 'Response Headers',
description: 'Response Headers for this request',
type: ComponentInputType.StringDictionary,
required: false,
},
{
id: 'response-body',
name: 'Response Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the message is successfully posted',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error',
},
],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the message is successfully posted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error'
}]
},
{
id: 'api-delete',
title: "API Delete (JSON)",
category: "API",
description: "Send a PATCH Request and get JSON Response",
title: 'API Delete (JSON)',
category: 'API',
description: 'Send a PATCH Request and get JSON Response',
iconProp: IconProp.Globe,
type: ComponentType.Component,
arguments: [{
id: "url",
name: "URL",
description: "URL to send request to",
type: ComponentInputType.URL,
required: true
}, {
id: "request-body",
name: "Request Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
}, {
id: "query-string",
name: "Query String",
description: "Send query string params",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
}, {
id: "request-headers",
name: "Request Headers",
description: "Request headers to send",
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true
},],
returnValues: [{
id: "error",
name: "Error",
description: "Error, if there is any.",
type: ComponentInputType.Text,
required: false
},
{
id: "status",
name: "Response Status",
description: "Response Status (200, for example)",
type: ComponentInputType.Number,
required: false
},
{
id: "response-headers",
name: "Response Headers",
description: "Response Headers for this request",
type: ComponentInputType.StringDictionary,
required: false
},
{
id: "response-body",
name: "Response Body",
description: "Response Body",
type: ComponentInputType.JSON,
required: false
},
arguments: [
{
id: 'url',
name: 'URL',
description: 'URL to send request to',
type: ComponentInputType.URL,
required: true,
},
{
id: 'request-body',
name: 'Request Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
{
id: 'query-string',
name: 'Query String',
description: 'Send query string params',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
{
id: 'request-headers',
name: 'Request Headers',
description: 'Request headers to send',
type: ComponentInputType.StringDictionary,
required: false,
isAdvanced: true,
},
],
returnValues: [
{
id: 'error',
name: 'Error',
description: 'Error, if there is any.',
type: ComponentInputType.Text,
required: false,
},
{
id: 'status',
name: 'Response Status',
description: 'Response Status (200, for example)',
type: ComponentInputType.Number,
required: false,
},
{
id: 'response-headers',
name: 'Response Headers',
description: 'Response Headers for this request',
type: ComponentInputType.StringDictionary,
required: false,
},
{
id: 'response-body',
name: 'Response Body',
description: 'Response Body',
type: ComponentInputType.JSON,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the message is successfully posted',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error',
},
],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the message is successfully posted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error'
}]
},
];
export default components;
export default components;

View File

@@ -2,11 +2,9 @@ import IconProp from '../../Icon/IconProp';
import Component, { ComponentInputType, ComponentType } from './../Component';
import BaseModel from '../../../Models/BaseModel';
export default class BaseModelComponent {
public static getComponents(model: BaseModel) {
const components: Array<Component> = [
];
public static getComponents(model: BaseModel): Array<Component> {
const components: Array<Component> = [];
if (!model.enableWorkflowOn) {
return [];
@@ -23,34 +21,43 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Filter",
description: "Please fill out this filter",
name: 'Filter',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
],
returnValues: [
{
id: 'model',
name: 'Model',
description: 'Model fetched from the database',
type: ComponentInputType.BaseModel,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error fetching data from the database',
id: 'error',
},
],
returnValues: [{
id: "model",
name: "Model",
description: "Model fetched from the database",
type: ComponentInputType.BaseModel,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error fetching data from the database',
id: 'error'
}]
});
components.push({
@@ -63,34 +70,43 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Filter",
description: "Please fill out this filter",
name: 'Filter',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
],
returnValues: [
{
id: 'model',
name: 'Model',
description: 'Model fetched from the database',
type: ComponentInputType.BaseModelArray,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error fetching data from the database',
id: 'error',
},
],
returnValues: [{
id: "model",
name: "Model",
description: "Model fetched from the database",
type: ComponentInputType.BaseModelArray,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error fetching data from the database',
id: 'error'
}]
});
}
@@ -105,31 +121,37 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Delete by",
description: "Please fill out this filter",
name: 'Delete by',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error deleting data from the database',
id: 'error'
}]
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error deleting data from the database',
id: 'error',
},
],
});
components.push({
id: 'delete-many',
title: `Delete Many ${model.pluralName}`,
@@ -140,28 +162,35 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Delete by",
description: "Please fill out this filter",
name: 'Delete by',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error deleting data from the database',
id: 'error'
}]
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error deleting data from the database',
id: 'error',
},
],
});
}
@@ -175,38 +204,46 @@ export default class BaseModelComponent {
type: ComponentType.Component,
arguments: [
{
id: "json",
name: "JSON Object",
description: "Model represented as JSON",
id: 'json',
name: 'JSON Object',
description: 'Model represented as JSON',
type: ComponentInputType.JSON,
required: true
}
required: true,
},
],
returnValues: [
{
id: 'model',
name: 'Model',
description: 'Model created in the database',
type: ComponentInputType.BaseModel,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error creating data from the database',
id: 'error',
},
],
returnValues: [{
id: "model",
name: "Model",
description: "Model created in the database",
type: ComponentInputType.BaseModel,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error creating data from the database',
id: 'error'
}]
});
components.push({
id: 'create-many',
title: `Create Many ${model.pluralName}`,
@@ -216,35 +253,44 @@ export default class BaseModelComponent {
type: ComponentType.Component,
arguments: [
{
id: "json-array",
name: "JSON Array",
description: "List of models represented as JSON array",
id: 'json-array',
name: 'JSON Array',
description: 'List of models represented as JSON array',
type: ComponentInputType.JSONArray,
required: true
}
required: true,
},
],
returnValues: [
{
id: 'models',
name: 'Model List',
description: 'Models created in the database',
type: ComponentInputType.BaseModel,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error creating data from the database',
id: 'error',
},
],
returnValues: [{
id: "models",
name: "Model List",
description: "Models created in the database",
type: ComponentInputType.BaseModel,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error creating data from the database',
id: 'error'
}]
});
}
@@ -259,44 +305,52 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Filter",
description: "Please fill out this filter",
name: 'Filter',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
{
id: "json",
name: "JSON Object",
description: "Model represented as JSON",
id: 'json',
name: 'JSON Object',
description: 'Model represented as JSON',
type: ComponentInputType.JSON,
required: true
}
required: true,
},
],
returnValues: [
{
id: 'model',
name: 'Model',
description: 'Model updated in the database',
type: ComponentInputType.BaseModel,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error updating data from the database',
id: 'error',
},
],
returnValues: [{
id: "model",
name: "Model",
description: "Model updated in the database",
type: ComponentInputType.BaseModel,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error updating data from the database',
id: 'error'
}]
});
components.push({
id: 'update-many',
title: `Update Many ${model.pluralName}`,
@@ -307,45 +361,53 @@ export default class BaseModelComponent {
arguments: [
{
type: ComponentInputType.Query,
name: "Filter",
description: "Please fill out this filter",
name: 'Filter',
description: 'Please fill out this filter',
required: false,
id: 'filter'
id: 'filter',
},
{
id: "json-array",
name: "JSON Array",
description: "List of models represented as JSON array",
id: 'json-array',
name: 'JSON Array',
description: 'List of models represented as JSON array',
type: ComponentInputType.JSONArray,
required: true
}
required: true,
},
],
returnValues: [
{
id: 'models',
name: 'Model List',
description: 'Models updated in the database',
type: ComponentInputType.BaseModel,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the query executes successfully',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error updating data from the database',
id: 'error',
},
],
returnValues: [{
id: "models",
name: "Model List",
description: "Models updated in the database",
type: ComponentInputType.BaseModel,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the query executes successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error updating data from the database',
id: 'error'
}]
});
}
return components;
}
}

View File

@@ -4,115 +4,129 @@ import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'if-true',
title: "If True",
category: "Condition",
description: "If the inputs are true then proceed",
title: 'If True',
category: 'Condition',
description: 'If the inputs are true then proceed',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.Text,
name: "Expression 1",
description: "Expression 1",
name: 'Expression 1',
description: 'Expression 1',
required: true,
id: 'expression-1'
id: 'expression-1',
},
{
type: ComponentInputType.Text,
name: "Expression 2",
description: "Expression 2",
name: 'Expression 2',
description: 'Expression 2',
required: true,
id: 'expression-2'
id: 'expression-2',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes'
}]
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes',
},
],
},
{
id: 'if-false',
title: "If True",
category: "Condition",
description: "If the inputs are true then proceed",
title: 'If True',
category: 'Condition',
description: 'If the inputs are true then proceed',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.Text,
name: "Expression 1",
description: "Expression 1",
name: 'Expression 1',
description: 'Expression 1',
required: true,
id: 'expression-1'
id: 'expression-1',
},
{
type: ComponentInputType.Text,
name: "Expression 2",
description: "Expression 2",
name: 'Expression 2',
description: 'Expression 2',
required: true,
id: 'expression-2'
id: 'expression-2',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes'
}]
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes',
},
],
},
{
id: 'if-else',
title: "If / Else",
category: "Condition",
description: "Branch based on Inputs",
title: 'If / Else',
category: 'Condition',
description: 'Branch based on Inputs',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.Text,
name: "Expression 1",
description: "Expression 1",
name: 'Expression 1',
description: 'Expression 1',
required: true,
id: 'expression-1'
id: 'expression-1',
},
{
type: ComponentInputType.Text,
name: "Expression 2",
description: "Expression 2",
name: 'Expression 2',
description: 'Expression 2',
required: true,
id: 'expression-2'
id: 'expression-2',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes'
},
{
title: 'No',
description: 'If, no then this port will be executed',
id: 'no'
}]
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Yes',
description: 'If, yes then this port will be executed',
id: 'yes',
},
{
title: 'No',
description: 'If, no then this port will be executed',
id: 'no',
},
],
},
];
export default components;
export default components;

View File

@@ -4,122 +4,149 @@ import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'json-to-text',
title: "JSON to Text",
category: "JSON",
description: "Converts JSON Object to Text",
title: 'JSON to Text',
category: 'JSON',
description: 'Converts JSON Object to Text',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.JSON,
name: "JSON",
description: "JSON Object as Input",
name: 'JSON',
description: 'JSON Object as Input',
required: true,
id: 'json'
id: 'json',
},
],
returnValues: [
{
type: ComponentInputType.Text,
name: 'Text',
description: 'Text as Output',
required: true,
id: 'text',
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the JSON is successfully converted',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error in conversion',
id: 'error',
},
],
returnValues: [{
type: ComponentInputType.Text,
name: "Text",
description: "Text as Output",
required: true,
id: 'text'
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the JSON is successfully converted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error in conversion',
id: 'error'
}]
},
{
id: 'text-to-json',
title: "Text to JSON",
category: "JSON",
description: "Converts Text to JSON Object",
title: 'Text to JSON',
category: 'JSON',
description: 'Converts Text to JSON Object',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.Text,
name: "Text",
description: "Text as Input",
name: 'Text',
description: 'Text as Input',
required: true,
id: 'text'
}
id: 'text',
},
],
returnValues: [{
type: ComponentInputType.JSON,
name: "JSON",
description: "JSON Object as Output",
required: true,
id: 'json'
},],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the JSON is successfully converted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error in conversion',
id: 'error'
}]
}, {
returnValues: [
{
type: ComponentInputType.JSON,
name: 'JSON',
description: 'JSON Object as Output',
required: true,
id: 'json',
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the JSON is successfully converted',
id: 'success',
},
{
title: 'Error',
description:
'This is executed when there is an error in conversion',
id: 'error',
},
],
},
{
id: 'json-merge',
title: "Merge JSON",
category: "JSON",
description: "Merge two JSON Objects into one",
title: 'Merge JSON',
category: 'JSON',
description: 'Merge two JSON Objects into one',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.JSON,
name: "JSON 1",
description: "JSON Object 1 as Input",
name: 'JSON 1',
description: 'JSON Object 1 as Input',
required: true,
id: 'json1'
}, {
id: 'json1',
},
{
type: ComponentInputType.JSON,
name: "JSON 2",
description: "JSON Object 2 as Input",
name: 'JSON 2',
description: 'JSON Object 2 as Input',
required: true,
id: 'json2'
id: 'json2',
},
],
returnValues: [
{
type: ComponentInputType.JSON,
name: 'JSON',
description: 'JSON Object as Output',
required: true,
id: 'json',
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the JSON is successfully merged',
id: 'success',
},
],
returnValues: [{
type: ComponentInputType.JSON,
name: "JSON",
description: "JSON Object as Output",
required: true,
id: 'json'
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the JSON is successfully merged',
id: 'success'
}]
},
];
export default components;
export default components;

View File

@@ -2,46 +2,52 @@ import IconProp from '../../Icon/IconProp';
import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'javascript',
title: "Run Custom JavaScript",
category: "Utils",
description: "Run custom JavaScript in your workflow",
title: 'Run Custom JavaScript',
category: 'Utils',
description: 'Run custom JavaScript in your workflow',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.AnyValue,
name: "Value",
description: "Value as Input",
name: 'Value',
description: 'Value as Input',
required: true,
id: 'input'
id: 'input',
},
],
returnValues: [{
type: ComponentInputType.AnyValue,
name: "Value",
description: "Value as Output",
required: false,
id: 'output'
},],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the code runs successfully',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when code fails to run',
id: 'error'
}]
},];
returnValues: [
{
type: ComponentInputType.AnyValue,
name: 'Value',
description: 'Value as Output',
required: false,
id: 'output',
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description: 'This is executed when the code runs successfully',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when code fails to run',
id: 'error',
},
],
},
];
export default components;
export default components;

View File

@@ -2,35 +2,40 @@ import IconProp from '../../Icon/IconProp';
import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'log',
title: "Log",
category: "Utils",
description: "Log to console what ever is passed to this component",
title: 'Log',
category: 'Utils',
description: 'Log to console what ever is passed to this component',
iconProp: IconProp.ArrowCircleLeft,
type: ComponentType.Component,
arguments: [
{
type: ComponentInputType.AnyValue,
name: "Value",
description: "Value to log",
name: 'Value',
description: 'Value to log',
required: true,
id: 'value'
id: 'value',
},
],
returnValues: [],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Out',
description: 'Connect to this port if you want other componets to execute after tha value has been logged.',
id: 'out'
}]
},];
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Out',
description:
'Connect to this port if you want other componets to execute after tha value has been logged.',
id: 'out',
},
],
},
];
export default components;
export default components;

View File

@@ -2,33 +2,33 @@ import IconProp from '../../Icon/IconProp';
import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'schedule',
title: "Schedule",
category: "Triggers",
description: "Run this workflow on particular schedule",
title: 'Schedule',
category: 'Triggers',
description: 'Run this workflow on particular schedule',
iconProp: IconProp.Clock,
type: ComponentType.Trigger,
arguments: [
{
type: ComponentInputType.CronTab,
name: "Schedule at",
description: "Trigger this workflow at",
name: 'Schedule at',
description: 'Trigger this workflow at',
required: true,
id: 'schedule'
id: 'schedule',
},
],
returnValues: [],
inPorts: [],
outPorts: [{
title: 'Execute',
description: 'Connect other components to this port if you want them to be executed.',
id: 'execute'
}]
outPorts: [
{
title: 'Execute',
description:
'Connect other components to this port if you want them to be executed.',
id: 'execute',
},
],
},
];
export default components;
export default components;

View File

@@ -2,39 +2,45 @@ import IconProp from '../../Icon/IconProp';
import Component, { ComponentInputType, ComponentType } from './../Component';
const components: Array<Component> = [
{
id: 'slack-send-message-to-channel',
title: "Send Message to Channel",
category: "Slack",
description: "Send message to slack channel",
title: 'Send Message to Channel',
category: 'Slack',
description: 'Send message to slack channel',
iconProp: IconProp.SendMessage,
type: ComponentType.Component,
arguments: [],
returnValues: [{
id: "error",
name: "Error",
description: "Error, if there is any.",
type: ComponentInputType.Text,
required: false
}],
inPorts: [{
title: 'In',
description: 'Please connect components to this port for this component to work.',
id: 'in'
}],
outPorts: [{
title: 'Success',
description: 'This is executed when the message is successfully posted',
id: 'success'
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error'
}]
returnValues: [
{
id: 'error',
name: 'Error',
description: 'Error, if there is any.',
type: ComponentInputType.Text,
required: false,
},
],
inPorts: [
{
title: 'In',
description:
'Please connect components to this port for this component to work.',
id: 'in',
},
],
outPorts: [
{
title: 'Success',
description:
'This is executed when the message is successfully posted',
id: 'success',
},
{
title: 'Error',
description: 'This is executed when there is an error',
id: 'error',
},
],
},
];
export default components;
export default components;

View File

@@ -87,8 +87,9 @@ const Accordian: FunctionComponent<ComponentProps> = (
)}
{props.title && (
<div
className={`ml-1 -mt-1 ${props.onClick ? 'cursor-pointer' : ''
}`}
className={`ml-1 -mt-1 ${
props.onClick ? 'cursor-pointer' : ''
}`}
>
<div className="text-gray-500">
{props.title}{' '}

View File

@@ -65,8 +65,8 @@ const Alert: FunctionComponent<ComponentProps> = (
style={
props.color
? {
backgroundColor: props.color?.toString(),
}
backgroundColor: props.color?.toString(),
}
: {}
}
>

View File

@@ -52,9 +52,9 @@ const Card: FunctionComponent<ComponentProps> = (
style={
i > 0
? {
marginLeft:
'10px',
}
marginLeft:
'10px',
}
: {}
}
key={i}

View File

@@ -115,7 +115,7 @@ const EventItem: FunctionComponent<ComponentProps> = (
)}
{props.eventResourcesAffected &&
props.eventResourcesAffected?.length > 0 ? (
props.eventResourcesAffected?.length > 0 ? (
<div key={0}>
<div className="flex space-x-1">
<div className="text-sm text-gray-400 mr-3 mt-1">
@@ -144,11 +144,12 @@ const EventItem: FunctionComponent<ComponentProps> = (
{props.eventTimeline && props.eventTimeline.length > 0 && (
<div
className={`w-full border-t border-gray-200 mt-5 -ml-5 ${props.eventTimeline &&
props.eventTimeline.length > 0
className={`w-full border-t border-gray-200 mt-5 -ml-5 ${
props.eventTimeline &&
props.eventTimeline.length > 0
? 'mb-5'
: 'mb-0'
} -mr-5 -pr-5`}
} -mr-5 -pr-5`}
style={{ width: 'calc(100% + 2.5em)' }}
></div>
)}
@@ -168,12 +169,12 @@ const EventItem: FunctionComponent<ComponentProps> = (
{i !==
props.eventTimeline
.length -
1 && (
<span
className="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200"
aria-hidden="true"
></span>
)}
1 && (
<span
className="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200"
aria-hidden="true"
></span>
)}
<div className="relative flex items-start space-x-3">
<div>
<div className="relative px-1">
@@ -240,12 +241,12 @@ const EventItem: FunctionComponent<ComponentProps> = (
{i !==
props.eventTimeline
.length -
1 && (
<span
className="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200"
aria-hidden="true"
></span>
)}
1 && (
<span
className="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200"
aria-hidden="true"
></span>
)}
<div className="relative flex items-start space-x-3">
<div>
<div className="relative px-1">

View File

@@ -122,7 +122,7 @@ const FilePicker: FunctionComponent<ComponentProps> = (
try {
setError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setError('Server Error. Please try again');
@@ -244,9 +244,9 @@ const FilePicker: FunctionComponent<ComponentProps> = (
.map((type: MimeType) => {
const enumKey: string | undefined =
Object.keys(MimeType)[
Object.values(
MimeType
).indexOf(type)
Object.values(
MimeType
).indexOf(type)
];
return enumKey?.toUpperCase() || '';
})

View File

@@ -9,7 +9,7 @@ import HeaderAlert from './HeaderAlert';
export interface ComponentProps<TBaseModel extends BaseModel> {
icon: IconProp;
modelType: { new(): TBaseModel };
modelType: { new (): TBaseModel };
singularName: string;
pluralName: string;
query: Query<TBaseModel>;
@@ -51,7 +51,7 @@ const HeaderModelAlert: Function = <TBaseModel extends BaseModel>(
try {
setError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setError('Server Error. Please try again');
@@ -81,8 +81,9 @@ const HeaderModelAlert: Function = <TBaseModel extends BaseModel>(
return (
<HeaderAlert
title={`${count} ${count > 1 ? props.pluralName : props.singularName
}`}
title={`${count} ${
count > 1 ? props.pluralName : props.singularName
}`}
icon={props.icon}
onClick={props.onClick}
className={props.className}

View File

@@ -1,6 +1,6 @@
import Color from 'Common/Types/Color';
import React, { FunctionComponent, ReactElement } from 'react';
import IconProp from "Common/Types/Icon/IconProp";
import IconProp from 'Common/Types/Icon/IconProp';
export enum SizeProp {
ExtraSmall,

View File

@@ -150,11 +150,11 @@ const Input: FunctionComponent<ComponentProps> = (
onKeyDown={
props.onEnterPress
? (event: any) => {
if (event.key === 'Enter') {
props.onEnterPress &&
props.onEnterPress();
}
}
if (event.key === 'Enter') {
props.onEnterPress &&
props.onEnterPress();
}
}
: undefined
}
readOnly={props.readOnly || props.disabled || false}

View File

@@ -85,8 +85,9 @@ const Modal: FunctionComponent<ComponentProps> = (
)}
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:mr-4 sm:text-left">
<h3
className={`text-lg font-medium leading-6 text-gray-900 ${props.icon ? 'ml-10 -mt-8 mb-5' : ''
}`}
className={`text-lg font-medium leading-6 text-gray-900 ${
props.icon ? 'ml-10 -mt-8 mb-5' : ''
}`}
id="modal-title"
>
{props.title}

View File

@@ -10,7 +10,7 @@ import IconProp from 'Common/Types/Icon/IconProp';
import ConfirmModal from '../Modal/ConfirmModal';
export interface ComponentProps<TBaseModel extends BaseModel> {
modelType: { new(): TBaseModel };
modelType: { new (): TBaseModel };
modelId: ObjectID;
onDeleteSuccess: () => void;
}
@@ -36,7 +36,7 @@ const ModelDelete: Function = <TBaseModel extends BaseModel>(
try {
setError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setError('Server Error. Please try again');

View File

@@ -43,15 +43,15 @@ const CardModelDetail: Function = <TBaseModel extends BaseModel>(
const hasPermissionToEdit: boolean = Boolean(
userProjectPermissions &&
userProjectPermissions.permissions &&
PermissionHelper.doesPermissionsIntersect(
model.updateRecordPermissions,
userProjectPermissions.permissions.map(
(item: UserPermission) => {
return item.permission;
}
userProjectPermissions.permissions &&
PermissionHelper.doesPermissionsIntersect(
model.updateRecordPermissions,
userProjectPermissions.permissions.map(
(item: UserPermission) => {
return item.permission;
}
)
)
)
);
if (props.isEditable && hasPermissionToEdit) {

View File

@@ -24,21 +24,21 @@ export default interface Columns<TEntity> {
disableSort?: boolean;
type: FieldType;
isFilterable: boolean;
filterEntityType?: { new(): BaseModel } | undefined;
filterEntityType?: { new (): BaseModel } | undefined;
filterQuery?: Query<BaseModel> | undefined;
tooltipText?: ((item: TEntity) => string) | undefined;
filterDropdownField?:
| {
label: string;
value: string;
}
| undefined;
| {
label: string;
value: string;
}
| undefined;
actionButtons?: Array<ActionButton>;
alignItem?: AlignItem | undefined;
getElement?:
| ((
item: JSONObject,
onBeforeFetchData?: JSONObject | undefined
) => ReactElement)
| undefined;
| ((
item: JSONObject,
onBeforeFetchData?: JSONObject | undefined
) => ReactElement)
| undefined;
}

View File

@@ -64,14 +64,14 @@ export enum ShowTableAs {
}
export interface ComponentProps<TBaseModel extends BaseModel> {
modelType: { new(): TBaseModel };
modelType: { new (): TBaseModel };
id: string;
onFetchInit?:
| undefined
| ((pageNumber: number, itemsOnPage: number) => void);
| undefined
| ((pageNumber: number, itemsOnPage: number) => void);
onFetchSuccess?:
| undefined
| ((data: Array<TBaseModel>, totalCount: number) => void);
| undefined
| ((data: Array<TBaseModel>, totalCount: number) => void);
cardProps?: CardComponentProps | undefined;
columns: Columns<TBaseModel>;
selectMoreFields?: Select<TBaseModel>;
@@ -203,8 +203,8 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
alignItem: column.alignItem,
getElement: column.getElement
? (item: JSONObject): ReactElement => {
return column.getElement!(item, onBeforeFetchData);
}
return column.getElement!(item, onBeforeFetchData);
}
: undefined,
});
@@ -236,7 +236,7 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
try {
setErrorModalText(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setErrorModalText('Server Error. Please try again');
@@ -349,7 +349,7 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
try {
setTableFilterError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setTableFilterError('Server Error. Please try again');
@@ -385,8 +385,8 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
getSelect(),
sortBy
? {
[sortBy as any]: sortOrder,
}
[sortBy as any]: sortOrder,
}
: {},
getPopulate(),
props.fetchRequestOptions
@@ -398,7 +398,7 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
try {
setError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setError('Server Error. Please try again');
@@ -511,8 +511,9 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
showTableAs !== ShowTableAs.OrderedStatesList
) {
headerbuttons.push({
title: `${props.createVerb || 'Create'} ${props.singularName || model.singularName
}`,
title: `${props.createVerb || 'Create'} ${
props.singularName || model.singularName
}`,
buttonStyle: ButtonStyleType.NORMAL,
className:
props.showFilterButton || props.showRefreshButton
@@ -999,9 +1000,9 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
let getTitleElement:
| ((
item: JSONObject,
onBeforeFetchData?: JSONObject | undefined
) => ReactElement)
item: JSONObject,
onBeforeFetchData?: JSONObject | undefined
) => ReactElement)
| undefined = undefined;
let getDescriptionElement:
| ((item: JSONObject) => ReactElement)
@@ -1045,10 +1046,10 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
onCreateNewItem={
props.isCreateable
? (order: number) => {
setOrderedStatesListNewItemOrder(order);
setModalType(ModalType.Create);
setShowModal(true);
}
setOrderedStatesListNewItemOrder(order);
setModalType(ModalType.Create);
setShowModal(true);
}
: undefined
}
singularLabel={
@@ -1113,8 +1114,9 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
}}
>
<Pill
text={`${new props.modelType().readBillingPlan
} Plan`}
text={`${
new props.modelType().readBillingPlan
} Plan`}
color={Yellow}
/>
</span>
@@ -1188,16 +1190,19 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
<ModelFormModal<TBaseModel>
title={
modalType === ModalType.Create
? `${props.createVerb || 'Create'} New ${props.singularName || model.singularName
}`
? `${props.createVerb || 'Create'} New ${
props.singularName || model.singularName
}`
: `Edit ${props.singularName || model.singularName}`
}
name={
modalType === ModalType.Create
? `${props.name} > ${props.createVerb || 'Create'
} New ${props.singularName || model.singularName}`
: `${props.name} > Edit ${props.singularName || model.singularName
}`
? `${props.name} > ${
props.createVerb || 'Create'
} New ${props.singularName || model.singularName}`
: `${props.name} > Edit ${
props.singularName || model.singularName
}`
}
initialValues={
modalType === ModalType.Create
@@ -1209,8 +1214,9 @@ const ModelTable: Function = <TBaseModel extends BaseModel>(
}}
submitButtonText={
modalType === ModalType.Create
? `${props.createVerb || 'Create'} ${props.singularName || model.singularName
}`
? `${props.createVerb || 'Create'} ${
props.singularName || model.singularName
}`
: `Save Changes`
}
onSuccess={async (item: TBaseModel) => {

View File

@@ -82,9 +82,9 @@ const OrderedStatesList: FunctionComponent<ComponentProps> = (
props.onCreateNewItem(
item[props.orderField]
? (item[
props
.orderField
] as number) + 1
props
.orderField
] as number) + 1
: 0
);
}}
@@ -121,14 +121,14 @@ const OrderedStatesList: FunctionComponent<ComponentProps> = (
/>
{((isEnd && props.shouldAddItemInTheEnd) ||
!isEnd) && (
<div className="vertical-list items-center m-10 ">
<Icon
icon={IconProp.ChevronDown}
size={SizeProp.Regular}
className="m-auto h-5 w-5 text-gray-500"
/>
</div>
)}
<div className="vertical-list items-center m-10 ">
<Icon
icon={IconProp.ChevronDown}
size={SizeProp.Regular}
className="m-auto h-5 w-5 text-gray-500"
/>
</div>
)}
{props.onCreateNewItem &&
((isEnd && props.shouldAddItemInTheEnd) ||
!isEnd) && (
@@ -140,9 +140,9 @@ const OrderedStatesList: FunctionComponent<ComponentProps> = (
props.onCreateNewItem(
item[props.orderField]
? (item[
props
.orderField
] as number) + 1
props
.orderField
] as number) + 1
: 0
);
}}

View File

@@ -11,7 +11,7 @@ import IconProp from 'Common/Types/Icon/IconProp';
export interface ComponentProps<TBaseModel extends BaseModel> {
link: Link;
modelType?: { new(): TBaseModel } | undefined;
modelType?: { new (): TBaseModel } | undefined;
badgeType?: BadgeType | undefined;
countQuery?: Query<TBaseModel> | undefined;
requestOptions?: RequestOptions | undefined;
@@ -55,7 +55,7 @@ const CountModelSideMenuItem: Function = <TBaseModel extends BaseModel>(
try {
setError(
(err as HTTPErrorResponse).message ||
'Server Error. Please try again'
'Server Error. Please try again'
);
} catch (e) {
setError('Server Error. Please try again');

View File

@@ -19,8 +19,9 @@ export interface ComponentProps {
const SideMenuItem: FunctionComponent<ComponentProps> = (
props: ComponentProps
) => {
let badgeClasName: string = `bg-indigo-${Navigation.isOnThisPage(props.link.to) ? '500' : '400'
} p-1 rounded-full pr-3 pl-3 text-white text-sm`;
let badgeClasName: string = `bg-indigo-${
Navigation.isOnThisPage(props.link.to) ? '500' : '400'
} p-1 rounded-full pr-3 pl-3 text-white text-sm`;
if (props.showWarning) {
badgeClasName =
'bg-yellow-500 p-1 rounded-full pr-2 pl-3 text-white text-sm';
@@ -33,10 +34,11 @@ const SideMenuItem: FunctionComponent<ComponentProps> = (
return (
<UILink
className={`${props.className ? props.className : ''} ${Navigation.isOnThisPage(props.link.to)
className={`${props.className ? props.className : ''} ${
Navigation.isOnThisPage(props.link.to)
? 'bg-gray-100 text-indigo-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium'
: 'text-gray-500 hover:text-gray-900 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium'
} flex justify-between`}
} flex justify-between`}
to={props.link.to}
>
<div className="flex">

View File

@@ -30,8 +30,9 @@ const TableHeader: FunctionComponent<ComponentProps> = (
return (
<th
key={i}
className={`px-6 py-3 text-left text-sm font-semibold text-gray-900 ${canSort ? 'cursor-pointer' : ''
}`}
className={`px-6 py-3 text-left text-sm font-semibold text-gray-900 ${
canSort ? 'cursor-pointer' : ''
}`}
onClick={() => {
if (!column.key) {
return;
@@ -59,10 +60,11 @@ const TableHeader: FunctionComponent<ComponentProps> = (
}}
>
<div
className={`flex ${column.type === FieldType.Actions
className={`flex ${
column.type === FieldType.Actions
? 'justify-end'
: 'justify-start'
}`}
}`}
>
{column.title}
{canSort &&

View File

@@ -82,7 +82,7 @@ const TableRow: FunctionComponent<ComponentProps> = (
props.item[column.key] ? (
OneUptimeDate.getDateAsLocalFormattedString(
props.item[
column.key
column.key
] as string,
true
)
@@ -90,11 +90,11 @@ const TableRow: FunctionComponent<ComponentProps> = (
''
)
) : column.type ===
FieldType.DateTime ? (
FieldType.DateTime ? (
props.item[column.key] ? (
OneUptimeDate.getDateAsLocalFormattedString(
props.item[
column.key
column.key
] as string,
false
)
@@ -102,7 +102,7 @@ const TableRow: FunctionComponent<ComponentProps> = (
''
)
) : column.type ===
FieldType.Boolean ? (
FieldType.Boolean ? (
props.item[column.key] ? (
<Icon
icon={IconProp.CheckCircle}
@@ -183,7 +183,7 @@ const TableRow: FunctionComponent<ComponentProps> = (
}
isLoading={
isButtonLoading[
i
i
]
}
onClick={() => {

View File

@@ -4,7 +4,6 @@ import Icon from '../Icon/Icon';
import IconProp from 'Common/Types/Icon/IconProp';
import { NodeDataProp } from './Component';
export interface ComponentProps {
data: NodeDataProp;
}
@@ -40,7 +39,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
{!props.data.isTrigger && (
<Handle
type="target"
onConnect={(_params: Connection) => { }}
onConnect={(_params: Connection) => {}}
isConnectable={true}
position={Position.Top}
style={handleStyle}

View File

@@ -51,39 +51,43 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
props.data.onClick(props.data);
}}
>
{isHovering && <div style={{
"width": "20px",
height: "20px",
borderRadius: "100px",
background: "#ef4444",
position: "absolute",
top: "-9px",
left: "228px",
cursor: "pointer"
}} onClick={() => {
if (props.data.onDeleteClick) {
props.data.onDeleteClick(props.data.id);
}
}} >
<Icon
icon={IconProp.Close}
{isHovering && (
<div
style={{
color: "white",
width: '1rem',
height: '1rem',
textAlign: 'center',
margin: 'auto',
marginTop: "2px"
width: '20px',
height: '20px',
borderRadius: '100px',
background: '#ef4444',
position: 'absolute',
top: '-9px',
left: '228px',
cursor: 'pointer',
}}
thick={ThickProp.Thick}
/>
</div>}
onClick={() => {
if (props.data.onDeleteClick) {
props.data.onDeleteClick(props.data.id);
}
}}
>
<Icon
icon={IconProp.Close}
style={{
color: 'white',
width: '1rem',
height: '1rem',
textAlign: 'center',
margin: 'auto',
marginTop: '2px',
}}
thick={ThickProp.Thick}
/>
</div>
)}
{!props.data.isTrigger && (
<Handle
type="target"
onConnect={(_params: Connection) => { }}
onConnect={(_params: Connection) => {}}
isConnectable={true}
position={Position.Top}
style={handleStyle}
@@ -149,7 +153,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
<Handle
type="source"
id="a"
onConnect={(_params: Connection) => { }}
onConnect={(_params: Connection) => {}}
isConnectable={true}
position={Position.Bottom}
style={handleStyle}

View File

@@ -1,2 +1 @@
// Show a large modal full of components.
// Show a large modal full of components.

View File

@@ -47,39 +47,42 @@ export interface ComponentProps {
const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
const edgeUpdateSuccessful: any = useRef(true);
const onClickNode = (_data: NodeDataProp) => {
const onClickNode: Function = (_data: NodeDataProp) => { };
}
const deleteNode: Function = (id: string): void => {
// remove the node.
const deleteNode = (id: string) => {
// remove the node.
const nodesToDelete: Array<Node> = [...nodes].filter((node: Node) => {
return node.data.id === id;
});
const edgeToDelete: Array<Edge> = getConnectedEdges(
nodesToDelete,
edges
);
const nodesToDelete = [...nodes].filter((node) => {
return node.data.id === id
})
const edgeToDelete = getConnectedEdges(nodesToDelete, edges);
setNodes((nds) => {
return nds.filter((node) => {
return node.data.id !== id
setNodes((nds: Array<Node>) => {
return nds.filter((node: Node) => {
return node.data.id !== id;
});
})
});
setNodes((eds) => {
return eds.filter((edge) => {
const idsToDelete = edgeToDelete.map((e) => e.id);
setEdges((eds: Array<Edge>) => {
return eds.filter((edge: Edge) => {
const idsToDelete: Array<string> = edgeToDelete.map((e: Edge) => {
return e.id;
});
return !idsToDelete.includes(edge.id);
})
});
});
};
const [nodes, setNodes, onNodesChange] = useNodesState(
props.initialNodes.map((node: Node) => {
node.data.onDeleteClick = deleteNode;
node.data.onClick = onClickNode;
return node;
})
}
const [nodes, setNodes, onNodesChange] = useNodesState(props.initialNodes.map((node) => {
node.data.onDeleteClick = deleteNode;
node.data.onClick = onClickNode;
return node;
}));
);
const [edges, setEdges, onEdgesChange] = useEdgesState(
props.initialEdges.map((edge: Edge) => {
@@ -149,9 +152,6 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
edgeUpdateSuccessful.current = true;
}, []);
return (
<div className="h-[48rem]">
<ReactFlow
@@ -168,7 +168,7 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
>
<MiniMap />
<Controls />
<Background color='#111827' />
<Background color="#111827" />
</ReactFlow>
</div>
);

View File

@@ -26,7 +26,7 @@ import EnableWorkflow from 'Common/Types/Model/EnableWorkflow';
create: true,
delete: true,
update: true,
read: true
read: true,
})
@CanAccessIfCanReadOn('statusPage')
@TenantColumn('projectId')