Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: multiple dashboard status messages #59

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ describe('Plugin', () => {
new Promise<ValuesResponse>((resolve) => {
const to = ZonedDateTime.now(ZoneId.UTC)
getValues(
plugin.skInfluxes[0],
plugin.skInfluxes()[0],
TESTCONTEXT as Context,
from,
to,
Expand Down
8 changes: 4 additions & 4 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface InfluxPlugin {
getValues: (params: QueryParams) => Promise<Array<unknown>>
getSelfValues: (params: Omit<QueryParams, 'context'>) => Promise<Array<unknown>>
flush: () => Promise<unknown>
skInfluxes: SKInflux[]
skInfluxes: () => SKInflux[]
}

export interface PluginConfig {
Expand All @@ -71,7 +71,7 @@ export default function InfluxPluginFactory(app: App): Plugin & InfluxPlugin {
delete writeOptionsProps.writeSuccess
const selfContext = 'vessels.' + app.selfId

const skInfluxes: SKInflux[] = []
let skInfluxes: SKInflux[] = []
let onStop: (() => void)[] = []
return {
start: function (config: PluginConfig) {
Expand All @@ -85,7 +85,7 @@ export default function InfluxPluginFactory(app: App): Plugin & InfluxPlugin {
.join(';'),
)
}
skInfluxes.push(...config.influxes.map((config: SKInfluxConfig) => new SKInflux(config, app, updatePluginStatus)))
skInfluxes = config.influxes.map((config: SKInfluxConfig) => new SKInflux(config, app, updatePluginStatus))
registerHistoryApiRoute(app, skInfluxes[0], app.selfId, app.debug)

onStop = []
Expand Down Expand Up @@ -136,6 +136,6 @@ export default function InfluxPluginFactory(app: App): Plugin & InfluxPlugin {
name: packageInfo.description,
description: 'Signal K integration with InfluxDb 2',
schema,
skInfluxes,
skInfluxes: () => skInfluxes,
}
}
Loading