Skip to content

Commit 1f93d0b

Browse files
committed
Added AppNames to cstg
Fixed bugs
1 parent 5175e3c commit 1f93d0b

File tree

3 files changed

+38
-65
lines changed

3 files changed

+38
-65
lines changed

webroot/adm/oncall/generate-api-key-secret.html

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ <h5>Create a new site</h5>
172172
for="createSite-workflow-clientTypes-PUBLISHER">PUBLISHER</label>
173173
</div>
174174
<div class="py-2">
175-
<label for="createSite-workflow-description">Description
176-
(Optional):</label>
175+
<label for="createSite-workflow-description">Description (Optional):</label>
177176
<input type="text" id="createSite-workflow-description"
178177
class="form-control" name="createSite-workflow-description">
179178
</div>
@@ -285,8 +284,7 @@ <h5>Update an existing site</h5>
285284
</div>
286285

287286
<div class="py-2">
288-
<label for="updateSite-workflow-afterSearch-description">Description
289-
(Optional):</label>
287+
<label for="updateSite-workflow-afterSearch-description">Description (Optional):</label>
290288
<input type="text" id="updateSite-workflow-afterSearch-description"
291289
class="form-control"
292290
name="updateSite-workflow-afterSearch-description">
@@ -341,39 +339,34 @@ <h5>Create a new client API Key</h5>
341339
<input type="checkbox" id="createClient-workflow-roles-GENERATOR"
342340
class="form-check-input" name="createClient-workflow-roles[]"
343341
value="GENERATOR">
344-
<label for="createClient-workflow-roles-GENERATOR">GENERATOR - for
345-
publishers</label>
342+
<label for="createClient-workflow-roles-GENERATOR">GENERATOR - for publishers</label>
346343
</div>
347344
<div class="form-check">
348345
<input type="checkbox" id="createClient-workflow-roles-MAPPER"
349346
class="form-check-input" name="createClient-workflow-roles[]"
350347
value="MAPPER">
351-
<label for="createClient-workflow-roles-MAPPER">MAPPER - for
352-
publishers</label>
348+
<label for="createClient-workflow-roles-MAPPER">MAPPER - for publishers</label>
353349
</div>
354350
<div class="form-check">
355351
<input type="checkbox" id="createClient-workflow-roles-ID_READER"
356352
class="form-check-input" name="createClient-workflow-roles[]"
357353
value="ID_READER">
358-
<label for="createClient-workflow-roles-ID_READER">ID_READER - for
359-
advertisers, data providers</label>
354+
<label for="createClient-workflow-roles-ID_READER">ID_READER - for advertisers, data providers</label>
360355
</div>
361356
<div class="form-check pt-3 pb-2">
362357
<input type="checkbox" class="form-check-input"
363358
id="createClient-workflow-roles-SHARER"
364359
name="createClient-workflow-roles[]" value="SHARER">
365360
<label for="createClient-workflow-roles-SHARER"
366-
class="form-check-label">Does it additionally need the SHARER
367-
role? Be sure that the client definitely needs this. Most
368-
don't.</label>
361+
class="form-check-label">Does it additionally need the SHARER role? Be sure that the client definitely needs this. Most don't.</label>
369362
</div>
370363
<a href="#create" class="btn-primary btn"
371364
id="createClient-workflow-submit">Create</a>
372365

373366
<div class="collapse" id="createClientOutput">
374367
<div class="pt-2">
375368
<div class="py-2">Please copy and paste this to a new <a
376-
href="https://tradesecrets.adsrvr.org/secrets/new">TradeSecret</a>:
369+
href="https://tradesecrets.adsrvr.org/secrets/new" target="_blank">TradeSecret</a>:
377370
</div>
378371
<div class="alert alert-secondary">
379372
<button type="button" class="btn float-end"
@@ -384,10 +377,7 @@ <h5>Create a new client API Key</h5>
384377
</div>
385378
</div>
386379
<div class="pt-2">
387-
<div class="py-2">Please copy and paste this into a comment on
388-
the
389-
JIRA
390-
ticket:
380+
<div class="py-2">Please copy and paste this into a comment on the JIRA ticket:
391381
</div>
392382
<div class="alert alert-secondary">
393383
<button type="button" class="btn float-end"
@@ -398,10 +388,7 @@ <h5>Create a new client API Key</h5>
398388
</div>
399389
</div>
400390
<div class="pt-2">
401-
<div class="py-2">This is the output for reference. You should
402-
not
403-
need
404-
to copy this.
391+
<div class="py-2">This is the output for reference. You should not need to copy this.
405392
</div>
406393
<div class="alert alert-dark">
407394
<pre id="fullClientOutputSpace"

webroot/adm/oncall/generate-cstg-keypair.html

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -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

webroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h1>UID2 Env Admin Site</h1>
1818
<br>
1919
</div>
2020

21-
<h3>On-call Support Workflow</h3>
21+
<h3 class="ro-adm" style="display: none">On-call Support Workflow</h3>
2222
<ul>
2323
<li class="ro-adm" style="display: none"><a href="/adm/oncall/generate-api-key-secret.html">Generate API Key/Secret</a></li>
2424
<li class="ro-adm" style="display: none"><a href="/adm/oncall/generate-cstg-keypair.html">Generate CSTG Keypair</a></li>

0 commit comments

Comments
 (0)