Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Fix processes table
Browse files Browse the repository at this point in the history
- table styling was broken since pid changed to processId.
- rename cellRenderer renderPIDCell to renderProcessIdCell.
- update endpoint.
  • Loading branch information
tjeerddie committed Sep 20, 2023
1 parent cc6ef13 commit a561bd1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class ApiClient extends ApiClientInterface {

processSubscriptionsByProcessId = (processId: string): Promise<ProcessSubscription[]> => {
return this.fetchJsonWithCustomErrorHandling<ProcessSubscription[]>(
`processes/process-subscriptions-by-pid/${processId}`
`processes/process-subscriptions-by-process_id/${processId}`
).catch((err) => []);
};

Expand Down
18 changes: 9 additions & 9 deletions src/components/tables/Processes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { EuiPanel } from "@elastic/eui";
import ActionContainer from "components/ActionContainer";
import {
renderCustomersCell,
renderPidCell,
renderProcessIdCell,
renderProductTagCell,
renderProductsCell,
renderSubscriptionsCell,
Expand Down Expand Up @@ -153,11 +153,11 @@ export function ProcessesTable({ initialTableSettings, renderActions }: Processe

const extraRowPropGetter: RowPropGetter<ProcessV2> = useCallback(
(props: any, { row }: any) => {
const highlighted = row.values.pid === highlightQ ? " highlighted" : "";
const highlighted = row.values.processId === highlightQ ? " highlighted" : "";
return {
...props,
id: row.values.pid,
className: `${row.values.last_status}${highlighted}`,
id: row.values.processId,
className: `${row.values.lastStatus}${highlighted}`,
};
},
[highlightQ]
Expand Down Expand Up @@ -188,11 +188,11 @@ export function ProcessesTable({ initialTableSettings, renderActions }: Processe
<i className="fa fa-arrows-alt-v" onClick={() => toggleAllRowsExpanded()} />
),
Cell: ({ row }: { row: Row; cell: Cell }) => {
const caret = row.values.process_id === highlightQ ? <i className={"fa fa-caret-right"} /> : null;
const caret = row.values.processId === highlightQ ? <i className={"fa fa-caret-right"} /> : null;
const button = row.isExpanded ? (
<i className={`fa fa-minus-circle ${row.values.last_status}`} />
<i className={`fa fa-minus-circle ${row.values.lastStatus}`} />
) : (
<i className={`fa fa-plus-circle ${row.values.last_status}`} />
<i className={`fa fa-plus-circle ${row.values.lastStatus}`} />
);
return (
<div
Expand All @@ -214,7 +214,7 @@ export function ProcessesTable({ initialTableSettings, renderActions }: Processe
accessor: "process_id",
disableSortBy: true,
disableFilters: true,
Cell: renderPidCell,
Cell: renderProcessIdCell,
},
{
Header: "Assignee",
Expand Down Expand Up @@ -306,7 +306,7 @@ export function ProcessesTable({ initialTableSettings, renderActions }: Processe
{
Header: "Modified",
id: "lastModifiedAt",
accessor: "last_lastModifiedAt_at",
accessor: "last_modified_at",
Cell: renderTimestampCell,
disableFilters: true,
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/tables/ProcessesStyling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const processesStyling = css`
}
}
}
td.step {
td.last_step {
width: 15%;
}
td.actions {
Expand All @@ -42,7 +42,7 @@ export const processesStyling = css`
font-size: 18px;
position: relative;
}
td.pid {
td.process_id {
width: 80px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tables/cellRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function renderTimestampCell({ cell }: { cell: Cell }): string | null {
return time.tz(timezone).format(format);
}

export function renderPidCell({ cell }: { cell: Cell }) {
export function renderProcessIdCell({ cell }: { cell: Cell }) {
const processId: string = cell.value;
return (
<Link key={processId} onClick={(e) => e.stopPropagation()} to={`/processes/${processId}`} title={processId}>
Expand Down
13 changes: 7 additions & 6 deletions src/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ I18n.translations.en = {
cancel: "Cancel",
choose_product: "Choose Product",
flash: {
create_create: "Created create process for product {{name}} with pid {{pid}}",
create_modify: "Created {{name}} process for subscription {{subscriptionId}} with pid {{pid}}",
create_create: "Created create process for product {{name}} with process id {{process_id}}",
create_modify:
"Created {{name}} process for subscription {{subscriptionId}} with process id {{process_id}}",
update: "Resumed process for workflow {{name}}",
wizard_next_step: "Navigated to next step in form wizard",
},
Expand Down Expand Up @@ -191,10 +192,10 @@ I18n.translations.en = {
wording_process: "Process {{product}} of workflow {{workflow}} for {{customer}}",
wording_task: "Task of workflow {{workflow}}",
summary: {
status: "Status",
last_status: "Status",
assignee: "Assignee",
created_by: "Created by",
step: "Current step",
last_step: "Current step",
started_at: "Started",
last_modified_at: "Last updated",
},
Expand Down Expand Up @@ -365,7 +366,7 @@ I18n.translations.en = {
relatedSubscriptionsLP: "The ports used in the {{description}} subscription:",
relatedSubscriptionsServicePort: "The light-paths using the {{description}} subscription:",
terminatedWarning: "The info below may be outdated as the subscription they belong to is terminated!",
failed_task: "See {{pid}}",
failed_task: "See {{process_id}}",
customer_descriptions: "Customer description(s)",
stats_in_grafana: "Stats",
go_to_grafana: "Go to Grafana",
Expand Down Expand Up @@ -735,7 +736,7 @@ I18n.translations.en = {
subscription_link_txt: "Show Subscription related by this task",
new_task: "New task",
flash: {
create: "Created task for workflow {{name}} with pid {{pid}}",
create: "Created task for workflow {{name}} with process id {{process_id}}",
update: "Resumed task for workflow {{name}}",
},
},
Expand Down
24 changes: 12 additions & 12 deletions src/stories/ProcessDetail.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,36 @@ export default {

export const Process: ComponentStory<typeof ProcessDetail> = () => {
mock.reset();
mock.onGet("processes/pid").reply(200, FAILED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-pid/1a5686d9-eaa2-4d0b-96eb-1ec081c62a08").reply(200, []);
mock.onGet("processes/process_id").reply(200, FAILED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-process_id/1a5686d9-eaa2-4d0b-96eb-1ec081c62a08").reply(200, []);

//@ts-ignore
return <ProcessDetail match={{ params: { id: "pid" } }} isProcess={true} />;
return <ProcessDetail match={{ params: { id: "process_id" } }} isProcess={true} />;
};

export const Task: ComponentStory<typeof ProcessDetail> = () => {
mock.reset();
mock.onGet("processes/pid").reply(200, FAILED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-pid/1a5686d9-eaa2-4d0b-96eb-1ec081c62a08").reply(200, []);
mock.onGet("processes/process_id").reply(200, FAILED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-process_id/1a5686d9-eaa2-4d0b-96eb-1ec081c62a08").reply(200, []);

//@ts-ignore
return <ProcessDetail match={{ params: { id: "pid" } }} isProcess={false} />;
return <ProcessDetail match={{ params: { id: "process_id" } }} isProcess={false} />;
};

export const SuspendedProcess: ComponentStory<typeof ProcessDetail> = () => {
mock.reset();
mock.onGet("processes/pid").reply(200, SUSPENDED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-pid/cdae2399-dd25-440b-81db-b8846c5fa3ce").reply(200, []);
mock.onGet("processes/process_id").reply(200, SUSPENDED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-process_id/cdae2399-dd25-440b-81db-b8846c5fa3ce").reply(200, []);

//@ts-ignore
return <ProcessDetail match={{ params: { id: "pid" } }} isProcess={true} />;
return <ProcessDetail match={{ params: { id: "process_id" } }} isProcess={true} />;
};

export const SuspendedTask: ComponentStory<typeof ProcessDetail> = () => {
mock.reset();
mock.onGet("processes/pid").reply(200, SUSPENDED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-pid/cdae2399-dd25-440b-81db-b8846c5fa3ce").reply(200, []);
mock.onGet("processes/process_id").reply(200, SUSPENDED_PROCESS_JSON);
mock.onGet("processes/process-subscriptions-by-process_id/cdae2399-dd25-440b-81db-b8846c5fa3ce").reply(200, []);

//@ts-ignore
return <ProcessDetail match={{ params: { id: "pid" } }} isProcess={false} />;
return <ProcessDetail match={{ params: { id: "process_id" } }} isProcess={false} />;
};

0 comments on commit a561bd1

Please sign in to comment.