Skip to content

Commit

Permalink
Fixed issue #19. Fixed main chart labels in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
opengs committed Dec 16, 2023
1 parent 06effe5 commit 6848b28
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
7 changes: 7 additions & 0 deletions lib/module/db1000n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ export class DB1000N extends Module<Config> {
} else {
const now = new Date()
const timeDiff = (now.getTime() - lastStatisticsEvent.getTime()) / 1000.0

// Bugfix [https://github.com/opengs/itarmykit/issues/19]. When PC goes to sleep mode, timediff is huge and not relevant
if (timeDiff > 60) {
lastStatisticsEvent = new Date()
continue
}

if (timeDiff > 0) {
currentSendBitrate = bytesSend * 1.0 / timeDiff
}
Expand Down
7 changes: 7 additions & 0 deletions lib/module/mhddosproxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ export class MHDDOSProxy extends Module<Config> {
if (lastStatisticsEvent != null) {
const now = new Date()
const timeDiff = (now.getTime() - lastStatisticsEvent.getTime()) / 1000.0

// Bugfix [https://github.com/opengs/itarmykit/issues/19]. When PC goes to sleep mode, timediff is huge and not relevant
if (timeDiff > 60) {
lastStatisticsEvent = new Date()
continue
}

if (timeDiff > 0) {
bytesSend = currentSendBitrate * timeDiff
}
Expand Down
2 changes: 1 addition & 1 deletion src-electron/electron-main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, nativeTheme, nativeImage } from 'electron'
import { app, BrowserWindow, nativeTheme, nativeImage, ipcMain } from 'electron'
import path from 'path'
import os from 'os'

Expand Down
20 changes: 16 additions & 4 deletions src/pages/dashboard/BitrateChartComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { ExecutionLogEntry } from 'app/src-electron/handlers/engine';
import { IpcRendererEvent } from 'electron';
import { onMounted, onUnmounted, ref, computed } from 'vue';
import VueApexCharts from 'vue3-apexcharts'
import { useQuasar } from 'quasar';
const $q = useQuasar()
function humanBytesString(bytes: number, dp=1) {
const thresh = 1000;
Expand Down Expand Up @@ -49,7 +52,10 @@ const chartOptions = computed (() => { return {
type: 'area',
zoom: {
autoScaleYaxis: true
}
},
toolbar: {
show: false
},
},
annotations: {
xaxis: executionEvents.value.map((e) => {
Expand Down Expand Up @@ -78,13 +84,19 @@ const chartOptions = computed (() => { return {
xaxis: {
type: 'datetime',
labels: {
datetimeUTC: false
datetimeUTC: false,
style: {
colors: ($q.dark.isActive ? '#fff' : '#000') ,
}
}
},
yaxis: {
labels: {
formatter: function (val: number) {
return humanBytesString(val) + "/s"
},
style: {
colors: ($q.dark.isActive ? '#fff' : '#000') ,
}
}
},
Expand All @@ -94,9 +106,9 @@ const chartOptions = computed (() => { return {
fill: {
type: 'gradient',
gradient: {
shadeIntensity: 1,
shadeIntensity: ($q.dark.isActive ? 0 : 1),
opacityFrom: 0.7,
opacityTo: 0.9,
opacityTo: ($q.dark.isActive ? 0 : 0.9),
stops: [0, 100]
}
},
Expand Down

0 comments on commit 6848b28

Please sign in to comment.