mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-07-24 13:02:21 +00:00
Date fix for alerts and recent calls (#176)
* date fix for alerts and recent calls * add a check for value to exist * getRecentCalls with sip_callid Co-authored-by: EgleHelms <e.helms@cognigy.com>
This commit is contained in:
+6
-6
@@ -530,19 +530,19 @@ export const getRecentCalls = (sid: string, query: Partial<CallQuery>) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getRecentCall = (sid: string, callSid: string) => {
|
||||
export const getRecentCall = (sid: string, sipCallId: string) => {
|
||||
return getFetch<TotalResponse>(
|
||||
import.meta.env.DEV
|
||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${callSid}`
|
||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${callSid}`
|
||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}`
|
||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}`
|
||||
);
|
||||
};
|
||||
|
||||
export const getPcap = (sid: string, callSid: string) => {
|
||||
export const getPcap = (sid: string, sipCallId: string) => {
|
||||
return getBlob(
|
||||
import.meta.env.DEV
|
||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${callSid}/pcap`
|
||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${callSid}/pcap`
|
||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}/pcap`
|
||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}/pcap`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ export const LocalLimits = ({
|
||||
Scope.account
|
||||
}
|
||||
>
|
||||
<React.Fragment key={category}>
|
||||
<React.Fragment>
|
||||
<label htmlFor={category}>{label}</label>
|
||||
<input
|
||||
ref={(el: HTMLInputElement) => {
|
||||
|
||||
@@ -101,9 +101,7 @@ export const Alerts = () => {
|
||||
<div className="item__info">
|
||||
<div className="item__title txt--jam">
|
||||
<strong>
|
||||
{dayjs
|
||||
.unix(alert.time / 1000)
|
||||
.format("YYYY MM.DD hh:mm a")}
|
||||
{dayjs(alert.time).format("YYYY MM.DD hh:mm a")}
|
||||
</strong>
|
||||
</div>
|
||||
<div className="item__meta">
|
||||
|
||||
@@ -28,9 +28,7 @@ export const DetailsItem = ({ call }: DetailsItemProps) => {
|
||||
<div className="item__info">
|
||||
<div className="item__title">
|
||||
<strong>
|
||||
{dayjs
|
||||
.unix(call.attempted_at / 1000)
|
||||
.format("YYYY MM.DD hh:mm a")}
|
||||
{dayjs(call.attempted_at).format("YYYY MM.DD hh:mm a")}
|
||||
</strong>
|
||||
<span className="i txt--dark">
|
||||
{call.direction === "inbound" ? (
|
||||
@@ -62,7 +60,11 @@ export const DetailsItem = ({ call }: DetailsItemProps) => {
|
||||
{Object.keys(call).map((key) => (
|
||||
<React.Fragment key={key}>
|
||||
<div>{key}:</div>
|
||||
<div>{call[key as keyof typeof call].toString()}</div>
|
||||
<div>
|
||||
{call[key as keyof typeof call]
|
||||
? call[key as keyof typeof call].toString()
|
||||
: "null"}
|
||||
</div>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -13,10 +13,10 @@ export const PcapButton = ({ call }: PcapButtonProps) => {
|
||||
const [pcap, setPcap] = useState<Pcap>();
|
||||
|
||||
useEffect(() => {
|
||||
getRecentCall(call.account_sid, call.call_sid)
|
||||
getRecentCall(call.account_sid, call.sip_callid)
|
||||
.then(({ json }) => {
|
||||
if (json.total > 0) {
|
||||
getPcap(call.account_sid, call.call_sid)
|
||||
getPcap(call.account_sid, call.sip_callid)
|
||||
.then(({ blob }) => {
|
||||
if (blob) {
|
||||
setPcap({
|
||||
|
||||
Reference in New Issue
Block a user