@@ -136,16 +136,14 @@ <h5>Create a new site</h5>
136136 < input type ="text " class ="form-control " id ="createSite-workflow-name "
137137 name ="createSite-workflow-name ">
138138 < div class ="py-2 ">
139- < label for ="createSite-workflow-domainNames "> Domain Names
140- (comma-separated list):</ label >
139+ < label for ="createSite-workflow-domainNames "> Domain Names (comma-separated list):</ label >
141140 < input type ="text " class ="form-control "
142141 id ="createSite-workflow-domainNames "
143142 name ="createSite-workflow-domainNames ">
144143
145144 </ div >
146145 < div class ="py-2 ">
147- < label for ="createSite-workflow-description "> Description
148- (Optional):</ label >
146+ < label for ="createSite-workflow-description "> Description (Optional):</ label >
149147 < input type ="text " id ="createSite-workflow-description "
150148 class ="form-control " name ="createSite-workflow-description ">
151149 </ div >
@@ -154,11 +152,7 @@ <h5>Create a new site</h5>
154152 id ="createSite-workflow-clientTypes-PUBLISHER "
155153 class ="form-check-input "
156154 name ="createSite-workflow-clientTypes[] " value ="PUBLISHER ">
157- < label for ="createSite-workflow-clientTypes-PUBLISHER "> Is this
158- participant a publisher?
159- Only
160- publishers are allowed to use CSTG.</ label >
161-
155+ < label for ="createSite-workflow-clientTypes-PUBLISHER "> Is this participant a publisher? Only publishers are allowed to use CSTG.</ label >
162156 </ div >
163157 < a href ="#create " class ="btn btn-primary pt-2 "
164158 id ="createSite-workflow-submit "> Create</ a >
@@ -227,19 +221,19 @@ <h5>Update an existing site</h5>
227221 id ="updateSite-workflow-afterSearch-name "
228222 name ="updateSite-workflow-afterSearch-name " disabled readonly >
229223 < div class ="py-2 ">
230- < label for ="updateSite-workflow-afterSearch-domainNames "> Domain
231- Names
232- (comma-separated list):</ label >
224+ < label for ="updateSite-workflow-afterSearch-domainNames "> Domain Names (comma-separated list):</ label >
233225 < input type ="text " class ="form-control "
234226 id ="updateSite-workflow-afterSearch-domainNames "
235227 name ="updateSite-workflow-afterSearch-domainNames ">
236-
237228 </ div >
238-
239-
240229 < div class ="py-2 ">
241- < label for ="updateSite-workflow-afterSearch-description "> Description
242- (Optional):</ label >
230+ < label for ="updateSite-workflow-afterSearch-appNames "> App Names (comma-separated list):</ label >
231+ < input type ="text " class ="form-control "
232+ id ="updateSite-workflow-afterSearch-appNames "
233+ name ="updateSite-workflow-afterSearch-appNames ">
234+ </ div >
235+ < div class ="py-2 ">
236+ < label for ="updateSite-workflow-afterSearch-description "> Description (Optional):</ label >
243237 < input type ="text " id ="updateSite-workflow-afterSearch-description "
244238 class ="form-control "
245239 name ="updateSite-workflow-afterSearch-description ">
@@ -251,14 +245,9 @@ <h5>Update an existing site</h5>
251245 class ="form-check-input "
252246 name ="updateSite-workflow-afterSearch-clientTypes[] "
253247 value ="PUBLISHER ">
254- < label for ="updateSite-workflow-afterSearch-PUBLISHER "> Is this
255- participant a publisher?
256- Only
257- publishers are allowed to use CSTG.</ label >
258-
248+ < label for ="updateSite-workflow-afterSearch-PUBLISHER "> Is this participant a publisher? Only publishers are allowed to use CSTG. </ label >
249+ < div > If the participant is an Advertiser, check < a href ="https://atlassian.thetradedesk.com/confluence/display/UID2/UID2+CSTG+How+to+create+a+new+client+side+keypair " target ="_blank "> UID2 CSTG How to create a new client side keypair</ a > for details</ div >
259250 </ div >
260-
261-
262251 < a href ="#update " class ="btn btn-primary "
263252 id ="updateSite-workflow-submit "> Update</ a >
264253
@@ -404,7 +393,7 @@ <h5>Create a new CSTG Pair</h5>
404393 } ) ;
405394
406395 $ ( "#createSite-workflow-submit" ) . on ( "click" , ( ) => {
407- let domainNames = convertDomainNamesToArray ( $ ( "#createSite-workflow-domainNames" ) . val ( ) ) ;
396+ let domainNames = convertNamesToArray ( $ ( "#createSite-workflow-domainNames" ) . val ( ) ) ;
408397 if ( domainNames . length === 0 ) {
409398 showCreateSiteError ( "Domain names cannot be empty" ) ;
410399 return ;
@@ -474,6 +463,7 @@ <h5>Create a new CSTG Pair</h5>
474463 const site = siteList [ 0 ] ;
475464 $ ( "#updateSite-workflow-afterSearch-name" ) . val ( site . name ) ;
476465 $ ( "#updateSite-workflow-afterSearch-domainNames" ) . val ( site . domain_names . join ( "," ) ) ;
466+ $ ( "#updateSite-workflow-afterSearch-appNames" ) . val ( site . app_names . join ( "," ) ) ;
477467 $ ( "#updateSite-workflow-afterSearch-description" ) . val ( site . description ) ;
478468 $ ( "#updateSite-workflow-afterSearch-PUBLISHER" ) . prop ( 'checked' , false ) ;
479469 if ( site . clientTypes . includes ( 'PUBLISHER' ) ) {
@@ -492,9 +482,10 @@ <h5>Create a new CSTG Pair</h5>
492482 return ;
493483 }
494484
495- const domainNames = convertDomainNamesToArray ( $ ( "#updateSite-workflow-afterSearch-domainNames" ) . val ( ) ) ;
496- if ( domainNames . length === 0 ) {
497- showUpdateSiteError ( "Domain names cannot be empty" ) ;
485+ const domainNames = convertNamesToArray ( $ ( "#updateSite-workflow-afterSearch-domainNames" ) . val ( ) ) ;
486+ const appNames = convertNamesToArray ( $ ( "#updateSite-workflow-afterSearch-appNames" ) . val ( ) ) ;
487+ if ( domainNames . length === 0 && appNames . length === 0 ) {
488+ showUpdateSiteError ( "Both Domain names and App names can not be empty" ) ;
498489 return ;
499490 }
500491
@@ -505,6 +496,7 @@ <h5>Create a new CSTG Pair</h5>
505496 const description = encodeURIComponent ( $ ( "#updateSite-workflow-afterSearch-description" ) . val ( ) ) ;
506497
507498 const updateDomainNamesUrl = `/api/site/domain_names?id=${ id } ` ;
499+ const updateAppNamesUrl = `/api/site/app_names?id=${ id } ` ;
508500 if ( ! currentClientTypesAfterSearch . includes ( 'PUBLISHER' ) && isPublisherChecked ) {
509501 // update the site and add publisher client type
510502 currentClientTypesAfterSearch . push ( 'PUBLISHER' ) ;
@@ -519,14 +511,11 @@ <h5>Create a new CSTG Pair</h5>
519511 const updateDescriptionUrl = `/api/site/update?id=${ id } &description=${ description } ` ;
520512
521513 const updateDomainNamesPayload = { domain_names : domainNames } ;
514+ const updateAppNamesPayload = { app_names : appNames } ;
522515
523- doApiCallWithCallback (
524- "POST" ,
525- updateDomainNamesUrl ,
526- ( ) => doApiCallWithCallback (
527- "POST" ,
528- updateDescriptionUrl ,
529- ( text ) => {
516+ doApiCallWithCallback ( "POST" , updateDomainNamesUrl ,
517+ ( ) => doApiCallWithCallback ( "POST" , updateAppNamesUrl ,
518+ ( ) => doApiCallWithCallback ( "POST" , updateDescriptionUrl , ( text ) => {
530519 const site = JSON . parse ( text ) ;
531520
532521 const alertMessage = `Updated site [${ site . name } ] with site ID [${ site . id } ]` ;
@@ -542,12 +531,9 @@ <h5>Create a new CSTG Pair</h5>
542531 $ ( "#updateSite-workflow-afterSearch" ) . collapse ( 'show' ) ;
543532 $ ( "#updateSiteOutput" ) . collapse ( 'show' ) ;
544533
545- } ,
546- ( err ) => alertErrorCallback ( err , "#updateSiteError" , "#updateSiteErrorAlert" )
547- ) ,
548- ( err ) => alertErrorCallback ( err , "#updateSiteError" , "#updateSiteErrorAlert" ) ,
549- JSON . stringify ( updateDomainNamesPayload )
550- ) ;
534+ } , ( err ) => alertErrorCallback ( err , "#updateSiteError" , "#updateSiteErrorAlert" ) ) ,
535+ ( err ) => alertErrorCallback ( err , "#updateSiteError" , "#updateSiteErrorAlert" ) , JSON . stringify ( updateAppNamesPayload ) ) ,
536+ ( err ) => alertErrorCallback ( err , "#updateSiteError" , "#updateSiteErrorAlert" ) , JSON . stringify ( updateDomainNamesPayload ) ) ;
551537 } ) ;
552538
553539
@@ -594,7 +580,7 @@ <h5>Create a new CSTG Pair</h5>
594580 } , ( err ) => alertErrorCallback ( err , "#createClientError" , "#createClientErrorAlert" ) , JSON . stringify ( payload ) ) ;
595581 } ) ;
596582
597- const convertDomainNamesToArray = ( domainNames ) => {
583+ const convertNamesToArray = ( domainNames ) => {
598584 return domainNames . replace ( / \s + / g, '' ) . split ( ',' ) . filter ( ( value , _ , __ ) => value !== "" ) ;
599585 }
600586
0 commit comments