Skip to content

Commit 1d23a66

Browse files
authored
Merge pull request #164 from GSA/feature/pointing_to_art_api_dev
ART Modal is Back!
2 parents 83c93ef + e3be687 commit 1d23a66

7 files changed

Lines changed: 39 additions & 20 deletions

File tree

src/app/solicitation/summary/results-detail/art-modal/art-modal.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p-button (click)="showDialog()" id="art" icon="pi pi-external-link" label="Take Action: Get 508 Language" class="btn usa-button usa-button--accent-warm"></p-button>
1+
<p-button (click)="showDialog()" id="art" icon="pi pi-external-link" label="Get 508 Language" class="btn usa-button usa-button--accent-warm"></p-button>
22
<p-dialog header="Get 508 Language"
33
[(visible)]="visible"
44
[style]="{width: '50vw'}"

src/app/solicitation/summary/results-detail/art-modal/art-modal.component.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,16 @@ describe('ArtIframeDialogComponent', () => {
3535
it('should create', () => {
3636
expect(component).toBeTruthy();
3737
});
38+
39+
it('should clear art_body on clearAll', () => {
40+
component.art_body = { someKey: 'someValue' };
41+
component.clearAll();
42+
expect(component.art_body).toEqual({});
43+
});
44+
45+
it('should clear art_body on updateLanguage', () => {
46+
component.art_body = { someKey: 'someValue' };
47+
component.updateLanguage();
48+
expect(component.art_body).toEqual({});
49+
});
3850
});

src/app/solicitation/summary/results-detail/art-modal/art-modal.component.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class ArtIframeDialogComponent {
177177
}
178178

179179
processCategory(category){
180-
console.log('category (processCategory):', category)
180+
console.debug('category (processCategory):', category)
181181

182182
let artBody = {}
183183

@@ -202,16 +202,16 @@ export class ArtIframeDialogComponent {
202202
artBody[category.art_api] = true
203203
}
204204

205-
console.log('Art Body (processCategory):', artBody)
205+
console.debug('Art Body (processCategory):', artBody)
206206

207207
return artBody
208208

209209
}
210210

