+
Файлы
)
diff --git a/src/pages/Main.jsx b/src/pages/Main.jsx
index 946c51d..8ca4432 100644
--- a/src/pages/Main.jsx
+++ b/src/pages/Main.jsx
@@ -3,7 +3,6 @@ import Wells from './Wells'
import PageHeader from './Header'
import Well from "../components/Well";
import {Redirect, Route, Switch} from "react-router-dom";
-import Notification from "../components/Notification";
const {Content} = Layout
diff --git a/src/pages/Messages.jsx b/src/pages/Messages.jsx
index 18c8afd..bbefeb7 100644
--- a/src/pages/Messages.jsx
+++ b/src/pages/Messages.jsx
@@ -1,13 +1,16 @@
-import {Table} from 'antd';
+import {Button, Table, Select} from 'antd';
import {MessageService} from '../services/api'
import {useState, useEffect} from 'react'
import {useParams} from 'react-router-dom'
import {Subscribe} from '../services/signalr'
import Loader from '../components/Loader'
-import moment from 'moment';
+import moment from 'moment'
import '../styles/message.css'
import Notification from '../components/Notification'
+const {Option} = Select
+
+
// Словарь категорий для строк таблицы
const categoryDictionary = {
@@ -23,8 +26,6 @@ const columns = [
key: 'date',
dataIndex: 'date',
render: (item) => moment(item).format('DD MMM YYYY, HH:MM:ss'),
- sorter: (a, b) => new Date(b.date) - new Date(a.date),
- sortDirections: ['descend', 'ascend'],
},
{
title: 'Категория',
@@ -32,14 +33,16 @@ const columns = [
dataIndex: 'categoryId',
render: (_, item) => categoryDictionary[item.categoryId].title,
style: (_, item) => categoryDictionary[item.categoryId].style,
- sorter: (a, b) => a.categoryId - b.categoryId,
- sortDirections: ['descend', 'ascend'],
+ filters: [
+ {text: 'Авария', value: '1'},
+ {text: 'Предупреждение', value: '2'},
+ {text: 'Информация', value: '3'},
+ ]
},
{
title: 'Сообщение',
key: 'message',
dataIndex: 'message',
- onFilter: (value, record) => record.name.indexOf(value) === 0,
},
{
title: 'Пользователь',
@@ -48,12 +51,22 @@ const columns = [
},
];
+// Опции для фильра
+
// Данные для таблицы
export default function Messages() {
let {id} = useParams()
const [messages, setMessages] = useState([])
const [loader] = useState(false)
+ const filterOptions = [
+ {label: 'Авария', value: 1},
+ {label: 'Предупреждение', value: 2},
+ {label: 'Информация', value: 3},
+ ]
+
+ const children = filterOptions.map((line) => (
))
+
const handleReceiveMessages = (messages) => {
if (messages) {
setMessages(messages.items)
@@ -61,34 +74,53 @@ export default function Messages() {
}
useEffect(() => {
- MessageService.getMessage(id)
- .then(handleReceiveMessages)
- .catch ((ex) => {
- Notification(`Не удалось загрузить сообщения по скважине "${id}"`, 'error')
- console.log(ex)
- })
+ MessageService.getMessage(id)
+ .then(handleReceiveMessages)
+ .catch((ex) => {
+ Notification(`Не удалось загрузить сообщения по скважине "${id}"`, 'error')
+ console.log(ex)
+ })
let unSubscribeMessagesHub = Subscribe('ReceiveMessages', `well_${id}`, handleReceiveMessages)
return () => {
unSubscribeMessagesHub()
}
- }, [id]);
+ }, [id])
return (
<>
Сообщения
+
Фильтр сообщений
+
+
+
`event_message_${record.categoryId} event_message`}
size={'small'}
- pagination={{pageSize: 28}}
+ pagination={{pageSize: 26}}
rowKey={(record) => record.id}
/>
{loader && }
>
)
-}
-
-// TODO Стили для отсортированных страниц
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/pages/TelemetryView.jsx b/src/pages/TelemetryView.jsx
index 0ca2da4..b7389ae 100644
--- a/src/pages/TelemetryView.jsx
+++ b/src/pages/TelemetryView.jsx
@@ -8,7 +8,6 @@ import {CustomColumn} from '../components/CustomColumn'
import {UserOfWells} from '../components/UserOfWells'
import {ModeDisplay} from '../components/ModeDisplay'
import {Display} from '../components/Display'
-import notify from '../components/Notification'
import moment from 'moment'
import {Subscribe} from '../services/signalr'
import {DataService, MessageService} from '../services/api'
diff --git a/src/styles/App.less b/src/styles/App.less
index 2e6a83b..cc0c15a 100644
--- a/src/styles/App.less
+++ b/src/styles/App.less
@@ -118,16 +118,16 @@ html {
flex: auto;
}
-.menu_title,
+.menu-title,
.chart-footer {
display: flex;
}
-.submit_button {
- display: flex;
- align-items: center;
- padding: 20px;
+.submit-button {
border-radius: 5px;
+ font-weight: bold;
+ text-align: center;
+ margin: 0 5px 5px 0;
}
.well_menu {
@@ -140,3 +140,8 @@ html {
tr.table_row_size {
height: 10px;
}
+
+.filter-selector {
+ width: 50%;
+ margin-right: 5px;
+}