Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed Jun 2, 2024
1 parent 4c8fa12 commit 20fd87a
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 35 deletions.
24 changes: 18 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
ActiveResourcePropertiesModal,
TracksModal,
ResourceSetModal,
ResourceSetFeatureModal,
ResourceImportDialog,
WeatherForecastModal
} from 'src/app/modules';
Expand Down Expand Up @@ -132,7 +133,7 @@ export class AppComponent {
public alarmsFacade: AlarmsFacade,
private stream: SKStreamFacade,
public skres: SKResources,
public skOtherRes: SKOtherResources,
public skresOther: SKOtherResources,
public signalk: SignalKClient,
private dom: DomSanitizer,
private overlayContainer: OverlayContainer,
Expand Down Expand Up @@ -464,7 +465,7 @@ export class AppComponent {
this.bottomSheet
.open(ResourceSetModal, {
disableClose: true,
data: { path: e.choice, skres: this.skOtherRes }
data: { path: e.choice, skres: this.skresOther }
})
.afterDismissed()
.subscribe(() => {
Expand Down Expand Up @@ -1244,9 +1245,7 @@ export class AppComponent {
public featureProperties(e: { id: string; type: string }) {
let v: FBRoute | SKVessel | SKSaR | SKAircraft | SKAtoN;
if (e.type === 'route') {
v = this.app.data.routes.filter((i) => {
return e.id === i[0] ? true : false;
})[0];
v = this.skres.fromCache('routes', e.id);
if (v) {
this.bottomSheet
.open(ActiveResourcePropertiesModal, {
Expand Down Expand Up @@ -1318,6 +1317,19 @@ export class AppComponent {
}
} else if (e.type === 'alarm') {
this.openAlarmsDialog();
} else if (e.type === 'rset') {
v = this.skres.resSetFromCache(e.id);
if (v) {
this.bottomSheet
.open(ResourceSetFeatureModal, {
disableClose: true,
data: { id: e.id, skres: v }
})
.afterDismissed()
.subscribe(() => {
this.focusMap();
});
}
} else {
v =
e.type === 'self'
Expand Down Expand Up @@ -1628,7 +1640,7 @@ export class AppComponent {
fetchOtherResources(onlySelected = false) {
this.skres.getTracks(onlySelected);
this.app.config.resources.paths.forEach((i) => {
this.skOtherRes.getItems(i, onlySelected);
this.skresOther.getItems(i, onlySelected);
});
}

Expand Down
17 changes: 9 additions & 8 deletions src/app/lib/components/measurements.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ import { MatToolbarModule } from '@angular/material/toolbar';
],
template: `
<div class="_ap_measurements">
<mat-toolbar style="background-color: #00796b; color: white; padding: 0 5px;">
<mat-toolbar
style="background-color: #00796b; color: white; padding: 0 5px;"
>
<div class="_ap_row">
<div class="_ap_row">
<div class="icon-label">
<mat-icon>straighten</mat-icon>
</div>
<div class="value">
{{ totalDistance }}<br>
</div>
<div class="value">{{ totalDistance }}<br /></div>
</div>
<div class="_ap_row">
<div class="_ap_row">
<div style="font-size: 12pt;">
<mat-icon>square_foot</mat-icon><br>
<mat-icon>square_foot</mat-icon><br />
{{
this.coords.length < 2
? '-'
Expand All @@ -54,7 +54,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
}}
</div>
<div class="value">
{{ legDistance }}<br>
{{ legDistance }}<br />
{{ legBearing }}
</div>
</div>
Expand All @@ -71,6 +71,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
</div>
</div>
</mat-toolbar>
</div>
`,
styles: [
`
Expand All @@ -96,11 +97,11 @@ import { MatToolbarModule } from '@angular/material/toolbar';
padding-right: 10px;
}
@media only screen and (max-width: 500px) {
@media only screen and (max-width: 500px) {
._ap_measurements {
left: 0;
width: 100%;
}
}
}
`
]
Expand Down
14 changes: 8 additions & 6 deletions src/app/modules/alarms/alarms.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@ export class AlarmsFacade {

muteAlarm(id: string) {
this.alarms.get(id)['muted'] = true;
this.signalk.api.post(this.app.skApiVersion,`alarms/${id}/silence`, undefined).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error silencing alarm: ${id}`, err);
}
);
this.signalk.api
.post(this.app.skApiVersion, `alarms/${id}/silence`, undefined)
.subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error silencing alarm: ${id}`, err);
}
);
}

unMuteAlarm(id: string) {
Expand Down
28 changes: 16 additions & 12 deletions src/app/modules/alarms/components/alarms-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,25 @@ export class AlarmsDialog implements OnInit {
}

raise(alarmType: string) {
this.signalk.api.post(this.app.skApiVersion,`alarms/${alarmType}`, undefined).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error raising alarm: ${alarmType}`, err);
}
);
this.signalk.api
.post(this.app.skApiVersion, `alarms/${alarmType}`, undefined)
.subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error raising alarm: ${alarmType}`, err);
}
);
this.dialogRef.close();
}

clear(alarmType: string) {
this.signalk.api.delete(this.app.skApiVersion,`alarms/${alarmType}`).subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error clearing alarm: ${alarmType}`, err);
}
);
this.signalk.api
.delete(this.app.skApiVersion, `alarms/${alarmType}`)
.subscribe(
() => undefined,
(err: HttpErrorResponse) => {
console.warn(`Error clearing alarm: ${alarmType}`, err);
}
);
}
}
4 changes: 1 addition & 3 deletions src/app/modules/skresources/lists/chartlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ export class ChartListComponent {
}

itemProperties(id: string) {
const ch = this.charts.filter((c: FBChart) => {
return c[0] === id ? true : false;
})[0][1];
const ch = this.charts.filter((c: FBChart) => c[0] === id)[0][1];
this.dialog.open(ChartInfoDialog, { data: ch });
}

Expand Down

0 comments on commit 20fd87a

Please sign in to comment.