Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
import {axios} from "../../../utils";
2
import React, { useEffect, useState } from "react";
3
import { useDispatch } from "react-redux";
4
import { addNotification } from "../../../redux/notification/notification.actions";
5
import MaterialTable from "../../../shared/materialTable/MaterialTable";
6
 
7
const DevicesColumns = [
8
  {
9
    field: "platform",
10
    headerName: "Plataforma",
11
  },
12
  {
13
    field: "brand",
14
    headerName: "Marca",
15
  },
16
  {
17
    field: "manufacturer",
18
    headerName: "Fabricante",
19
  },
20
  {
21
    field: "model",
22
    headerName: "Modelo",
23
  },
24
  {
25
    field: "version",
26
    headerName: "Versión",
27
  },
28
  {
29
    field: "ip",
30
    headerName: "IP",
31
  },
32
  {
33
    field: "updated_on",
34
    headerName: "Fecha",
35
  },
36
];
37
 
38
const Devices = ({ routeDevices }) => {
39
  const dispatch = useDispatch();
40
 
41
  const [Devices, setDevicesData] = useState({});
42
 
43
  useEffect(async () => {
44
    const resData = (await axios.get(routeDevices)).data;
45
    if (!resData.success) {
46
      return dispatch(
47
        addNotification({
48
          style: "danger",
49
          msg: "Ha ocurrido un error, por favor recargue la pagina",
50
        })
51
      );
52
    }
53
    setDevicesData(resData.data);
54
  }, []);
55
 
56
  return (
57
    <div className="acc-setting">
58
      <h3>Navegadores</h3>
59
      <div
60
        className="cp-field"
61
        style={{
62
          marginBottom: "1rem",
63
        }}
64
      >
65
        <MaterialTable
66
          columns={DevicesColumns}
67
          rows={Devices.items}
68
          count={Devices.total}
69
        />
70
      </div>
71
    </div>
72
  );
73
};
74
 
75
export default Devices;