Skip to content

Commit

Permalink
Merge pull request #536 from ncats/editStructureSR2
Browse files Browse the repository at this point in the history
fixes to edit to structure search link
  • Loading branch information
NikoAnderson authored Aug 15, 2024
2 parents 698a629 + c518f07 commit 14f5b0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/app/core/config/config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface Config {
useApprovalAPI?: boolean;
dummyWhoami?: Auth;
enableStructureFeatures?: boolean;
structureEditSearch?: boolean;
}

export interface StagingAreaSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h4>Draw or import a structure using Ketcher. Then, if any features are detected
<mat-icon svgIcon="search"></mat-icon>
Check for duplicates
</button>
<button (click)="structureSearch()" matTooltip="open structure search in new tab" mat-button
<button (click)="structureSearch()" matTooltip="open structure search in new tab" mat-button *ngIf = "structureEditSearch"
color="primary" class="dupe-check">
<mat-icon svgIcon="search"></mat-icon>
Structure Search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class SubstanceFormStructureCardComponent extends SubstanceFormBase imple
displayedColumns = ['key', 'value'];
featuresOnly = false;
hideFeaturesTable = false;
structureEditSearch = true;
@ViewChild(StructureEditorComponent) structureEditorComponent!: StructureEditorComponent;

constructor(
Expand All @@ -69,6 +70,12 @@ export class SubstanceFormStructureCardComponent extends SubstanceFormBase imple
if (this.configService.configData && this.configService.configData.enableStructureFeatures) {
this.enableStructureFeatures = this.configService.configData.enableStructureFeatures;
}

if (this.configService.configData &&
(this.configService.configData.structureEditSearch !== undefined &&
this.configService.configData.structureEditSearch !== null)) {
this.structureEditSearch = this.configService.configData.structureEditSearch;
}
if(this.activatedRoute.snapshot.routeConfig.path === 'structure-features') {
this.featuresOnly = true;
}
Expand Down Expand Up @@ -373,14 +380,11 @@ export class SubstanceFormStructureCardComponent extends SubstanceFormBase imple
let url = this.configService.configData.gsrsHomeBaseUrl + '/structure-search?structure=' + response.structure.id;
window.open(url, '_blank');
} else {

const baseUrl = window.location.href.replace(this.router.url, '');
const url = baseUrl + this.router.serializeUrl(this.router.createUrlTree(['/structure-search'],
{ queryParams: navigationExtras.queryParams}));
window.open( url, '_blank');
}
const urlTree = this.router.createUrlTree(['/structure-search/'], {
queryParams: navigationExtras.queryParams,
queryParamsHandling: 'merge',
preserveFragment: true
});
window.open(urlTree.toString(), '_blank');
}, error => {
this.loadingService.setLoading(false);
});
Expand Down

0 comments on commit 14f5b0a

Please sign in to comment.