Skip to content

Commit

Permalink
feat(next/web): display trigger create/update time
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Nov 1, 2023
1 parent 9a8f99c commit 8da6071
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions next/api/src/response/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class TriggerResponse {
actions: this.trigger.actions,
position: this.trigger.getPosition(),
active: this.trigger.active,
createdAt: this.trigger.createdAt.toISOString(),
updatedAt: this.trigger.updatedAt.toISOString(),
};
}
}
21 changes: 16 additions & 5 deletions next/web/src/App/Admin/Settings/Automations/Triggers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'react-icons/bi';
import { FiMoreVertical } from 'react-icons/fi';
import { produce } from 'immer';
import moment from 'moment';

import {
Button,
Expand Down Expand Up @@ -64,12 +65,22 @@ function TriggerItem({ trigger, number, onDelete }: TriggerItemProps) {
return (
<div className={`${style.triggerItem} rounded mb-5`}>
<div className="flex pr-5 py-[18px] h-20">
<div className="relative grow overflow-hidden">
<div className="absolute w-9 text-right font-medium">{number}.</div>
<div className="pl-10 font-medium">
<Link to={trigger.id}>{trigger.title}</Link>
<div className="w-9 text-right font-medium mr-1 shrink-0">{number}.</div>
<div className="grow overflow-hidden grid grid-cols-3">
<div className="col-span-2">
<Link className="block font-medium truncate" to={trigger.id}>
{trigger.title}
</Link>
<div className="mt-1 text-sm text-[#475867] truncate">{trigger.description}</div>
</div>
<div className="text-sm text-[#475867] p-1">
<div className="truncate">
创建时间: {moment(trigger.createdAt).format('YYYY-MM-DD HH:mm:ss')}
</div>
<div className="mt-1 truncate">
更新时间: {moment(trigger.updatedAt).format('YYYY-MM-DD HH:mm:ss')}
</div>
</div>
<div className="mt-1 pl-10 text-sm text-[#475867]">{trigger.description}</div>
</div>
<div className="flex shrink-0 items-center">
<Switch
Expand Down
2 changes: 2 additions & 0 deletions next/web/src/api/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface TriggerData {
actions: any[];
position: number;
active: boolean;
createdAt: string;
updatedAt: string;
}

export async function fetchTriggers() {
Expand Down

0 comments on commit 8da6071

Please sign in to comment.