Compare commits

...

2 Commits

Author SHA1 Message Date
Orne Brocaar
5418218aa1 ui: Run make format to format ui code. 2024-08-28 14:42:16 +01:00
Orne Brocaar
29b5c3de1c ui: Fix tooltip date formatting.
With the migration from moment to date-fns (#460) some of the formatting
strings were not updated accordingly.

Fixes #503.
2024-08-28 14:41:43 +01:00
3 changed files with 10 additions and 11 deletions

View File

@@ -15,16 +15,16 @@ interface IProps {
function MetricChart(props: IProps) { function MetricChart(props: IProps) {
let unit: TimeUnit = "hour"; let unit: TimeUnit = "hour";
let tooltipFormat = "LT"; let tooltipFormat = "p";
if (props.aggregation === Aggregation.DAY) { if (props.aggregation === Aggregation.DAY) {
unit = "day"; unit = "day";
tooltipFormat = "MMM Do"; tooltipFormat = "MMM d";
} else if (props.aggregation === Aggregation.MONTH) { } else if (props.aggregation === Aggregation.MONTH) {
unit = "month"; unit = "month";
tooltipFormat = "MMM YYYY"; tooltipFormat = "MMM yyyy";
} else if (props.aggregation === Aggregation.MINUTE) { } else if (props.aggregation === Aggregation.MINUTE) {
unit = "minute"; unit = "minute";
tooltipFormat = "LT"; tooltipFormat = "p";
} }
const animation = false as const; const animation = false as const;
@@ -59,8 +59,6 @@ function MetricChart(props: IProps) {
.sort((a, b) => a.getLabel().localeCompare(b.getLabel())) .sort((a, b) => a.getLabel().localeCompare(b.getLabel()))
.map((v, i) => { .map((v, i) => {
const colors = palette("cb-Paired", props.metric.getDatasetsList().length).map((hex: string) => "#" + hex); const colors = palette("cb-Paired", props.metric.getDatasetsList().length).map((hex: string) => "#" + hex);
console.log(v.getLabel());
console.log(colors[i]);
return { return {
label: v.getLabel(), label: v.getLabel(),

View File

@@ -87,8 +87,9 @@ function ListDevices(props: IProps) {
width: 250, width: 250,
render: (text, record) => ( render: (text, record) => (
<Link <Link
to={`/tenants/${props.application.getTenantId()}/applications/${props.application.getId()}/devices/${record.devEui to={`/tenants/${props.application.getTenantId()}/applications/${props.application.getId()}/devices/${
}`} record.devEui
}`}
> >
{text} {text}
</Link> </Link>
@@ -179,7 +180,7 @@ function ListDevices(props: IProps) {
req.setMulticastGroupId(mgSelected); req.setMulticastGroupId(mgSelected);
req.setDevEui(devEui); req.setDevEui(devEui);
MulticastGroupStore.addDevice(req, () => { }); MulticastGroupStore.addDevice(req, () => {});
} }
setMgModalVisible(false); setMgModalVisible(false);
@@ -191,7 +192,7 @@ function ListDevices(props: IProps) {
req.setRelayDevEui(relaySelected); req.setRelayDevEui(relaySelected);
req.setDeviceDevEui(devEui); req.setDeviceDevEui(devEui);
RelayStore.addDevice(req, () => { }); RelayStore.addDevice(req, () => {});
} }
setRelayModalVisible(false); setRelayModalVisible(false);

View File

@@ -179,7 +179,7 @@ function ListGateways(props: IProps) {
req.setMulticastGroupId(mgSelected); req.setMulticastGroupId(mgSelected);
req.setGatewayId(gatewayId); req.setGatewayId(gatewayId);
MulticastGroupStore.addGateway(req, () => { }); MulticastGroupStore.addGateway(req, () => {});
} }
setMgModalVisible(false); setMgModalVisible(false);