Преглед изворни кода

fix: 修改运维管理的bug

100011797 пре 3 година
родитељ
комит
5e64716252

BIN
public/images/access-network.png


BIN
public/images/access-protocol.png


+ 1 - 0
src/components/TitleComponent/index.less

@@ -7,6 +7,7 @@
   padding-left: 10px;
   color: rgba(0, 0, 0, 0.8);
   font-weight: 600;
+  line-height: 1;
 
   .title-before {
     position: absolute;

+ 6 - 0
src/global.less

@@ -86,6 +86,7 @@ ol {
 
 .ant-formily-item-label-content {
   position: relative;
+  padding-bottom: 8px;
   overflow: unset;
 
   .ant-formily-item-asterisk {
@@ -100,6 +101,11 @@ ol {
   display: none;
 }
 
+.ant-formily-item-label-tooltip-icon {
+  align-items: flex-start;
+  padding-top: 5px;
+}
+
 .ant-page-header-heading {
   display: none;
 }

+ 1 - 1
src/pages/Log/Access/Detail/index.tsx

@@ -17,7 +17,7 @@ const Detail = (props: Props) => {
 
   return (
     <Modal title={'详情'} visible onCancel={props.close} onOk={props.close} width={1000}>
-      <Descriptions bordered>
+      <Descriptions bordered labelStyle={{ width: 120, textAlign: 'center' }}>
         <Descriptions.Item label="URL">{data?.url}</Descriptions.Item>
         <Descriptions.Item label="请求方法" span={2}>
           {data?.httpMethod}

+ 5 - 1
src/pages/Log/Access/index.tsx

@@ -27,6 +27,7 @@ const Access = () => {
       dataIndex: 'ip',
       ellipsis: true,
       fixed: 'left',
+      width: 150,
     },
     {
       title: intl.formatMessage({
@@ -35,6 +36,7 @@ const Access = () => {
       }),
       dataIndex: 'url',
       ellipsis: true,
+      // width: 250,
     },
     {
       title: '请求方法',
@@ -72,6 +74,7 @@ const Access = () => {
       }),
       dataIndex: 'requestTime',
       sorter: true,
+      width: 200,
       valueType: 'dateTime',
       defaultSortOrder: 'descend',
       ellipsis: true,
@@ -93,6 +96,7 @@ const Access = () => {
         defaultMessage: '请求用户',
       }),
       dataIndex: 'context.username',
+      width: 100,
       render: (text, record: any) =>
         record?.context?.username ? <Tag color="geekblue">{record?.context?.username}</Tag> : '',
     },
@@ -136,7 +140,7 @@ const Access = () => {
         columnEmptyText={''}
         tableClassName={'accessLog'}
         tableStyle={{ minHeight }}
-        scroll={{ x: 1366 }}
+        // scroll={{ x: 1366 }}
         request={async (params) =>
           service.query({ ...params, sorts: [{ name: 'responseTime', order: 'desc' }] })
         }

+ 1 - 0
src/pages/Log/System/index.tsx

@@ -63,6 +63,7 @@ const System = () => {
       }),
       dataIndex: 'message',
       ellipsis: true,
+      width: 200,
     },
     {
       title: intl.formatMessage({

+ 0 - 1
src/pages/link/AccessConfig/Detail/Access/index.less

@@ -113,7 +113,6 @@
     width: 44px;
     height: 44px;
     color: #fff;
-    background-color: red;
     background-color: @primary-color-active;
     transform: rotate(-45deg);
 

+ 12 - 8
src/pages/link/AccessConfig/Detail/Channel/index.tsx

@@ -111,19 +111,23 @@ const Media = (props: Props) => {
             <div style={{ marginLeft: 10 }}>
               <TitleComponent data={'配置概览'} />
               <div>
-                <p>接入方式:{props.provider?.name || ''}</p>
-                {props.provider?.description && <p>{props.provider?.description || ''}</p>}
-                <p>消息协议:{protocol}</p>
+                <div style={{ marginBottom: 10 }}>接入方式:{props.provider?.name || ''}</div>
+                {props.provider?.description && (
+                  <div style={{ marginBottom: 10 }}>{props.provider?.description || ''}</div>
+                )}
+                <div style={{ marginBottom: 10 }}>消息协议:{protocol}</div>
                 {config?.document && (
-                  <div>{<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}</div>
+                  <div style={{ marginBottom: 10 }}>
+                    {<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}
+                  </div>
                 )}
               </div>
               <TitleComponent data={'设备接入指引'} />
               <div>
-                <p>1、配置{name}通道</p>
-                <p>2、创建{name}设备接入网关</p>
-                <p>3、创建产品,并选中接入方式为{name}</p>
-                <p>4、添加设备,单独为每一个设备进行数据点绑定</p>
+                <div style={{ marginBottom: 10 }}>1、配置{name}通道</div>
+                <div style={{ marginBottom: 10 }}>2、创建{name}设备接入网关</div>
+                <div style={{ marginBottom: 10 }}>3、创建产品,并选中接入方式为{name}</div>
+                <div style={{ marginBottom: 10 }}>4、添加设备,单独为每一个设备进行数据点绑定</div>
               </div>
             </div>
           </Col>

+ 24 - 16
src/pages/link/AccessConfig/Detail/components/Finish/index.tsx

@@ -183,32 +183,36 @@ const Finish = (props: Props) => {
         <div style={{ marginLeft: 10 }}>
           <TitleComponent data={'配置概览'} />
           <div>
-            <p>接入方式:{props.provider?.name || ''}</p>
-            {props.provider?.description && <p>{props.provider?.description || ''}</p>}
-            <p>消息协议:{props.config.protocol}</p>
+            <div style={{ marginBottom: 10 }}>接入方式:{props.provider?.name || ''}</div>
+            {props.provider?.description && (
+              <div style={{ marginBottom: 10 }}>{props.provider?.description || ''}</div>
+            )}
+            <div style={{ marginBottom: 10 }}>消息协议:{props.config.protocol}</div>
             {config?.document && (
-              <div>{<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}</div>
+              <div style={{ marginBottom: 10 }}>
+                {<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}
+              </div>
             )}
           </div>
           <TitleComponent data={'设备接入指引'} />
           <div>
-            <p>
+            <div style={{ marginBottom: 10 }}>
               1、创建类型为{props?.provider?.id === 'OneNet' ? 'OneNet' : 'CTWing'}的设备接入网关
-            </p>
-            <p>
+            </div>
+            <div style={{ marginBottom: 10 }}>
               2、创建产品,并选中接入方式为
               {props?.provider?.id === 'OneNet'
                 ? 'OneNet'
                 : 'CTWing,选中后需填写CTWing平台中的产品ID、Master-APIkey。'}
-            </p>
+            </div>
             {props?.provider?.id === 'OneNet' ? (
-              <p>
+              <div style={{ marginBottom: 10 }}>
                 3、添加设备,为每一台设备设置唯一的IMEI、IMSI码(需与OneNet平台中填写的值一致,若OneNet平台没有对应的设备,将会通过OneNet平台提供的LWM2M协议自动创建)
-              </p>
+              </div>
             ) : (
-              <p>
+              <div style={{ marginBottom: 10 }}>
                 3、添加设备,为每一台设备设置唯一的IMEI、SN、IMSI、PSK码(需与CTWingt平台中填写的值一致,若CTWing平台没有对应的设备,将会通过CTWing平台提供的LWM2M协议自动创建)
-              </p>
+              </div>
             )}
           </div>
         </div>
@@ -218,11 +222,15 @@ const Finish = (props: Props) => {
         <div>
           <TitleComponent data={'配置概览'} />
           <div>
-            <p>接入方式:{props.provider?.name || ''}</p>
-            {props.provider?.description && <p>{props.provider?.description || ''}</p>}
-            <p>消息协议:{props.config.protocol}</p>
+            <div style={{ marginBottom: 10 }}>接入方式:{props.provider?.name || ''}</div>
+            {props.provider?.description && (
+              <div style={{ marginBottom: 10 }}>{props.provider?.description || ''}</div>
+            )}
+            <div style={{ marginBottom: 10 }}>消息协议:{props.config.protocol}</div>
             {config?.document && (
-              <div>{<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}</div>
+              <div style={{ marginBottom: 10 }}>
+                {<ReactMarkdown>{config?.document}</ReactMarkdown> || ''}
+              </div>
             )}
           </div>
         </div>

+ 1 - 3
src/pages/link/AccessConfig/Detail/components/Network/index.less

@@ -56,8 +56,7 @@
 .cardRender {
   width: 100%;
   overflow: hidden;
-  background: url('/images/access.png') no-repeat;
-  background-size: 100% 100%;
+  background: url('/images/access.png') 100% 100% no-repeat;
 
   .checkedIcon {
     position: absolute;
@@ -68,7 +67,6 @@
     width: 44px;
     height: 44px;
     color: #fff;
-    background-color: red;
     background-color: @primary-color-active;
     transform: rotate(-45deg);
 

+ 7 - 1
src/pages/link/AccessConfig/Detail/components/Network/index.tsx

@@ -98,9 +98,15 @@ const Network = (props: Props) => {
                     styles.cardRender,
                     networkCurrent === item.id ? styles.checked : '',
                   )}
+                  style={{
+                    background: `url("/images/access-network.png") no-repeat`,
+                    backgroundSize: '100% 100%',
+                  }}
                   hoverable
                   onClick={() => {
-                    setNetworkCurrent(item.id);
+                    if (!props.view) {
+                      setNetworkCurrent(item.id);
+                    }
                   }}
                 >
                   <div className={styles.title}>

+ 4 - 0
src/pages/link/AccessConfig/Detail/components/Protocol/index.tsx

@@ -105,6 +105,10 @@ const Protocol = (props: Props) => {
                     styles.cardRender,
                     protocolCurrent === item.id ? styles.checked : '',
                   )}
+                  style={{
+                    background: `url("/images/access-protocol.png") no-repeat`,
+                    backgroundSize: '100% 100%',
+                  }}
                   hoverable
                   onClick={() => {
                     if (!props.dt?.id) {

+ 15 - 7
src/pages/link/Type/Detail/index.tsx

@@ -130,14 +130,18 @@ const Save = observer(() => {
             if (param?.id && param.id !== ':id') {
               const resp = await service.detail(param.id);
               const data = resp?.result || {};
-              console.log(data);
               if (data?.shareCluster === false) {
-                data.cluster = data.cluster?.map((item: any) => ({
-                  ...item.configuration,
-                  configuration: item,
-                }));
+                const cluster = (data?.cluster || []).map((item: any) => {
+                  return {
+                    ...item.configuration,
+                    configuration: item,
+                  };
+                });
+                const obj = _.cloneDeep({ ...data, cluster });
+                form1.setValues(obj);
+              } else {
+                form1.setValues({ ...data });
               }
-              form1.setValues({ ...data });
             }
           });
           onFieldValueChange('type', (field, f) => {
@@ -966,6 +970,10 @@ const Save = observer(() => {
                     type: 'void',
                     title: '新增',
                     'x-component': 'ArrayCollapse.Addition',
+                    'x-component-props': {
+                      ghost: true,
+                      type: 'primary',
+                    },
                   },
                 },
               },
@@ -1024,7 +1032,7 @@ const Save = observer(() => {
       <Card>
         <Row gutter={24}>
           <Col span={16}>
-            <Form form={form} layout="vertical" style={{ padding: 30 }}>
+            <Form form={form} layout="vertical">
               <SchemaField
                 schema={schema}
                 scope={{

+ 1 - 1
src/pages/media/Stream/Detail/index.tsx

@@ -271,7 +271,7 @@ const Detail = () => {
             }
           }}
         >
-          <Row gutter={[16, 16]}>
+          <Row gutter={24}>
             <Col span={12}>
               <Form.Item
                 label="流媒体名称"

+ 9 - 1
src/pages/rule-engine/Alarm/Log/Detail/Info.tsx

@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
 import moment from 'moment';
 import { Store } from 'jetlinks-store';
 import styles from './index.less';
+import ReactJson from 'react-json-view';
 
 interface Props {
   data: Partial<AlarmLogHistoryItem>;
@@ -64,7 +65,14 @@ const Info = (props: Props) => {
           </Tooltip>
         </Descriptions.Item>
         <Descriptions.Item label="告警流水" span={2}>
-          {data?.alarmInfo || ''}
+          <div style={{ maxHeight: 200, overflowY: 'auto' }}>
+            <ReactJson
+              displayObjectSize={false}
+              displayDataTypes={false}
+              name={false}
+              src={JSON.parse(data?.alarmInfo || '{}')}
+            />
+          </div>
         </Descriptions.Item>
       </Descriptions>
     </Modal>

+ 1 - 1
src/pages/rule-engine/DashBoard/index.less

@@ -108,7 +108,7 @@
 
 .alarmRank {
   width: 250px;
-  padding-left: 12px;
+  padding-left: 55px;
 }
 
 .rankingList {

+ 58 - 50
src/pages/rule-engine/DashBoard/index.tsx

@@ -1,7 +1,7 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import { EChartsOption } from 'echarts';
 import { useEffect, useRef, useState } from 'react';
-import { Badge, Card, Col, Tooltip, Select } from 'antd';
+import { Badge, Col, Tooltip, Select } from 'antd';
 import './index.less';
 import Service from './service';
 import { observer } from '@formily/react';
@@ -178,12 +178,16 @@ const Dashboard = observer(() => {
     if (currentAlarm.status === 200) {
       if (alarmLevel.status === 200) {
         const levels = alarmLevel.result.levels;
-        state.alarmList = currentAlarm.result?.data.map((item: { level: any }) => ({
-          ...item,
-          levelName: levels.find((l: any) => l.level === item.level)?.title,
-        }));
+        state.alarmList = currentAlarm.result?.data
+          .filter((i: any) => i?.state?.value === 'warning')
+          .map((item: { level: any }) => ({
+            ...item,
+            levelName: levels.find((l: any) => l.level === item.level)?.title,
+          }));
       } else {
-        state.alarmList = currentAlarm.result?.data;
+        state.alarmList = currentAlarm.result?.data.filter(
+          (item: any) => item?.state?.value === 'warning',
+        );
       }
     }
   };
@@ -355,8 +359,8 @@ const Dashboard = observer(() => {
         grid: {
           top: '2%',
           bottom: '5%',
-          left: '50px',
-          right: '50px',
+          left: '24px',
+          right: '24px',
         },
         series: [
           {
@@ -481,45 +485,46 @@ const Dashboard = observer(() => {
           </Col>
         </DashBoardTopCard>
       </div>
-      <Card style={{ marginTop: 10 }}>
-        <DashBoard
-          title="告警统计"
-          height={600}
-          showTimeTool={true}
-          showTime
-          options={options}
-          initialValues={{
-            targetType: 'device',
-          }}
-          extraParams={{
-            key: 'targetType',
-            Children: (
-              <Select
-                options={
-                  isNoCommunity
-                    ? [
-                        { label: '设备', value: 'device' },
-                        { label: '产品', value: 'product' },
-                        { label: '组织', value: 'org' },
-                        { label: '其它', value: 'other' },
-                      ]
-                    : [
-                        { label: '设备', value: 'device' },
-                        { label: '产品', value: 'product' },
-                        { label: '其它', value: 'other' },
-                      ]
-                }
-              />
-            ),
-          }}
-          onParamsChange={getEcharts}
-          ref={alarmCountRef}
-          defaultTime={'week'}
-          echartsAfter={
-            <div className={styles.alarmRank}>
-              <h4>告警排名</h4>
+      {/*<Card style={{ marginTop: 10 }}>*/}
+      <DashBoard
+        title="告警统计"
+        height={600}
+        showTimeTool={true}
+        showTime
+        options={options}
+        initialValues={{
+          targetType: 'device',
+        }}
+        extraParams={{
+          key: 'targetType',
+          Children: (
+            <Select
+              options={
+                isNoCommunity
+                  ? [
+                      { label: '设备', value: 'device' },
+                      { label: '产品', value: 'product' },
+                      { label: '组织', value: 'org' },
+                      { label: '其它', value: 'other' },
+                    ]
+                  : [
+                      { label: '设备', value: 'device' },
+                      { label: '产品', value: 'product' },
+                      { label: '其它', value: 'other' },
+                    ]
+              }
+            />
+          ),
+        }}
+        onParamsChange={getEcharts}
+        ref={alarmCountRef}
+        defaultTime={'week'}
+        echartsAfter={
+          <div className={styles.alarmRank}>
+            <h4>告警排名</h4>
+            {state.ranking.length ? (
               <ul className={styles.rankingList}>
-                {state.ranking?.map((item, i) => (
+                {state.ranking.map((item, i) => (
                   <li key={item.targetId}>
                     <img
                       src={require(`/public/images/rule-engine/dashboard/ranking/${i + 1}.png`)}
@@ -535,10 +540,13 @@ const Dashboard = observer(() => {
                   </li>
                 ))}
               </ul>
-            </div>
-          }
-        />
-      </Card>
+            ) : (
+              <Empty />
+            )}
+          </div>
+        }
+      />
+      {/*</Card>*/}
     </PageContainer>
   );
 });