Skip to content

Commit

Permalink
Fix alarm not clearing.
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed May 28, 2024
1 parent 4ea3a7e commit a3527ff
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG: Freeboard

### v2.8.1

- **Fixed**: Unable to clearing alarms on server v2.8 or greater due to 'DELETE' requests not being passed to plugins.

### v2.8.0

- **Added**: Option to display laylines when destination is active. (#149)
Expand Down
2 changes: 1 addition & 1 deletion helper/alarms/alarms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const STANDARD_ALARMS = [

let server: FreeboardHelperApp;
let pluginId: string;
const ALARM_API_PATH = '/signalk/v1/api/alarms';
const ALARM_API_PATH = '/signalk/v2/api/alarms';

export const initAlarms = (app: FreeboardHelperApp, id: string) => {
server = app;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signalk/freeboard-sk",
"version": "2.8.0",
"version": "2.8.1",
"description": "Openlayers chart plotter implementation for Signal K",
"keywords": [
"signalk-webapp",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class AppInfo extends Info {
this.name = 'Freeboard-SK';
this.shortName = 'Freeboard';
this.description = `Signal K Chart Plotter.`;
this.version = '2.8.0';
this.version = '2.8.1';
this.url = 'https://github.com/signalk/freeboard-sk';
this.logo = './assets/img/app_logo.png';

Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/alarms/alarms.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class AlarmsFacade {

muteAlarm(id: string) {
this.alarms.get(id)['muted'] = true;
this.signalk.api.post(`alarms/${id}/silence`, undefined).subscribe(
this.signalk.api.post(this.app.skApiVersion,`alarms/${id}/silence`, undefined).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error silencing alarm: ${id}`, err);
Expand Down
6 changes: 4 additions & 2 deletions src/app/modules/alarms/components/alarms-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Subscription } from 'rxjs';
import { SignalKClient } from 'signalk-client-angular';
import { AlarmsFacade } from '../alarms.facade';
import { AppInfo } from 'src/app/app.info';

/********* AlarmsDialog *********
data: {
Expand Down Expand Up @@ -90,6 +91,7 @@ export class AlarmsDialog implements OnInit {
private obs: Subscription;

constructor(
private app: AppInfo,
private signalk: SignalKClient,
private facade: AlarmsFacade,
public dialogRef: MatDialogRef<AlarmsDialog>,
Expand Down Expand Up @@ -202,7 +204,7 @@ export class AlarmsDialog implements OnInit {
}

raise(alarmType: string) {
this.signalk.api.post(`alarms/${alarmType}`, undefined).subscribe(
this.signalk.api.post(this.app.skApiVersion,`alarms/${alarmType}`, undefined).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error raising alarm: ${alarmType}`, err);
Expand All @@ -212,7 +214,7 @@ export class AlarmsDialog implements OnInit {
}

clear(alarmType: string) {
this.signalk.api.delete(`alarms/${alarmType}`).subscribe(
this.signalk.api.delete(this.app.skApiVersion,`alarms/${alarmType}`).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error clearing alarm: ${alarmType}`, err);
Expand Down

0 comments on commit a3527ff

Please sign in to comment.