@mxtommy/kip
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "@mxtommy/kip", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -29,2 +29,5 @@ # Kip | ||
* Radial/Linear Gauge Zones | ||
* Hash based routing to be friendly to node server *Done! | ||
* Boolean state widget | ||
* Attitude Indicator | ||
@@ -31,0 +34,0 @@ ### V0.3 |
@@ -53,5 +53,11 @@ import { Injectable } from '@angular/core'; | ||
if (localStorage.getItem('signalKData') == null) { | ||
localStorage.setItem('signalKData', JSON.stringify(BlankConfig)); | ||
this.setDefaultConfig(); | ||
} | ||
this.loadSettings(); | ||
} | ||
loadSettings() { | ||
let storageObject: appSettings = JSON.parse(localStorage.getItem('signalKData')); | ||
@@ -66,3 +72,2 @@ this.signalKUrl.next(storageObject['signalKUrl']); | ||
this.derivations = storageObject.derivations; | ||
} | ||
@@ -72,4 +77,2 @@ | ||
// SignalKURL | ||
@@ -170,7 +173,2 @@ getSignalKURLAsO() { | ||
replaceConfig(jsonConfig:string) { | ||
localStorage.setItem('signalKData', jsonConfig); | ||
this.router.navigate(['/']); | ||
location.reload(); | ||
} | ||
@@ -182,9 +180,26 @@ saveToLocalStorage() { | ||
resetSettings() { | ||
this.replaceConfig(JSON.stringify(BlankConfig)); | ||
localStorage.removeItem("signalKData"); | ||
this.reloadApp(); | ||
} | ||
replaceConfig(newConfig: string) { | ||
localStorage.setItem('signalKData', newConfig); | ||
this.reloadApp(); | ||
} | ||
loadDemoConfig() { | ||
this.replaceConfig(JSON.stringify(DemoConfig)); | ||
this.replaceConfig(JSON.stringify(DemoConfig)); | ||
} | ||
reloadApp() { | ||
this.router.navigate(['/']); | ||
setTimeout(()=>{ location.reload() }, 200); | ||
} | ||
setDefaultConfig() { | ||
let config = BlankConfig; | ||
config.signalKUrl = window.location.origin; | ||
localStorage.setItem('signalKData', JSON.stringify(config)); | ||
} | ||
} |
@@ -59,3 +59,4 @@ import { BrowserModule } from '@angular/platform-browser'; | ||
import { WidgetTutorialComponent } from './widget-tutorial/widget-tutorial.component'; | ||
import { ResetConfigComponent } from './reset-config/reset-config.component' | ||
import { ResetConfigComponent } from './reset-config/reset-config.component'; | ||
import { WidgetStateComponent, WidgetStateModalComponent } from './widget-state/widget-state.component' | ||
@@ -103,3 +104,5 @@ | ||
WidgetTutorialComponent, | ||
ResetConfigComponent | ||
ResetConfigComponent, | ||
WidgetStateComponent, | ||
WidgetStateModalComponent | ||
], | ||
@@ -110,3 +113,3 @@ imports: [ | ||
HttpClientModule, | ||
RouterModule.forRoot(appRoutes, { /*enableTracing: true */ } ), | ||
RouterModule.forRoot(appRoutes, { useHash: true /* , enableTracing: true */ } ), | ||
AngularSplitModule, | ||
@@ -135,2 +138,3 @@ BrowserAnimationsModule, | ||
WidgetGaugeComponent, | ||
WidgetStateComponent, | ||
WidgetTutorialComponent, | ||
@@ -145,3 +149,4 @@ | ||
SettingsDerivedModalComponent, | ||
SettingsDatasetsModalComponent | ||
SettingsDatasetsModalComponent, | ||
WidgetStateModalComponent | ||
], | ||
@@ -148,0 +153,0 @@ providers: [ |
export const BlankConfig = { | ||
"signalKUrl": "http://demo.signalk.org/signalk", | ||
"signalKUrl": "", // get's overwritten with host | ||
"themeName": "default-light", | ||
@@ -4,0 +4,0 @@ "widgets": [ |
export const DemoConfig = { | ||
"signalKUrl": "http://demo.signalk.org/signalk", | ||
"signalKUrl": "http://demo.signalk.org", | ||
"themeName": "default-light", | ||
@@ -6,0 +6,0 @@ "widgets": [ |
@@ -124,3 +124,9 @@ import { Injectable } from '@angular/core'; | ||
this.http.get<signalKEndpointResponse>(this.signalKURL, {observe: 'response'}).subscribe( | ||
let fullURL = this.signalKURL; | ||
let re = new RegExp("signalk/?$"); | ||
if (!re.test(fullURL)) { | ||
fullURL = fullURL + "/signalk/"; | ||
} | ||
this.http.get<signalKEndpointResponse>(fullURL, {observe: 'response'}).subscribe( | ||
// when we go ok, this runs | ||
@@ -127,0 +133,0 @@ response => { |
@@ -26,5 +26,4 @@ import { Injectable } from '@angular/core'; | ||
if (typeof(data) == 'boolean') { return; } //wilhelmsk has some boolean stuff, not needed for now to support boolean... | ||
if ( (typeof(data) == 'string') || (typeof(data) == 'number')) { // is it a simple value? | ||
if ( (typeof(data) == 'string') || (typeof(data) == 'number') || (typeof(data) == 'boolean')) { // is it a simple value? | ||
let timestamp = Date.now(); | ||
@@ -31,0 +30,0 @@ let source = 'noSource' |
@@ -10,2 +10,3 @@ import { Injectable } from '@angular/core'; | ||
import { WidgetGaugeComponent } from './widget-gauge/widget-gauge.component'; | ||
import { WidgetStateComponent } from './widget-state/widget-state.component'; | ||
import { WidgetTutorialComponent } from './widget-tutorial/widget-tutorial.component'; | ||
@@ -46,2 +47,7 @@ | ||
{ | ||
name: 'WidgetStateComponent', | ||
componentName: WidgetStateComponent, | ||
description: 'State (boolean) Value', | ||
}, | ||
{ | ||
name: 'WidgetGaugeComponent', | ||
@@ -48,0 +54,0 @@ componentName: WidgetGaugeComponent, |
@@ -61,3 +61,3 @@ import { Component, Input, OnInit, OnDestroy, Inject } from '@angular/core'; | ||
this.widgetConfig = this.activeWidget.config; // load existing config. | ||
}0 | ||
} | ||
this.subscribePath(); | ||
@@ -64,0 +64,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8456228
253
41287
44