Skip to content

Commit

Permalink
ui: ui updates to Statements Page
Browse files Browse the repository at this point in the history
This commit introduces fixes to Statements Page:

- Update style of link on tooltip for diagnostic status and
add space before `When`
- Remove word `current` from the Cancel Diagnostics request
- Slow loading message only show after a few seconds of page loading
- Space between item (seach / filter/ time picker) are now 12px and
the size of both dividers are the same (using the heigh of all items)
- Update color of alert message on Conditional Diagnostic Request
- Change `trace` to `diagnostic bundle`
- Update link color/underline on hover for node and app name

Partially addresses #77982

Release note: None
  • Loading branch information
maryliag committed Mar 18, 2022
1 parent e0e6166 commit 3bf6fa6
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/common/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ h3.base-heading {

.separator {
border-left: 1px solid #C0C6D9;
padding-left: 25px;
padding-left: 12px;
}
1 change: 1 addition & 0 deletions pkg/ui/workspaces/cluster-ui/src/core/colors.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $colors--primary-blue-4: #005fb3;
$colors--primary-blue-5: #00294d;
$colors--primary-blue-6: #89b0ff;
$colors--primary-blue-7: #b6ceff;
$colors--primary-blue-alert: #e1ecff;

$colors--primary-green-0: #daf8d4;
$colors--primary-green-1: #b4f1aa;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
align-items: center;

.page-config__item {
margin-right: 24px;
margin-right: 12px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
white-space: nowrap;
line-height: $line-height--medium;
font-weight: $font-weight--bold;
color: $colors--primary-blue-3;

&:hover {
color: $colors--primary-blue-3;
text-decoration: underline;
}

&__unset {
color: $tooltip-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
margin-top: $spacing-small;
margin-left: $spacing-medium;

.ant-alert-info {
background-color: $colors--primary-blue-alert;
border: none;
}

&-icon {
margin-top: $spacing-medium-small;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
@import "src/core/index.module";

.diagnostic-status-badge {
&__content {
width: fit-content;
}
}

.tooltip--title a {
color: $colors--neutral-0;
text-decoration: underline;
&:hover {
opacity: 0.7;
color: $colors--neutral-0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ function mapStatusToDescription(diagnosticsStatus: DiagnosticStatuses) {
);
case "WAITING":
return (
<div className={cx("tooltip__table--title")}>
<div className={cx("tooltip--title")}>
<p>
CockroachDB is waiting for the next SQL statement that matches this
fingerprint.
</p>
<p>
{"When the most recent "}
{" When the most recent "}
<Anchor href={statementDiagnostics} target="_blank">
diagnostics
</Anchor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
width: fit-content;
}

.reset-btn-area {
height: $line-height--larger;
display: flex;
align-items: center;
}

.app-filter-dropdown {
/*
we are truncating the text in the filter,
Expand Down
21 changes: 19 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import ClearStats from "../sqlActivity/clearStats";
import SQLActivityError from "../sqlActivity/errorComponent";
import {
TimeScaleDropdown,
defaultTimeScaleSelected,
TimeScale,
toDateRange,
} from "../timeScaleDropdown";
Expand Down Expand Up @@ -135,6 +134,7 @@ export interface StatementsPageState {
pagination: ISortedTablePagination;
filters?: Filters;
activeFilters?: number;
startRequest?: Date;
}

export type StatementsPageProps = StatementsPageDispatchProps &
Expand Down Expand Up @@ -183,6 +183,7 @@ export class StatementsPage extends React.Component<
pageSize: 20,
current: 1,
},
startRequest: new Date(),
};
const stateFromHistory = this.getStateFromHistory();
this.state = merge(defaultState, stateFromHistory);
Expand Down Expand Up @@ -250,6 +251,9 @@ export class StatementsPage extends React.Component<
if (this.props.onTimeScaleChange) {
this.props.onTimeScaleChange(ts);
}
this.setState({
startRequest: new Date(),
});
};

resetPagination = (): void => {
Expand All @@ -270,9 +274,15 @@ export class StatementsPage extends React.Component<
resetSQLStats = (): void => {
const req = statementsRequestFromProps(this.props);
this.props.resetSQLStats(req);
this.setState({
startRequest: new Date(),
});
};

componentDidMount(): void {
this.setState({
startRequest: new Date(),
});
this.refreshStatements();
this.props.refreshUserSQLRoles();
if (!this.props.isTenant && !this.props.hasViewActivityRedactedRole) {
Expand Down Expand Up @@ -611,7 +621,12 @@ export class StatementsPage extends React.Component<
? []
: unique(nodes.map(node => nodeRegions[node.toString()])).sort();
const { filters, activeFilters } = this.state;

const timeNow = new Date();
const timeWaitingResponse =
(timeNow.getTime() - this.state.startRequest.getTime()) / 1000;
const longLoadingMessage = isNil(this.props.statements) &&
timeWaitingResponse > 2 &&
isNil(getValidErrorsList(this.props.statementsError)) && (
<InlineAlert
intent="info"
Expand Down Expand Up @@ -651,7 +666,9 @@ export class StatementsPage extends React.Component<
setTimeScale={this.changeTimeScale}
/>
</PageConfigItem>
<PageConfigItem className={commonStyles("separator")}>
<PageConfigItem
className={`${commonStyles("separator")} ${cx("reset-btn-area")} `}
>
<ClearStats
resetSQLStats={this.resetSQLStats}
tooltipType="statement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const StatementTableCell = {
return {
name: (
<div className={cx("diagnostic-report-dropdown-option")}>
{`Cancel current diagnostic request`}
{`Cancel diagnostic request`}
</div>
),
value: dr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $subnav-background = $background-color
align-items center

.page-config__item
margin-right 24px
margin-right 12px

&__spread
display flex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ class StatementDiagnosticsHistoryView extends React.Component<
if (totalCount <= this.tablePageSize) {
return (
<div className="diagnostics-history-view__table-header">
<Text>{`${totalCount} traces`}</Text>
<Text>{`${totalCount} diagnostics bundles`}</Text>
</div>
);
}

return (
<div className="diagnostics-history-view__table-header">
<Text>{`${this.tablePageSize} of ${totalCount} traces`}</Text>
<Text>{`${this.tablePageSize} of ${totalCount} diagnostics bundles`}</Text>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
align-items center

.page-config__item
margin-right 24px
margin-right 12px

&__spread
display flex
Expand Down

0 comments on commit 3bf6fa6

Please sign in to comment.