Skip to content

Commit 488785b

Browse files
authored
Merge pull request #612 from nickcdon/main
🎨 issue列表展示msg信息
2 parents bac28a4 + cc79e4a commit 488785b

16 files changed

Lines changed: 947 additions & 607 deletions

File tree

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
- name: Checkout Repo
2525
uses: actions/checkout@v3
2626

27-
- name: Setup Node 14
27+
- name: Setup Node 16
2828
uses: actions/setup-node@v3
2929
with:
3030
# 选择要使用的 node 版本
31-
node-version: "14"
31+
node-version: "16"
3232
cache: "yarn"
3333
cache-dependency-path: "doc/yarn.lock"
3434

@@ -39,8 +39,8 @@ jobs:
3939
with:
4040
path: doc/node_modules
4141
key: ${{ runner.os }}-yarn-${{ hashFiles('doc/yarn.lock') }}
42-
restore-keys: |
43-
${{ runner.os }}-yarn-
42+
# restore-keys: |
43+
# ${{ runner.os }}-yarn-
4444

4545
# 如果缓存没有命中,安装依赖
4646
- if: ${{ steps.yarn-cache.outputs.cache-hit == false }}

doc/.vuepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineUserConfig } from '@vuepress/cli'
22
import { defaultTheme } from '@vuepress/theme-default'
3+
import { searchPlugin } from '@vuepress/plugin-search'
34
import { navbar, sidebar } from './configs'
4-
const { searchPlugin } = require('@vuepress/plugin-search')
55

66
const isProd = process.env.NODE_ENV === 'production'
77

doc/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"tca",
77
"document"
88
],
9+
"type": "module",
910
"license": "MIT",
1011
"scripts": {
1112
"dev": "vuepress dev",
1213
"build:comment": "echo '构建帮助文档,默认base前缀为document,可根据部署需要进行相应调整'",
1314
"build": "BASE=${BASE:-CodeAnalysis} vuepress build -d ./dist"
1415
},
1516
"devDependencies": {
16-
"@vuepress/plugin-search": "^2.0.0-beta.43",
17-
"vuepress": "^2.0.0-beta.42"
17+
"@vuepress/plugin-search": "2.0.0-beta.51",
18+
"vuepress": "2.0.0-beta.51"
1819
}
19-
}
20+
}

doc/yarn.lock

Lines changed: 754 additions & 530 deletions
Large diffs are not rendered by default.

web/build-source.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
# 用于管道命令 只要一个子命令失败,整个管道命令就失败,脚本就会终止执行
44
set -eo pipefail
@@ -13,9 +13,19 @@ function warning() {
1313
echo -e "\033[33m >>> $*\033[0;39m"
1414
}
1515

16+
# 当前脚本执行目录
17+
CURRENT_PATH=$(
18+
cd "$(dirname "${BASH_SOURCE[0]}")"
19+
pwd
20+
)
21+
22+
# web目录
23+
ROOT_PATH=$CURRENT_PATH
24+
25+
cd "$ROOT_PATH"
26+
1627
# git 版本
1728
GIT_REVISION=$(git rev-parse HEAD)
18-
ROOT_PATH=$(pwd)
1929
CONF_PATH="${ROOT_PATH}/tca-deploy-source/conf/"
2030
BUILD_ZIP_PATH="${ROOT_PATH}/tca-deploy-source/build_zip/"
2131

