Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: Adding Flow Name to Editor Files #3246

Merged
merged 36 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f5e0849
add name to store functions
May 28, 2024
54cb3b2
revert changes to store
May 28, 2024
7458e9b
alter get flow and create flow on team page
May 29, 2024
19649de
add name to renaming mutation
May 29, 2024
aaa05d1
refactor code to switch slug to name in data retrieval
May 30, 2024
f4e8a05
alter rename logic to check for name instead of slug to capture capit…
May 31, 2024
03a508d
alter state updates
RODO94 May 31, 2024
d3dc865
add setFlow to team view and remove reference to setFlowName from pre…
RODO94 Jun 4, 2024
2ddec96
remove setFlowName and a console.log
RODO94 Jun 4, 2024
fb2ff5e
console log removal
RODO94 Jun 4, 2024
da2966c
removing console logs
RODO94 Jun 5, 2024
40035cd
rever team changes to individually update global store
RODO94 Jun 10, 2024
d093df0
attempt: add flowName to flow context in e2e testing
RODO94 Jun 10, 2024
d0aec62
add planx-core latest commit hash
RODO94 Jun 10, 2024
32a3998
update create flow functions to include test flowName
RODO94 Jun 10, 2024
9610c82
Merge branch 'main' into rory/add-name-editor-2
RODO94 Jun 10, 2024
a986712
install new dependencies from planx-core changes
RODO94 Jun 10, 2024
e3cc2ff
fix: add name variable for create flow calls
RODO94 Jun 10, 2024
79162a3
format change
RODO94 Jun 11, 2024
ca7b46f
prettier changes for e2e testing
RODO94 Jun 11, 2024
4a96a7b
extra prettier commit for missed files
RODO94 Jun 11, 2024
f233dd0
remove redundant name change
RODO94 Jun 11, 2024
20a0cc1
run prettier on context changes
RODO94 Jun 11, 2024
468e520
Merge branch 'main' into rory/add-name-editor-2
RODO94 Jun 11, 2024
fd91661
fix: make flow name required and update all contexts for passing e2e …
jessicamcinchak Jun 11, 2024
57f8a81
add name to copy flow
RODO94 Jun 12, 2024
866509e
ternary for using slug if name doesn't exist
RODO94 Jun 12, 2024
9a384c0
Merge branch 'main' into rory/add-name-editor-2
RODO94 Jun 12, 2024
d60a4a8
run prettier on file changes
RODO94 Jun 12, 2024
3ba46d4
ran prettier on changes
RODO94 Jun 12, 2024
2f20913
replacing name with slug if name is null
RODO94 Jun 12, 2024
93bb0d1
replacing name with slug if name is null
RODO94 Jun 12, 2024
2a8f40b
replacing name with slug if name is null
RODO94 Jun 12, 2024
6fc8842
replacing name with slug if name is null
RODO94 Jun 12, 2024
7d828e9
replacing name with slug if name is null
RODO94 Jun 12, 2024
cbed3a0
revert changes to switch out flow name for slug when name is null
RODO94 Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api.planx.uk/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { $public, getClient } from "./client";

export interface FlowData {
slug: string;
name: string;
data: Flow["data"];
team_id: number;
team: { slug: string };
Expand All @@ -28,6 +29,7 @@ const getFlowData = async (id: string): Promise<FlowData> => {
flow: flows_by_pk(id: $id) {
slug
data
name
team_id
team {
slug
Expand Down Expand Up @@ -62,6 +64,7 @@ interface InsertFlow {
const insertFlow = async (
teamId: number,
slug: string,
name: string,
flowData: Flow["data"],
creatorId?: number,
copiedFrom?: Flow["id"],
Expand All @@ -75,6 +78,7 @@ const insertFlow = async (
mutation InsertFlow(
$team_id: Int!
$slug: String!
$name: String!
$data: jsonb = {}
$creator_id: Int
$copied_from: uuid
Expand All @@ -83,6 +87,7 @@ const insertFlow = async (
object: {
team_id: $team_id
slug: $slug
name: $name
data: $data
version: 1
creator_id: $creator_id
Expand All @@ -96,6 +101,7 @@ const insertFlow = async (
{
team_id: teamId,
slug: slug,
name: name,
data: flowData,
creator_id: creatorId,
copied_from: copiedFrom,
Expand Down
2 changes: 2 additions & 0 deletions api.planx.uk/modules/flows/copyFlow/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ const copyFlow = async (
// Check if copied flow data should be inserted into `flows` table, or just returned for reference
if (insert) {
const newSlug = flow.slug + "-copy";
const newName = flow.name + " (copy)";
const creatorId = userContext.getStore()?.user?.sub;
if (!creatorId) throw Error("User details missing from request");

// Insert the flow and an associated operation
await insertFlow(
flow.team_id,
newSlug,
newName,
uniqueFlowData,
parseInt(creatorId),
flowId,
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
40 changes: 18 additions & 22 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
40 changes: 18 additions & 22 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion e2e/tests/api-driven/src/flowStatusHistory/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ Before<CustomWorld>("@flow-status-history", async function () {
});

Given<CustomWorld>("a flow exists", async function () {
const flowId = await createFlow({ teamId: this.teamId, slug: "test-flow" });
const flowId = await createFlow({
teamId: this.teamId,
slug: "test-flow",
name: "Test Flow",
});

assert.ok(flowId, "flowId is not defined");

Expand Down
1 change: 1 addition & 0 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export async function buildITPFlow({
const flowId: string = await $admin.flow.create({
teamId,
slug: `test-invite-to-pay-flow-with-send-to-${destination.toLowerCase()}`,
name: `Test invite to pay flow with send to ${destination}`,
status: "online",
data: flowGraph,
});
Expand Down
2 changes: 2 additions & 0 deletions e2e/tests/api-driven/src/permissions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const setup = async () => {
const team1FlowId = await createFlow({
teamId: teamId1,
slug: "team-1-flow",
name: "Team 1 Flow",
});

const user2Id = await createUser({
Expand All @@ -44,6 +45,7 @@ export const setup = async () => {
const team2FlowId = await createFlow({
teamId: teamId2,
slug: "team-2-flow",
name: "Team 2 Flow",
});

const world = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/src/permissions/queries/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const UPDATE_FLOW_QUERY = gql`
mutation UpdateFlowE2E($team1FlowId: uuid!) {
result: update_flows_by_pk(
pk_columns: { id: $team1FlowId }
_set: { slug: "new-slug" }
_set: { slug: "new-slug", name: "new Name" }
) {
id
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
Loading
Loading