@@ -34,9 +34,74 @@ import {
3434import { MetaObjectPayload } from "../../models/meta" ;
3535import { DataSourceCommand , DataSourceMessage2 } from "../../models/messages" ;
3636import { dataSourceStyles , kdbStyles , shoelaceStyles } from "./styles" ;
37- import { UDA , UDAParam } from "../../models/uda" ;
37+ import { ParamFieldType , UDA , UDAParam } from "../../models/uda" ;
3838
3939const MAX_RULES = 32 ;
40+ const UDA_DISTINGUISED_PARAMS : UDAParam [ ] = [
41+ {
42+ name : "table" ,
43+ description : "Table to target." ,
44+ isReq : false ,
45+ type : [ - 11 ] ,
46+ isVisible : false ,
47+ fieldType : ParamFieldType . Text ,
48+ isDistinguised : true ,
49+ } ,
50+ {
51+ name : "labels" ,
52+ description : "A dictionary describing DAP labels to target," ,
53+ isReq : false ,
54+ type : [ 99 ] ,
55+ isVisible : false ,
56+ fieldType : ParamFieldType . JSON ,
57+ isDistinguised : true ,
58+ } ,
59+ {
60+ name : "scope" ,
61+ description : "A dictionary describing what RC and/or DAPs to target." ,
62+ isReq : false ,
63+ type : [ 99 ] ,
64+ fieldType : ParamFieldType . JSON ,
65+ isDistinguised : true ,
66+ } ,
67+ {
68+ name : "startTS" ,
69+ description : "Inclusive start time of the request." ,
70+ isReq : false ,
71+ type : [ - 19 ] ,
72+ isVisible : false ,
73+ fieldType : ParamFieldType . Timestamp ,
74+ isDistinguised : true ,
75+ } ,
76+ {
77+ name : "endTS" ,
78+ description : "Exclusive end time of the request." ,
79+ isReq : false ,
80+ type : [ - 19 ] ,
81+ isVisible : false ,
82+ fieldType : ParamFieldType . Timestamp ,
83+ isDistinguised : true ,
84+ } ,
85+ {
86+ name : "inputTZ" ,
87+ description : "Timezone of startTS and endTS (default: UTC)." ,
88+ isReq : false ,
89+ type : [ - 11 ] ,
90+ isVisible : false ,
91+ fieldType : ParamFieldType . Text ,
92+ isDistinguised : true ,
93+ } ,
94+ {
95+ name : "outputTZ" ,
96+ description :
97+ "Timezone of the final result (.kxi.getData only). No effect on routing." ,
98+ isReq : false ,
99+ type : [ - 11 ] ,
100+ isVisible : false ,
101+ fieldType : ParamFieldType . Text ,
102+ isDistinguised : true ,
103+ } ,
104+ ] ;
40105
41106@customElement ( "kdb-data-source-view" )
42107export class KdbDataSourceView extends LitElement {
@@ -954,7 +1019,6 @@ export class KdbDataSourceView extends LitElement {
9541019 ${ this . renderUDAOptions ( ) }
9551020 </ sl-select >
9561021 ${ this . renderUDADetails ( ) } ${ this . renderUDAParams ( ) }
957- ${ this . userSelectedUDA ? this . renderUDAAddParamButton ( ) : null }
9581022 </ div >
9591023 ` ;
9601024 }
@@ -1015,26 +1079,36 @@ export class KdbDataSourceView extends LitElement {
10151079 const visibleParams = this . renderVisibleUDAParams ( ) ;
10161080 const noParams = this . renderUDANoParams ( ) ;
10171081 const invalidParams = this . renderUDAInvalidParams ( ) ;
1082+ const addParamsBtn = this . renderUDAAddParamButton ( ) ;
10181083
10191084 if ( invalidParams ) {
10201085 params . push ( invalidParams ) ;
10211086 } else {
1022- params . push ( ...( visibleParams . length ? visibleParams : [ noParams ] ) ) ;
1087+ params . push (
1088+ ...( visibleParams . length ? visibleParams : [ noParams ] ) ,
1089+ ...[ addParamsBtn ] ,
1090+ ) ;
10231091 }
10241092
10251093 return params ;
10261094 }
10271095
10281096 renderUDAAddParamButton ( ) {
10291097 return html `
1030- < sl-dropdown
1031- class ="udaDropdown "
1032- @sl-select ="${ this . handleUDAAddParamSelect } ">
1033- < sl-button slot ="trigger " variant ="neutral " class ="width-200-px " caret >
1034- + Add Parameter
1035- </ sl-button >
1036- ${ this . renderUDAAddParamBtnOptions ( ) }
1037- </ sl-dropdown >
1098+ < div class ="width-98-pct ">
1099+ < sl-dropdown
1100+ class ="udaDropdown width-30-pct "
1101+ @sl-select ="${ this . handleUDAAddParamSelect } ">
1102+ < sl-button
1103+ slot ="trigger "
1104+ class ="width-100-pct "
1105+ variant ="neutral "
1106+ caret >
1107+ + Add Parameter
1108+ </ sl-button >
1109+ ${ this . renderUDAAddParamBtnOptions ( ) }
1110+ </ sl-dropdown >
1111+ </ div >
10381112 ` ;
10391113 }
10401114
@@ -1051,7 +1125,7 @@ export class KdbDataSourceView extends LitElement {
10511125
10521126 renderUDAAddParamBtnOptions ( ) {
10531127 return html `
1054- < sl-menu class ="width-200-px ">
1128+ < sl-menu class ="width-100-pct ">
10551129 ${ this . renderUDAOptionalParamsOpts ( ) }
10561130 </ sl-menu >
10571131 ` ;
@@ -1064,26 +1138,61 @@ export class KdbDataSourceView extends LitElement {
10641138 ` ;
10651139 }
10661140
1141+ const optParamTxtHtml = html `
1142+ < small class ="btn-opt-text "> < strong > OPTIONAL PARAMETERS:</ strong > </ small >
1143+ ` ;
1144+ const distParamTxtHtml = html `
1145+ < small class ="btn-opt-text "
1146+ > < strong > DISTINGUISHED PARAMETERS:</ strong > </ small
1147+ >
1148+ ` ;
1149+
10671150 const optionalParams = this . userSelectedUDA . params . filter (
10681151 ( param ) => ! param . isReq ,
10691152 ) ;
1153+ const filteredDistinguisedParam = UDA_DISTINGUISED_PARAMS . filter (
1154+ ( param ) =>
1155+ ! optionalParams . some (
1156+ ( optionalParam ) => param . name === optionalParam . name ,
1157+ ) ,
1158+ ) ;
10701159
1071- if ( optionalParams . length === 0 ) {
1072- return html `
1073- < sl-menu-item disabled > No optional parameters available</ sl-menu-item >
1074- ` ;
1160+ const renderParams = ( params : any [ ] ) =>
1161+ params . map (
1162+ ( param : {
1163+ isVisible : unknown ;
1164+ name : unknown ;
1165+ description : unknown ;
1166+ } ) => html `
1167+ < sl-menu-item
1168+ .type =${ param . isVisible ? "checkbox" : "normal" }
1169+ .disabled =${ ! ! param . isVisible }
1170+ .value=${ param . name as string } >
1171+ ${ param . name } < br /> < small > ${ param . description } </ small >
1172+ </ sl-menu-item >
1173+ ` ,
1174+ ) ;
1175+
1176+ const optionalParamsHtml = [
1177+ optParamTxtHtml ,
1178+ ...( optionalParams . length
1179+ ? renderParams ( optionalParams )
1180+ : [
1181+ html `< sl-menu-item disabled
1182+ > No optional parameters available</ sl-menu-item
1183+ > ` ,
1184+ ] ) ,
1185+ ] ;
1186+
1187+ if ( filteredDistinguisedParam . length > 0 ) {
1188+ optionalParamsHtml . push (
1189+ html `< hr class ="btn-opt-divider " /> ` ,
1190+ distParamTxtHtml ,
1191+ ...renderParams ( filteredDistinguisedParam ) ,
1192+ ) ;
10751193 }
10761194
1077- return optionalParams . map (
1078- ( param ) => html `
1079- < sl-menu-item
1080- .type =${ param . isVisible ? "checkbox" : "normal" }
1081- .disabled =${ param . isVisible === true }
1082- .value=${ param . name } >
1083- ${ param . name } < br /> < small > ${ param . description } </ small >
1084- </ sl-menu-item >
1085- ` ,
1086- ) ;
1195+ return optionalParamsHtml ;
10871196 }
10881197
10891198 renderDeleteUDAParamButton ( param : UDAParam ) {
@@ -1115,7 +1224,7 @@ export class KdbDataSourceView extends LitElement {
11151224 multitype : "multitype" ,
11161225 text : "text" ,
11171226 } ;
1118- return inputTypes [ type || "text" ] || "text" ;
1227+ return inputTypes [ type ?? "text" ] || "text" ;
11191228 }
11201229
11211230 renderVisibleUDAParams ( ) {
@@ -1200,7 +1309,7 @@ export class KdbDataSourceView extends LitElement {
12001309 < sl-select
12011310 class ="reset-widths-limit width-30-pct "
12021311 label ="${ param . name } "
1203- .helpText ="Select a type "
1312+ help-text ="Select a type "
12041313 .value ="${ live ( value ) } "
12051314 @sl-change ="${ ( event : Event ) => {
12061315 param . selectedMultiTypeString = (
0 commit comments