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

feat(web): templates store use feature flag #3515

Merged
merged 16 commits into from
May 29, 2023

Conversation

LetItRock
Copy link
Contributor

What change does this PR introduce?

Templates Store uses the feature flag.

Why was this change needed?

Templates Store PRD.

Other information (Screenshots)

Screen.Recording.2023-05-26.at.13.52.21.mov

@LetItRock LetItRock self-assigned this May 26, 2023
@linear
Copy link

linear bot commented May 26, 2023

@@ -66,8 +66,7 @@ export const POPULAR_TEMPLATES_GROUPED = {
{
_id: '1',
name: ':fa-regular fa-message: Comments',
description:
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate quas totam quod beatae. Ipsam quasi fugiat commodi adipisci eligendi necessitatibus cumque aliquam, dicta natus cupiditate suscipit voluptatum rerum debitis. Ipsum!',
description: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate quas totam quod beatae.',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the description should be less or equal 100 characters

Comment on lines 78 to 87
active: true,
draft: false,
critical: false,
preferenceSettings: {
chat: true,
email: true,
in_app: true,
push: true,
sms: true,
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing fields

Comment on lines 61 to 69
return (
storedBlueprint
? storedBlueprint
: {
...localBlueprint,
_notificationGroupId: firstBlueprint._notificationGroupId,
notificationGroup: firstBlueprint.notificationGroup,
}
) as INotificationTemplate;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, the popular blueprints are hardcoded constants that don't have the notification group and this raises an API error when creating the workflow from it on the FE...

I'm not sure what is the best way to bypass this, but here I'm assigning the first blueprint notification group...

@djabarovgeorge cc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to our decision last week (don't use hardcoded data directly on the client) the only thing that we will need is the ID, so we won't have this issue.

@@ -0,0 +1,76 @@
import styled from '@emotion/styled';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted the old view shown when there is no workflows, where we have two tiles: "Create Workflow" and "Try the Digest playground"

Comment on lines 179 to 208
{isTemplateStoreEnabled ? (
<>
<When truthy={hasTemplates}>
<Table
onRowClick={onRowClick}
loading={isLoading || areNotificationGroupLoading}
data-test-id="notifications-template"
columns={columns}
data={templates}
pagination={{
pageSize: pageSize,
current: page,
total: totalTemplatesCount,
onPageChange: handleTableChange,
}}
/>
</When>
<When truthy={!hasTemplates}>
<TemplatesListNoData
readonly={readonly}
blueprints={popular?.blueprints}
isLoading={areBlueprintsLoading}
isCreating={isCreatingTemplateFromBlueprint}
allTemplatesDisabled={areBlueprintsLoading || !hasGroups}
onBlankWorkflowClick={() => handleRedirectToCreateTemplate(false)}
onTemplateClick={handleOnBlueprintClick}
onAllTemplatesClick={openModal}
/>
</When>
</>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when templates store feature flag enabled

Comment on lines 222 to 228
noDataPlaceholder={
<TemplatesListNoDataOld
onCreateClick={() => handleRedirectToCreateTemplate(false)}
onTryDigestClick={handleCreateDigestDemoWorkflow}
tryDigestDisabled={isTryDigestDisabled}
/>
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the templates store feature flag is disabled

@p-fernandez p-fernandez force-pushed the nv-2242-hide-template-store-behind-a-feature-flag branch from a2b5dd1 to 0336544 Compare May 26, 2023 12:28
@p-fernandez p-fernandez force-pushed the nv-2242-hide-template-store-behind-a-feature-flag branch from 0336544 to ee2ee4f Compare May 26, 2023 12:57
@p-fernandez p-fernandez force-pushed the nv-2242-hide-template-store-behind-a-feature-flag branch 2 times, most recently from 9f469d2 to 2b7b782 Compare May 26, 2023 14:01
Base automatically changed from nv-2242-hide-template-store-behind-a-feature-flag to next May 26, 2023 15:50

const STEPS = [
const STEPS: INotificationTemplateStep[] = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that after clicking on "Use template" button the Workflow Editor shows some errors on the steps, so I've fixed them here

Comment on lines +106 to +118
{popular.map((group) => (
<TemplatesGroup key={group.name}>
<GroupName>{group.name}</GroupName>
{group.blueprints.map((template) => {
return (
<TemplateItem key={template.name} onClick={() => handleTemplateClick(template)}>
<FontAwesomeIcon icon={template.iconName} />
<span>{template.name}</span>
</TemplateItem>
);
})}
</TemplatesGroup>
))}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to show the popular blueprints the the Templates Store modal, they will be rendered at the top

Copy link
Contributor

@p-fernandez p-fernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smooth 🍹
🌟

Comment on lines +17 to +21
const isTemplateStoreEnabled = useIsTemplateStoreEnabled();
const hasGroups = general && general.length > 0;
const hasPopular = !!(popular && popular?.blueprints.length > 0);
const hasGroupsOrPopular = hasGroups || hasPopular;
const isOpened = opened && hasGroupsOrPopular && isTemplateStoreEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all this information could be living in its own hook for tidiness, though I acknowledge the reusability might be non existent.

…re-use-feature-flag

# Conflicts:
#	apps/api/src/app/blueprint/usecases/get-grouped-blueprints/consts.ts
#	apps/api/src/app/blueprint/usecases/get-grouped-blueprints/get-grouped-blueprints.usecase.ts
#	apps/web/src/pages/templates/components/templates-store/TemplatesStoreModal.tsx
Copy link
Contributor

@djabarovgeorge djabarovgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@LetItRock LetItRock added this pull request to the merge queue May 29, 2023
Merged via the queue into next with commit 31aa2d9 May 29, 2023
32 checks passed
@LetItRock LetItRock deleted the nv-2385-templates-store-use-feature-flag branch May 29, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants