From 974254f984d68fb82cc6252599c269ed996188ca Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 09:34:11 +0500 Subject: [PATCH 1/8] on load of modal pull data object for workflow on load of feature --- .../widgetViews/GenerateStoriesView.tsx | 75 +++++++++++++++---- src/people/widgetViews/workspace/style.ts | 2 +- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index 1c644c57..db770525 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -1,6 +1,7 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { EuiOverlayMask } from '@elastic/eui'; +import { useStores } from '../../store'; import { GenerateStoriesModal, GenerateStoriesHeader, @@ -13,26 +14,72 @@ import { const GenerateStoriesView: React.FC = () => { const history = useHistory(); + const { main } = useStores(); const { feature_uuid } = useParams<{ feature_uuid: string }>(); + const [featureName, setFeatureName] = useState(''); + const [featureBrief, setFeatureBrief] = useState(''); + const [mission, setMission] = useState(''); + const [tactics, setTactics] = useState(''); + + useEffect(() => { + const fetchData = async () => { + try { + if (!feature_uuid) return; + + const featureData = await main.getFeaturesByUuid(feature_uuid); + + setFeatureName(featureData?.name); + setFeatureBrief(featureData?.brief); + + if (featureData?.workspace_uuid) { + const workspaceData = await main.getUserWorkspaceByUuid(featureData.workspace_uuid); + + setMission(workspaceData?.mission); + setTactics(workspaceData?.tactics); + } + } catch (error) { + console.error('Error fetching data:', error); + } + }; + + fetchData(); + }, [feature_uuid, main]); const handleClose = () => { history.push(`/feature/${feature_uuid}`); }; + const postData = { + postData: { + productBrief: `Product: ${featureName}. \nProduct Brief: \n* Mission: ${mission}. \n* Objectives: ${tactics}`, + featureName: featureName ?? '', + description: featureBrief ?? '', + examples: [], + webhook_url: 'https://webhook.site/8adf917d-d292-47ce-88e8-3994f63bfcce', + featureUUID: feature_uuid + } + }; + return ( - - - - User Story Automation - - - Story Generation Coming Soon! - - - Cancel - - - + + + + User Story Automation + + + + {postData ? ( +
{JSON.stringify(postData, null, 2)}
+ ) : ( + 'Story Generation Coming Soon!' + )} +
+
+ + Cancel + +
+
); }; diff --git a/src/people/widgetViews/workspace/style.ts b/src/people/widgetViews/workspace/style.ts index f70ed10d..6a9575aa 100644 --- a/src/people/widgetViews/workspace/style.ts +++ b/src/people/widgetViews/workspace/style.ts @@ -1402,7 +1402,7 @@ export const GenerateStoriesText = styled.p` font-size: 18px; color: #5f6368; margin: 0; - text-align: center; + width: 500px; `; export const GenerateStoriesFooter = styled.div` From b860bb370dcfde8939e09061a13630b04c72ca65 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 09:56:41 +0500 Subject: [PATCH 2/8] on load of modal pull data object for workflow on load of feature story --- .../widgetViews/GenerateStoriesView.tsx | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index db770525..8fa70d81 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -61,25 +61,25 @@ const GenerateStoriesView: React.FC = () => { }; return ( - - - - User Story Automation - - - - {postData ? ( -
{JSON.stringify(postData, null, 2)}
- ) : ( - 'Story Generation Coming Soon!' - )} -
-
- - Cancel - -
-
+ + + + User Story Automation + + + + {postData ? ( +
{JSON.stringify(postData, null, 2)}
+ ) : ( + 'Story Generation Coming Soon!' + )} +
+
+ + Cancel + +
+
); }; From 8c0948c257e9b643b53726be4937ae42b99f5831 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 12:59:26 +0500 Subject: [PATCH 3/8] update webhook url --- src/people/widgetViews/GenerateStoriesView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index 8fa70d81..38d16290 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { EuiOverlayMask } from '@elastic/eui'; import { useStores } from '../../store'; +import { getHost } from '../../config'; import { GenerateStoriesModal, GenerateStoriesHeader, @@ -49,13 +50,15 @@ const GenerateStoriesView: React.FC = () => { history.push(`/feature/${feature_uuid}`); }; + const host = getHost(); + const postData = { postData: { productBrief: `Product: ${featureName}. \nProduct Brief: \n* Mission: ${mission}. \n* Objectives: ${tactics}`, featureName: featureName ?? '', description: featureBrief ?? '', examples: [], - webhook_url: 'https://webhook.site/8adf917d-d292-47ce-88e8-3994f63bfcce', + webhook_url: `${host}/features/stories`, featureUUID: feature_uuid } }; From d83c7bf17db6e1bfeaa3f432eaa69e1d1f9df0c6 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 13:06:16 +0500 Subject: [PATCH 4/8] test failing issue on github --- src/people/widgetViews/workspace/style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/widgetViews/workspace/style.ts b/src/people/widgetViews/workspace/style.ts index 6a9575aa..850eb9ed 100644 --- a/src/people/widgetViews/workspace/style.ts +++ b/src/people/widgetViews/workspace/style.ts @@ -1402,7 +1402,7 @@ export const GenerateStoriesText = styled.p` font-size: 18px; color: #5f6368; margin: 0; - width: 500px; + width: 501px; `; export const GenerateStoriesFooter = styled.div` From a4ad925e47a5e144706a70fa3289cf63e1fea3a0 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 13:11:44 +0500 Subject: [PATCH 5/8] resolved --- src/people/widgetViews/workspace/style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/widgetViews/workspace/style.ts b/src/people/widgetViews/workspace/style.ts index 850eb9ed..6a9575aa 100644 --- a/src/people/widgetViews/workspace/style.ts +++ b/src/people/widgetViews/workspace/style.ts @@ -1402,7 +1402,7 @@ export const GenerateStoriesText = styled.p` font-size: 18px; color: #5f6368; margin: 0; - width: 501px; + width: 500px; `; export const GenerateStoriesFooter = styled.div` From 0665a281c2abcf66f93f1a5c9eabbb551342524e Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 16:43:27 +0500 Subject: [PATCH 6/8] update post data --- src/people/widgetViews/GenerateStoriesView.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index 38d16290..280d9bd7 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -53,14 +53,12 @@ const GenerateStoriesView: React.FC = () => { const host = getHost(); const postData = { - postData: { - productBrief: `Product: ${featureName}. \nProduct Brief: \n* Mission: ${mission}. \n* Objectives: ${tactics}`, - featureName: featureName ?? '', - description: featureBrief ?? '', - examples: [], - webhook_url: `${host}/features/stories`, - featureUUID: feature_uuid - } + productBrief: `Product: ${featureName}. \nProduct Brief: \n* Mission: ${mission} \n* Objectives: \n${tactics}`, + featureName: featureName ?? '', + description: featureBrief ?? '', + examples: [], + webhook_url: `${host}/features/stories`, + featureUUID: feature_uuid ?? '' }; return ( From 7f067c7503ea802159604504d9c4856524a61b6a Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 16:46:18 +0500 Subject: [PATCH 7/8] update post data --- src/people/widgetViews/GenerateStoriesView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index 280d9bd7..c29150a7 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -65,7 +65,7 @@ const GenerateStoriesView: React.FC = () => { - User Story Automation + User Story Automations From 869c5b1cc1552e0b822c1c4a826e7b763fb72690 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 7 Nov 2024 16:48:28 +0500 Subject: [PATCH 8/8] updated post formate --- src/people/widgetViews/GenerateStoriesView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/widgetViews/GenerateStoriesView.tsx b/src/people/widgetViews/GenerateStoriesView.tsx index c29150a7..280d9bd7 100644 --- a/src/people/widgetViews/GenerateStoriesView.tsx +++ b/src/people/widgetViews/GenerateStoriesView.tsx @@ -65,7 +65,7 @@ const GenerateStoriesView: React.FC = () => { - User Story Automations + User Story Automation