Skip to content

Commit 8bf7410

Browse files
(v2.10) timeline has icons and fix empty cache issue
1 parent 785d754 commit 8bf7410

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

ui/src/components/ApiAction.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,8 @@ export default function ApiAction(props: Props) {
195195
}
196196

197197
if (method == 'GET' || method == 'HEAD' || method == 'DELETE') {
198-
if (cached) {
198+
if (cached && cached.trim() != "") {
199199
setQueryParams(cached)
200-
// setGetCurlCommand(cached)
201200
setCurlCommand(makeCurlCommand(host, lrdDocsItem.uri, method, cached, requestHeaders))
202201
return
203202
}
@@ -216,7 +215,7 @@ export default function ApiAction(props: Props) {
216215
setCurlCommand(makeCurlCommand(host, lrdDocsItem.uri, method, queries, requestHeaders))
217216
}
218217
if (method == 'POST' || method == 'PUT' || method == 'PATCH') {
219-
if (cached) {
218+
if (cached && (cached.trim() != "" || cached.trim() != "{}")) {
220219
setBodyParams(cached)
221220
setCurlCommand(makeCurlCommand(host, lrdDocsItem.uri, method, cached, requestHeaders))
222221
return

ui/src/components/elements/ApiActionEvents.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ import React from 'react';
22

33
import { explode } from '../../libs/strings'
44
import shortid from 'shortid';
5+
import {
6+
CheckIcon,
7+
ChevronDoubleDownIcon,
8+
ArrowPathIcon,
9+
MinusIcon,
10+
PlusIcon,
11+
} from '@heroicons/react/24/outline'
512

613
interface Props {
714
modelsData: any,
815
}
916

17+
18+
1019
export default function ApiActionEvents(props: Props) {
1120
const { modelsData } = props
1221
const { modelsSummary, modelsTimeline } = modelsData
@@ -36,9 +45,18 @@ export default function ApiActionEvents(props: Props) {
3645
<div className='' dangerouslySetInnerHTML={{ __html: explode(model.split('\\')[model.split('\\').length - 1], 30, "<br/>") }} />
3746
</td>
3847
)}
39-
<td className='capitalize'>{event}</td>
48+
<td className='capitalize'>
49+
{event == 'created' && <PlusIcon className={`inline-block w-3 h-3 mr-1`} />}
50+
{event == 'saved' && <CheckIcon className={`inline-block w-3 h-3 mr-1`} />}
51+
{event == 'retrieved' && <ChevronDoubleDownIcon className={`inline-block w-3 h-3 text-white mr-1`} />}
52+
{event == 'updated' && <ArrowPathIcon className={`inline-block w-3 h-3 mr-1`} />}
53+
{event == 'deleted' && <MinusIcon className={`inline-block w-3 h-3 mr-1`} />}
54+
{event}
55+
</td>
4056
<td>
41-
<span className='font-bold'>{modelsSummary[model][event]}</span>
57+
<span className='font-bold'>
58+
{modelsSummary[model][event]}
59+
</span>
4260
<span className='text-slate-400 pl-1'>
4361
Time{modelsSummary[model][event] > 1 ? 's' : ''}
4462
</span>
@@ -67,7 +85,12 @@ export default function ApiActionEvents(props: Props) {
6785
<div className={`h-full w-1 bg-${modelsTimeline[index].event} pointer-events-none`}></div>
6886
</div>
6987
<div className={`w-3 h-3 absolute top-1/2 rounded-full bg-${modelsTimeline[index].event} shadow text-center`}>
70-
<i className="fas fa-check-circle text-white"></i>
88+
{modelsTimeline[index].event == 'created' && <PlusIcon className={`w-3 h-3 text-black mx-auto`} />}
89+
{modelsTimeline[index].event == 'saved' && <CheckIcon className={`w-3 h-3 text-black mx-auto`} />}
90+
{modelsTimeline[index].event == 'retrieved' && <ChevronDoubleDownIcon className={`w-3 h-3 text-white mx-auto`} />}
91+
{modelsTimeline[index].event == 'updated' && <ArrowPathIcon className={`w-3 h-3 text-black mx-auto`} />}
92+
{modelsTimeline[index].event == 'deleted' && <MinusIcon className={`w-3 h-3 text-black mx-auto`} />}
93+
7194
</div>
7295
</div>
7396
<div className="col-start-4 col-end-12 rounded-md my-3 mr-auto w-full break-all">
@@ -76,7 +99,7 @@ export default function ApiActionEvents(props: Props) {
7699
</h3>
77100
<p className="title text-justify w-full">
78101
<span className={`badge badge-${modelsTimeline[index].event} rounded-sm`}>
79-
{ modelsTimeline[index].event}
102+
{modelsTimeline[index].event}
80103
</span>
81104
</p>
82105
</div>

0 commit comments

Comments
 (0)