web/packages/tca-analysis/src/modules/projects/issues/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,17 @@ const Issues = (props: IssuesProps) => {
360360
sorter
361361
sortOrder={sort.key === 'checkrule_real_name' ? sort.order : undefined}
362362
render={(name: any, item: any) => (
363-
<Tooltip title={item.msg}>
364-
<span>{name}</span>
365-
</Tooltip>
363+
<>
364+
<p>{name}</p>
365+
{
366+
item.msg && item.msg?.length > 120
367+
? (
368+
<Tooltip title={item.msg}>
369+
<p className={style.path}>错误信息:{item?.msg?.substring(0, 120)}...</p>
370+
</Tooltip>
371+
) : <p className={style.path}>错误信息:{item.msg}</p>
372+
}
373+
</>
366374
)}
367375
/>
368376
<Column

web/packages/tca-analysis/src/modules/projects/issues/rule-detail.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ interface RuleDetailProps {
2727
const RuleDetail = (props: RuleDetailProps) => {
2828
const { data, visible, onClose } = props;
2929
const { orgSid } = useParams<any>();
30-
console.log(data);
3130

3231
return (
3332
<Drawer

web/packages/tca-analysis/src/modules/projects/issues/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
.path {
4343
font-size: 12px;
44-
color: $grey-7;
44+
color: $grey-6;
4545
max-width: 400px;
4646
word-break: break-all;
4747
}

web/packages/tca-analysis/src/modules/schemes/code-lint/all-rules-search.tsx

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,27 @@
55
// ==============================================================================
66

77
import React, { useEffect } from 'react';
8-
import { toNumber, isString, isEmpty, isArray, cloneDeep } from 'lodash';
9-
import { Input, Form, Button } from 'coding-oa-uikit';
8+
import { toNumber, isString, isEmpty, isArray, cloneDeep, find } from 'lodash';
9+
import { Input, Form, Button, Select } from 'coding-oa-uikit';
1010

1111
import SelectBorderless from '@src/components/select-borderless';
1212
import Filter from '@src/components/filter';
1313
import { SEVERITY, CATEGORY } from '../constants';
1414

15-
const numberParams = ['checkpackage', 'severity', 'category', 'checktool'];
15+
const numberParams = ['checkpackage', 'severity', 'category'];
1616
const arrayParams = ['language'];
1717

1818
interface SearchProps {
1919
filters: any;
2020
searchParams: any;
2121
loading: boolean;
22+
addToolsRules: (toolId: number) => void; // 一键添加工具所有规则
2223
callback: (params: any) => void;
2324
}
2425

2526
const Search = (props: SearchProps) => {
2627
const [form] = Form.useForm();
27-
const { searchParams, loading, filters, callback } = props;
28+
const { searchParams, loading, filters, addToolsRules, callback } = props;
2829
const { allPkgs = [], languages = [], checkTools = [] }: any = filters;
2930

3031
const initialValues = cloneDeep(searchParams);
@@ -36,6 +37,10 @@ const Search = (props: SearchProps) => {
3637
.map((item: string) => toNumber(item));
3738
}
3839

40+
if (initialValues.checktool) {
41+
initialValues.checktool = toNumber(initialValues.checktool);
42+
}
43+
3944
if (arrayParams.includes(key) && isString(value)) {
4045
initialValues[key] = value.split(',');
4146
}
@@ -104,46 +109,70 @@ const Search = (props: SearchProps) => {
104109
}
105110
/>
106111
</Filter.Item>
107-
<Filter.Item label="所属工具" name="checktool">
112+
<Filter.Item label="适用语言" name="language">
108113
<SelectBorderless
109114
multiple
110115
allowClear
111116
placeholder="全部"
112-
data={checkTools?.map((item: any) => ({
113-
value: item.id,
117+
data={languages?.map((item: any) => ({
118+
value: item.name,
114119
text: item.display_name,
115120
}))}
116-
onChange={(value: any) => value && onChange('checktool', value.join(','))
121+
onChange={(value: any) => value && onChange('language', value.join(','))
117122
}
118123
/>
119124
</Filter.Item>
120-
<Filter.Item label="适用语言" name="language">
121-
<SelectBorderless
122-
multiple
125+
<Filter.Item label="所属工具" name="checktool">
126+
<Select
127+
showSearch
128+
allowClear
129+
size='middle'
130+
placeholder='全部工具'
131+
style={{ minWidth: '150px' }}
132+
optionFilterProp='children'
133+
dropdownMatchSelectWidth={false}
134+
onChange={(value: any) => onChange('checktool', value)}
135+
>
136+
{
137+
checkTools.map((item: any) => (
138+
<Select.Option key={item.id} value={item.id}>{item.display_name}</Select.Option>
139+
))
140+
}
141+
</Select>
142+
{/* <SelectBorderless
123143
allowClear
124144
placeholder="全部"
125-
data={languages?.map((item: any) => ({
126-
value: item.name,
145+
data={checkTools?.map((item: any) => ({
146+
value: item.id,
127147
text: item.display_name,
128148
}))}
129-
onChange={(value: any) => value && onChange('language', value.join(','))
149+
onChange={(value: any) => value && onChange('checktool', value.join(','))
130150
}
131-
/>
151+
/> */}
132152
</Filter.Item>
153+
133154
<Filter.Item label="" name="real_name">
134155
<Input.Search
135156
size="middle"
136157
placeholder="规则名称"
158+
style={{ minWidth: '150px' }}
137159
onSearch={value => onChange('real_name', value)}
138160
/>
139161
</Filter.Item>
140162
{Object.keys(searchParams).some((key: string) => (isArray(searchParams[key])
141163
? !isEmpty(searchParams[key])
142164
: searchParams[key])) && (
143-
<Button type="link" onClick={onClear} style={{ height: '36px' }}>
165+
<Button type="link" onClick={onClear} style={{ height: '36px', marginRight: 10 }}>
144166
清空过滤
145167
</Button>
146168
)}
169+
{
170+
find(checkTools, { id: initialValues.checktool }) && (
171+
<Button type="link" style={{ height: '36px' }} onClick={() => addToolsRules(initialValues.checktool)}>
172+
一键添加 {find(checkTools, { id: initialValues.checktool })?.display_name} 工具的所有规则
173+
</Button>
174+
)
175+
}
147176
</Filter>
148177
);
149178
};

web/packages/tca-analysis/src/modules/schemes/code-lint/all-rules.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,19 @@ const AllRules = () => {
129129
});
130130
};
131131

132+
/**
133+
* 一键添加指定工具所有规则
134+
* @param toolId
135+
*/
136+
const addToolsRules = (toolId: number) => {
137+
addRule(orgSid, teamName, repoId, schemeId, {
138+
checktool: toolId,
139+
}).then(() => {
140+
message.success('批量添加成功');
141+
getListData(pageStart, pageSize);
142+
});
143+
};
144+
132145
const openRuleDetail = async (ruleId: number) => {
133146
setRuleDetailVsb(true);
134147
const res = await getRuleDetail(orgSid, teamName, repoId, schemeId, ruleId);
@@ -163,6 +176,7 @@ const AllRules = () => {
163176
}}
164177
searchParams={cloneDeep(searchParams)}
165178
loading={loading}
179+
addToolsRules={addToolsRules}
166180
callback={(params: any) => {
167181
getListData(DEFAULT_PAGER.pageStart, pageSize, params);
168182
}}
@@ -212,7 +226,7 @@ const AllRules = () => {
212226
<Column title="规则概要" dataIndex="rule_title" />
213227
<Column title="所属工具" dataIndex={['checktool', 'display_name']} />
214228
<Column title="分类" dataIndex="category_name" />
215-
<Column title="问题级别" dataIndex="severity_name" />
229+
<Column title="问题级别" dataIndex="severity_name" width={80}/>
216230
</Table>
217231
</div>
218232
<RuleDetail

0 commit comments

Comments
 (0)