Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Entry Type Changes - SEAB-5365 #1761

Merged
merged 4 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
90 changes: 68 additions & 22 deletions src/app/container/info-tab/info-tab.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<mat-card-header>
<mat-card-title>Tool Information</mat-card-title>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content class="p-1 pt-3">
<ul class="list-unstyled container-info">
<li *ngIf="tool?.providerUrl && tool?.mode !== DockstoreToolType.ModeEnum.HOSTED">
Expand Down Expand Up @@ -362,31 +363,76 @@

<mat-card *ngIf="selectedVersion" class="mt-3">
<mat-card-header>
<mat-card-title class="m-0">Tag Information</mat-card-title>
<mat-card-subtitle class="m-0">{{ selectedVersion?.name }}</mat-card-subtitle>
<mat-card-title>Tool Version Information</mat-card-title>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content class="p-1 pt-3">
<div>
<strong matTooltip="Author listed in descriptor">Author</strong>: {{ selectedVersion?.author ? selectedVersion?.author : 'n/a' }}
</div>
<div>
<strong matTooltip="E-mail of corresponding author for tool">E-mail</strong>:
<a [href]="'mailto:' + selectedVersion?.email" *ngIf="selectedVersion?.email">
{{ selectedVersion?.email }}
</a>
<span *ngIf="!selectedVersion?.email"> n/a </span>
<div fxLayout fxLayoutAlign="start center" fxLayoutGap="2rem">
<span class="bubble">
{{ selectedVersion?.name }}
</span>
<span *ngIf="isValidVersion" id="downloadZipButton" data-cy="downloadZip">
<button *ngIf="!tool?.is_published" mat-button color="accent" class="private-btn small-btn-structure" (click)="downloadZip()">
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP
</button>
<a
[href]="downloadZipLink"
*ngIf="tool?.is_published"
mat-button
color="accent"
class="private-btn small-btn-structure no-underline"
>
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP
</a>
</span>
</div>
<span *ngIf="isValidVersion" id="downloadZipButton" data-cy="downloadZip">
<button *ngIf="!tool?.is_published" mat-button color="accent" class="private-btn small-btn-structure" (click)="downloadZip()">
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP
</button>
<a [href]="downloadZipLink" *ngIf="tool?.is_published" mat-button color="accent" class="private-btn small-btn-structure">
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP</a
>
</span>

<mat-divider [inset]="true" class="mt-3"></mat-divider>
<table mat-table [dataSource]="this.authors" class="w-100 mb-5" aria-describedby="Authors">
<ng-container matColumnDef="name">
<th scope="col" mat-header-cell *matHeaderCellDef>Author</th>
<td mat-cell *matCellDef="let author">{{ author.name }}</td>
</ng-container>
<ng-container matColumnDef="role">
<th
scope="col"
mat-header-cell
fxHide.lt-md
*matHeaderCellDef
[ngClass]="{ 'inactive-table-header': this.authors.length === 0 }"
>
Role
</th>
<td mat-cell fxHide.lt-md *matCellDef="let author">{{ author.role }}</td>
</ng-container>
<ng-container matColumnDef="affiliation">
<th
scope="col"
mat-header-cell
fxHide.lt-md
*matHeaderCellDef
[ngClass]="{ 'inactive-table-header': this.authors.length === 0 }"
>
Affiliation
</th>
<td mat-cell fxHide.lt-md *matCellDef="let author">{{ author.affiliation }}</td>
</ng-container>
<ng-container matColumnDef="email">
<th scope="col" mat-header-cell *matHeaderCellDef [ngClass]="{ 'inactive-table-header': this.authors.length === 0 }">Email</th>
<td mat-cell *matCellDef="let author">
<span *ngIf="author.email">
<mat-icon class="info-icon" color="accent">email</mat-icon>
<a [href]="'mailto:' + author.email" target="_top">{{ author.email }}</a>
</span>
</td>
</ng-container>
<tr class="mat-row" *matNoDataRow>
<td class="mat-cell" [colSpan]="displayedColumns.length">Not Available</td>
</tr>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
<div *ngIf="selectedVersion?.description || !isPublic">
<label matTooltip="Description of tool obtained from tool descriptor"> Description </label>:
<div *ngIf="selectedVersion?.description" class="well well-sm">
Expand Down
4 changes: 4 additions & 0 deletions src/app/container/info-tab/info-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DockstoreTool } from '../../shared/swagger/model/dockstoreTool';
import { Tag } from '../../shared/swagger/model/tag';
import { exampleDescriptorPatterns, validationDescriptorPatterns } from '../../shared/validationMessages.model';
import { InfoTabService } from './info-tab.service';
import { Author } from 'app/shared/openapi';

import DescriptorTypeEnum = ToolVersion.DescriptorTypeEnum;

