2023-07-14 10:34:23 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
import Models 1.0
|
|
|
|
|
2023-08-03 20:30:34 +00:00
|
|
|
import Storybook 1.0
|
|
|
|
|
2023-07-14 10:34:23 +00:00
|
|
|
SplitView {
|
2023-08-03 20:30:34 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
orientation: Qt.Vertical
|
2023-07-14 10:34:23 +00:00
|
|
|
|
|
|
|
OverviewSettingsChart {
|
|
|
|
id: chart
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
2023-08-03 20:30:34 +00:00
|
|
|
onCollectCommunityMetricsMessagesCount: generateRandomModel(intervals)
|
|
|
|
}
|
|
|
|
|
|
|
|
function generateRandomModel(intervalsStr) {
|
|
|
|
if(!intervalsStr) return
|
|
|
|
|
|
|
|
var response = {
|
|
|
|
communityId: "",
|
|
|
|
metricsType: timestampMetrics.checked ? "MessagesTimestamps" : "MessagesCount",
|
|
|
|
intervals: []
|
|
|
|
}
|
2023-07-14 10:34:23 +00:00
|
|
|
|
2023-08-03 20:30:34 +00:00
|
|
|
var intervals = JSON.parse(intervalsStr)
|
|
|
|
|
|
|
|
response.intervals = intervals.map( x => {
|
|
|
|
var timestamps = generateRandomDate(x.startTimestamp, x.endTimestamp, Math.random() * 10)
|
|
|
|
|
|
|
|
return {
|
|
|
|
startTimestamp: x.startTimestamp,
|
|
|
|
endTimestamp: x.endTimestamp,
|
|
|
|
timestamps: timestamps,
|
|
|
|
count: timestamps.length
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
chart.model = response
|
2023-07-14 10:34:23 +00:00
|
|
|
}
|
|
|
|
|
2023-08-03 20:30:34 +00:00
|
|
|
function generateRandomDate(from, to, count) {
|
2023-07-14 10:34:23 +00:00
|
|
|
var newModel = []
|
2023-08-03 20:30:34 +00:00
|
|
|
for(var i = 0; i < count; i++) {
|
|
|
|
var date = from + Math.random() * (to - from)
|
2023-07-14 10:34:23 +00:00
|
|
|
newModel.push(date)
|
|
|
|
}
|
|
|
|
return newModel
|
|
|
|
}
|
|
|
|
|
2023-08-03 20:30:34 +00:00
|
|
|
LogsAndControlsPanel {
|
|
|
|
id: logsAndControlsPanel
|
|
|
|
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 150
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: timestampMetrics
|
|
|
|
text: "Metrics using timestamps"
|
|
|
|
checked: false
|
|
|
|
onCheckedChanged: chart.reset()
|
|
|
|
}
|
2023-07-14 10:34:23 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Panels
|
2023-10-03 11:56:30 +00:00
|
|
|
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba⎜Desktop?type=design&node-id=31281-635619&mode=design&t=RYpVRgwqCjp8fUEX-0
|