Skip to content

Commit

Permalink
Feature/remove circular dependency (#854)
Browse files Browse the repository at this point in the history
* remove circular dependecy
  • Loading branch information
agduncan94 authored Dec 20, 2019
1 parent 3ca3d7a commit ee9e910
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
10 changes: 9 additions & 1 deletion src/app/myworkflows/myworkflows.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ export class MyWorkflowsService extends MyEntriesService<Workflow, OrgWorkflowOb

registerEntry(entryType: EntryType | null) {
if (entryType === EntryType.BioWorkflow) {
this.matDialog.open(RegisterWorkflowModalComponent, { width: '600px' });
const dialogRef = this.matDialog.open(RegisterWorkflowModalComponent, { width: '600px' });
dialogRef.afterClosed().subscribe(reloadEntries => {
if (reloadEntries) {
const user = this.userQuery.getValue().user;
if (user) {
this.getMyEntries(user.id, entryType);
}
}
});
}
if (entryType === EntryType.Service) {
this.gitHubAppInstallationLink$.pipe(take(1)).subscribe(link => window.open(link));
Expand Down
7 changes: 2 additions & 5 deletions src/app/shared/myentries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
*/
import { OrgToolObject } from 'app/mytools/my-tool/my-tool.component';
import { OrgWorkflowObject } from 'app/myworkflows/my-workflow/my-workflow.component';
import { Base } from './base';
import { EntryType } from './enum/entry-type';
import { DockstoreTool, Workflow } from './swagger';
import { UrlResolverService } from './url-resolver.service';

export abstract class MyEntriesService<E extends DockstoreTool | Workflow, O extends OrgToolObject<E> | OrgWorkflowObject<E>> extends Base {
constructor(protected urlResolverService: UrlResolverService) {
super();
}
export abstract class MyEntriesService<E extends DockstoreTool | Workflow, O extends OrgToolObject<E> | OrgWorkflowObject<E>> {
constructor(protected urlResolverService: UrlResolverService) {}

recomputeWhatEntryToSelect(entries: E[]): E | null {
const foundEntry = this.findEntryFromPath(this.urlResolverService.getEntryPathFromUrl(), entries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ <h4 mat-dialog-title>Register Workflow</h4>
<entry-wizard></entry-wizard>
<div class="modal-footer">
<button mat-button color="secondary" matStepperPrevious>Back</button>
<button
type="button"
mat-flat-button
color="primary"
[mat-dialog-close]="true"
(click)="clearWorkflowRegisterError(); getMyEntries()"
>
<button type="button" mat-flat-button color="primary" [mat-dialog-close]="true" (click)="clearWorkflowRegisterError()">
Finish
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ import {
} from '../../shared/validationMessages.model';
import { RegisterWorkflowModalService } from './register-workflow-modal.service';
import DescriptorTypeEnum = Workflow.DescriptorTypeEnum;
import { MyWorkflowsService } from 'app/myworkflows/myworkflows.service';
import { SessionQuery } from 'app/shared/session/session.query';
import { UserQuery } from 'app/shared/user/user.query';

export interface HostedWorkflowObject {
name: string;
Expand Down Expand Up @@ -88,10 +85,7 @@ export class RegisterWorkflowModalComponent implements OnInit, AfterViewChecked,
private registerWorkflowModalService: RegisterWorkflowModalService,
public dialogRef: MatDialogRef<RegisterWorkflowModalComponent>,
private alertQuery: AlertQuery,
private descriptorLanguageService: DescriptorLanguageService,
private myWorkflowsService: MyWorkflowsService,
private sessionQuery: SessionQuery,
private userQuery: UserQuery
private descriptorLanguageService: DescriptorLanguageService
) {}

friendlyRepositoryKeys(): Array<string> {
Expand Down Expand Up @@ -244,17 +238,6 @@ export class RegisterWorkflowModalComponent implements OnInit, AfterViewChecked,
}
}

/**
* Updates list of entries for the logged in user
*/
getMyEntries() {
const user = this.userQuery.getValue().user;
const entryType = this.sessionQuery.getValue().entryType;
if (user && entryType) {
this.myWorkflowsService.getMyEntries(user.id, entryType);
}
}

ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
Expand Down

0 comments on commit ee9e910

Please sign in to comment.