-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7086 from TheThingsNetwork/feature/network-activi…
…ty-panel Blurry network activity panel
- Loading branch information
Showing
19 changed files
with
434 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...webui/console/components/blurry-network-activity-panel/blurry-network-activity-panel.styl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright © 2024 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
.panel | ||
height: 100% | ||
display: flex | ||
flex-direction: column | ||
position: relative | ||
|
||
.content | ||
position: relative | ||
height: 100% | ||
min-height: 15rem | ||
margin-top: $cs.xl | ||
|
||
.upseller | ||
height: 100% | ||
background-image: url('../../../assets/misc/blurry-heatmap-big.png') | ||
background-repeat: no-repeat | ||
background-size: 100% 100% | ||
transition: background-image $ad.m | ||
display: flex | ||
flex-direction: column | ||
justify-content: center | ||
align-items: center | ||
&.small | ||
background-image: url('../../../assets/misc/blurry-heatmap-small.png') | ||
|
||
.chart-date | ||
color: var(--c-text-neutral-light) | ||
font-size: $fs.s | ||
|
84 changes: 84 additions & 0 deletions
84
pkg/webui/console/components/blurry-network-activity-panel/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright © 2024 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import React, { useCallback, useState } from 'react' | ||
import classnames from 'classnames' | ||
|
||
import { IconChartBar, IconBolt } from '@ttn-lw/components/icon' | ||
import Panel from '@ttn-lw/components/panel' | ||
import Toggle from '@ttn-lw/components/panel/toggle' | ||
import Button from '@ttn-lw/components/button' | ||
|
||
import Message from '@ttn-lw/lib/components/message' | ||
|
||
import sharedMessages from '@ttn-lw/lib/shared-messages' | ||
|
||
import style from './blurry-network-activity-panel.styl' | ||
|
||
const toggleOptions = [ | ||
{ label: sharedMessages.packetsPerDataRate, value: 0 }, | ||
{ label: sharedMessages.packetsPerChannel, value: 1 }, | ||
] | ||
|
||
const BlurryNetworkActivityPanel = () => { | ||
const [activeToggle, setActiveToggle] = useState(0) | ||
|
||
const handleToggleChange = useCallback((_, value) => { | ||
setActiveToggle(value) | ||
}, []) | ||
|
||
return ( | ||
<Panel | ||
title={sharedMessages.networkActivity} | ||
icon={IconChartBar} | ||
shortCutLinkTitle={sharedMessages.noc} | ||
shortCutLinkPath="#" | ||
shortCutLinkTarget="_blank" | ||
shortCutLinkDisabled | ||
className={style.panel} | ||
> | ||
<Toggle | ||
options={toggleOptions} | ||
active={activeToggle} | ||
onToggleChange={handleToggleChange} | ||
fullWidth | ||
/> | ||
<div className={style.content}> | ||
<div | ||
className={classnames(style.upseller, { | ||
[style.small]: activeToggle === 0, | ||
})} | ||
> | ||
<Message | ||
className="c-text-neutral-heavy fw-bold fs-l text-center" | ||
content={sharedMessages.unlockTheNoc} | ||
/> | ||
<Message | ||
className="c-text-neutral-light fs-m text-center mb-cs-l" | ||
content={sharedMessages.quicklyTroubleshoot} | ||
/> | ||
<Button.AnchorLink | ||
primary | ||
message={sharedMessages.upgradeNow} | ||
icon={IconBolt} | ||
href="https://www.thethingsindustries.com/stack/plans/" | ||
target="_blank" | ||
/> | ||
</div> | ||
</div> | ||
</Panel> | ||
) | ||
} | ||
|
||
export default BlurryNetworkActivityPanel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright © 2024 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
const options = { | ||
chart: { | ||
type: 'heatmap', | ||
toolbar: { | ||
show: false, | ||
}, | ||
animations: { | ||
enabled: false, | ||
}, | ||
zoom: { | ||
enabled: false, | ||
}, | ||
events: { | ||
mounted: chart => { | ||
chart.windowResizeHandler() | ||
}, | ||
}, | ||
}, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
colors: ['#152F66'], | ||
grid: { | ||
show: false, | ||
strokeDashArray: 0, | ||
padding: { | ||
left: 0, | ||
right: 0, | ||
bottom: -13, | ||
top: -30, | ||
}, | ||
}, | ||
yaxis: { | ||
labels: { | ||
align: 'left', | ||
offsetX: 10, | ||
}, | ||
}, | ||
xaxis: { | ||
labels: { | ||
show: false, | ||
}, | ||
axisBorder: { | ||
show: false, | ||
}, | ||
tooltip: { | ||
enabled: false, | ||
}, | ||
}, | ||
tooltip: { | ||
x: { | ||
show: false, | ||
}, | ||
marker: { | ||
show: false, | ||
}, | ||
custom: ({ series, seriesIndex, dataPointIndex, w }) => { | ||
const val = series[seriesIndex][dataPointIndex] | ||
const date = new Date(w.globals.seriesX[seriesIndex][dataPointIndex]) | ||
const formattedDate = date.toLocaleDateString('en-US', { | ||
month: '2-digit', | ||
day: '2-digit', | ||
}) | ||
const formattedTime = date.toLocaleTimeString('en-US', { | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
hour12: false, | ||
}) | ||
return `<div class="pl-cs-s pr-cs-s pt-cs-xs pb-cs-xs"><strong>${formattedDate} ${formattedTime}</strong>: ${val}</div>` | ||
}, | ||
}, | ||
} | ||
|
||
export default options |
Oops, something went wrong.