feat(editor): Change WorkflowCard archived styles (no-changelog) (#15214)

This commit is contained in:
Jaakko Husso
2025-05-08 17:20:30 +03:00
committed by GitHub
parent cfea538f1c
commit b6055c5fe9
2 changed files with 51 additions and 16 deletions

View File

@@ -314,17 +314,20 @@ describe('WorkflowCard', () => {
expect(heading).toHaveTextContent('Read only'); expect(heading).toHaveTextContent('Read only');
}); });
it('should show Archived badge on archived workflows', async () => { it('should show Archived text on archived workflows', async () => {
const data = createWorkflow({ isArchived: true }); const data = createWorkflow({ isArchived: true });
const { getByTestId } = renderComponent({ props: { data } }); const { getByTestId, queryByTestId } = renderComponent({ props: { data } });
expect(getByTestId('workflow-archived-tag')).toBeInTheDocument(); expect(getByTestId('workflow-card-archived')).toBeInTheDocument();
expect(getByTestId('workflow-card-archived')).toHaveTextContent('Archived');
expect(queryByTestId('workflow-card-activator')).not.toBeInTheDocument();
}); });
it('should not show Archived badge on non archived workflows', async () => { it('should not show Archived text on non archived workflows', async () => {
const data = createWorkflow({ isArchived: false }); const data = createWorkflow({ isArchived: false });
const { queryByTestId } = renderComponent({ props: { data } }); const { queryByTestId } = renderComponent({ props: { data } });
expect(queryByTestId('workflow-archived-tag')).not.toBeInTheDocument(); expect(queryByTestId('workflow-card-archived')).not.toBeInTheDocument();
expect(queryByTestId('workflow-card-activator')).toBeInTheDocument();
}); });
}); });

View File

@@ -401,22 +401,28 @@ const onBreadcrumbItemClick = async (item: PathItem) => {
</script> </script>
<template> <template>
<n8n-card :class="$style.cardLink" data-test-id="workflow-card" @click="onClick"> <n8n-card
:class="{
[$style.cardLink]: true,
[$style.cardArchived]: data.isArchived,
}"
data-test-id="workflow-card"
@click="onClick"
>
<template #header> <template #header>
<n8n-text tag="h2" bold :class="$style.cardHeading" data-test-id="workflow-card-name"> <n8n-text
tag="h2"
bold
:class="{
[$style.cardHeading]: true,
[$style.cardHeadingArchived]: data.isArchived,
}"
data-test-id="workflow-card-name"
>
{{ data.name }} {{ data.name }}
<N8nBadge v-if="!workflowPermissions.update" class="ml-3xs" theme="tertiary" bold> <N8nBadge v-if="!workflowPermissions.update" class="ml-3xs" theme="tertiary" bold>
{{ locale.baseText('workflows.item.readonly') }} {{ locale.baseText('workflows.item.readonly') }}
</N8nBadge> </N8nBadge>
<N8nBadge
v-if="data.isArchived"
class="ml-3xs"
theme="tertiary"
bold
data-test-id="workflow-archived-tag"
>
{{ locale.baseText('workflows.item.archived') }}
</N8nBadge>
</n8n-text> </n8n-text>
</template> </template>
<div :class="$style.cardDescription"> <div :class="$style.cardDescription">
@@ -472,7 +478,19 @@ const onBreadcrumbItemClick = async (item: PathItem) => {
</n8n-breadcrumbs> </n8n-breadcrumbs>
</div> </div>
</ProjectCardBadge> </ProjectCardBadge>
<n8n-text
v-if="data.isArchived"
color="text-light"
size="small"
bold
class="ml-s mr-s"
data-test-id="workflow-card-archived"
>
{{ locale.baseText('workflows.item.archived') }}
</n8n-text>
<WorkflowActivator <WorkflowActivator
v-else
class="mr-s" class="mr-s"
:is-archived="data.isArchived" :is-archived="data.isArchived"
:workflow-active="data.active" :workflow-active="data.active"
@@ -515,6 +533,10 @@ const onBreadcrumbItemClick = async (item: PathItem) => {
} }
} }
.cardHeadingArchived {
color: var(--color-text-light);
}
.cardDescription { .cardDescription {
min-height: 19px; min-height: 19px;
display: flex; display: flex;
@@ -532,6 +554,10 @@ const onBreadcrumbItemClick = async (item: PathItem) => {
cursor: default; cursor: default;
} }
.cardBadge {
background-color: var(--color-background-xlight);
}
.cardBadge.with-breadcrumbs { .cardBadge.with-breadcrumbs {
:global(.n8n-badge) { :global(.n8n-badge) {
padding-right: 0; padding-right: 0;
@@ -541,6 +567,12 @@ const onBreadcrumbItemClick = async (item: PathItem) => {
} }
} }
.cardArchived {
background-color: var(--color-background-light);
border-color: var(--color-foreground-light);
color: var(--color-text-base);
}
@include mixins.breakpoint('sm-and-down') { @include mixins.breakpoint('sm-and-down') {
.cardLink { .cardLink {
--card--padding: 0 var(--spacing-s) var(--spacing-s); --card--padding: 0 var(--spacing-s) var(--spacing-s);