Skip to content

Commit

Permalink
Merge pull request #3982 from activepieces/chore/display-app-name-whe…
Browse files Browse the repository at this point in the history
…n-creating-connection

chore: show piece name in dialog title when creating a new connection
  • Loading branch information
AbdulTheActivePiecer committed Feb 21, 2024
2 parents 38cd1c8 + 3901e40 commit f32a5f3
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@
||
''}}
</div>
<div >
<div>
<app-add-edit-connection-button *ngIf="formGroup.enabled && formGroup.get(property.key)!.value"
(click)="$event.stopPropagation()" btnSize="extraSmall" [isEditConnectionButton]="true"
[authProperty]="property.value" [pieceName]="pieceName" [pieceVersion]="pieceVersion"
[propertyKey]="property.key"
[propertyKey]="property.key" [pieceDisplayName]="pieceDisplayName"
[selectedConnectionInterpolatedString]="formGroup.get(property.key)!.value"
(connectionPropertyValueChanged)="connectionValueChanged($event)"
[triggerName]="actionOrTriggerName">
<div class="ap-px-2" i18n >
<div class="ap-px-2" i18n>
Reconnect
</div>
</app-add-edit-connection-button>
Expand All @@ -487,7 +487,8 @@
<app-add-edit-connection-button btnSize="medium" class="ap-hidden" *ngIf="formGroup.enabled"
[isEditConnectionButton]="false" #addConnectionBtn [authProperty]="property.value" [pieceName]="pieceName"
[pieceVersion]="pieceVersion" [propertyKey]="property.key"
(connectionPropertyValueChanged)="connectionValueChanged($event)" [triggerName]="actionOrTriggerName">
(connectionPropertyValueChanged)="connectionValueChanged($event)" [triggerName]="actionOrTriggerName"
[pieceDisplayName]="pieceDisplayName">

