-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3967 from MoShizzle/interfaces-changes
feat(forms): rename interfaces to forms
- Loading branch information
Showing
28 changed files
with
286 additions
and
213 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# pieces-forms | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Building | ||
|
||
Run `nx build pieces-forms` to build the library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@activepieces/piece-forms", | ||
"version": "0.0.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createPiece, PieceAuth } from '@activepieces/pieces-framework'; | ||
import { returnFile } from './lib/actions/return-file'; | ||
import { returnMarkdown } from './lib/actions/return-markdown'; | ||
import { onFormSubmission } from './lib/triggers/form-trigger'; | ||
import { onFileSubmission } from './lib/triggers/file-trigger'; | ||
import { PieceCategory } from '@activepieces/shared'; | ||
|
||
export const forms = createPiece({ | ||
displayName: 'Forms (BETA)', | ||
description: 'Trigger a flow through form interfaces.', | ||
auth: PieceAuth.None(), | ||
minimumSupportedRelease: '0.20.3', | ||
categories: [PieceCategory.CORE], | ||
logoUrl: 'https://cdn.activepieces.com/pieces/forms.png', | ||
authors: ['MoShizzle'], | ||
actions: [ | ||
returnFile, | ||
returnMarkdown | ||
], | ||
triggers: [ | ||
onFormSubmission, | ||
onFileSubmission, | ||
], | ||
}); |
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
packages/pieces/community/forms/src/lib/triggers/file-trigger.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
Property, | ||
TriggerStrategy, | ||
createTrigger, | ||
} from '@activepieces/pieces-framework'; | ||
|
||
const markdown = ` | ||
The form title is same as the flow's title. \n | ||
Form URL: \n | ||
**{{formUrl}}** | ||
`; | ||
|
||
export const onFileSubmission = createTrigger({ | ||
name: 'file_submission', | ||
displayName: 'Simple File Submission', | ||
description: 'Trigger the flow by submitting a file.', | ||
props: { | ||
about: Property.MarkDown({ | ||
value: markdown, | ||
}), | ||
waitForResponse: Property.Checkbox({ | ||
displayName: 'Wait for Response', | ||
description: | ||
'If enabled, the form will return the flow output to the frontend. Make sure to use the Return Response action to return a response.', | ||
defaultValue: true, | ||
required: true, | ||
}), | ||
}, | ||
sampleData: {}, | ||
type: TriggerStrategy.WEBHOOK, | ||
async onEnable() { | ||
return; | ||
}, | ||
async onDisable() { | ||
return; | ||
}, | ||
async run(context) { | ||
return [context.payload.body]; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@activepieces/shared", | ||
"version": "0.10.81", | ||
"version": "0.10.82", | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
packages/ui/core/src/app/modules/forms/forms.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<div | ||
class="ap-h-screen ap-w-full ap-flex ap-items-center ap-justify-center ap-bg-center ap-bg-cover ap-bg-authBg ap-flex-col"> | ||
<ng-container *ngIf="!error && props"> | ||
<form [formGroup]="form" (ngSubmit)="submit()" class="ap-flex ap-flex-col ap-gap-2"> | ||
<mat-card class="md:ap-min-w-[480px] md:ap-max-w-initial ap-min-w-[350px] ap-max-w-[350px] auth-card ap-max-h-[80vh] ap-overflow-scroll"> | ||
<div class="ap-typography-headline-5 ap-text-center ap-mb-6">{{ title }}</div> | ||
<ng-container *ngFor="let input of inputs"> | ||
<ng-container [ngSwitch]="input.type"> | ||
<ng-container *ngSwitchCase="PropertyType.SHORT_TEXT"> | ||
<mat-form-field class="ap-w-full ap-mb-4" appearance="outline" subscriptSizing="dynamic"> | ||
<mat-label>{{ input.displayName }}</mat-label> | ||
<input matInput type="text" [formControlName]="getInputKey(input.displayName)"> | ||
<mat-hint>{{ input.description }}</mat-hint> | ||
<mat-error *ngIf="form.controls[getInputKey(input.displayName)]?.invalid"> | ||
{{ input.displayName }} is required | ||
</mat-error> | ||
</mat-form-field> | ||
</ng-container> | ||
<ng-container *ngSwitchCase="PropertyType.FILE"> | ||
<mat-form-field class="ap-w-full" subscriptSizing="dynamic"> | ||
<mat-label i18n>{{ input.displayName }}</mat-label> | ||
<ap-file-upload [required]="input.required" #flowInput | ||
[formControlName]="getInputKey(input.displayName)" [extensions]="['.*']"></ap-file-upload> | ||
<ap-icon-button [height]="25" [width]="25" iconFilename="attach.svg" matSuffix | ||
(buttonClicked)="flowInput.fileInput.nativeElement.click()"></ap-icon-button> | ||
|
||
<mat-hint>{{ input.description }}</mat-hint> | ||
<mat-error *ngIf="form.controls[getInputKey(input.displayName)]?.invalid"> | ||
{{ input.displayName }} is required | ||
</mat-error> | ||
</mat-form-field> | ||
</ng-container> | ||
<ng-container *ngSwitchCase="PropertyType.CHECKBOX"> | ||
<div class="app-w-full ap-mb-4"> | ||
<div> | ||
<mat-slide-toggle [formControlName]="getInputKey(input.displayName)" color="primary" i18n>{{ input.displayName }}</mat-slide-toggle> | ||
</div> | ||
<markdown class="ap-typography-caption">{{ input.description }}</markdown> | ||
<mat-error *ngIf="form.controls[getInputKey(input.displayName)]?.invalid" class="ap-mt-2"> | ||
{{ input.displayName }} is required | ||
</mat-error> | ||
</div> | ||
</ng-container> | ||
<ng-container *ngSwitchCase="PropertyType.LONG_TEXT"> | ||
<mat-form-field class="ap-w-full ap-mb-4" appearance="outline" subscriptSizing="dynamic"> | ||
<mat-label>{{ input.displayName }}</mat-label> | ||
<textarea matInput [formControlName]="getInputKey(input.displayName)"></textarea> | ||
<mat-hint>{{ input.description }}</mat-hint> | ||
<mat-error *ngIf="form.controls[getInputKey(input.displayName)]?.invalid"> | ||
{{ input.displayName }} is required | ||
</mat-error> | ||
</mat-form-field> | ||
</ng-container> | ||
</ng-container> | ||
</ng-container> | ||
|
||
<div class="text-center ap-mt-6 ap-flex ap-flex-col ap-gap-2"> | ||
<ap-button [loading]="loading" (buttonClicked)="submit()" btnColor="primary" btnSize="large" | ||
[fullWidthOfContainer]="true" i18n> | ||
Submit | ||
</ap-button> | ||
</div> | ||
|
||
<ng-container *ngIf="markdownResponse | async as mkResponse"> | ||
<ap-markdown [fullWidth]="true" [data]="mkResponse" class="ap-mt-4 ap-mb-4"></ap-markdown> | ||
</ng-container> | ||
</mat-card> | ||
</form> | ||
</ng-container> | ||
<ng-container *ngIf="error"> | ||
{{ error }} | ||
</ng-container> | ||
<ap-powered-by-activepieces class="ap-mt-4"></ap-powered-by-activepieces> | ||
</div> | ||
<ng-container *ngIf="flow$ | async as flow"></ng-container> | ||
<ng-container *ngIf="submitForm$ | async"></ng-container> |
Oops, something went wrong.