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

release-21.2: ui: updates the jobs table styling #70449

Merged
merged 1 commit into from
Sep 20, 2021
Merged
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 pkg/ui/workspaces/db-console/src/util/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export const metaRanges = docsURL(
);
export const databaseTable = docsURL("ui-databases-page.html");
export const jobTable = docsURL("ui-jobs-page.html");
export const jobStatus = docsURL("ui-jobs-page.html#job-status");
export const jobsPause = docsURL("pause-job");
export const jobsResume = docsURL("resume-job");
export const jobsCancel = docsURL("cancel-job");
export const statementsTable = docsURL("ui-statements-page.html");
export const statementDiagnostics = docsURL(
"ui-statements-page.html#diagnostics",
Expand Down
94 changes: 85 additions & 9 deletions pkg/ui/workspaces/db-console/src/views/jobs/jobTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// licenses/APL.txt.

import React, { MouseEvent } from "react";
import _ from "lodash";
import { cockroach } from "src/js/protos";
import { TimestampToMoment } from "src/util/convert";
import { DATE_FORMAT_24_UTC } from "src/util/format";
Expand All @@ -25,46 +24,123 @@ import {
Pagination,
ResultsPerPageLabel,
} from "@cockroachlabs/cluster-ui";
import { jobTable } from "src/util/docs";
import {
jobsCancel,
jobsPause,
jobsResume,
jobStatus,
jobTable,
} from "src/util/docs";
import { trackDocsLink } from "src/util/analytics";
import { EmptyTable } from "@cockroachlabs/cluster-ui";
import { EmptyTable, SortedTable } from "@cockroachlabs/cluster-ui";
import { Anchor } from "src/components";
import emptyTableResultsIcon from "assets/emptyState/empty-table-results.svg";
import magnifyingGlassIcon from "assets/emptyState/magnifying-glass.svg";
import { SortedTable } from "../shared/components/sortedtable";
import { Tooltip } from "@cockroachlabs/ui-components";

class JobsSortedTable extends SortedTable<Job> {}

const jobsTableColumns: ColumnDescriptor<Job>[] = [
{
name: "description",
title: "Description",
title: (
<Tooltip
placement="bottom"
style="tableTitle"
content={
<p>
The description of the job, if set, or the SQL statement if there is
no job description.
</p>
}
>
{"Description"}
</Tooltip>
),
className: "cl-table__col-query-text",
cell: job => <JobDescriptionCell job={job} />,
sort: job => job.statement || job.description || job.type,
},
{
name: "jobId",
title: "Job ID",
title: (
<Tooltip
placement="bottom"
style="tableTitle"
content={
<p>
{"Unique job ID. This value is used to "}
<Anchor href={jobsPause} target="_blank">
pause
</Anchor>
{", "}
<Anchor href={jobsResume} target="_blank">
resume
</Anchor>
{", or "}
<Anchor href={jobsCancel} target="_blank">
cancel
</Anchor>
{" jobs."}
</p>
}
>
{"Job ID"}
</Tooltip>
),
titleAlign: "right",
cell: job => String(job.id),
sort: job => job.id?.toNumber(),
},
{
name: "users",
title: "Users",
title: (
<Tooltip
placement="bottom"
style="tableTitle"
content={<p>User that created the job.</p>}
>
{"User"}
</Tooltip>
),
cell: job => job.username,
sort: job => job.username,
},
{
name: "creationTime",
title: "Creation Time",
title: (
<Tooltip
placement="bottom"
style="tableTitle"
content={<p>Date and time the job was created.</p>}
>
{"Creation Time"}
</Tooltip>
),
cell: job => TimestampToMoment(job?.created).format(DATE_FORMAT_24_UTC),
sort: job => TimestampToMoment(job?.created).valueOf(),
},
{
name: "status",
title: "Status",
title: (
<Tooltip
placement="bottom"
style="tableTitle"
content={
<p>
{"Current "}
<Anchor href={jobStatus} target="_blank">
job status
</Anchor>
{
" or completion progress, and the total time the job took to complete."
}
</p>
}
>
{"Status"}
</Tooltip>
),
cell: job => <JobStatusCell job={job} compact />,
sort: job => job.fraction_completed,
},
Expand Down