Skip to content

Commit

Permalink
feat: 审计结果折叠面板
Browse files Browse the repository at this point in the history
fix: -
  • Loading branch information
youngster-yj committed Aug 21, 2024
1 parent 60f8fa8 commit 21dceb7
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 72 deletions.
16 changes: 14 additions & 2 deletions app/protos/grpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1975,10 +1975,22 @@ message YaklangInspectInformationRequest {

message YaklangLanguageSuggestionRequest {
string InspectType = 1;// completion(补全) / hover(提示) / signature(签名) / definition(找定义) / reference(找引用)

// {
// from source code : support all InspectType
string YakScriptType = 2;
string YakScriptCode = 3;
Range Range = 4;
string ModelID = 5;
// }

Range Range = 4; // selected range
string ModelID = 5; // monaco model id

// {
// from database : support getReference
// if set this progranName will use this from database
string ProgramName = 6;
string FileName = 7;
// }
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const AuditTreeNode: React.FC<AuditTreeNodeProps> = memo((props) => {
</div>

{getDetail && (
<Tooltip title={getDetail.url}>
<Tooltip title={`${getDetail.url}:${getDetail.start_line}`}>
<div
className={classNames(styles["detail"], "yakit-content-single-ellipsis")}
>{`${getDetail.fileName}:${getDetail.start_line}`}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {ipcRenderer} = window.require("electron")
const {Panel} = Collapse

export const CollapseList: <T>(props: CollapseListProp<T>) => ReactElement | null = memo((props) => {
const {type = "sideBar", onlyKey, list, titleRender, renderItem, collapseProps, isShowBottom} = props
const {type = "sideBar", panelKey, onlyKey = "", list, titleRender, renderItem, collapseProps, isShowBottom} = props

const wrapperClassName = useMemo(() => {
if (type === "sideBar") return styles["collapse-list-side-bar"]
Expand All @@ -48,7 +48,10 @@ export const CollapseList: <T>(props: CollapseListProp<T>) => ReactElement | nul
>
{list.map((item, index) => {
return (
<Panel header={titleRender(item)} key={item[onlyKey] || `collapse-list-${index}`}>
<Panel
header={titleRender(item)}
key={item[onlyKey] || `${panelKey || "collapse-list"}-${index}`}
>
<div
className={classNames(styles["list-item-render"], {
[styles["list-item-render-sideBar"]]: type === "sideBar"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CollapseProps } from "antd"
import {CollapseProps} from "antd"
import {ReactNode} from "react"
import { Selection } from "../RunnerTabs/RunnerTabsType";
import {Selection} from "../RunnerTabs/RunnerTabsType"

export interface CollapseListProp<T> {
/**
Expand All @@ -9,7 +9,8 @@ export interface CollapseListProp<T> {
* @default sideBar
*/
type?: "sideBar" | "output"
onlyKey: string
panelKey?: string
onlyKey?: string
list: T[]
titleRender: (info: T) => ReactNode
renderItem: (info: T) => ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {v4 as uuidv4} from "uuid"
import { GraphInfoProps } from "./RightAuditDetail"
export const GraphInfoMap: Map<string, GraphInfoProps> = new Map()

export const setMapGraphInfoDetail = (nodeId: string, info: GraphInfoProps) => {
GraphInfoMap.set(nodeId, info)
}

export const getMapGraphInfoDetail = (nodeId: string) => {
return (
GraphInfoMap.get(nodeId)
)
}

export const getMapAllGraphInfoValue = () => {
return Array.from(GraphInfoMap.values())
}

export const getMapAllGraphInfoKey = () => {
return Array.from(GraphInfoMap.keys())
}

export const getMapAllGraphInfoSize = () => {
return GraphInfoMap.size
}

export const clearMapGraphInfoDetail = () => {
GraphInfoMap.clear()
}

export const removeMapGraphInfoDetail = (nodeId: string) => {
GraphInfoMap.delete(nodeId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,83 @@
align-items: center;
gap: 4px;
}
.extra {
display: flex;
flex-direction: row;
gap: 4px;
}
}
}
}
.main {
flex: 1;
overflow: hidden;
.content {
.audit-result-box {
height: 100%;
overflow: auto;
padding: 12px;
display: flex;
flex-direction: column;
gap: 8px;
.url-box {
color: rgb(136, 99, 247);
font-size: 12px;
font-weight: 400;
line-height: 16px;
&:hover {
cursor: pointer;
text-decoration: underline;
}
}
.message-box {
color: #31343f;
font-size: 12px;
font-weight: 400;
line-height: 18px;
}
.ir-code-box {
padding: 8px;
border-radius: 4px;
background: #f0f1f3;
overflow: auto;
.title-render {
color: #31343f;
font-size: 12px;
font-weight: 600;
line-height: 16px;
}

.audit-result-item {
.result-render {
width: 100%;
overflow: hidden;
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 8px;
.title {
color: #31343f;
font-size: 12px;
font-weight: 500;
line-height: 16px;
overflow: hidden;
flex: 1;
}
.url-box {
width: 60px;
text-align: right;
color: #f28b44;
font-size: 12px;
font-weight: 400;
line-height: 16px;
overflow: hidden;
&:hover {
text-decoration: underline;
}
}
.active-url-box{
color: rgb(136, 99, 247);
}
}
.ir-code-box {
padding: 8px;
border-radius: 4px;
background: #f0f1f3;
white-space: pre;
overflow: auto;
}
:global {
.ant-collapse-item > .ant-collapse-header {
padding: 3px 0px 3px 0px !important;
}
.ant-collapse-header-text{
flex: 1;
}
}
}
}
}
Expand Down Expand Up @@ -130,7 +173,7 @@
width: 100%;
display: flex;
flex-direction: column;
border-top: 1px solid #EAECF3;
border-top: 1px solid #eaecf3;
.header {
display: flex;
flex-direction: row;
Expand All @@ -141,6 +184,8 @@
flex: 1;
display: flex;
flex-direction: column;
padding: 0px 12px 12px;
gap: 8px;
.url-box {
color: #f28b44;
font-size: 12px;
Expand Down
Loading

0 comments on commit 21dceb7

Please sign in to comment.