5252 :key =" param.Name"
5353 v-bind =" param"
5454 v-model =" values[param.Name]"
55+ :service-values =" serviceValues[param.Name]"
5556 />
5657 <p v-if =" authError" class =" text-danger" >{{ authError }}</p >
5758 <div class =" d-flex justify-content-end" >
109110 :key =" param.Name"
110111 v-bind =" param"
111112 v-model =" values[param.Name]"
113+ :service-values =" serviceValues[param.Name]"
112114 />
113115
114116 <PropertyCollapsible >
119121 :key =" param.Name"
120122 v-bind =" param"
121123 v-model =" values[param.Name]"
124+ :service-values =" serviceValues[param.Name]"
122125 />
123126 </template >
124127 <template v-if =" $slots [' collapsible-more' ]" #more >
@@ -160,7 +163,7 @@ import { initialTestState, performTest } from "../utils/test";
160163import sleep from " @/utils/sleep" ;
161164import { extractDomain } from " @/utils/extractDomain" ;
162165import { ConfigType } from " @/types/evcc" ;
163- import type { DeviceType } from " @/types/evcc" ;
166+ import type { DeviceType , Timeout } from " @/types/evcc" ;
164167import {
165168 handleError ,
166169 type DeviceValues ,
@@ -172,6 +175,7 @@ import {
172175 type ApiData ,
173176 applyDefaultsFromTemplate ,
174177 createDeviceUtils ,
178+ fetchServiceValues ,
175179} from " ./index" ;
176180
177181const CUSTOM_FIELDS = [" modbus" ];
@@ -248,6 +252,8 @@ export default defineComponent({
248252 loadingTemplate: false ,
249253 values: { ... this .initialValues } as DeviceValues ,
250254 test: initialTestState (),
255+ serviceValues: {} as Record <string , string []>,
256+ serviceValuesTimer: null as Timeout | null ,
251257 };
252258 },
253259 computed: {
@@ -423,6 +429,8 @@ export default defineComponent({
423429 if (! isYamlInput ) {
424430 this .loadTemplate ();
425431 }
432+
433+ this .updateServiceValues ();
426434 },
427435 usage() {
428436 // Reload products when usage changes (e.g., meter type selection)
@@ -446,9 +454,22 @@ export default defineComponent({
446454 values: {
447455 handler() {
448456 this .test = initialTestState ();
457+ this .updateServiceValues ();
458+ },
459+ deep: true ,
460+ },
461+ authValues: {
462+ handler() {
463+ if (this .authRequired ) {
464+ this .resetAuthStatus ();
465+ }
449466 },
450467 deep: true ,
451468 },
469+ authRequired() {
470+ // update on auth state change
471+ this .updateServiceValues ();
472+ },
452473 },
453474 methods: {
454475 reset() {
@@ -515,9 +536,12 @@ export default defineComponent({
515536 }
516537 this .loadingTemplate = false ;
517538 },
518- async checkAuthStatus () {
539+ resetAuthStatus () {
519540 this .authOk = false ;
520541 this .authProviderUrl = null ;
542+ },
543+ async checkAuthStatus() {
544+ this .resetAuthStatus ();
521545
522546 // no auth required
523547 if (! this .template ?.Auth ) return ;
@@ -532,8 +556,6 @@ export default defineComponent({
532556 // validate data
533557 if (this .authValuesMissing ) return ;
534558
535- this .authOk = false ;
536- this .authProviderUrl = null ;
537559 const { type } = this .template .Auth ;
538560 const values = this .authValues ;
539561 this .authLoading = true ;
@@ -672,6 +694,14 @@ export default defineComponent({
672694 }
673695 return value === ConfigType .Custom ;
674696 },
697+ async updateServiceValues() {
698+ if (this .serviceValuesTimer ) {
699+ clearTimeout (this .serviceValuesTimer );
700+ }
701+ this .serviceValuesTimer = setTimeout (async () => {
702+ this .serviceValues = await fetchServiceValues (this .templateParams , this .values );
703+ }, 500 );
704+ },
675705 },
676706});
677707 </script >
0 commit comments