diff --git a/presets/library/step-functions-execution-form/preset.mjs b/presets/library/step-functions-execution-form/preset.mjs new file mode 100644 index 0000000..6e1afff --- /dev/null +++ b/presets/library/step-functions-execution-form/preset.mjs @@ -0,0 +1,3 @@ +import { extend, extract } from '../../../src/index.js' + +export default [extend('presets/base/typescript-cdk'), extract()] diff --git a/presets/library/step-functions-execution-form/templates/README.md b/presets/library/step-functions-execution-form/templates/README.md new file mode 100644 index 0000000..59871b6 --- /dev/null +++ b/presets/library/step-functions-execution-form/templates/README.md @@ -0,0 +1,25 @@ +

+ + Buttonize.io + +

+ +--- + +## StepFunctions Execution Form + +[![StepFunctions Execution Form](https://github.com/buttonize/create-buttonize/assets/6282843/c3a40e5f-ed7b-4561-8e0f-375fcde9ef52)](https://buttonize.io/library/step-functions-execution-form) + +Learn more about StepFunctions Execution Form Construct [here](https://buttonize.io/library/step-functions-execution-form). + +## CDK + +The `cdk.json` file tells the CDK Toolkit how to execute your app. + +### Useful commands + +* `npm run build` compile typescript to js +* `npm run watch` watch for changes and compile +* `npx cdk deploy` deploy this stack to your default AWS account/region +* `npx cdk diff` compare deployed stack with current state +* `npx cdk synth` emits the synthesized CloudFormation template diff --git a/presets/library/step-functions-execution-form/templates/lib/example-stack.ts b/presets/library/step-functions-execution-form/templates/lib/example-stack.ts new file mode 100644 index 0000000..01e5822 --- /dev/null +++ b/presets/library/step-functions-execution-form/templates/lib/example-stack.ts @@ -0,0 +1,49 @@ +import * as cdk from 'aws-cdk-lib' +import { Pass, StateMachine } from 'aws-cdk-lib/aws-stepfunctions' +import { Buttonize, Input } from 'buttonize/cdk' +import { StepFunctionsExecutionForm } from 'buttonize/library' +import { Construct } from 'constructs' + +export class ExampleStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props) + + Buttonize.init(this, { + apiKey: '@@apiKey' + }) + + const stateMachine = new StateMachine(this, 'StateMachine', { + definition: new Pass(this, 'PassTest') + }) + + new StepFunctionsExecutionForm(this, 'ExecutionForm', { + name: 'Product cache invalidation panel', + description: + 'Trigger invalidation of a product in all the caches in the in the company systems', + stateMachine, + submitButtonLabel: 'Invalidate', + fields: [ + Input.text({ + id: 'id', + label: 'Product ID' + }), + Input.select({ + id: 'reason', + options: [ + { label: 'New manual update', value: 'manual_update' }, + { label: 'System bug', value: 'bug' } + ] + }) + ], + executionInput: { + operation: 'invalidate', + product: { + pid: '{{id}}' + }, + metadata: { + reasonStatement: '{{reason.value}}' + } + } + }) + } +}