-
-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): add function ide console panel (#593)
* fix(web): add types request url * feat(web): add custom url for per page * feat(web): add tooltip for menu icon * feat(web): add console panel Co-authored-by: maslow <wangfugen@126.com>
- Loading branch information
Showing
10 changed files
with
150 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
import CopyText from "@/components/CopyText"; | ||
import PanelHeader from "@/components/Panel/Header"; | ||
import { formatDate } from "@/utils/format"; | ||
|
||
import useFunctionStore from "../../store"; | ||
|
||
import { LogControllerGetLogs } from "@/apis/v1/apps"; | ||
|
||
function ConsolePanel() { | ||
const { currentRequestId } = useFunctionStore(); | ||
|
||
const logControllerGetLogsQuery = useQuery( | ||
["LogControllerGetLogs", currentRequestId], | ||
() => { | ||
return LogControllerGetLogs({ requestId: currentRequestId, limit: 100 }); | ||
}, | ||
{ | ||
enabled: typeof currentRequestId !== "undefined", | ||
}, | ||
); | ||
|
||
return ( | ||
<div className="flex-1 "> | ||
<PanelHeader className="bg-slate-100 !mb-1">Console</PanelHeader> | ||
<div className="relative overflow-y-auto px-2 font-mono text-sm" style={{ height: "200px" }}> | ||
{currentRequestId && ( | ||
<p className="mb-1 ml-1"> | ||
ReqeustID: {currentRequestId} <CopyText text={String(currentRequestId)} /> | ||
</p> | ||
)} | ||
{(logControllerGetLogsQuery.data?.data?.list || []).map((item: any) => { | ||
return ( | ||
<div key={item._id} className="flex "> | ||
<span className=" text-slate-500 min-w-[160px]"> | ||
[{formatDate(item.created_at, "YYYY-MM-DD hh:mm:ss")}] | ||
</span> | ||
<pre className="flex-1">{item.data}</pre> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default ConsolePanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.