Skip to content

Commit

Permalink
feat: event tag
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Dec 24, 2023
1 parent 3fda218 commit c39bb60
Showing 1 changed file with 42 additions and 36 deletions.
78 changes: 42 additions & 36 deletions src/views/extra-features/webhook/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
NPopconfirm,
NSpace,
NSwitch,
NTag,
NThing,
useDialog,
} from 'naive-ui'
Expand Down Expand Up @@ -83,14 +84,17 @@ export default defineComponent({
{{
default() {
return (
<NThing
title={item.payloadUrl}
description={
item.events.slice(0, 3).join(', ') +
(item.events.length > 3 ? '...' : '')
}
>
<NThing title={item.payloadUrl}>
{{
description() {
return item.events.map((event) => {
return (
<NTag size="small" type="success" round>
{event}
</NTag>
)
})
},
avatar() {
return (
<div
Expand All @@ -109,36 +113,38 @@ export default defineComponent({
},
suffix() {
return (
<NButtonGroup>
<NButton
round
onClick={() => {
presetEditableModal(item)
}}
>
编辑
</NButton>
<NPopconfirm
positiveText={'取消'}
negativeText="删除"
onNegativeClick={async () => {
await RESTManager.api.webhooks(item.id).delete()
mutate()
}}
>
{{
trigger: () => (
<NButton round type="error" ghost>
移除
</NButton>
),
<div onClick={(e) => e.stopPropagation()}>
<NButtonGroup>
<NButton
round
onClick={() => {
presetEditableModal(item)
}}
>
编辑
</NButton>
<NPopconfirm
positiveText={'取消'}
negativeText="删除"
onNegativeClick={async () => {
await RESTManager.api.webhooks(item.id).delete()
mutate()
}}
>
{{
trigger: () => (
<NButton round type="error" ghost>
移除
</NButton>
),

default: () => (
<span class="max-w-48">确定要删除 ?</span>
),
}}
</NPopconfirm>
</NButtonGroup>
default: () => (
<span class="max-w-48">确定要删除 ?</span>
),
}}
</NPopconfirm>
</NButtonGroup>
</div>
)
},
}}
Expand Down

0 comments on commit c39bb60

Please sign in to comment.