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

frontend: Improve visibility of 'User error' messages #1960

Merged
merged 7 commits into from
Apr 27, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ <h5>
<lib-executions-timeline
*ngIf="!loadingExecutions"
[jobExecutions]="jobExecutions"
[showErrorMessage]="true"
[next]="
(jobState?.deployments | extractJobStatus) ===
'Enabled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ hr {

margin-bottom: 1rem;

.form-section-readonly {
word-break: break-word;
}

.data-pipelines-job__section--border-none {
border: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
isJobMessageDifferentFromStatus()
"
>
<clr-signpost-content
[clrPosition]="'right-middle'"
*clrIfOpen="clrOpen"
>
<clr-signpost-content [clrPosition]="'right-bottom'" *clrIfOpen>
{{ jobMessage }}
<vdk-copy-to-clipboard-button
[tooltip]="'Copy to clipboard'"
Expand All @@ -29,10 +26,19 @@
></vdk-copy-to-clipboard-button>
</clr-signpost-content>
</div>
<span
class="job-execution-status__text"
data-cy="data-pipelines-job-executions-status-filters"
clrSignpostTrigger
>{{ executionStatusProperties.text }}
</span>
<div class="job-execution-status__container">
<span
class="job-execution-status__text"
data-cy="data-pipelines-job-executions-status-filters"
clrSignpostTrigger
>{{ executionStatusProperties.text }}
</span>
<button
*ngIf="showErrorMessage && isJobStatusSuitableForMessageTooltip() && isJobMessageDifferentFromStatus()"
class="btn btn-link btn-icon btn-sm job-execution-status__btn"
clrSignpostTrigger
>
details
</button>
</div>
</clr-signpost>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@
* SPDX-License-Identifier: Apache-2.0
*/

.job-execution-status__text {
margin-left: 0.25rem;
.job-execution-status__container {
display: flex;
align-items: baseline;
flex-direction: column;

.job-execution-status__text {
margin-left: 0.25rem;
}

.job-execution-status__btn {
padding: 0;
margin-left: 5px;
text-transform: lowercase;
font-size: 12px;
outline-color: transparent;
}
}

:host {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ type StatusPropertiesMapping = {
styleUrls: ['./data-job-execution-status.component.scss']
})
export class DataJobExecutionStatusComponent {
@HostListener('mouseenter') onMouseEnter(): void {
this.clrOpen = true;
}

@HostListener('mouseleave') onMouseLeave(): void {
this.clrOpen = false;
}

@Input() jobStatus: DataJobExecutionStatus;
@Input() jobMessage = '';
@Input() showErrorMessage = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
<lib-data-job-execution-status
*ngIf="getJobStatus(job)"
[jobStatus]="getJobStatus(job)"
[showErrorMessage]="true"
></lib-data-job-execution-status>
</clr-dg-cell>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ describe('DataJobsApiService', () => {
id
status
logsUrl
message
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class DataJobsApiService extends TaurusBaseApiService<DataJobsApiService>
id
status
logsUrl
message
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let execution of jobExecutions
| slice
: (jobExecutions.length > 5 ? jobExecutions.length - 5 : 0);
trackBy: trackByFn
trackBy: trackByFn; index as i
"
class="clr-timeline-step"
[attr.data-cy]="execution.id"
Expand Down Expand Up @@ -86,6 +86,36 @@

<div class="clr-timeline-step-description">
<div class="clr-timeline__element--display-block">
<span
*ngIf="showErrorMessage && isJobStatusSuitableForMessageTooltip(execution) && isJobMessageDifferentFromStatus(execution)"
>
<span *ngIf=" showExecutionFullMessage[i]"
>{{ execution.message }}
<button
class="btn btn-link btn-sm btn-show-more"
(click)=" showExecutionFullMessage[i] = false"
>
show less
</button>
</span>

<span *ngIf="!showExecutionFullMessage[i]"
>{{ execution.message | words :
messageWordsBeforeTruncate }}
<button
*ngIf="
execution.message?.split(' ')
.length >
messageWordsBeforeTruncate
"
class="btn btn-link btn-sm btn-show-more"
(click)=" showExecutionFullMessage[i] = true"
>
show more
</button>
</span>
<br />
</span>
<span>Duration: </span>
<span
class="clr-timeline__duration-tag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@

.clr-timeline__element--display-block {
display: block;
width: 200px;

span {
word-break: break-word;

.btn-show-more {
padding: 0;
margin: 0;
}
}
}

.clr-timeline__duration-tag {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, Inject, Input, OnInit } from '@angular/core';

import {
DATA_PIPELINES_CONFIGS,
Expand All @@ -20,20 +20,27 @@ import {
styleUrls: ['./executions-timeline.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ExecutionsTimelineComponent {
export class ExecutionsTimelineComponent implements OnInit {
static manualRunKnownUser = 'This job is triggered manually by user';
static manualRunNoUser = 'This job is triggered manually, but there is no info about the user';

@Input() jobExecutions: DataJobExecutions = [];
@Input() next: Date = null;
@Input() showErrorMessage = false;
showExecutionFullMessage: boolean[];

messageWordsBeforeTruncate = 50;
dataJobExecutionStatus = DataJobExecutionStatus;

constructor(
@Inject(DATA_PIPELINES_CONFIGS)
public dataPipelinesModuleConfig: DataPipelinesConfig
) {}

ngOnInit(): void {
this.showExecutionFullMessage = new Array(this.jobExecutions.length).fill(false);
}

/**
* ** NgFor elements tracking function.
*/
Expand All @@ -55,4 +62,17 @@ export class ExecutionsTimelineComponent {

return `${ExecutionsTimelineComponent.manualRunKnownUser} ${user}`;
}

isJobStatusSuitableForMessageTooltip(execution: DataJobExecution): boolean {
return (
execution.status === DataJobExecutionStatus.PLATFORM_ERROR ||
execution.status === DataJobExecutionStatus.USER_ERROR ||
execution.status === DataJobExecutionStatus.SKIPPED
);
}

isJobMessageDifferentFromStatus(execution: DataJobExecution): boolean {
const message = execution.message?.toLowerCase();
return message !== 'user error' && message !== 'platform error' && message !== 'skipped' && message !== '';
}
}