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

SEAB-6341: Add Metrics type icons in versions tab and Rescent Versions sidebar #2048

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions cypress/e2e/group3/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ describe('Dockstore Metrics', () => {
}).as('getMetrics');
});
cy.visit('/workflows/github.com/A/l:master');
goToTab('Versions');
cy.get('[data-cy=execution-metrics-icon]').should('be.visible');
cy.get('[data-cy=validation-metrics-icon]').should('be.visible');

cy.wait('@getMetrics');
goToTab('Metrics');

Expand Down
10 changes: 9 additions & 1 deletion src/app/workflow/executions/executions-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, Input, OnChanges, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import { EntryTab } from '../../shared/entry/entry-tab';
import {
CloudInstance,
Expand Down Expand Up @@ -122,6 +122,9 @@
@Input() entry: BioWorkflow | Service | Notebook;
@Input() version: WorkflowVersion;

@Output() showExecutionIcon = new EventEmitter<boolean>();
@Output() showValidationIcon = new EventEmitter<boolean>();

Check warning on line 127 in src/app/workflow/executions/executions-tab.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/workflow/executions/executions-tab.component.ts#L125-L127

Added lines #L125 - L127 were not covered by tests
constructor(
private extendedGA4GHService: ExtendedGA4GHService,
private alertService: AlertService,
Expand Down Expand Up @@ -205,6 +208,10 @@
const metrics = this.metrics.get(partner);
this.executionMetricsExist = metrics?.executionStatusCount !== null;

if (this.executionMetricsExist) {
this.showExecutionIcon.emit(true);
}

Check warning on line 213 in src/app/workflow/executions/executions-tab.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/workflow/executions/executions-tab.component.ts#L211-L213

Added lines #L211 - L213 were not covered by tests

if (metrics?.executionStatusCount) {
this.executionStatusToMetrics = new Map(Object.entries(metrics.executionStatusCount.count));

Expand Down Expand Up @@ -284,6 +291,7 @@
if (this.validatorToolMetricsExist) {
this.validatorToolToValidatorInfo = new Map(Object.entries(this.metrics.get(partner).validationStatus.validatorTools));
this.validatorTools = Array.from(this.validatorToolToValidatorInfo.keys());
this.showValidationIcon.emit(true);

if (this.validatorTools.length > 0) {
this.onSelectedValidatorToolChange(this.validatorTools[0]);
Expand Down
13 changes: 12 additions & 1 deletion src/app/workflow/versions/versions.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,18 @@
>
</th>
<td mat-cell *matCellDef="let version">
<mat-icon data-cy="metrics" *ngIf="version.metricsByPlatform && (version.metricsByPlatform | json) !== '{}'">check</mat-icon>
<img
*ngIf="hasExecutionMetrics"
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of relying on event emitter, can't you just tell by looking a version.metricsByPlatform where there are execution and validation metrics or not? I may be missing something, and you may need a pipe to figure it out, but it seems more straightforward than having an event emitter from the executions-tab-component.

src="assets/svg/manufacturing.svg"
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
alt="Execution Metrics Icon"
matTooltip="This version contains execution metrics."
/>
<img
*ngIf="hasValidationMetrics"
src="assets/svg/data_check.svg"
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
alt="Validation Metrics Icon"
matTooltip="This version contains validation metrics."
/>
</td>
</ng-container>

Expand Down
3 changes: 3 additions & 0 deletions src/app/workflow/versions/versions.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
@Input() workflowId: number;
@Input() verifiedVersionPlatforms: Array<VersionVerifiedPlatform>;
@Input() publicPage: boolean;
@Input() hasExecutionMetrics!: boolean;
@Input() hasValidationMetrics!: boolean;

Check warning on line 86 in src/app/workflow/versions/versions.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/workflow/versions/versions.component.ts#L86

Added line #L86 was not covered by tests
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved

_selectedVersion: WorkflowVersion;
Dockstore = Dockstore;
@Input() set selectedVersion(value: WorkflowVersion) {
Expand Down
23 changes: 22 additions & 1 deletion src/app/workflow/workflow.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ <h3>
[canRead]="canRead"
[canWrite]="canWrite"
[isOwner]="isOwner"
[hasExecutionMetrics]="hasExecutionMetrics"
[hasValidationMetrics]="hasValidationMetrics"
>
</app-versions-workflow>
</div>
Expand Down Expand Up @@ -456,7 +458,12 @@ <h3>
</mat-tab>
</div>
<mat-tab id="metricsTab" label="Metrics">
<app-executions-tab [entry]="workflow" [version]="selectedVersion"></app-executions-tab>
<app-executions-tab
[entry]="workflow"
[version]="selectedVersion"
(showExecutionIcon)="showExecutionMetricsIcon($event)"
(showValidationIcon)="showValidationMetricsIcon($event)"
></app-executions-tab>
</mat-tab>
<mat-tab *ngIf="!isPublic() && isHosted() && isOwner" id="permissionsTab" label="Permissions">
<app-permissions [workflow]="workflow"></app-permissions>
Expand Down Expand Up @@ -514,6 +521,20 @@ <h3>
</a>
</mat-chip>
</span>
<img
*ngIf="hasExecutionMetrics"
src="assets/svg/manufacturing.svg"
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
alt="Execution Metrics Icon"
data-cy="execution-metrics-icon"
matTooltip="This version contains execution metrics."
/>
<img
*ngIf="hasValidationMetrics"
src="assets/svg/data_check.svg"
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
alt="Validation Metrics Icon"
data-cy="validation-metrics-icon"
matTooltip="This version contains validation metrics."
/>
</div>
<small>{{ sortedVersion.last_modified | date }}</small>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/app/workflow/workflow.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
public selectedVersionDoi: Doi | undefined;
public selectedConceptDoi: Doi | undefined;

public hasExecutionMetrics: boolean = false;
public hasValidationMetrics: boolean = false;

Check warning on line 212 in src/app/workflow/workflow.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/workflow/workflow.component.ts#L212

Added line #L212 was not covered by tests

@Input() user;
@Input() selectedVersion: WorkflowVersion;
@Input() shouldClearState: boolean = true;
Expand Down Expand Up @@ -558,6 +561,14 @@
});
}

showExecutionMetricsIcon(showExecutionMetricsIcon: boolean) {
this.hasExecutionMetrics = showExecutionMetricsIcon;
}

showValidationMetricsIcon(showValidationMetricsIcon: boolean) {
this.hasValidationMetrics = showValidationMetricsIcon;
}

resetWorkflowEditData() {
const labelArray = this.dockstoreService.getLabelStrings(this.workflow.labels);
const workflowLabels = labelArray;
Expand Down
Loading