Skip to content
Merged

Fixes #1439

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,32 @@ export class DbTableViewComponent implements OnInit {
return stringValue;
};

// Check if there's any selection
if (!this.selection.selected || this.selection.selected.length === 0) {
this._notifications.showErrorSnackbar('No rows selected for export');
return;
}

const header = Object.keys(this.selection.selected[0]);

// Create CSV rows with proper handling of nested objects
// Create CSV rows with proper handling of foreign keys
const csv = this.selection.selected.map((row) =>
header
.map((fieldName) => convertToCSVValue(row[fieldName]))
.map((fieldName) => {
let value = row[fieldName];

// Check if this field is a foreign key
if (this.isForeignKey(fieldName) && value && typeof value === 'object') {
// Get the foreign key definition
const foreignKey = this.tableData.foreignKeys[fieldName];

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing null safety: The code accesses this.tableData.foreignKeys[fieldName] without checking if this.tableData.foreignKeys exists. If foreignKeys is undefined or null, this will throw a runtime error. Consider adding a check like this.tableData.foreignKeys && this.tableData.foreignKeys[fieldName] or using optional chaining this.tableData.foreignKeys?.[fieldName].

Suggested change
const foreignKey = this.tableData.foreignKeys[fieldName];
const foreignKey = this.tableData.foreignKeys?.[fieldName];

Copilot uses AI. Check for mistakes.
if (foreignKey) {
// Extract only the primary key value from the foreign key object
value = value[foreignKey.referenced_column_name];
}
}

return convertToCSVValue(value);
})
.join(',')
);

Expand Down
5 changes: 5 additions & 0 deletions frontend/src/app/components/sso/sso.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
width: 100%;
}

.samlConfigForm__checkbox {
margin-top: -4px;
margin-bottom: 20px;
}

.ssoPageHeader {
margin-bottom: 24px !important;
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/components/sso/sso.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ <h1 class="mat-h1 ssoPageHeader">
</mat-form-field>

<mat-checkbox name="active" #active="ngModel"
class="samlConfigForm__checkbox"
data-testid="active-checkbox"
labelPosition="after"
[disabled]="submitting"
Expand All @@ -79,6 +80,7 @@ <h1 class="mat-h1 ssoPageHeader">
</mat-checkbox>

<mat-checkbox name="authnResponseSignedValidation" #authnResponseSignedValidation="ngModel"
class="samlConfigForm__checkbox"
data-testid="authnResponseSignedValidation-checkbox"
labelPosition="after"
[disabled]="submitting"
Expand Down
Loading