211211
createARTBody(){
212212
// Make ART JSON body in structure shown above
213-
//console.log('selected Categories:', this.selectedCategories)
214-
//console.log('selected SubCategories:', this.selectedSubcategories)
213+
//console.debug('selected Categories:', this.selectedCategories)
214+
//console.debug('selected SubCategories:', this.selectedSubcategories)
215215

216216
this.categories.forEach(category => {
217217

@@ -226,8 +226,8 @@ export class ArtIframeDialogComponent {
226226

227227
onSubmit(): void {
228228
// Process ART data here
229-
console.log('Selected Categories:', this.selectedCategories)
230-
console.log('Selected Subcategories:', this.selectedSubcategories)
229+
console.debug('Selected Categories:', this.selectedCategories)
230+
console.debug('Selected Subcategories:', this.selectedSubcategories)
231231

232232
if (this.selectedCategories.length === 0 && this.selectedSubcategories.length === 0) {
233233
this.alert_display = 'inherit'
@@ -239,32 +239,34 @@ export class ArtIframeDialogComponent {
239239

240240
this.createARTBody()
241241

242-
console.log('Art Body:', this.art_body)
242+
console.debug('Art Body:', this.art_body)
243243

244244

245245
this.artService.getArtLanguage(this.art_body)
246246
.subscribe({
247247
next: data => {
248-
console.log('Art Language Data:', data)
248+
console.debug('Art Language Data:', data)
249249
this.art_language = data;
250250

251251
if (data) {
252252
this.display = 'inherit'
253253
this.solicitationService.postSolicitationART(this.solicitationId, data).subscribe({
254-
next: (response) => console.log('Post Solicitation ART Response:', response),
254+
next: (response) => console.debug('Post Solicitation ART Response:', response),
255255
error: (error) => console.error('Post Solicitation ART Error:', error)
256256
})
257257

258258
}
259259

260+
this.art_body = {};
261+
260262
},
261263
error: error => {
262264
let errors: string[] = [];
263265

264266
const replaceFieldNames = (error: string, fieldNames: { [key: string]: string }): string => {
265267
return error.replace(/'([^']+)'/g, (match, p1) => {
266-
console.log('Match:', match)
267-
console.log('P1:', p1)
268+
console.debug('Match:', match)
269+
console.debug('P1:', p1)
268270
const parts = p1.split('.');
269271
const art_api = parts[parts.length - 1];
270272
return fieldNames[art_api] ? `'${fieldNames[art_api]}'` : match;
@@ -283,14 +285,15 @@ export class ArtIframeDialogComponent {
283285
}
284286
});
285287

286-
console.log('Art Language:', this.art_language)
288+
console.debug('Art Language:', this.art_language)
287289
}
288290

289291
clearAll() {
290292
this.selectedCategories = [];
291293
this.selectedSubcategories = [];
292294
this.display = 'none';
293295
this.art_language = null;
296+
this.art_body = {};
294297

295298
this.categories.forEach(category => {
296299
category.isChecked = false
@@ -319,7 +322,7 @@ export class ArtIframeDialogComponent {
319322
}
320323

321324
onCategoryChange(selected) {
322-
console.log('Selected:', selected)
325+
console.debug('Selected:', selected)
323326

324327
this.selectedCategories = selected.selectedCategories;
325328
let parent = selected.parent;
@@ -332,13 +335,13 @@ export class ArtIframeDialogComponent {
332335

333336
}
334337

335-
console.log('Selected Subcategories:', this.selectedSubcategories)
338+
console.debug('Selected Subcategories:', this.selectedSubcategories)
336339
}
337340

338341
copyToClipBoard(elem) {
339342
navigator.clipboard.writeText(elem.innerText)
340343
.then(() => {
341-
console.log('Text copied to clipboard');
344+
console.debug('Text copied to clipboard');
342345
// Additional code after copying to clipboard
343346
})
344347
.catch((error) => {
@@ -371,6 +374,7 @@ export class ArtIframeDialogComponent {
371374
}
372375

373376
this.art_language = []; // Remove art language
377+
this.art_body = {}; // Remove art body
374378
this.display = 'none';
375379
}
376380

src/app/solicitation/summary/results-detail/results-detail.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ <h1 class="font-sans-xl margin-bottom-2">{{solicitation.title}}</h1>
2424
<div *ngIf="solicitation.reviewRec !== 'Compliant'">
2525
<div class="grid-row padding-top-2">
2626
<div class="tablet:grid-col-8">
27+
<!--
2728
<a class="btn usa-button usa-button--accent-warm"
2829
href="https://app.buyaccessible.gov/"
2930
target="_blank"
3031
rel="noopener noreferrer">
3132
<i class="pi pi-external-link"></i>Get 508 Language</a>
33+
-->
3234
<!-- Hotfix: Commented out the following line to prevent the ART modal from appearing for time being
33-
<app-art-modal></app-art-modal>
35+
3436
-->
37+
<app-art-modal></app-art-modal>
3538
</div>
3639
</div>
3740
</div>

src/environments/environment.dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const environment = {
88
SERVER_URL: 'https://srt-server-dev.app.cloud.gov/api',
99
EMAIL_NOTIFICATION: true,
1010
FILE_UPLOAD_API: 'http://srt-server-dev.app.cloud.gov/file/upload',
11-
ART_API_SERVER:'https://art-api.app.cloud.gov',
11+
ART_API_SERVER:'https://art-api-dev.app.cloud.gov',
1212
USE_CLIENT_EMAIL: true,
1313
ENVIRONMENT: 'dev',
1414
feature_flags: {

src/environments/environment.local.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const environment = {
99
SERVER_URL: 'http://localhost:3000/api',
1010
EMAIL_NOTIFICATION: true,
1111
FILE_UPLOAD_API: 'http://localhost:3000/file/upload',
12-
ART_API_SERVER:'https://art-api.app.cloud.gov',
12+
ART_API_SERVER:'https://art-api-dev.app.cloud.gov',
1313
needToken: false,
1414
USE_CLIENT_EMAIL: true,
1515
ENVIRONMENT: 'local',

src/environments/environment.staging.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const environment = {
88
SERVER_URL: 'https://srt-server-staging.app.cloud.gov/api',
99
EMAIL_NOTIFICATION: true,
1010
FILE_UPLOAD_API: 'http://srt-server-staging.app.cloud.gov/file/upload',
11-
ART_API_SERVER:'https://art-api.app.cloud.gov',
11+
ART_API_SERVER:'https://art-api-dev.app.cloud.gov',
1212
USE_CLIENT_EMAIL: true,
1313
ENVIRONMENT: 'staging',
1414
feature_flags: {

0 commit comments

Comments
 (0)