Skip to content

Commit

Permalink
Merge pull request #512 from GSA/508-website-service-category-modal-t…
Browse files Browse the repository at this point in the history
…able-click-fix

Fixed website service category modal not behaving like the rest of th…
  • Loading branch information
hatfieldjm4 authored Oct 29, 2024
2 parents 354aa4b + 4984bd6 commit bcf3295
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/models/website-scan.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class WebsiteScan {
public Scan_ID: number;
public Website_ID: number;
public website_id: number;
public desktop_img_file_name: string;
public mobile_img_file_name: string;
public scan_date: Date;
Expand Down
2 changes: 1 addition & 1 deletion api/models/websites.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class Website {
public Website_ID: string;
public website_id: string;
public domain: string;
public office: string;
public sub_office: string;
Expand Down
2 changes: 1 addition & 1 deletion api/queries/GET/get_website_scans.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
id AS Scan_ID,
obj_website_id AS Website_ID,
obj_website_id AS website_id,
desktop_img_file_name,
mobile_img_file_name,
scan_date,
Expand Down
2 changes: 1 addition & 1 deletion api/queries/GET/get_websites.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SELECT
id AS Website_ID,
id AS website_id,
domain,
office,
sub_office,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export class WebsiteManagerComponent implements OnInit {

setFormDefaults(): void {
// Populate Related Systems
this.apiService.getWebsiteSys(this.website.Website_ID).subscribe((data: any[]) => {
this.apiService.getWebsiteSys(this.website.website_id).subscribe((data: any[]) => {
this.systemRelations = [];
// Only take ID and name
data.forEach(element => {
this.systemRelations.push({
ID: element.Website_ID,
ID: element.website_id,
Name: element.Name,
DisplayName: element.DisplayName
})
Expand Down Expand Up @@ -136,10 +136,10 @@ export class WebsiteManagerComponent implements OnInit {
// console.log("Form values before committing to database: ", this.websiteForm.value); // Debug

// Send data to database
this.apiService.updateWebsiteSys(this.website.Website_ID, this.websiteForm.value).toPromise()
this.apiService.updateWebsiteSys(this.website.website_id, this.websiteForm.value).toPromise()
.then(res => {
// Grab new data from database
this.apiService.getOneWebsite(this.website.Website_ID).toPromise()
this.apiService.getOneWebsite(this.website.website_id).toPromise()
.then(data => { this.websiteDetailRefresh(data[0]) }),
(error) => {
console.log("GET Updated Website rejected with " + JSON.stringify(error));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class WebsiteServiceCategoryModalComponent implements OnInit {
showColumns: false,
showExport: true,
exportFileName: null,
headerStyle: 'bg-royal-blue',
headerStyle: 'bg-royal-blue text-white',
pagination: false,
search: true,
sortName: 'domain',
Expand Down Expand Up @@ -88,10 +88,11 @@ export class WebsiteServiceCategoryModalComponent implements OnInit {
}
);

$('#websiteServiceCategoryWebsites').bootstrapTable({
columns: this.serviceCategoryWebsitesColumnDefs,
data: [],
});
$('#websiteServiceCategoryWebsites').bootstrapTable(
$.extend(this.serviceCategoryWebsitesTableOptions, {
columns: this.serviceCategoryWebsitesColumnDefs,
data: [],
}));

const self = this;
$(document).ready(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class WebsitesModalComponent implements OnInit {
this.modalService.currentWebsite.subscribe((website) => {
this.website = website;
this.apiService
.getWebsiteScans(this.website.Website_ID)
.getWebsiteScans(this.website.website_id)
.subscribe(
(websiteScanData) =>
(this.websiteScans =
Expand All @@ -84,7 +84,7 @@ export class WebsitesModalComponent implements OnInit {
: this.getBlankWebsiteScan())
);
this.apiService
.getWebsiteServiceCategories(this.website.Website_ID)
.getWebsiteServiceCategories(this.website.website_id)
.subscribe(
(websiteServiceCategories) =>
(this.websiteServiceCategories = websiteServiceCategories)
Expand Down Expand Up @@ -132,7 +132,7 @@ export class WebsitesModalComponent implements OnInit {
return [
{
Scan_ID: 0,
Website_ID: this.website.Website_ID,
website_id: this.website.website_id,
desktop_img_file_name: 'desktop.png',
mobile_img_file_name: 'mobile.png',
scan_date: '',
Expand Down
11 changes: 8 additions & 3 deletions src/app/services/tables/table.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export class TableService {
public websitesTableClick(data: any, addRoute: boolean = true) {
var options: ClickOptions = {
data: data,
dataID: 'Website_ID',
dataID: 'website_id',
update: 'website',
detailModalID: '#websiteDetail',
sysTableID: '#websitesRelSysTable',
Expand Down Expand Up @@ -495,8 +495,8 @@ export class TableService {
websites_mappings.map(({ obj_websites_Id }) => obj_websites_Id)
);
// Filter Websites to the IDs related to the one website
system_related_websites = websites.filter(({ Website_ID }) =>
websiteID_from_mappings.has(parseInt(Website_ID))
system_related_websites = websites.filter(({ website_id }) =>
websiteID_from_mappings.has(parseInt(website_id))
); // Parse into int as GoogleAPI makes everything strings
// Update related websites table with filtered systems
$('#systemWebsitesTable').bootstrapTable('refreshOptions', {
Expand All @@ -507,6 +507,7 @@ export class TableService {
}

private clickMethod(options: ClickOptions) {
console.log(options)
this.modalService.updateDetails(
options.data,
options.update,
Expand Down Expand Up @@ -711,6 +712,10 @@ export class TableService {
this.websitesTableClick(previousModal.data);
break;

case 'websiteServiceCategory':
this.websiteServiceCategoryTableClick(previousModal.data);
break;

default:
break;
}
Expand Down

0 comments on commit bcf3295

Please sign in to comment.