@mxtommy/kip 3.0.2-beta.9 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -388
- package/README.md +3 -0
- package/package.json +1 -1
- package/public/assets/screenshot-540x720.png +0 -0
- package/public/assets/screenshot-720x540.png +0 -0
- package/public/{chunk-LPWOW5XL.js → chunk-5DXBSI3U.js} +1 -1
- package/public/{chunk-UR533PV7.js → chunk-6XNAATXC.js} +1 -1
- package/public/{chunk-OIOAF5VL.js → chunk-BHXOUGEH.js} +1 -1
- package/public/{chunk-YKX6CUZZ.js → chunk-CU7EEHLK.js} +8 -8
- package/public/{chunk-X2BELKUK.js → chunk-G2RDI5CW.js} +1 -1
- package/public/chunk-P2NQVKWN.js +1 -0
- package/public/{chunk-WOZMVUVV.js → chunk-S2QRZEAO.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-ML2RV63G.js → main-AU7ZMZ6I.js} +14 -14
- package/public/chunk-DLFK64UP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-LTMJXHF3.js";import{g as l}from"./chunk-FCC7GNHD.js";import"./chunk-SGYCFQGT.js";import{a as g}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-LTMJXHF3.js";import{g as l}from"./chunk-FCC7GNHD.js";import"./chunk-SGYCFQGT.js";import{a as g}from"./chunk-P2NQVKWN.js";import"./chunk-RCSPPHLA.js";import{g as a,n as r}from"./chunk-AHFD2AA5.js";import{Hb as s,ua as t}from"./chunk-JIJMSRKJ.js";var v=(()=>{class o{dialog=t(l);auth=t(r);appService=t(g);appSettingsService=t(a);connectionConfig=null;ngOnInit(){this.connectionConfig=this.appSettingsService.getConnectionConfig(),this.openUserCredentialModal("Sign in failed: Incorrect user/password. Enter valide credentials or access the Confifuration/Settings menu, validate the server URL or/and disable the user Sign in option")}openUserCredentialModal(e){this.dialog.open(c,{disableClose:!0,data:{user:this.connectionConfig.loginName,password:this.connectionConfig.loginPassword,error:e}}).afterClosed().subscribe(i=>{i===void 0||!i||(this.connectionConfig.loginName=i.user,this.connectionConfig.loginPassword=i.password,this.appSettingsService.setConnectionConfig(this.connectionConfig),this.serverLogin())})}serverLogin(e){this.auth.login({usr:this.connectionConfig.loginName,pwd:this.connectionConfig.loginPassword,newUrl:e}).then(n=>{this.appSettingsService.reloadApp()}).catch(n=>{n.status==401?(this.openUserCredentialModal("Sign in failed: Invalide user/password. Enter valide credentials"),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==404?(this.appService.sendSnackbarNotification("Sign in failed: Login API not found at URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==0?(this.appService.sendSnackbarNotification("Sign in failed: Cannot reach server at Signal K URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: Cannot reach server at Signal K URL:"+n.message)):(this.appService.sendSnackbarNotification("Unknown authentication failure: "+JSON.stringify(n),5e3,!1),console.log("[Setting-SignalK Component] Unknown login error response: "+JSON.stringify(n)))})}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=s({type:o,selectors:[["app-widget-login"]],decls:0,vars:0,template:function(n,i){},encapsulation:2})}return o})();export{v as WidgetLoginComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as c,k as s,r as p}from"./chunk-AHFD2AA5.js";import{Va as i,cd as a,m as n,o as m,oa as g,ua as l}from"./chunk-JIJMSRKJ.js";var u="3.1.1";var D=(()=>{class o{MODE_PATH="self.environment.mode";configurableThemeColors=[{label:"Contrast",value:"contrast"},{label:"Blue",value:"blue"},{label:"Green",value:"green"},{label:"Orange",value:"orange"},{label:"Yellow",value:"yellow"},{label:"Pink",value:"pink"},{label:"Purple",value:"purple"},{label:"Grey",value:"grey"}];snackbarAppNotifications=new n;cssThemeColorRoles$=new m(null);_cssThemeColorRoles=null;_settings=l(c);_data=l(p);isNightMode=i(!1);_useAutoNightMode=s(this._settings.getAutoNightModeAsO(),{requireSync:!0});_theme=s(this._settings.getThemeNameAsO(),{requireSync:!0});_redNightMode=s(this._settings.getRedNightModeAsO(),{requireSync:!0});_environmentMode=s(this._data.subscribePath(this.MODE_PATH,"default"));appVersion=i(u);browserVersion=i("Unknown");osVersion=i("Unknown");constructor(){a(()=>{this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")}),a(()=>{let t=this._environmentMode().data.value;this._useAutoNightMode()&&(this.isNightMode.set(t==="night"),this.toggleDayNightMode())}),a(()=>{this._redNightMode()?this.toggleDayNightMode():this.toggleDayNightMode()}),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue(),this.browserVersion.set(this.getBrowserVersion()),this.osVersion.set(this.getOSVersion()),console.log("*********** KIP Version Information ***********"),console.log(`** App Version: ${this.appVersion()}`),console.log(`** Browser Version: ${this.browserVersion()}`),console.log(`** OS Version: ${this.osVersion()}`),console.log("***********************************************")}sendSnackbarNotification(t,e=1e4,r=!1){this.snackbarAppNotifications.next({message:t,duration:e,silent:r})}getSnackbarAppNotifications(){return this.snackbarAppNotifications.asObservable()}readThemeCssRoleVariables(){let t=document.body,e=getComputedStyle(t),r={background:e.getPropertyValue("--mat-sys-background").trim(),cardColor:e.getPropertyValue("--kip-widget-card-background-color").trim(),blue:e.getPropertyValue("--kip-blue-color").trim(),blueDim:e.getPropertyValue("--kip-blue-dim-color").trim(),blueDimmer:e.getPropertyValue("--kip-blue-dimmer-color").trim(),green:e.getPropertyValue("--kip-green-color").trim(),greenDim:e.getPropertyValue("--kip-green-dim-color").trim(),greenDimmer:e.getPropertyValue("--kip-green-dimmer-color").trim(),grey:e.getPropertyValue("--kip-grey-color").trim(),greyDim:e.getPropertyValue("--kip-grey-dim-color").trim(),greyDimmer:e.getPropertyValue("--kip-grey-dimmer-color").trim(),orange:e.getPropertyValue("--kip-orange-color").trim(),orangeDim:e.getPropertyValue("--kip-orange-dim-color").trim(),orangeDimmer:e.getPropertyValue("--kip-orange-dimmer-color").trim(),pink:e.getPropertyValue("--kip-pink-color").trim(),pinkDim:e.getPropertyValue("--kip-pink-dim-color").trim(),pinkDimmer:e.getPropertyValue("--kip-pink-dimmer-color").trim(),purple:e.getPropertyValue("--kip-purple-color").trim(),purpleDim:e.getPropertyValue("--kip-purple-dim-color").trim(),purpleDimmer:e.getPropertyValue("--kip-purple-dimmer-color").trim(),contrast:e.getPropertyValue("--kip-contrast-color").trim(),contrastDim:e.getPropertyValue("--kip-contrast-dim-color").trim(),contrastDimmer:e.getPropertyValue("--kip-contrast-dimmer-color").trim(),yellow:e.getPropertyValue("--kip-yellow-color").trim(),yellowDim:e.getPropertyValue("--kip-yellow-dim-color").trim(),yellowDimmer:e.getPropertyValue("--kip-yellow-dimmer-color").trim(),port:e.getPropertyValue("--kip-port-color").trim(),starboard:e.getPropertyValue("--kip-starboard-color").trim(),zoneNominal:e.getPropertyValue("--kip-zone-nominal-color").trim(),zoneAlert:e.getPropertyValue("--kip-zone-alert-color").trim(),zoneWarn:e.getPropertyValue("--kip-zone-warn-color").trim(),zoneAlarm:e.getPropertyValue("--kip-zone-alarm-color").trim(),zoneEmergency:e.getPropertyValue("--kip-zone-emergency-color").trim()};this.cssThemeColorRoles$.next(r)}get cssThemeColors(){return this._cssThemeColorRoles}setBrightness(t,e=!1){let r=document.body;r.style.setProperty("--kip-nightModeBrightness",`${t}`);let h=e?" sepia(0.5) hue-rotate(-30deg)":"";r.style.setProperty("--kip-nightModeFilters",h)}toggleDayNightMode(){this.isNightMode()?this._redNightMode()?(document.body.classList.toggle("night-theme",!0),this.setBrightness(1,!1)):(this.setBrightness(this._settings.getNightModeBrightness(),!0),document.body.classList.remove("night-theme"),this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")):(document.body.classList.remove("night-theme"),this._theme()==="light-theme"&&document.body.classList.toggle("light-theme",this._theme()==="light-theme"),this.setBrightness(1,!1)),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue()}getBrowserVersion(){let t=navigator.userAgent,e="Unknown";return t.includes("Edg")?e=`Edge ${t.match(/Edg\/(\d+)/)?.[1]}`:t.includes("Chrome")&&!t.includes("Edg")&&!t.includes("Chromium")?e=`Chrome ${t.match(/Chrome\/(\d+)/)?.[1]}`:t.includes("Chromium")?e=`Chromium ${t.match(/Chromium\/(\d+)/)?.[1]}`:t.includes("Firefox")?e=`Firefox ${t.match(/Firefox\/(\d+)/)?.[1]}`:t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")?e=`Safari ${t.match(/Version\/(\d+)/)?.[1]}`:(t.includes("Opera")||t.includes("OPR"))&&(e=`Opera ${t.match(/(Opera|OPR)\/(\d+)/)?.[2]}`),e}getOSVersion(){let t=navigator.platform,e=navigator.userAgent;return t.startsWith("Mac")?"macOS":t.startsWith("Win")?"Windows":/Linux/.test(t)?e.includes("ARM")||e.includes("aarch64")||e.includes("Raspberry")||t.includes("armv7l")||t.includes("armv8l")?"Raspberry Pi":"Linux":"Unknown OS"}static \u0275fac=function(e){return new(e||o)};static \u0275prov=g({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();export{D as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-6NIOBZZL.js";import{f as ne,j as ie}from"./chunk-7OTNT2GF.js";import{j as N}from"./chunk-VIHODUV4.js";import{a as V}from"./chunk-DLFK64UP.js";import{a as te}from"./chunk-RCSPPHLA.js";import{D as Z,E as ee,f as L,g as P,n as I,t as Q,z as X}from"./chunk-AHFD2AA5.js";import{Cc as _,Dc as o,Ea as d,Fa as p,Gc as M,Hb as E,Ic as x,Jc as w,Kc as y,Nb as u,Pc as O,Vc as T,Xe as R,Zb as g,Ze as j,af as W,bf as q,ef as J,f as k,hf as U,ic as n,if as B,jc as i,kc as h,lf as G,oc as b,of as K,qc as f,rc as C,rd as D,rf as H,sd as F,tf as z,ua as v,ub as c,uf as Y,ve as A,vf as $}from"./chunk-JIJMSRKJ.js";var ae=()=>({standalone:!1});function re(l,m){l&1&&(n(0,"div"),o(1,' Writing to the server requires "Login to Server" authentication or a Device token '),i())}function le(l,m){if(l&1){let e=b();n(0,"div")(1,"mat-form-field",32)(2,"mat-label"),o(3,"Scope"),i(),n(4,"mat-select",33),y("ngModelChange",function(t){d(e);let a=C();return w(a.saveConfigScope,t)||(a.saveConfigScope=t),p(t)}),n(5,"mat-option",34),o(6," Global "),i(),n(7,"mat-option",35),o(8," User "),i()()(),n(9,"mat-form-field",36)(10,"mat-label"),o(11,"Configuration Name"),i(),n(12,"input",37),y("ngModelChange",function(t){d(e);let a=C();return w(a.saveConfigName,t)||(a.saveConfigName=t),p(t)}),i()(),u(13,re,2,0,"div",38),i()}if(l&2){let e=C();c(4),x("ngModel",e.saveConfigScope),c(8),x("ngModel",e.saveConfigName),g("ngModelOptions",O(4,ae)),c(),g("ngIf",!e.hasToken)}}function se(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Server authentication or Device Token required"),i()())}function ce(l,m){if(l&1&&(n(0,"mat-option",43),o(1),i()),l&2){let e=m.$implicit;g("value",e),c(),M(" ",e.scope," / ",e.name," ")}}function ge(l,m){if(l&1){let e=b();n(0,"div")(1,"mat-form-field",40)(2,"mat-label"),o(3,"Configuration"),i(),n(4,"mat-select",41),y("ngModelChange",function(t){d(e);let a=C();return w(a.deleteConfigItem,t)||(a.deleteConfigItem=t),p(t)}),u(5,ce,2,3,"mat-option",42),i()()()}if(l&2){let e=C();c(4),x("ngModel",e.deleteConfigItem),c(),g("ngForOf",e.serverConfigList)}}function de(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Authentication or Device Token required"),i()())}function pe(l,m){if(l&1&&(n(0,"mat-option",43),o(1),i()),l&2){let e=m.$implicit;g("value",e),c(),M(" ",e.scope," / ",e.name," ")}}function me(l,m){if(l&1&&(n(0,"div")(1,"mat-form-field",40)(2,"mat-label"),o(3,"Configuration"),i(),n(4,"mat-select",44),u(5,pe,2,3,"mat-option",42),i()()()),l&2){let e=C();c(5),g("ngForOf",e.serverConfigList)}}function fe(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Authentication or Device Token required"),i()())}var Pe=(()=>{class l{appSettingsService=v(P);storageSvc=v(L);appService=v(V);auth=v(I);fb=v(z);pageTitle="Configurations";hasToken=!1;isTokenTypeDevice=!1;tokenSub;supportApplicationData=!1;serverConfigList=[];serverUpgradableConfigList=[];copyConfigForm;storageLocation=null;locations=["Local Storage","Server Storage"];saveConfigName=null;saveConfigScope=null;deleteConfigItem;jsonData=null;ngOnInit(){this.tokenSub=this.auth.authToken$.subscribe(e=>{e&&e.token?(this.hasToken=!0,this.isTokenTypeDevice=e.isDeviceAccessToken,e.isDeviceAccessToken?this.saveConfigScope="global":this.saveConfigScope="user"):this.hasToken=!1}),this.copyConfigForm=this.fb.group({sourceTarget:[{value:"",disabled:!1},j.required]}),this.supportApplicationData=this.storageSvc.isAppDataSupported,this.getServerConfigList()}getServerConfigList(e){this.supportApplicationData&&this.storageSvc.listConfigs(e).then(r=>{let t=r.filter(a=>!(a.scope==="user"&&a.name==="default"));e?this.serverUpgradableConfigList=t:this.serverConfigList=t}).catch(r=>{let t=null;switch(r.status){case 401:this.appService.sendSnackbarNotification("Application Storage Error: "+r.statusText+". Signal K configuration must meet the following requirements; 1) Security enabled. 2) Application Data Storage Interface: On. 3) Either Allow Readonly Access enabled, or connecting with a user.",0,!1);break;default:this.appService.sendSnackbarNotification("Error listing server configurations: "+r,3e3,!1);break}})}saveConfig(e,r,t,a,s){if(this.supportApplicationData){if(r==="user"&&t==="default"&&!s){this.appService.sendSnackbarNotification("Saving configuration with scope 'user' and name 'default' is not allowed.",5e3,!1);return}this.storageSvc.setConfig(r,t,e)?(this.appService.sendSnackbarNotification(`Configuration [${t}] saved to [${r}] storage scope`,5e3,!1),a||this.getServerConfigList()):this.appService.sendSnackbarNotification("Error saving configuration to server",0,!1)}}saveToLocalstorage(e){this.appSettingsService.replaceConfig("appConfig",e.app,!1),this.appSettingsService.replaceConfig("dashboardsConfig",e.dashboards,!1),this.appSettingsService.replaceConfig("themeConfig",e.theme,!1)}copyConfig(){return k(this,null,function*(){let e=null;try{yield this.storageSvc.getConfig(this.copyConfigForm.value.sourceTarget.scope,this.copyConfigForm.value.sourceTarget.name).then(r=>{e=r})}catch(r){this.appService.sendSnackbarNotification("Error retrieving configuration from server: "+r.statusText,3e3,!1);return}this.saveConfig(e,"user","default",!1,!0),this.appSettingsService.reloadApp()})}deleteConfig(e,r,t,a){this.storageSvc.removeItem(e,r,t),this.appService.sendSnackbarNotification(`Configuration [${r}] deleted from [${e}] storage scope`,5e3,!1),a||this.getServerConfigList()}resetConfigToDefault(){this.appSettingsService.resetSettings()}resetConnectionToDefault(){this.appSettingsService.resetConnection()}loadDemoConfig(){this.appSettingsService.loadDemoConfig()}getActiveConfig(){let e;return this.appSettingsService.useSharedConfig?e=this.getLocalConfigFromMemory():e=this.getLocalConfigFromLocalStorage(),e}getLocalConfigFromMemory(){return{app:this.appSettingsService.getAppConfig(),dashboards:this.appSettingsService.getDashboardConfig(),theme:this.appSettingsService.getThemeConfig()}}getLocalConfigFromLocalStorage(){return{app:this.appSettingsService.loadConfigFromLocalStorage("appConfig"),dashboards:this.appSettingsService.loadConfigFromLocalStorage("dashboardsConfig"),theme:this.appSettingsService.loadConfigFromLocalStorage("themeConfig")}}downloadJsonConfig(){let e=this.getActiveConfig(),r=JSON.stringify(e,null,2),t=new Blob([r],{type:"application/json"}),a=window.URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download="KipConfig.json",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(a)}uploadJsonConfig(e){let r=e.target.files[0];if(r&&r.type==="application/json"){let t=new FileReader;t.onload=a=>{try{this.jsonData=JSON.parse(a.target?.result),this.hasToken?this.saveConfig(this.jsonData,"user","default",!1,!0):this.saveToLocalstorage(this.jsonData),this.appSettingsService.reloadApp()}catch(s){this.appService.sendSnackbarNotification("Invalid JSON file",3e3,!1),console.error("Invalid JSON file:",s)}},t.readAsText(r)}else this.appService.sendSnackbarNotification("Please select a valid JSON file",0,!1)}ngOnDestroy(){this.tokenSub.unsubscribe()}static \u0275fac=function(r){return new(r||l)};static \u0275cmp=E({type:l,selectors:[["settings-config"]],decls:85,vars:11,consts:[["saveConfigForm","ngForm"],["elseBlock",""],["deleteConfigForm","ngForm"],["fileInput",""],[3,"pageTitle"],[1,"page-content"],["routerLink","/help"],[1,"flex-container"],[1,"flex-item-rounded-card","rounded-card-color"],["name","saveConfigForm",3,"ngSubmit"],[2,"margin-bottom","16px"],[4,"ngIf","ngIfElse"],[1,"formActionFooter"],[1,"formActionDivider"],["mat-flat-button","","type","submit","color","accent",3,"disabled"],["name","deleteConfigForm",3,"ngSubmit"],[3,"ngSubmit","formGroup"],[1,"flex-item-reset","rounded-card-color"],[1,"config-operation-container",2,"margin-top","20px"],[1,"download-txt"],[1,"download-btn","btn-div"],["mat-flat-button","","type","button",1,"adv-btn",3,"click"],[1,"upload-txt"],[1,"upload-btn","btn-div"],["type","file","accept",".json","hidden","",3,"change"],["mat-flat-button","",1,"adv-btn",3,"click"],[1,"demo-txt"],[1,"demo-btn","btn-div"],[1,"reset-txt"],[1,"reset-btn","btn-div"],[1,"config-txt"],[1,"config-btn","btn-div"],[2,"width","25%"],["name","serverConfiScope","required","",3,"ngModelChange","ngModel"],["value","global"],["value","user"],[2,"width","70%","padding-left","3%"],["matInput","","name","serverConfigName","placeholder","Enter a name for the configuration","required","",3,"ngModelChange","ngModel","ngModelOptions"],[4,"ngIf"],[1,"no-token-notice"],[2,"width","100%"],["name","selectedDeleteItem","required","",3,"ngModelChange","ngModel"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["formControlName","sourceTarget"]],template:function(r,t){if(r&1){let a=b();h(0,"page-header",4),n(1,"div",5)(2,"p"),o(3," Recommended Reading: To understand configuration management and storage options, consult the "),n(4,"a",6),o(5,"Configuration Management Help"),i(),o(6," section. "),i(),n(7,"div",7)(8,"div",8)(9,"form",9,0),f("ngSubmit",function(){return d(a),p(t.saveConfig(t.getActiveConfig(),t.saveConfigScope,t.saveConfigName))}),n(11,"h2"),o(12,"Backup"),i(),n(13,"p",10),o(14," Create a backup of the current active configuration on the server. "),i(),u(15,le,14,5,"div",11)(16,se,3,0,"ng-template",null,1,T),n(18,"div",12),h(19,"mat-divider",13),n(20,"button",14),o(21," Create "),i()()()(),n(22,"div",8)(23,"form",15,2),f("ngSubmit",function(){return d(a),p(t.deleteConfig(t.deleteConfigItem.scope,t.deleteConfigItem.name))}),n(25,"h2"),o(26,"Delete"),i(),n(27,"p",10),o(28," Select a backup configuration to permanently delete from the server. "),i(),u(29,ge,6,2,"div",11)(30,de,3,0,"ng-template",null,1,T),n(32,"div",12),h(33,"mat-divider",13),n(34,"button",14),o(35," Delete "),i()()()(),n(36,"div",8)(37,"form",16),f("ngSubmit",function(){return d(a),p(t.copyConfig())}),n(38,"h2"),o(39,"Restore"),i(),n(40,"p",10),o(41," Replace the current configuration with a backup from the server. "),i(),u(42,me,6,1,"div",11)(43,fe,3,0,"ng-template",null,1,T),n(45,"div",12),h(46,"mat-divider",13),n(47,"button",14),o(48," Restore "),i()()()(),n(49,"div",17)(50,"h2"),o(51,"Advanced"),i(),n(52,"div",18)(53,"div",19)(54,"p"),o(55,"Download the active configuration to a file."),i()(),n(56,"div",20)(57,"button",21),f("click",function(){return d(a),p(t.downloadJsonConfig())}),o(58," Download "),i()(),n(59,"div",22)(60,"p"),o(61," Select a configuration file to upload. The file must be a valid KIP configuration file of JSON format. "),i()(),n(62,"div",23)(63,"input",24,3),f("change",function(S){return d(a),p(t.uploadJsonConfig(S))}),i(),n(65,"button",25),f("click",function(){d(a);let S=_(64);return p(S.click())}),o(66," Upload "),i()(),n(67,"div",26)(68,"p"),o(69," Load the demonstration configuration and connection to Signal K demo server. WARNING: This will completely reset all your settings. "),i()(),n(70,"div",27)(71,"button",21),f("click",function(){return d(a),p(t.loadDemoConfig())}),o(72," Demo "),i()(),n(73,"div",28)(74,"p"),o(75," Reset all your settings to default. The default configuration has a single Getting Started instruction widget. Your Signal K server connection settings will remain. "),i()(),n(76,"div",29)(77,"button",21),f("click",function(){return d(a),p(t.resetConfigToDefault())}),o(78," Default "),i()(),n(79,"div",30)(80,"p"),o(81," Clear the current connection configuration. This only affects Connectivity tab settings. "),i()(),n(82,"div",31)(83,"button",21),f("click",function(){return d(a),p(t.resetConnectionToDefault())}),o(84," Connection "),i()()()()()()}if(r&2){let a=_(10),s=_(17),S=_(24);g("pageTitle",t.pageTitle),c(15),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.hasToken||!a.valid),c(9),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.hasToken||!S.valid),c(3),g("formGroup",t.copyConfigForm),c(5),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.copyConfigForm.valid)}},dependencies:[N,F,Y,B,R,W,q,H,U,J,te,A,X,Q,ie,ne,Z,D,$,G,K,oe,ee],styles:['[_nghost-%COMP%]{display:block;height:100%;width:100%}.page-content[_ngcontent-%COMP%]{width:100%;height:calc(100% - 63px);overflow-y:scroll;scroll-behavior:smooth;padding:0 24px 10px}.flex-item-copy[_ngcontent-%COMP%]{flex:2 1 41%;padding:10px 20px;border-radius:15px}.flex-item-reset[_ngcontent-%COMP%]{flex:1 1 100%;padding:10px 20px;border-radius:15px}a[_ngcontent-%COMP%]{font-size:14px}a[_ngcontent-%COMP%]:hover{text-decoration:underline;cursor:pointer}a[_ngcontent-%COMP%]:link, a[_ngcontent-%COMP%]:visited{color:#8ab4f8;text-decoration:none}.warningText[_ngcontent-%COMP%]{padding-left:15px}.no-token-notice[_ngcontent-%COMP%]{height:58px;contain:content;text-align:center;font-style:italic}.mat-mdc-radio-button[_ngcontent-%COMP%] ~ .mat-radio-button[_ngcontent-%COMP%]{margin-right:16px;margin-left:16px}.config-column[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-basis:100%;flex:1;margin:0 10px}.sources-radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.sources-radio-button[_ngcontent-%COMP%]{margin:5px;margin-left:0!important}.select-config[_ngcontent-%COMP%]{margin-left:0}.config-row[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.btn-div[_ngcontent-%COMP%]{align-self:center}.adv-btn[_ngcontent-%COMP%]{width:100%}.config-operation-container[_ngcontent-%COMP%]{display:grid;grid-template-columns:[col-start] auto [col1-end] min-content [col2-end];grid-template-rows:[row-start] max-content [row1-end] max-content [row2-end];grid-template-areas:"download-txt download-btn" "upload-txt upload-btn" "demo-txt demo-btn" "reset-txt reset-btn" "config-txt config-btn";row-gap:20px;column-gap:10px}.upload-txt[_ngcontent-%COMP%]{grid-area:upload-txt}.upload-btn[_ngcontent-%COMP%]{grid-area:upload-btn}.download-txt[_ngcontent-%COMP%]{grid-area:download-txt}.download-btn[_ngcontent-%COMP%]{grid-area:download-btn}.demo-txt[_ngcontent-%COMP%]{grid-area:demo-txt}.demo-btn[_ngcontent-%COMP%]{grid-area:demo-btn}.reset-txt[_ngcontent-%COMP%]{grid-area:reset-txt}.reset-btn[_ngcontent-%COMP%]{grid-area:reset-btn}.config-txt[_ngcontent-%COMP%]{grid-area:config-txt}.config-btn[_ngcontent-%COMP%]{grid-area:config-btn}']})}return l})();export{Pe as SettingsConfigComponent};
|
|
1
|
+
import{a as oe}from"./chunk-6NIOBZZL.js";import{f as ne,j as ie}from"./chunk-7OTNT2GF.js";import{j as N}from"./chunk-VIHODUV4.js";import{a as V}from"./chunk-P2NQVKWN.js";import{a as te}from"./chunk-RCSPPHLA.js";import{D as Z,E as ee,f as L,g as P,n as I,t as Q,z as X}from"./chunk-AHFD2AA5.js";import{Cc as _,Dc as o,Ea as d,Fa as p,Gc as M,Hb as E,Ic as x,Jc as w,Kc as y,Nb as u,Pc as O,Vc as T,Xe as R,Zb as g,Ze as j,af as W,bf as q,ef as J,f as k,hf as U,ic as n,if as B,jc as i,kc as h,lf as G,oc as b,of as K,qc as f,rc as C,rd as D,rf as H,sd as F,tf as z,ua as v,ub as c,uf as Y,ve as A,vf as $}from"./chunk-JIJMSRKJ.js";var ae=()=>({standalone:!1});function re(l,m){l&1&&(n(0,"div"),o(1,' Writing to the server requires "Login to Server" authentication or a Device token '),i())}function le(l,m){if(l&1){let e=b();n(0,"div")(1,"mat-form-field",32)(2,"mat-label"),o(3,"Scope"),i(),n(4,"mat-select",33),y("ngModelChange",function(t){d(e);let a=C();return w(a.saveConfigScope,t)||(a.saveConfigScope=t),p(t)}),n(5,"mat-option",34),o(6," Global "),i(),n(7,"mat-option",35),o(8," User "),i()()(),n(9,"mat-form-field",36)(10,"mat-label"),o(11,"Configuration Name"),i(),n(12,"input",37),y("ngModelChange",function(t){d(e);let a=C();return w(a.saveConfigName,t)||(a.saveConfigName=t),p(t)}),i()(),u(13,re,2,0,"div",38),i()}if(l&2){let e=C();c(4),x("ngModel",e.saveConfigScope),c(8),x("ngModel",e.saveConfigName),g("ngModelOptions",O(4,ae)),c(),g("ngIf",!e.hasToken)}}function se(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Server authentication or Device Token required"),i()())}function ce(l,m){if(l&1&&(n(0,"mat-option",43),o(1),i()),l&2){let e=m.$implicit;g("value",e),c(),M(" ",e.scope," / ",e.name," ")}}function ge(l,m){if(l&1){let e=b();n(0,"div")(1,"mat-form-field",40)(2,"mat-label"),o(3,"Configuration"),i(),n(4,"mat-select",41),y("ngModelChange",function(t){d(e);let a=C();return w(a.deleteConfigItem,t)||(a.deleteConfigItem=t),p(t)}),u(5,ce,2,3,"mat-option",42),i()()()}if(l&2){let e=C();c(4),x("ngModel",e.deleteConfigItem),c(),g("ngForOf",e.serverConfigList)}}function de(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Authentication or Device Token required"),i()())}function pe(l,m){if(l&1&&(n(0,"mat-option",43),o(1),i()),l&2){let e=m.$implicit;g("value",e),c(),M(" ",e.scope," / ",e.name," ")}}function me(l,m){if(l&1&&(n(0,"div")(1,"mat-form-field",40)(2,"mat-label"),o(3,"Configuration"),i(),n(4,"mat-select",44),u(5,pe,2,3,"mat-option",42),i()()()),l&2){let e=C();c(5),g("ngForOf",e.serverConfigList)}}function fe(l,m){l&1&&(n(0,"div",39)(1,"p"),o(2,"Authentication or Device Token required"),i()())}var Pe=(()=>{class l{appSettingsService=v(P);storageSvc=v(L);appService=v(V);auth=v(I);fb=v(z);pageTitle="Configurations";hasToken=!1;isTokenTypeDevice=!1;tokenSub;supportApplicationData=!1;serverConfigList=[];serverUpgradableConfigList=[];copyConfigForm;storageLocation=null;locations=["Local Storage","Server Storage"];saveConfigName=null;saveConfigScope=null;deleteConfigItem;jsonData=null;ngOnInit(){this.tokenSub=this.auth.authToken$.subscribe(e=>{e&&e.token?(this.hasToken=!0,this.isTokenTypeDevice=e.isDeviceAccessToken,e.isDeviceAccessToken?this.saveConfigScope="global":this.saveConfigScope="user"):this.hasToken=!1}),this.copyConfigForm=this.fb.group({sourceTarget:[{value:"",disabled:!1},j.required]}),this.supportApplicationData=this.storageSvc.isAppDataSupported,this.getServerConfigList()}getServerConfigList(e){this.supportApplicationData&&this.storageSvc.listConfigs(e).then(r=>{let t=r.filter(a=>!(a.scope==="user"&&a.name==="default"));e?this.serverUpgradableConfigList=t:this.serverConfigList=t}).catch(r=>{let t=null;switch(r.status){case 401:this.appService.sendSnackbarNotification("Application Storage Error: "+r.statusText+". Signal K configuration must meet the following requirements; 1) Security enabled. 2) Application Data Storage Interface: On. 3) Either Allow Readonly Access enabled, or connecting with a user.",0,!1);break;default:this.appService.sendSnackbarNotification("Error listing server configurations: "+r,3e3,!1);break}})}saveConfig(e,r,t,a,s){if(this.supportApplicationData){if(r==="user"&&t==="default"&&!s){this.appService.sendSnackbarNotification("Saving configuration with scope 'user' and name 'default' is not allowed.",5e3,!1);return}this.storageSvc.setConfig(r,t,e)?(this.appService.sendSnackbarNotification(`Configuration [${t}] saved to [${r}] storage scope`,5e3,!1),a||this.getServerConfigList()):this.appService.sendSnackbarNotification("Error saving configuration to server",0,!1)}}saveToLocalstorage(e){this.appSettingsService.replaceConfig("appConfig",e.app,!1),this.appSettingsService.replaceConfig("dashboardsConfig",e.dashboards,!1),this.appSettingsService.replaceConfig("themeConfig",e.theme,!1)}copyConfig(){return k(this,null,function*(){let e=null;try{yield this.storageSvc.getConfig(this.copyConfigForm.value.sourceTarget.scope,this.copyConfigForm.value.sourceTarget.name).then(r=>{e=r})}catch(r){this.appService.sendSnackbarNotification("Error retrieving configuration from server: "+r.statusText,3e3,!1);return}this.saveConfig(e,"user","default",!1,!0),this.appSettingsService.reloadApp()})}deleteConfig(e,r,t,a){this.storageSvc.removeItem(e,r,t),this.appService.sendSnackbarNotification(`Configuration [${r}] deleted from [${e}] storage scope`,5e3,!1),a||this.getServerConfigList()}resetConfigToDefault(){this.appSettingsService.resetSettings()}resetConnectionToDefault(){this.appSettingsService.resetConnection()}loadDemoConfig(){this.appSettingsService.loadDemoConfig()}getActiveConfig(){let e;return this.appSettingsService.useSharedConfig?e=this.getLocalConfigFromMemory():e=this.getLocalConfigFromLocalStorage(),e}getLocalConfigFromMemory(){return{app:this.appSettingsService.getAppConfig(),dashboards:this.appSettingsService.getDashboardConfig(),theme:this.appSettingsService.getThemeConfig()}}getLocalConfigFromLocalStorage(){return{app:this.appSettingsService.loadConfigFromLocalStorage("appConfig"),dashboards:this.appSettingsService.loadConfigFromLocalStorage("dashboardsConfig"),theme:this.appSettingsService.loadConfigFromLocalStorage("themeConfig")}}downloadJsonConfig(){let e=this.getActiveConfig(),r=JSON.stringify(e,null,2),t=new Blob([r],{type:"application/json"}),a=window.URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download="KipConfig.json",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(a)}uploadJsonConfig(e){let r=e.target.files[0];if(r&&r.type==="application/json"){let t=new FileReader;t.onload=a=>{try{this.jsonData=JSON.parse(a.target?.result),this.hasToken?this.saveConfig(this.jsonData,"user","default",!1,!0):this.saveToLocalstorage(this.jsonData),this.appSettingsService.reloadApp()}catch(s){this.appService.sendSnackbarNotification("Invalid JSON file",3e3,!1),console.error("Invalid JSON file:",s)}},t.readAsText(r)}else this.appService.sendSnackbarNotification("Please select a valid JSON file",0,!1)}ngOnDestroy(){this.tokenSub.unsubscribe()}static \u0275fac=function(r){return new(r||l)};static \u0275cmp=E({type:l,selectors:[["settings-config"]],decls:85,vars:11,consts:[["saveConfigForm","ngForm"],["elseBlock",""],["deleteConfigForm","ngForm"],["fileInput",""],[3,"pageTitle"],[1,"page-content"],["routerLink","/help"],[1,"flex-container"],[1,"flex-item-rounded-card","rounded-card-color"],["name","saveConfigForm",3,"ngSubmit"],[2,"margin-bottom","16px"],[4,"ngIf","ngIfElse"],[1,"formActionFooter"],[1,"formActionDivider"],["mat-flat-button","","type","submit","color","accent",3,"disabled"],["name","deleteConfigForm",3,"ngSubmit"],[3,"ngSubmit","formGroup"],[1,"flex-item-reset","rounded-card-color"],[1,"config-operation-container",2,"margin-top","20px"],[1,"download-txt"],[1,"download-btn","btn-div"],["mat-flat-button","","type","button",1,"adv-btn",3,"click"],[1,"upload-txt"],[1,"upload-btn","btn-div"],["type","file","accept",".json","hidden","",3,"change"],["mat-flat-button","",1,"adv-btn",3,"click"],[1,"demo-txt"],[1,"demo-btn","btn-div"],[1,"reset-txt"],[1,"reset-btn","btn-div"],[1,"config-txt"],[1,"config-btn","btn-div"],[2,"width","25%"],["name","serverConfiScope","required","",3,"ngModelChange","ngModel"],["value","global"],["value","user"],[2,"width","70%","padding-left","3%"],["matInput","","name","serverConfigName","placeholder","Enter a name for the configuration","required","",3,"ngModelChange","ngModel","ngModelOptions"],[4,"ngIf"],[1,"no-token-notice"],[2,"width","100%"],["name","selectedDeleteItem","required","",3,"ngModelChange","ngModel"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["formControlName","sourceTarget"]],template:function(r,t){if(r&1){let a=b();h(0,"page-header",4),n(1,"div",5)(2,"p"),o(3," Recommended Reading: To understand configuration management and storage options, consult the "),n(4,"a",6),o(5,"Configuration Management Help"),i(),o(6," section. "),i(),n(7,"div",7)(8,"div",8)(9,"form",9,0),f("ngSubmit",function(){return d(a),p(t.saveConfig(t.getActiveConfig(),t.saveConfigScope,t.saveConfigName))}),n(11,"h2"),o(12,"Backup"),i(),n(13,"p",10),o(14," Create a backup of the current active configuration on the server. "),i(),u(15,le,14,5,"div",11)(16,se,3,0,"ng-template",null,1,T),n(18,"div",12),h(19,"mat-divider",13),n(20,"button",14),o(21," Create "),i()()()(),n(22,"div",8)(23,"form",15,2),f("ngSubmit",function(){return d(a),p(t.deleteConfig(t.deleteConfigItem.scope,t.deleteConfigItem.name))}),n(25,"h2"),o(26,"Delete"),i(),n(27,"p",10),o(28," Select a backup configuration to permanently delete from the server. "),i(),u(29,ge,6,2,"div",11)(30,de,3,0,"ng-template",null,1,T),n(32,"div",12),h(33,"mat-divider",13),n(34,"button",14),o(35," Delete "),i()()()(),n(36,"div",8)(37,"form",16),f("ngSubmit",function(){return d(a),p(t.copyConfig())}),n(38,"h2"),o(39,"Restore"),i(),n(40,"p",10),o(41," Replace the current configuration with a backup from the server. "),i(),u(42,me,6,1,"div",11)(43,fe,3,0,"ng-template",null,1,T),n(45,"div",12),h(46,"mat-divider",13),n(47,"button",14),o(48," Restore "),i()()()(),n(49,"div",17)(50,"h2"),o(51,"Advanced"),i(),n(52,"div",18)(53,"div",19)(54,"p"),o(55,"Download the active configuration to a file."),i()(),n(56,"div",20)(57,"button",21),f("click",function(){return d(a),p(t.downloadJsonConfig())}),o(58," Download "),i()(),n(59,"div",22)(60,"p"),o(61," Select a configuration file to upload. The file must be a valid KIP configuration file of JSON format. "),i()(),n(62,"div",23)(63,"input",24,3),f("change",function(S){return d(a),p(t.uploadJsonConfig(S))}),i(),n(65,"button",25),f("click",function(){d(a);let S=_(64);return p(S.click())}),o(66," Upload "),i()(),n(67,"div",26)(68,"p"),o(69," Load the demonstration configuration and connection to Signal K demo server. WARNING: This will completely reset all your settings. "),i()(),n(70,"div",27)(71,"button",21),f("click",function(){return d(a),p(t.loadDemoConfig())}),o(72," Demo "),i()(),n(73,"div",28)(74,"p"),o(75," Reset all your settings to default. The default configuration has a single Getting Started instruction widget. Your Signal K server connection settings will remain. "),i()(),n(76,"div",29)(77,"button",21),f("click",function(){return d(a),p(t.resetConfigToDefault())}),o(78," Default "),i()(),n(79,"div",30)(80,"p"),o(81," Clear the current connection configuration. This only affects Connectivity tab settings. "),i()(),n(82,"div",31)(83,"button",21),f("click",function(){return d(a),p(t.resetConnectionToDefault())}),o(84," Connection "),i()()()()()()}if(r&2){let a=_(10),s=_(17),S=_(24);g("pageTitle",t.pageTitle),c(15),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.hasToken||!a.valid),c(9),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.hasToken||!S.valid),c(3),g("formGroup",t.copyConfigForm),c(5),g("ngIf",t.hasToken)("ngIfElse",s),c(5),g("disabled",!t.copyConfigForm.valid)}},dependencies:[N,F,Y,B,R,W,q,H,U,J,te,A,X,Q,ie,ne,Z,D,$,G,K,oe,ee],styles:['[_nghost-%COMP%]{display:block;height:100%;width:100%}.page-content[_ngcontent-%COMP%]{width:100%;height:calc(100% - 63px);overflow-y:scroll;scroll-behavior:smooth;padding:0 24px 10px}.flex-item-copy[_ngcontent-%COMP%]{flex:2 1 41%;padding:10px 20px;border-radius:15px}.flex-item-reset[_ngcontent-%COMP%]{flex:1 1 100%;padding:10px 20px;border-radius:15px}a[_ngcontent-%COMP%]{font-size:14px}a[_ngcontent-%COMP%]:hover{text-decoration:underline;cursor:pointer}a[_ngcontent-%COMP%]:link, a[_ngcontent-%COMP%]:visited{color:#8ab4f8;text-decoration:none}.warningText[_ngcontent-%COMP%]{padding-left:15px}.no-token-notice[_ngcontent-%COMP%]{height:58px;contain:content;text-align:center;font-style:italic}.mat-mdc-radio-button[_ngcontent-%COMP%] ~ .mat-radio-button[_ngcontent-%COMP%]{margin-right:16px;margin-left:16px}.config-column[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-basis:100%;flex:1;margin:0 10px}.sources-radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.sources-radio-button[_ngcontent-%COMP%]{margin:5px;margin-left:0!important}.select-config[_ngcontent-%COMP%]{margin-left:0}.config-row[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.btn-div[_ngcontent-%COMP%]{align-self:center}.adv-btn[_ngcontent-%COMP%]{width:100%}.config-operation-container[_ngcontent-%COMP%]{display:grid;grid-template-columns:[col-start] auto [col1-end] min-content [col2-end];grid-template-rows:[row-start] max-content [row1-end] max-content [row2-end];grid-template-areas:"download-txt download-btn" "upload-txt upload-btn" "demo-txt demo-btn" "reset-txt reset-btn" "config-txt config-btn";row-gap:20px;column-gap:10px}.upload-txt[_ngcontent-%COMP%]{grid-area:upload-txt}.upload-btn[_ngcontent-%COMP%]{grid-area:upload-btn}.download-txt[_ngcontent-%COMP%]{grid-area:download-txt}.download-btn[_ngcontent-%COMP%]{grid-area:download-btn}.demo-txt[_ngcontent-%COMP%]{grid-area:demo-txt}.demo-btn[_ngcontent-%COMP%]{grid-area:demo-btn}.reset-txt[_ngcontent-%COMP%]{grid-area:reset-txt}.reset-btn[_ngcontent-%COMP%]{grid-area:reset-btn}.config-txt[_ngcontent-%COMP%]{grid-area:config-txt}.config-btn[_ngcontent-%COMP%]{grid-area:config-btn}']})}return l})();export{Pe as SettingsConfigComponent};
|
package/public/index.html
CHANGED
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
</app-root>
|
|
64
|
-
<link rel="modulepreload" href="chunk-
|
|
64
|
+
<link rel="modulepreload" href="chunk-BHXOUGEH.js"><link rel="modulepreload" href="chunk-5BPL4ALQ.js"><link rel="modulepreload" href="chunk-CU7EEHLK.js"><link rel="modulepreload" href="chunk-YQQFIIO5.js"><link rel="modulepreload" href="chunk-WJMKCVFQ.js"><link rel="modulepreload" href="chunk-MCACXEYY.js"><link rel="modulepreload" href="chunk-OG77M7OV.js"><link rel="modulepreload" href="chunk-FMVUDX5R.js"><link rel="modulepreload" href="chunk-FFCTE2U5.js"><link rel="modulepreload" href="chunk-7OTNT2GF.js"><script src="polyfills-2DK6FBPF.js" type="module"></script><script src="main-AU7ZMZ6I.js" type="module"></script></body>
|
|
65
65
|
</html>
|