Skip to content

Commit

Permalink
refactor(event): update event page
Browse files Browse the repository at this point in the history
  • Loading branch information
jsers committed May 23, 2023
1 parent 69583f0 commit ad6cef5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
8 changes: 6 additions & 2 deletions src/pages/event/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ function Card(props: Props, ref) {

const columns = [
{
title: t('common:datasource.type'),
dataIndex: 'cate',
title: t('prod'),
dataIndex: 'rule_prod',
width: 100,
render: (value) => {
return t(`AlertHisEvents:rule_prod.${value}`);
},
},
{
title: t('common:datasource.name'),
Expand Down
23 changes: 13 additions & 10 deletions src/pages/event/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@ const EventDetailPage: React.FC = () => {
label: t('detail.rule_name'),
key: 'rule_name',
render(content, { rule_id }) {
return (
<Link
to={{
pathname: `/alert-rules/edit/${rule_id}`,
}}
target='_blank'
>
{content}
</Link>
);
if (!_.includes(['firemap', 'northstar'], eventDetail?.rule_prod)) {
return (
<Link
to={{
pathname: `/alert-rules/edit/${rule_id}`,
}}
target='_blank'
>
{content}
</Link>
);
}
return content;
},
},
...(!_.includes(['firemap', 'northstar'], eventDetail?.rule_prod)
Expand Down
15 changes: 14 additions & 1 deletion src/pages/event/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const Event: React.FC = () => {
return <Select.Option value={item.value}>{t(`hours.${item.value}`)}</Select.Option>;
})}
</Select>
<AdvancedWrap var='VITE_IS_ALERT_AI,VITE_IS_ALERT_ES,VITE_IS_SLS_DS'>
<AdvancedWrap var='VITE_IS_ALERT_AI,VITE_IS_ALERT_ES,VITE_IS_SLS_DS,VITE_IS_COMMON_DS'>
{(isShow) => {
let options = [
{
Expand Down Expand Up @@ -121,6 +121,19 @@ const Event: React.FC = () => {
},
];
}
if (isShow[3]) {
options = [
...options,
{
label: t('AlertHisEvents:rule_prod.firemap'),
value: 'firemap',
},
{
label: t('AlertHisEvents:rule_prod.northstar'),
value: 'northstar',
},
];
}
return (
<Select
allowClear
Expand Down
15 changes: 14 additions & 1 deletion src/pages/historyEvents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const Event: React.FC = () => {
return <Select.Option value={item.value}>{t(`hours.${item.value}`)}</Select.Option>;
})}
</Select>
<AdvancedWrap var='VITE_IS_ALERT_AI,VITE_IS_ALERT_ES,VITE_IS_SLS_DS'>
<AdvancedWrap var='VITE_IS_ALERT_AI,VITE_IS_ALERT_ES,VITE_IS_SLS_DS,VITE_IS_COMMON_DS'>
{(isShow) => {
let options = [
{
Expand Down Expand Up @@ -183,6 +183,19 @@ const Event: React.FC = () => {
},
];
}
if (isShow[3]) {
options = [
...options,
{
label: t('rule_prod.firemap'),
value: 'firemap',
},
{
label: t('rule_prod.northstar'),
value: 'northstar',
},
];
}
return (
<Select
allowClear
Expand Down

0 comments on commit ad6cef5

Please sign in to comment.