Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): replace Button destructive boolean with tone semantic axis (#35176)

yyhebf741114dca
diff --git a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
index da1da8448b9..05048008b43 100644
--- a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
+++ b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
@@ -159,7 +159,7 @@ const AvatarWithEdit = ({ onSave, ...props }: AvatarWithEditProps) => {
{t('operation.cancel', { ns: 'common' })}
</Button>
- <Button variant="primary" destructive className="w-full" onClick={handleDeleteAvatar}>
+ <Button variant="primary" tone="destructive" className="w-full" onClick={handleDeleteAvatar}>
{t('operation.delete', { ns: 'common' })}
</Button>
</div>
diff --git a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
index 7e14d889d95..01e19e51b16 100644
--- a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
+++ b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
@@ -53,7 +53,7 @@ export default function VerifyEmail(props: DeleteAccountProps) {
}}
/>
<div className="mt-3 flex w-full flex-col gap-2">
- <Button className="w-full" disabled={shouldButtonDisabled} loading={isDeleting} variant="primary" destructive onClick={handleConfirm}>{t('account.permanentlyDeleteButton', { ns: 'common' })}</Button>
+ <Button className="w-full" disabled={shouldButtonDisabled} loading={isDeleting} variant="primary" tone="destructive" onClick={handleConfirm}>{t('account.permanentlyDeleteButton', { ns: 'common' })}</Button>
<Button className="w-full" onClick={props.onCancel}>{t('operation.cancel', { ns: 'common' })}</Button>
<Countdown onResend={sendEmail} />
</div>
diff --git a/web/app/components/app/configuration/configuration-view.tsx b/web/app/components/app/configuration/configuration-view.tsx
index aaee68cb717..049ccf41714 100644
--- a/web/app/components/app/configuration/configuration-view.tsx
+++ b/web/app/components/app/configuration/configuration-view.tsx
@@ -165,10 +165,10 @@ const ConfigurationView: FC<ConfigurationViewModel> = ({
</AlertDialogDescription>
</div>
<AlertDialogActions>
- <AlertDialogCancelButton destructive={false}>
+ <AlertDialogCancelButton tone="default">
{t('operation.cancel', { ns: 'common' })}
</AlertDialogCancelButton>
- <AlertDialogConfirmButton variant="primary" destructive={false} onClick={onConfirmUseGPT4}>
+ <AlertDialogConfirmButton variant="primary" tone="default" onClick={onConfirmUseGPT4}>
{t('operation.confirm', { ns: 'common' })}
</AlertDialogConfirmButton>
</AlertDialogActions>
diff --git a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
index 71a6757bf2c..59ba840a070 100644
--- a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
+++ b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
@@ -43,7 +43,7 @@ const DSLConfirmModal = ({
</div>
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="primary" destructive onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
</div>
</Modal>
)
diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx
index bd6c91f323c..1fd985c7f88 100644
--- a/web/app/components/app/create-from-dsl-modal/index.tsx
+++ b/web/app/components/app/create-from-dsl-modal/index.tsx
@@ -322,7 +322,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
</div>
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="primary" destructive onClick={onDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
</div>
</Modal>
</>
diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx
index 7ccbfccf308..16016b80968 100644
--- a/web/app/components/app/switch-app-modal/index.tsx
+++ b/web/app/components/app/switch-app-modal/index.tsx
@@ -152,7 +152,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo
</div>
<div className="flex items-center">
<Button className="mr-2" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button className="border-red-700" disabled={isAppsFull || !name} variant="primary" destructive onClick={goStart}>{t('switchStart', { ns: 'app' })}</Button>
+ <Button className="border-red-700" disabled={isAppsFull || !name} variant="primary" tone="destructive" onClick={goStart}>{t('switchStart', { ns: 'app' })}</Button>
</div>
</div>
</Modal>
diff --git a/web/app/components/base/confirm/index.tsx b/web/app/components/base/confirm/index.tsx
index f958d32b996..f23df5cc42a 100644
--- a/web/app/components/base/confirm/index.tsx
+++ b/web/app/components/base/confirm/index.tsx
@@ -152,7 +152,7 @@ function Confirm({
</div>
<div className="flex items-start justify-end gap-2 self-stretch p-6">
{showCancel && <Button onClick={onCancel}>{cancelTxt}</Button>}
- {showConfirm && <Button variant="primary" destructive={type !== 'info'} loading={isLoading} disabled={isConfirmDisabled} onClick={onConfirm}>{confirmTxt}</Button>}
+ {showConfirm && <Button variant="primary" tone={type !== 'info' ? 'destructive' : 'default'} loading={isLoading} disabled={isConfirmDisabled} onClick={onConfirm}>{confirmTxt}</Button>}
</div>
</div>
</div>
diff --git a/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx b/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
index 6d615554dcb..521988d3e6f 100644
--- a/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
+++ b/web/app/components/base/inline-delete-confirm/__tests__/index.spec.tsx
@@ -93,7 +93,7 @@ describe('InlineDeleteConfirm', () => {
)
const confirmButton = getByText('Yes').closest('button')
- expect(confirmButton?.className).toContain('btn-destructive')
+ expect(confirmButton?.className).toContain('btn-destructive-primary')
})
it('should render without destructive class for warning variant', () => {
@@ -108,7 +108,7 @@ describe('InlineDeleteConfirm', () => {
)
const confirmButton = getByText('Yes').closest('button')
- expect(confirmButton?.className).not.toContain('btn-destructive')
+ expect(confirmButton?.className).not.toContain('btn-destructive-primary')
})
it('should render without destructive class for info variant', () => {
@@ -123,7 +123,7 @@ describe('InlineDeleteConfirm', () => {
)
const confirmButton = getByText('Yes').closest('button')
- expect(confirmButton?.className).not.toContain('btn-destructive')
+ expect(confirmButton?.className).not.toContain('btn-destructive-primary')
})
})
diff --git a/web/app/components/base/inline-delete-confirm/index.tsx b/web/app/components/base/inline-delete-confirm/index.tsx
index b119f4bb83d..b2f1242da8a 100644
--- a/web/app/components/base/inline-delete-confirm/index.tsx
+++ b/web/app/components/base/inline-delete-confirm/index.tsx
@@ -62,7 +62,7 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
<Button
size="small"
variant="primary"
- destructive={variant === 'delete'}
+ tone={variant === 'delete' ? 'destructive' : 'default'}
onClick={onConfirm}
aria-label={confirmTxt}
className="flex-1"
diff --git a/web/app/components/base/tag-management/tag-remove-modal.tsx b/web/app/components/base/tag-management/tag-remove-modal.tsx
index 35ab6c319b7..31b6174d663 100644
--- a/web/app/components/base/tag-management/tag-remove-modal.tsx
+++ b/web/app/components/base/tag-management/tag-remove-modal.tsx
@@ -39,7 +39,7 @@ const TagRemoveModal = ({ show, tag, onConfirm, onClose }: TagRemoveModalProps)
</div>
<div className="flex items-center justify-end pt-6">
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
- <Button className="border-red-700" variant="primary" destructive onClick={onConfirm}>{t('operation.delete', { ns: 'common' })}</Button>
+ <Button className="border-red-700" variant="primary" tone="destructive" onClick={onConfirm}>{t('operation.delete', { ns: 'common' })}</Button>
</div>
</Modal>
)
diff --git a/web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx b/web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx
index adbcb621c91..3eec5f9f057 100644
--- a/web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx
+++ b/web/app/components/base/ui/alert-dialog/__tests__/index.spec.tsx
@@ -110,7 +110,7 @@ describe('AlertDialog wrapper', () => {
expect(screen.getByTestId('actions')).toHaveClass('flex', 'items-start', 'justify-end', 'gap-2', 'self-stretch', 'p-6', 'custom-actions')
const confirmButton = screen.getByRole('button', { name: 'Confirm' })
expect(confirmButton).toHaveClass('btn-primary')
- expect(confirmButton).toHaveClass('btn-destructive')
+ expect(confirmButton).toHaveClass('btn-destructive-primary')
})
it('should keep dialog open after confirm click and close via cancel helper', async () => {
diff --git a/web/app/components/base/ui/alert-dialog/index.tsx b/web/app/components/base/ui/alert-dialog/index.tsx
index 05d9ab3ad95..c8e68260c03 100644
--- a/web/app/components/base/ui/alert-dialog/index.tsx
+++ b/web/app/components/base/ui/alert-dialog/index.tsx
@@ -86,13 +86,13 @@ type AlertDialogConfirmButtonProps = ButtonProps
export function AlertDialogConfirmButton({
variant = 'primary',
- destructive = true,
+ tone = 'destructive',
...props
}: AlertDialogConfirmButtonProps) {
return (
<Button
variant={variant}
- destructive={destructive}
+ tone={tone}
{...props}
/>
)
diff --git a/web/app/components/base/ui/button/__tests__/index.spec.tsx b/web/app/components/base/ui/button/__tests__/index.spec.tsx
index fa592814842..656c344b1a6 100644
--- a/web/app/components/base/ui/button/__tests__/index.spec.tsx
+++ b/web/app/components/base/ui/button/__tests__/index.spec.tsx
@@ -51,9 +51,14 @@ describe('Button', () => {
expect(screen.getByRole('button').className).toContain(`btn-${variant}`)
})
- it('applies destructive modifier', () => {
- render(<Button destructive>Click me</Button>)
- expect(screen.getByRole('button').className).toContain('btn-destructive')
+ it('applies destructive tone with default variant', () => {
+ render(<Button tone="destructive">Click me</Button>)
+ expect(screen.getByRole('button').className).toContain('btn-destructive-secondary')
+ })
+
+ it('applies destructive tone with primary variant', () => {
+ render(<Button variant="primary" tone="destructive">Click me</Button>)
+ expect(screen.getByRole('button').className).toContain('btn-destructive-primary')
})
})
diff --git a/web/app/components/base/ui/button/index.css b/web/app/components/base/ui/button/index.css
index 30140c212d7..eee8b7944bb 100644
--- a/web/app/components/base/ui/button/index.css
+++ b/web/app/components/base/ui/button/index.css
@@ -98,53 +98,51 @@
}
}
-@utility btn-destructive {
- &.btn-primary {
- @apply bg-components-button-destructive-primary-bg
+@utility btn-destructive-primary {
+ @apply bg-components-button-destructive-primary-bg
border-components-button-destructive-primary-border
hover:bg-components-button-destructive-primary-bg-hover
hover:border-components-button-destructive-primary-border-hover
text-components-button-destructive-primary-text;
- }
- &.btn-primary:is(:disabled, [data-disabled]) {
+ &:is(:disabled, [data-disabled]) {
@apply shadow-none
bg-components-button-destructive-primary-bg-disabled
border-components-button-destructive-primary-border-disabled
text-components-button-destructive-primary-text-disabled;
}
+}
- &.btn-secondary {
- @apply bg-components-button-destructive-secondary-bg
+@utility btn-destructive-secondary {
+ @apply bg-components-button-destructive-secondary-bg
border-components-button-destructive-secondary-border
hover:bg-components-button-destructive-secondary-bg-hover
hover:border-components-button-destructive-secondary-border-hover
text-components-button-destructive-secondary-text;
- }
- &.btn-secondary:is(:disabled, [data-disabled]) {
+ &:is(:disabled, [data-disabled]) {
@apply bg-components-button-destructive-secondary-bg-disabled
border-components-button-destructive-secondary-border-disabled
text-components-button-destructive-secondary-text-disabled;
}
+}
- &.btn-tertiary {
- @apply bg-components-button-destructive-tertiary-bg
+@utility btn-destructive-tertiary {
+ @apply bg-components-button-destructive-tertiary-bg
hover:bg-components-button-destructive-tertiary-bg-hover
text-components-button-destructive-tertiary-text;
- }
- &.btn-tertiary:is(:disabled, [data-disabled]) {
+ &:is(:disabled, [data-disabled]) {
@apply bg-components-button-destructive-tertiary-bg-disabled
text-components-button-destructive-tertiary-text-disabled;
}
+}
- &.btn-ghost {
- @apply hover:bg-components-button-destructive-ghost-bg-hover
+@utility btn-destructive-ghost {
+ @apply hover:bg-components-button-destructive-ghost-bg-hover
text-components-button-destructive-ghost-text;
- }
- &.btn-ghost:is(:disabled, [data-disabled]) {
+ &:is(:disabled, [data-disabled]) {
@apply text-components-button-destructive-ghost-text-disabled;
}
}
diff --git a/web/app/components/base/ui/button/index.stories.tsx b/web/app/components/base/ui/button/index.stories.tsx
index 8921dc9b27a..9552452a228 100644
--- a/web/app/components/base/ui/button/index.stories.tsx
+++ b/web/app/components/base/ui/button/index.stories.tsx
@@ -11,7 +11,10 @@ const meta = {
tags: ['autodocs'],
argTypes: {
loading: { control: 'boolean' },
- destructive: { control: 'boolean' },
+ tone: {
+ control: 'select',
+ options: ['default', 'destructive'],
+ },
disabled: { control: 'boolean' },
variant: {
control: 'select',
@@ -92,7 +95,7 @@ export const Loading: Story = {
export const Destructive: Story = {
args: {
variant: 'primary',
- destructive: true,
+ tone: 'destructive',
children: 'Delete',
},
}
diff --git a/web/app/components/base/ui/button/index.tsx b/web/app/components/base/ui/button/index.tsx
index 22dc6ce3c86..00bbe3c8b74 100644
--- a/web/app/components/base/ui/button/index.tsx
+++ b/web/app/components/base/ui/button/index.tsx
@@ -21,13 +21,21 @@ const buttonVariants = cva(
medium: 'btn-medium',
large: 'btn-large',
},
- destructive: {
- true: 'btn-destructive',
+ tone: {
+ default: '',
+ destructive: '',
},
},
+ compoundVariants: [
+ { variant: 'primary', tone: 'destructive', class: 'btn-destructive-primary' },
+ { variant: 'secondary', tone: 'destructive', class: 'btn-destructive-secondary' },
+ { variant: 'tertiary', tone: 'destructive', class: 'btn-destructive-tertiary' },
+ { variant: 'ghost', tone: 'destructive', class: 'btn-destructive-ghost' },
+ ],
defaultVariants: {
variant: 'secondary',
size: 'medium',
+ tone: 'default',
},
},
)
@@ -43,7 +51,7 @@ export function Button({
className,
variant,
size,
- destructive,
+ tone,
loading,
disabled,
type = 'button',
@@ -53,7 +61,7 @@ export function Button({
return (
<BaseButton
type={type}
- className={cn(buttonVariants({ variant, size, destructive, className }))}
+ className={cn(buttonVariants({ variant, size, tone, className }))}
disabled={disabled || loading}
aria-busy={loading || undefined}
{...props}
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
index 71a6757bf2c..59ba840a070 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
@@ -43,7 +43,7 @@ const DSLConfirmModal = ({
</div>
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="primary" destructive onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
</div>
</Modal>
)
diff --git a/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx b/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
index 9a2798698c5..3e5f395dfe9 100644
--- a/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
@@ -130,7 +130,7 @@ const BatchAction: FC<IBatchActionProps> = ({
)}
<Button
variant="ghost"
- destructive
+ tone="destructive"
className="gap-x-0.5 px-3"
onClick={showDeleteConfirm}
>
diff --git a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
index 8aea0245def..33d9f550a85 100644
--- a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
@@ -30,7 +30,7 @@ const DefaultContent: FC<IDefaultContentProps> = React.memo(({
<Button onClick={onCancel}>
{t('operation.cancel', { ns: 'common' })}
</Button>
- <Button variant="primary" destructive onClick={onConfirm}>
+ <Button variant="primary" tone="destructive" onClick={onConfirm}>
{t('operation.regenerate', { ns: 'common' })}
</Button>
</div>
@@ -50,7 +50,7 @@ const RegeneratingContent: FC = React.memo(() => {
<p className="system-md-regular text-text-secondary">{t('segment.regeneratingMessage', { ns: 'datasetDocuments' })}</p>
</div>
<div className="flex justify-end pt-6">
- <Button variant="primary" destructive disabled className="inline-flex items-center gap-x-0.5">
+ <Button variant="primary" tone="destructive" disabled className="inline-flex items-center gap-x-0.5">
<RiLoader2Line className="h-4 w-4 animate-spin text-components-button-destructive-primary-text-disabled" />
<span>{t('operation.regenerate', { ns: 'common' })}</span>
</Button>
diff --git a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
index 4500509d00d..8554db341f4 100644
--- a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
@@ -173,7 +173,7 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {
<MemberSelector exclude={[userProfile.id]} value={newOwner} onSelect={setNewOwner} />
</div>
<div className="mt-4 space-y-2">
- <Button data-testid="transfer-modal-submit" disabled={!newOwner || isTransfer} className="w-full!" variant="primary" destructive onClick={handleTransfer}>
+ <Button data-testid="transfer-modal-submit" disabled={!newOwner || isTransfer} className="w-full!" variant="primary" tone="destructive" onClick={handleTransfer}>
{t('members.transferModal.transfer', { ns: 'common' })}
</Button>
<Button data-testid="transfer-modal-cancel" className="w-full!" onClick={onClose}>
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
index 6a251ee302c..995da8bb98b 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
@@ -387,7 +387,7 @@ const ModelModal: FC<ModelModalProps> = ({
isEditMode && (
<Button
variant="primary"
- destructive
+ tone="destructive"
onClick={() => openConfirmDelete(credential, model)}
>
{t('operation.remove', { ns: 'common' })}
diff --git a/web/app/components/plugins/update-plugin/downgrade-warning.tsx b/web/app/components/plugins/update-plugin/downgrade-warning.tsx
index 1f17dcd85f6..da53ebfb12b 100644
--- a/web/app/components/plugins/update-plugin/downgrade-warning.tsx
+++ b/web/app/components/plugins/update-plugin/downgrade-warning.tsx
@@ -25,7 +25,7 @@ const DowngradeWarningModal = ({
</div>
<div className="mt-9 flex items-start justify-end space-x-2 self-stretch">
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="secondary" destructive onClick={onJustDowngrade}>{t(`${i18nPrefix}.downgrade`, { ns: 'plugin' })}</Button>
+ <Button variant="secondary" tone="destructive" onClick={onJustDowngrade}>{t(`${i18nPrefix}.downgrade`, { ns: 'plugin' })}</Button>
<Button variant="primary" onClick={onExcludeAndDowngrade}>{t(`${i18nPrefix}.exclude`, { ns: 'plugin' })}</Button>
</div>
</>
diff --git a/web/app/components/rag-pipeline/components/__tests__/version-mismatch-modal.spec.tsx b/web/app/components/rag-pipeline/components/__tests__/version-mismatch-modal.spec.tsx
index 9ff1de49adb..038362c7ce6 100644
--- a/web/app/components/rag-pipeline/components/__tests__/version-mismatch-modal.spec.tsx
+++ b/web/app/components/rag-pipeline/components/__tests__/version-mismatch-modal.spec.tsx
@@ -101,7 +101,7 @@ describe('VersionMismatchModal', () => {
const confirmBtn = screen.getByRole('button', { name: /app\.newApp\.Confirm/ })
expect(confirmBtn).toHaveClass('btn-primary')
- expect(confirmBtn).toHaveClass('btn-destructive')
+ expect(confirmBtn).toHaveClass('btn-destructive-primary')
})
})
diff --git a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
index a420f02b9ea..cc5d8cd7ddc 100644
--- a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
+++ b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
@@ -91,7 +91,7 @@ const UpdateDSLModal = ({
<Button
disabled={!currentFile || loading}
variant="primary"
- destructive
+ tone="destructive"
onClick={handleImport}
loading={loading}
>
diff --git a/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx b/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
index bf69e114357..5277a11ca7f 100644
--- a/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
+++ b/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
@@ -45,7 +45,7 @@ const VersionMismatchModal = ({
</div>
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
<Button variant="secondary" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="primary" destructive onClick={onConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
</div>
</Modal>
)
diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx
index 506eab1c8f1..6a15010189d 100644
--- a/web/app/components/tools/edit-custom-collection-modal/index.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx
@@ -344,7 +344,7 @@ const EditCustomCollectionModal: FC<Props> = ({
<div className={cn(isEdit ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
{
isEdit && (
- <Button variant="primary" destructive onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
)
}
<div className="flex space-x-2">
diff --git a/web/app/components/tools/workflow-tool/confirm-modal/__tests__/index.spec.tsx b/web/app/components/tools/workflow-tool/confirm-modal/__tests__/index.spec.tsx
index e076ae67e28..2cbe98c7ab0 100644
--- a/web/app/components/tools/workflow-tool/confirm-modal/__tests__/index.spec.tsx
+++ b/web/app/components/tools/workflow-tool/confirm-modal/__tests__/index.spec.tsx
@@ -165,7 +165,7 @@ describe('ConfirmModal', () => {
// Assert
const confirmButton = screen.getByText('common.operation.confirm')
expect(confirmButton).toHaveClass('btn-primary')
- expect(confirmButton).toHaveClass('btn-destructive')
+ expect(confirmButton).toHaveClass('btn-destructive-primary')
})
})
diff --git a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
index 1533b22f8ee..ff78cc017d7 100644
--- a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
+++ b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
@@ -36,7 +36,7 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
<div className="flex items-center justify-end pt-6">
<div className="flex items-center">
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
- <Button variant="primary" destructive onClick={onConfirm}>{t('operation.confirm', { ns: 'common' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onConfirm}>{t('operation.confirm', { ns: 'common' })}</Button>
</div>
</div>
</Modal>
diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsx
index d93a378ec23..aa99d2aa27d 100644
--- a/web/app/components/tools/workflow-tool/index.tsx
+++ b/web/app/components/tools/workflow-tool/index.tsx
@@ -318,7 +318,7 @@ const WorkflowToolAsModal: FC<Props> = ({
</div>
<div className={cn((!isAdd && onRemove) ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
{!isAdd && onRemove && (
- <Button variant="primary" destructive onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
)}
<div className="flex space-x-2">
<Button onClick={onHide}>{t('operation.cancel', { ns: 'common' })}</Button>
diff --git a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
index daf485c5a5b..4779be89847 100644
--- a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
@@ -34,7 +34,7 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
<Button onClick={onClose}>
{t('operation.cancel', { ns: 'common' })}
</Button>
- <Button variant="primary" destructive onClick={onDelete.bind(null, versionInfo.id)}>
+ <Button variant="primary" tone="destructive" onClick={onDelete.bind(null, versionInfo.id)}>
{t('operation.delete', { ns: 'common' })}
</Button>
</div>
diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx
index 38607b97d51..98176033c9d 100644
--- a/web/app/components/workflow/update-dsl-modal.tsx
+++ b/web/app/components/workflow/update-dsl-modal.tsx
@@ -247,7 +247,7 @@ const UpdateDSLModal = ({
<Button
disabled={!currentFile || loading}
variant="primary"
- destructive
+ tone="destructive"
onClick={handleImport}
loading={loading}
>
@@ -278,7 +278,7 @@ const UpdateDSLModal = ({
</div>
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
- <Button variant="primary" destructive onClick={onUpdateDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
+ <Button variant="primary" tone="destructive" onClick={onUpdateDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
</div>
</Modal>
</>