mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-30 01:42:19 +00:00
2.5.42: wifi scan download filename fix
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ucentral-client",
|
||||
"version": "2.5.41",
|
||||
"version": "2.5.42",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ucentral-client",
|
||||
"version": "2.5.41",
|
||||
"version": "2.5.42",
|
||||
"dependencies": {
|
||||
"@coreui/coreui": "^3.4.0",
|
||||
"@coreui/icons": "^2.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ucentral-client",
|
||||
"version": "2.5.41",
|
||||
"version": "2.5.42",
|
||||
"dependencies": {
|
||||
"@coreui/coreui": "^3.4.0",
|
||||
"@coreui/icons": "^2.0.1",
|
||||
|
||||
@@ -5,12 +5,14 @@ import { CButton, CModal, CModalHeader, CModalBody, CModalTitle, CPopover } from
|
||||
import CIcon from '@coreui/icons-react';
|
||||
import { cilCloudDownload, cilX } from '@coreui/icons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { prettyDate } from 'utils/helper';
|
||||
import { prettyDate, prettyDateForFile } from 'utils/helper';
|
||||
import { useDevice } from 'ucentral-libs';
|
||||
import { CSVLink } from 'react-csv';
|
||||
import WifiChannelTable from './WifiChannelTable';
|
||||
|
||||
const WifiScanResultModal = ({ show, toggle, scanResults, date }) => {
|
||||
const { t } = useTranslation();
|
||||
const { deviceSerialNumber } = useDevice();
|
||||
|
||||
const getData = useCallback(() => {
|
||||
if (scanResults === null || scanResults.length === 0) return [];
|
||||
@@ -90,7 +92,12 @@ const WifiScanResultModal = ({ show, toggle, scanResults, date }) => {
|
||||
</CModalTitle>
|
||||
<div className="text-right">
|
||||
<CPopover content={t('common.download')}>
|
||||
<CSVLink data={getData()}>
|
||||
<CSVLink
|
||||
filename={`wifi_scan_${deviceSerialNumber}_${
|
||||
date !== '' ? prettyDateForFile(date) : ''
|
||||
}`}
|
||||
data={getData()}
|
||||
>
|
||||
<CButton color="primary" variant="outline" className="ml-2">
|
||||
<CIcon content={cilCloudDownload} />
|
||||
</CButton>
|
||||
|
||||
@@ -28,6 +28,15 @@ export const prettyDate = (dateString) => {
|
||||
date.getSeconds(),
|
||||
)}`;
|
||||
};
|
||||
export const prettyDateForFile = (dateString) => {
|
||||
const convertedTimestamp = unixToDateString(dateString);
|
||||
const date = new Date(convertedTimestamp);
|
||||
return `${date.getFullYear()}_${prettyNumber(date.getMonth() + 1)}_${prettyNumber(
|
||||
date.getDate(),
|
||||
)}_${prettyNumber(date.getHours())}h${prettyNumber(date.getMinutes())}m${prettyNumber(
|
||||
date.getSeconds(),
|
||||
)}s`;
|
||||
};
|
||||
|
||||
export const unixToTime = (dateString) => {
|
||||
const convertedTimestamp = unixToDateString(dateString);
|
||||
|
||||
Reference in New Issue
Block a user