Skip to content
Merged

Fixes #1368

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 @@ -28,7 +28,7 @@
matTooltip="Duplicate row">
<mat-icon fontSet="material-icons-outlined">difference</mat-icon>
</a>
<button type="button" mat-icon-button *ngIf="permissions.delete && hasKeyAttributesFromURL"
<button type="button" mat-icon-button *ngIf="permissions.delete && canDelete && hasKeyAttributesFromURL"
matTooltip="Delete row"
(click)="handleDeleteRow()">
<mat-icon fontSet="material-icons-outlined">delete</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class DbTableRowEditComponent implements OnInit {
public referencedTablesURLParams: any;
public isDesktop: boolean = true;
public permissions: TablePermissions;
public canDelete: boolean;
public pageAction: string;
public tableFiltersUrlString: string;
public backUrlParams: object;
Expand Down Expand Up @@ -214,6 +215,7 @@ export class DbTableRowEditComponent implements OnInit {
this.dispalyTableName = res.display_name || normalizeTableName(this.tableName);
this.title.setTitle(`${this.dispalyTableName} - Edit record | Rocketadmin`);
this.permissions = res.table_access_level;
this.canDelete = res.can_delete;
this.keyAttributesListFromStructure = res.primaryColumns.map((field: TableField) => field.column_name);

this.nonModifyingFields = res.structure
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/app/services/connections.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ describe('ConnectionsService', () => {

service.getConnectionSettings('12345678').subscribe(res => {
expect(res).toEqual(connectionSettingsNetwork);
expect(service.connectionLogo).toEqual('https://example.com/logo.png');
expect(service.companyName).toEqual('Example Company');
expect(mockThemeService.updateColors).toHaveBeenCalledWith({
palettes: { primaryPalette: '#123456', accentedPalette: '#654321' },
});
Expand Down
30 changes: 8 additions & 22 deletions frontend/src/app/services/connections.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export class ConnectionsService {
public connectionAccessLevel: AccessLevel;
public groupsAccessLevel: boolean;
public currentPage: string;
public connectionLogo: string;
public companyName: string;
public isCustomAccentedColor: boolean;
public defaultDisplayTable: string;
public ownConnections: Connection[] = null;
Expand Down Expand Up @@ -104,14 +102,6 @@ export class ConnectionsService {
return this.defineConnectionTitle(this.connection);
}

get logo() {
return this.connectionLogo;
}

get name() {
return this.companyName;
}

get defaultTableToOpen() {
return this.defaultDisplayTable;
}
Expand Down Expand Up @@ -160,6 +150,7 @@ export class ConnectionsService {
}

setConnectionInfo(id: string) {
this.defaultDisplayTable = null;
if (id) {
this.fetchConnection(id).subscribe(res => {
this.connection = res.connection;
Expand All @@ -168,27 +159,22 @@ export class ConnectionsService {
this.connectionNameSubject.next(res.connection.title || res.connection.database);
this.connectionSigningKeySubject.next(res.connection.signing_key);
if (res.connectionProperties) {
this.connectionLogo = res.connectionProperties.logo_url;
this.companyName = res.connectionProperties.company_name;
this.defaultDisplayTable = res.connectionProperties.default_showing_table;
this.isCustomAccentedColor = !!res.connectionProperties.secondary_color;
this._themeService.updateColors({ palettes: { primaryPalette: res.connectionProperties.primary_color, accentedPalette: res.connectionProperties.secondary_color }});
} else {
this.connectionLogo = null;
this.companyName = null;
this.defaultDisplayTable = null;
this.isCustomAccentedColor = false;
this._themeService.updateColors({ palettes: { primaryPalette: '#212121', accentedPalette: '#C177FC' }});
}
});
} else {
this.connection = {...this.connectionInitialState};
this.connectionLogo = null;
this.companyName = null;
this.defaultDisplayTable = null;
this.isCustomAccentedColor = false;
this._themeService.updateColors({ palettes: { primaryPalette: '#212121', accentedPalette: '#C177FC' }});
}

console.log('this.defaultDisplayTable');
console.log(this.defaultDisplayTable);
}

isPermitted(accessLevel: AccessLevel) {
Expand Down Expand Up @@ -246,9 +232,11 @@ export class ConnectionsService {
map(res => {
const connection = this.defineConnectionType(res.connection);
if (res.connectionProperties) {
this.connectionLogo = res.connectionProperties.logo_url;
this.companyName = res.connectionProperties.company_name;
this.defaultDisplayTable = res.connectionProperties.default_showing_table;
this._themeService.updateColors({ palettes: { primaryPalette: res.connectionProperties.primary_color, accentedPalette: res.connectionProperties.secondary_color }});
} else {
this.defaultDisplayTable = null;
this._themeService.updateColors({ palettes: { primaryPalette: '#212121', accentedPalette: '#C177FC' }});
}
return {...res, connection};
}),
Expand Down Expand Up @@ -416,8 +404,6 @@ export class ConnectionsService {
.pipe(
map((res: any) => {
if (res) {
this.connectionLogo = res.logo_url;
this.companyName = res.company_name;
this._themeService.updateColors({ palettes: { primaryPalette: res.primary_color, accentedPalette: res.secondary_color }});
}
return res;
Expand Down