Expand All @@ -47,6 +48,8 @@ export class InfoTabComponent extends Base implements OnInit, OnChanges {
public tool: DockstoreTool;
public topicEditing: boolean;
public TopicSelectionEnum = DockstoreTool.TopicSelectionEnum;
public authors: Array<Author> = [];
public displayedColumns: string[] = ['name', 'role', 'affiliation', 'email'];
dockerFileEditing: boolean;
cwlPathEditing: boolean;
wdlPathEditing: boolean;
Expand All @@ -65,6 +68,7 @@ export class InfoTabComponent extends Base implements OnInit, OnChanges {
ngOnChanges() {
this.tool = JSON.parse(JSON.stringify(this.extendedDockstoreTool));
if (this.selectedVersion && this.tool) {
this.authors = this.selectedVersion.authors;
this.currentVersion = this.selectedVersion;
this.isValidVersion = this.validVersions.some((version: Tag) => version.id === this.selectedVersion.id);
this.downloadZipLink = Dockstore.API_URI + '/containers/' + this.tool.id + '/zip/' + this.currentVersion.id;
Expand Down
8 changes: 7 additions & 1 deletion src/app/workflow/info-tab/info-tab.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,13 @@
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP
</button>
<a [href]="downloadZipLink" *ngIf="workflow?.is_published" mat-button color="accent" class="private-btn small-btn-structure">
<a
[href]="downloadZipLink"
*ngIf="workflow?.is_published"
mat-button
color="accent"
class="private-btn small-btn-structure no-underline"
>
<mat-icon class="mat-icon-sm">file_download</mat-icon>
Export as ZIP
</a>
Expand Down
15 changes: 3 additions & 12 deletions src/app/workflow/workflow.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,8 @@ <h2 class="text-center">The workflow linked to could not be found!</h2>
<app-json-ld [json]="schema"></app-json-ld>
<div fxFlex="80">
<h3 id="workflow-path" data-cy="workflowTitle" fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="1rem">
<span *ngIf="entryType === EntryType.Tool" data-cy="tool-icon">
<img src="../../assets/svg/tool-circle.svg" alt="tool icon" />
</span>
<span *ngIf="entryType === EntryType.BioWorkflow" data-cy="workflow-icon">
<img src="../../assets/svg/workflow-circle.svg" alt="workflow icon" />
</span>
<span *ngIf="entryType === EntryType.Service" data-cy="service-icon">
<img src="../../assets/svg/service-circle.svg" alt="service icon" />
</span>
<span *ngIf="entryType === EntryType.Notebook" data-cy="notebook-icon">
<img src="../../assets/svg/notebook-circle.svg" alt="notebook icon" />
<span [attr.data-cy]="entryType + '-icon'">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is much better!

<img src="../../assets/svg/{{ entryType }}-circle.svg" alt="{{ entryType }} icon" />
</span>
<span fxLayout.lt-sm="column" style="word-break: break-word">
{{ title
Expand Down Expand Up @@ -225,7 +216,7 @@ <h3>
<div [ngClass]="{ 'mr-3': isWorkflowPublic }">
<mat-tab-group
[selectedIndex]="selected.value"
class="workflow-tab-group"
class="{{ entryType }}-tab-group"
id="workflow_tabs"
#entryTabs
(selectedIndexChange)="selected.setValue($event)"
Expand Down
2 changes: 1 addition & 1 deletion src/app/workflows/workflows.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
</div>
<ng-template #search>
<img src="../assets/svg/sub-nav/{{ entryType$ | async }}.svg" alt="{{ entryType$ | async }} icon" />
<img [src]="'../assets/svg/sub-nav/' + getEntryTerm(entryType$ | async) + '.svg'" [alt]="getEntryTerm(entryType$ | async) + 'icon'" />
<span class="mx-1">{{ entryPageTitle$ | async | titlecase }}</span>
<div *ngIf="(entryType$ | async) === EntryType.Service || (entryType$ | async) === EntryType.Notebook" class="bubble preview-bubble">
PREVIEW
Expand Down
9 changes: 8 additions & 1 deletion src/app/workflows/workflows.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { SessionService } from 'app/shared/session/session.service';
import { Observable } from 'rxjs';
import { EntryType } from '../shared/enum/entry-type';
import { UrlResolverService } from '../shared/url-resolver.service';
import { EntryTypeMetadataService } from '../entry/type-metadata/entry-type-metadata.service';
import { EntryType as newEntryType } from 'app/shared/openapi';

@Component({
selector: 'app-workflows',
Expand All @@ -39,7 +41,8 @@ export class WorkflowsComponent {
private sessionService: SessionService,
private route: ActivatedRoute,
private router: Router,
private urlResolverService: UrlResolverService
private urlResolverService: UrlResolverService,
public entryTypeMetadataService: EntryTypeMetadataService
) {
/* Force refresh of route when nagivating from /entryType to /entryType/entryName to update header */
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
Expand All @@ -49,4 +52,8 @@ export class WorkflowsComponent {
this.searchPage = this.searchPageUrls.includes(this.urlResolverService.getEntryPathFromUrl());
this.entryName = this.urlResolverService.getEntryPathFromUrl();
}

getEntryTerm(type: newEntryType): string {
return this.entryTypeMetadataService.get(type.toUpperCase() as newEntryType).term;
}
}