</app-add-edit-connection-button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ export class PiecePropertiesFormComponent implements ControlValueAccessor {
requiredProperties: PiecePropertyMap = {};
optionalProperties: PiecePropertyMap = {};
optionalConfigsMenuOpened = false;
@Input() actionOrTriggerName: string;
@Input() packageType: PackageType;
@Input() pieceType: PieceType;
@Input() pieceName: string;
@Input() pieceVersion: string;
@Input() pieceDisplayName: string;
@Input() isTriggerPieceForm = false;
@Input({ required: true }) actionOrTriggerName: string;
@Input({ required: true }) packageType: PackageType;
@Input({ required: true }) pieceType: PieceType;
@Input({ required: true }) pieceName: string;
@Input({ required: true }) pieceVersion: string;
@Input({ required: true }) pieceDisplayName: string;
@Input({ required: true }) isTriggerPieceForm = false;
@ViewChildren('textControl', { read: ElementRef })
theInputs: QueryList<ElementRef>;
@ViewChild('addConnectionBtn')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@
</ng-container>

</div>
</ng-template>
</ng-template>

<ng-container *ngIf="setInitialFormValue$ | async"></ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {
tap,
} from 'rxjs';
import {
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
} from '@angular/forms';
import { Store } from '@ngrx/store';
import { MatSnackBar } from '@angular/material/snack-bar';
Expand All @@ -41,6 +42,7 @@ import {
} from '@activepieces/ui/feature-builder-store';
import { TriggerBase, TriggerStrategy } from '@activepieces/pieces-framework';
import { PieceMetadataService } from '@activepieces/ui/feature-pieces';
import { InputFormsSchema } from '../../input-forms/input-forms-schema';

@Component({
selector: 'app-edit-step-form-container',
Expand All @@ -51,12 +53,13 @@ export class EditStepFormContainerComponent {
readOnly$: Observable<boolean> = of(false);
cancelAutoSaveListener$: Subject<boolean> = new Subject();
_selectedStep: Step;
stepForm: UntypedFormGroup;
stepForm: FormGroup<{ settings: FormControl<InputFormsSchema> }>;
webhookUrl$: Observable<string>;
ActionType = ActionType;
TriggerType = TriggerType;
ApEdition = ApEdition;
edition$: Observable<ApEdition>;
setInitialFormValue$: Observable<void>;
@Input() set selectedStep(step: Step) {
this._selectedStep = step;
this.cancelAutoSaveListener$.next(true);
Expand Down Expand Up @@ -97,11 +100,20 @@ export class EditStepFormContainerComponent {
}

updateFormValue(stepSelected: Step) {
const settingsControl = this.stepForm.get('settings')!;
settingsControl.setValue({
...stepSelected.settings,
type: stepSelected.type,
});
const settingsControl = this.stepForm.controls.settings;
this.setInitialFormValue$ = this.store
.select(BuilderSelectors.selectFlowItemDetails(stepSelected))
.pipe(
take(1),
tap((res) => {
settingsControl.setValue({
...stepSelected.settings,
pieceDisplayName: res?.name || '',
type: stepSelected.type,
});
}),
switchMap(() => of(void 0))
);
}

setAutoSaveListener() {
Expand Down Expand Up @@ -216,7 +228,7 @@ export class EditStepFormContainerComponent {

createNewStepSettings(currentStep: Step) {
const inputControlValue: StepSettings =
this.stepForm.get('settings')?.value;
this.stepForm.controls.settings.value;

switch (currentStep.type) {
case ActionType.CODE: {
Expand Down Expand Up @@ -259,7 +271,7 @@ export class EditStepFormContainerComponent {

createPieceSettings(step: Step) {
const inputControlValue: StepSettings =
this.stepForm.get('settings')?.value;
this.stepForm.controls.settings.value;
const stepSettings: PieceTriggerSettings = {
...step.settings,
...inputControlValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ export interface ScheduledTriggerInputFormSchema extends InputFormsSchemaBase {
cronExpression: string;
}

export interface PieceActionInputFormSchema extends InputFormsSchemaBase {
type CommonPieceFormsProps = {
packageType: PackageType;
pieceType: PieceType;
pieceName: string;
pieceDisplayName: string;
pieceVersion: string;
};
export interface PieceActionInputFormSchema
extends InputFormsSchemaBase,
CommonPieceFormsProps {
actionName: string;
input: ConfigsAndTheirValues;
inputUiInfo: {
Expand All @@ -42,11 +47,9 @@ export interface PieceActionInputFormSchema extends InputFormsSchemaBase {
errorHandlingOptions?: ActionErrorHandlingOptions;
}

export interface ComponentTriggerInputFormSchema extends InputFormsSchemaBase {
packageType: PackageType;
pieceType: PieceType;
pieceName: string;
pieceVersion: string;
export interface PieceTriggerInputFormSchema
extends InputFormsSchemaBase,
CommonPieceFormsProps {
triggerName: string;
input: ConfigsAndTheirValues;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<app-piece-properties-form
[actionOrTriggerName]="pieceActionForm.get(ACTION_FORM_CONTROL_NAME)!.value?.actionName"
[packageType]="packageType" [pieceType]="pieceType" [pieceName]="pieceName" [pieceVersion]="pieceVersion"
[isTriggerPieceForm]="false" [pieceDisplayName]="pieceDisplayName"
[formControlName]="CONFIGS_FORM_CONTROL_NAME">
</app-piece-properties-form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class PieceActionInputFormComponent
pieceType: PieceType;
pieceName: string;
pieceVersion: string;
pieceDisplayName: string;
initialComponentInputFormValue: PieceActionInputFormSchema | null;
selectedAction$: Observable<ActionDropdownOption | undefined>;
actions$: Observable<ActionDropdownOption[]>;
Expand Down Expand Up @@ -303,7 +304,7 @@ export class PieceActionInputFormComponent
this.pieceType = obj.pieceType;
this.pieceName = obj.pieceName;
this.pieceVersion = obj.pieceVersion;

this.pieceDisplayName = obj.pieceDisplayName;
this.pieceActionForm
.get(ACTION_FORM_CONTROL_NAME)
?.setValue(undefined, { emitEvent: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@
</div>

<div class="ap-flex-grow"></div>
<div *ngIf="opt.label.isWebhook"
matTooltip="Instantly triggered once change occurs"
i18n-matTooltip
class="ap-rounded-full ap-drop-shadow-md ap-min-h-[30px] ap-min-w-[30px] ap-flex ap-items-center ap-justify-center">
<div *ngIf="opt.label.isWebhook" matTooltip="Instantly triggered once change occurs" i18n-matTooltip
class="ap-rounded-full ap-drop-shadow-md ap-min-h-[30px] ap-min-w-[30px] ap-flex ap-items-center ap-justify-center">
<svg-icon src="assets/img/custom/triggers/instant.svg" class="ap-w-[25px] ap-h-[25px] ap-fill-body"
[applyClass]="true">
</svg-icon>
</div>
<div *ngIf="!opt.label.isWebhook && pieceName !== CORE_SCHEDULE"
matTooltip="Checks for changes periodically, based on your plan"
i18n-matTooltip
class="ap-rounded-full ap-drop-shadow-md ap-min-h-[30px] ap-justify-center ap-min-w-[30px] ap-flex ap-items-center">
matTooltip="Checks for changes periodically, based on your plan" i18n-matTooltip
class="ap-rounded-full ap-drop-shadow-md ap-min-h-[30px] ap-justify-center ap-min-w-[30px] ap-flex ap-items-center">
<svg-icon src="assets/img/custom/triggers/periodic.svg" class="ap-w-[25px] ap-h-[25px] ap-fill-body"
[applyClass]="true">
</svg-icon>
Expand All @@ -37,7 +34,8 @@
</div>
</mat-option>
<mat-option [disabled]="true"
*ngIf=" ( triggers$ | async) === undefined || (triggers$ | async) === null || (triggers$ | async)?.length === 0" i18n>
*ngIf=" ( triggers$ | async) === undefined || (triggers$ | async) === null || (triggers$ | async)?.length === 0"
i18n>
No options available
</mat-option>
</mat-select>
Expand All @@ -51,11 +49,8 @@

<app-piece-properties-form
[actionOrTriggerName]="pieceTriggerInputForm.get(TRIGGER_FORM_CONTROL_NAME)!.value?.triggerName"
[isTriggerPieceForm]="true"
[packageType]="packageType"
[pieceType]="pieceType"
[pieceName]="pieceName"
[pieceVersion]="pieceVersion"
[isTriggerPieceForm]="true" [packageType]="packageType" [pieceType]="pieceType" [pieceName]="pieceName"
[pieceVersion]="pieceVersion" [pieceDisplayName]="pieceDisplayName"
[formControlName]="CONFIGS_FORM_CONTROL_NAME">
</app-piece-properties-form>
</div>
Expand All @@ -73,4 +68,4 @@
<ng-container *ngIf="triggerDropdownValueChanged$ | async"></ng-container>
<ng-container *ngIf="initialSetup$ | async"> </ng-container>
<ng-container *ngIf="selectedTrigger$ | async"></ng-container>
<ng-container *ngIf="updateStepName$ | async"></ng-container>
<ng-container *ngIf="updateStepName$ | async"></ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
FlowsActions,
} from '@activepieces/ui/feature-builder-store';
import { PiecePropertiesFormValue } from '@activepieces/ui/feature-builder-form-controls';
import { ComponentTriggerInputFormSchema } from '../../input-forms-schema';
import { PieceTriggerInputFormSchema } from '../../input-forms-schema';
import { PiecePropertyMap } from '@activepieces/pieces-framework';
import {
CORE_SCHEDULE,
Expand Down Expand Up @@ -83,6 +83,7 @@ export class PieceTriggerInputFormComponent {
packageType: PackageType;
pieceType: PieceType;
pieceName: string;
pieceDisplayName: string;
pieceVersion: string;
initialComponentTriggerInputFormValue: {
triggerName: string;
Expand Down Expand Up @@ -238,13 +239,13 @@ export class PieceTriggerInputFormComponent {
}
}

writeValue(obj: ComponentTriggerInputFormSchema): void {
writeValue(obj: PieceTriggerInputFormSchema): void {
this.initialComponentTriggerInputFormValue = obj;
this.packageType = obj.packageType;
this.pieceType = obj.pieceType;
this.pieceName = obj.pieceName;
this.pieceVersion = obj.pieceVersion;

this.pieceDisplayName = obj.pieceDisplayName;
this.pieceTriggerInputForm
.get(TRIGGER_FORM_CONTROL_NAME)
?.setValue(undefined, { emitEvent: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class AddEditConnectionButtonComponent {
isEditConnectionButton = false;
@Input()
triggerName: string;
@Input({ required: true }) pieceDisplayName: string;
@Output()
connectionPropertyValueChanged: EventEmitter<{
propertyKey: string;
Expand Down Expand Up @@ -186,6 +187,7 @@ export class AddEditConnectionButtonComponent {
pieceAuthProperty: this
.authProperty as CustomAuthProperty<CustomAuthProps>,
pieceName: this.pieceName,
pieceDisplayName: this.pieceDisplayName,
};

return this.dialogService
Expand Down Expand Up @@ -215,6 +217,7 @@ export class AddEditConnectionButtonComponent {
const dialogData: BasicAuthDialogData = {
pieceAuthProperty: this.authProperty as BasicAuthProperty,
pieceName: this.pieceName,
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(BasicAuthConnectionDialogComponent, {
Expand All @@ -231,6 +234,7 @@ export class AddEditConnectionButtonComponent {
pieceName: this.pieceName,
displayName: this.authProperty.displayName,
description: this.authProperty.description || '',
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(SecretTextConnectionDialogComponent, {
Expand Down Expand Up @@ -290,6 +294,7 @@ export class AddEditConnectionButtonComponent {
pieceAuthProperty: this.authProperty as OAuth2Property<OAuth2Props>,
pieceName: this.pieceName,
redirectUrl: frontEndUrl + '/redirect',
pieceDisplayName: this.pieceDisplayName,
};

return this.dialogService
Expand Down Expand Up @@ -340,6 +345,7 @@ export class AddEditConnectionButtonComponent {
isTriggerAppWebhook: isTriggerAppWebhook,
connectionType: pieceOAuth2Details.connectionType,
frontendUrl,
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(ManagedOAuth2ConnectionDialogComponent, {
Expand Down Expand Up @@ -410,6 +416,7 @@ export class AddEditConnectionButtonComponent {
pieceAuthProperty: this
.authProperty as CustomAuthProperty<CustomAuthProps>,
connectionToUpdate: customAuthConnection,
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(CustomAuthConnectionDialogComponent, {
Expand All @@ -434,6 +441,7 @@ export class AddEditConnectionButtonComponent {
displayName: this.authProperty.displayName,
description: this.authProperty.description || '',
connectionName: connection!.name,
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(SecretTextConnectionDialogComponent, {
Expand All @@ -456,6 +464,7 @@ export class AddEditConnectionButtonComponent {
pieceName: this.pieceName,
pieceAuthProperty: this.authProperty as BasicAuthProperty,
connectionToUpdate: connection,
pieceDisplayName: this.pieceDisplayName,
};

return this.dialogService
Expand Down Expand Up @@ -487,6 +496,7 @@ export class AddEditConnectionButtonComponent {
pieceAuthProperty: this.authProperty,
pieceName: this.pieceName,
redirectUrl: frontendUrl + '/redirect',
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(OAuth2ConnectionDialogComponent, {
Expand All @@ -510,6 +520,7 @@ export class AddEditConnectionButtonComponent {
isTriggerAppWebhook: false,
connectionType: pieceOAuth2Details.connectionType,
frontendUrl,
pieceDisplayName: this.pieceDisplayName,
};
return this.dialogService
.open(ManagedOAuth2ConnectionDialogComponent, {
Expand Down
Loading

0 comments on commit f32a5f3

Please sign in to comment.