-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Add workflow evaluation edit and list views (no-changel…
…og) (#11719)
- Loading branch information
1 parent
a535e88
commit 132aa0b
Showing
32 changed files
with
2,490 additions
and
12 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/design-system/src/components/N8nNavigationDropdown/NavigationDropdown.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import type { IRestApiContext } from '@/Interface'; | ||
import { makeRestApiRequest } from '@/utils/apiUtils'; | ||
export interface TestDefinitionRecord { | ||
id: string; | ||
name: string; | ||
workflowId: string; | ||
evaluationWorkflowId?: string | null; | ||
annotationTagId?: string | null; | ||
description?: string | null; | ||
updatedAt?: string; | ||
createdAt?: string; | ||
} | ||
interface CreateTestDefinitionParams { | ||
name: string; | ||
workflowId: string; | ||
evaluationWorkflowId?: string | null; | ||
} | ||
|
||
export interface UpdateTestDefinitionParams { | ||
name?: string; | ||
evaluationWorkflowId?: string | null; | ||
annotationTagId?: string | null; | ||
description?: string | null; | ||
} | ||
export interface UpdateTestResponse { | ||
createdAt: string; | ||
updatedAt: string; | ||
id: string; | ||
name: string; | ||
workflowId: string; | ||
description: string | null; | ||
annotationTag: string | null; | ||
evaluationWorkflowId: string | null; | ||
annotationTagId: string | null; | ||
} | ||
|
||
const endpoint = '/evaluation/test-definitions'; | ||
|
||
export async function getTestDefinitions(context: IRestApiContext) { | ||
return await makeRestApiRequest<{ count: number; testDefinitions: TestDefinitionRecord[] }>( | ||
context, | ||
'GET', | ||
endpoint, | ||
); | ||
} | ||
|
||
export async function getTestDefinition(context: IRestApiContext, id: string) { | ||
return await makeRestApiRequest<{ id: string }>(context, 'GET', `${endpoint}/${id}`); | ||
} | ||
|
||
export async function createTestDefinition( | ||
context: IRestApiContext, | ||
params: CreateTestDefinitionParams, | ||
) { | ||
return await makeRestApiRequest<TestDefinitionRecord>(context, 'POST', endpoint, params); | ||
} | ||
|
||
export async function updateTestDefinition( | ||
context: IRestApiContext, | ||
id: string, | ||
params: UpdateTestDefinitionParams, | ||
) { | ||
return await makeRestApiRequest<UpdateTestResponse>( | ||
context, | ||
'PATCH', | ||
`${endpoint}/${id}`, | ||
params, | ||
); | ||
} | ||
|
||
export async function deleteTestDefinition(context: IRestApiContext, id: string) { | ||
return await makeRestApiRequest<{ success: boolean }>(context, 'DELETE', `${endpoint}/${id}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/editor-ui/src/components/TestDefinition/EditDefinition/BlockArrow.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<div :class="$style.arrowConnector"></div> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.arrowConnector { | ||
$arrow-width: 12px; | ||
$arrow-height: 8px; | ||
$stalk-width: 2px; | ||
$color: var(--color-text-dark); | ||
position: relative; | ||
height: var(--arrow-height, 3rem); | ||
margin: 0.5rem 0; | ||
&::before, | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
} | ||
&::before { | ||
top: 0; | ||
width: $stalk-width; | ||
height: calc(100% - #{$arrow-height}); | ||
background-color: $color; | ||
} | ||
&::after { | ||
bottom: 0; | ||
width: 0; | ||
height: 0; | ||
border-left: calc($arrow-width / 2) solid transparent; | ||
border-right: calc($arrow-width / 2) solid transparent; | ||
border-top: $arrow-height solid $color; | ||
} | ||
} | ||
</style> |
40 changes: 40 additions & 0 deletions
40
packages/editor-ui/src/components/TestDefinition/EditDefinition/DescriptionInput.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script setup lang="ts"> | ||
import { useI18n } from '@/composables/useI18n'; | ||
interface Props { | ||
modelValue: string; | ||
} | ||
withDefaults(defineProps<Props>(), { | ||
modelValue: '', | ||
}); | ||
defineEmits<{ 'update:modelValue': [value: string] }>(); | ||
const locale = useI18n(); | ||
</script> | ||
|
||
<template> | ||
<div :class="[$style.description]"> | ||
<n8n-input-label | ||
:label="locale.baseText('testDefinition.edit.description')" | ||
:bold="false" | ||
size="small" | ||
:class="$style.field" | ||
> | ||
<N8nInput | ||
:model-value="modelValue" | ||
type="textarea" | ||
:placeholder="locale.baseText('testDefinition.edit.descriptionPlaceholder')" | ||
@update:model-value="$emit('update:modelValue', $event)" | ||
/> | ||
</n8n-input-label> | ||
</div> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.field { | ||
width: 100%; | ||
margin-top: var(--spacing-xs); | ||
} | ||
</style> |
100 changes: 100 additions & 0 deletions
100
packages/editor-ui/src/components/TestDefinition/EditDefinition/EvaluationHeader.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<script setup lang="ts"> | ||
import { useI18n } from '@/composables/useI18n'; | ||
export interface EvaluationHeaderProps { | ||
modelValue: { | ||
value: string; | ||
isEditing: boolean; | ||
tempValue: string; | ||
}; | ||
startEditing: (field: string) => void; | ||
saveChanges: (field: string) => void; | ||
handleKeydown: (e: KeyboardEvent, field: string) => void; | ||
} | ||
defineEmits<{ 'update:modelValue': [value: EvaluationHeaderProps['modelValue']] }>(); | ||
defineProps<EvaluationHeaderProps>(); | ||
const locale = useI18n(); | ||
</script> | ||
|
||
<template> | ||
<div :class="$style.header"> | ||
<n8n-icon-button | ||
icon="arrow-left" | ||
:class="$style.backButton" | ||
type="tertiary" | ||
:title="locale.baseText('testDefinition.edit.backButtonTitle')" | ||
@click="$router.back()" | ||
/> | ||
<h2 :class="$style.title"> | ||
<template v-if="!modelValue.isEditing"> | ||
<span :class="$style.titleText"> | ||
{{ modelValue.value }} | ||
</span> | ||
<n8n-icon-button | ||
:class="$style.editInputButton" | ||
icon="pen" | ||
type="tertiary" | ||
@click="startEditing('name')" | ||
/> | ||
</template> | ||
<N8nInput | ||
v-else | ||
ref="nameInput" | ||
data-test-id="evaluation-name-input" | ||
:model-value="modelValue.tempValue" | ||
type="text" | ||
:placeholder="locale.baseText('testDefinition.edit.namePlaceholder')" | ||
@update:model-value="$emit('update:modelValue', { ...modelValue, tempValue: $event })" | ||
@blur="() => saveChanges('name')" | ||
@keydown="(e: KeyboardEvent) => handleKeydown(e, 'name')" | ||
/> | ||
</h2> | ||
</div> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.header { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--spacing-2xs); | ||
margin-bottom: var(--spacing-l); | ||
&:hover { | ||
.editInputButton { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
.title { | ||
margin: 0; | ||
flex-grow: 1; | ||
font-size: var(--font-size-xl); | ||
font-weight: var(--font-weight-bold); | ||
color: var(--color-text-dark); | ||
display: flex; | ||
align-items: center; | ||
max-width: 100%; | ||
overflow: hidden; | ||
.titleText { | ||
display: block; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
} | ||
.editInputButton { | ||
--button-font-color: var(--prim-gray-490); | ||
opacity: 0; | ||
border: none; | ||
} | ||
.backButton { | ||
--button-font-color: var(--color-text-light); | ||
border: none; | ||
} | ||
</style> |
Oops, something went wrong.