Skip to content

Commit

Permalink
feat: display editor in versions history
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSelene committed Feb 17, 2024
1 parent c145cbd commit 33f29cc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@ export const flowVersionService = {
},
})
const paginationResult = await paginator.paginate(
flowVersionRepo().createQueryBuilder('flow_version').where({
flowVersionRepo().createQueryBuilder('flow_version').innerJoinAndMapOne(
'flow_version.updatedByUser',
'user',
'user',
'flow_version.updatedBy = "user"."id"',
).where({
flowId,
}),
)
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/lib/flows/flow-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { BaseModelSchema, Nullable } from '../common/base-model'
import { ApId } from '../common/id-generator'
import { Trigger } from './triggers/trigger'
import { Static, Type } from '@sinclair/typebox'
import { User } from '../user'

export type FlowVersionId = ApId

Expand All @@ -28,6 +29,8 @@ export const FlowVersionMetadata = Type.Object({
displayName: Type.String(),
valid: Type.Boolean(),
state: Type.Enum(FlowVersionState),
updatedBy: Nullable(Type.String()),
updatedByUser: Nullable(User),
})

export type FlowVersionMetadata = Static<typeof FlowVersionMetadata>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="ap-text-body">{{version.created |date:'mediumDate'
}}, {{version.created |date:'shortTime' }} </div>
<div class=" ap-text-description ap-typography-subtitle-2 ">Version
#{{flowVersions.data.length - idx}}</div>
#{{flowVersions.data.length - idx}} ({{version.updatedByUser?.email}})</div>
</div>

<div class="ap-flex-grow"></div>
Expand Down Expand Up @@ -73,4 +73,4 @@
</ng-template>

<ng-container *ngIf="useAsDraft$ | async"></ng-container>
<ng-container *ngIf="displayVersion$ | async"></ng-container>
<ng-container *ngIf="displayVersion$ | async"></ng-container>
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { FlowOperationType, FlowVersion, SeekPage } from '@activepieces/shared';
import {
FlowOperationType,
FlowVersionMetadata,
SeekPage,
} from '@activepieces/shared';
import { FlowService } from '@activepieces/ui/common';
import {
BuilderSelectors,
Expand Down Expand Up @@ -32,13 +36,13 @@ import { MatDialog } from '@angular/material/dialog';
})
export class VersionHistoryComponent {
sideBarDisplayName = $localize`Versions`;
flowVersions$: Observable<SeekPage<FlowVersion>>;
flowVersions$: Observable<SeekPage<FlowVersionMetadata>>;
useAsDraft$?: Observable<void>;
rewritingDraft = false;
publishedVersion$: Observable<FlowVersion | undefined>;
publishedVersion$: Observable<FlowVersionMetadata | undefined>;
draftVersionId$: Observable<string>;
displayVersion$?: Observable<unknown>;
viewedVersion$: Observable<FlowVersion>;
viewedVersion$: Observable<FlowVersionMetadata>;
constructor(
private flowService: FlowService,
private store: Store,
Expand All @@ -58,7 +62,7 @@ export class VersionHistoryComponent {
);
}

useAsDraft(flowVersion: FlowVersion, versionNumber: number) {
useAsDraft(flowVersion: FlowVersionMetadata, versionNumber: number) {
if (this.rewritingDraft) {
return;
}
Expand Down Expand Up @@ -109,7 +113,7 @@ export class VersionHistoryComponent {
);
}

displayVersion(flowVersion: FlowVersion) {
displayVersion(flowVersion: FlowVersionMetadata) {
this.displayVersion$ = forkJoin({
flow: this.flowService.get(flowVersion.flowId, flowVersion.id),
published: this.store
Expand Down

0 comments on commit 33f29cc

Please sign in to comment.