mirror of
https://github.com/coder/coder.git
synced 2025-03-14 10:09:57 +00:00
Apply Kaylas suggestions
This commit is contained in:
@ -34,10 +34,8 @@ export type OrganizationSettingsValue = Readonly<{
|
||||
organizationPermissions?: OrganizationPermissions;
|
||||
}>;
|
||||
|
||||
export const useOrganizationSettings = (
|
||||
defaultValues?: OrganizationSettingsValue,
|
||||
): OrganizationSettingsValue => {
|
||||
const context = useContext(OrganizationSettingsContext) ?? defaultValues;
|
||||
export const useOrganizationSettings = (): OrganizationSettingsValue => {
|
||||
const context = useContext(OrganizationSettingsContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { expect, userEvent, waitFor, within } from "@storybook/test";
|
||||
import { Table, TableBody } from "components/Table/Table";
|
||||
import { MockProvisionerJob } from "testHelpers/entities";
|
||||
import { daysAgo } from "utils/time";
|
||||
import { JobRow } from "./JobRow";
|
||||
|
||||
@ -9,35 +10,8 @@ const meta: Meta<typeof JobRow> = {
|
||||
component: JobRow,
|
||||
args: {
|
||||
job: {
|
||||
id: "373cb47a-c33b-4e35-83bf-23c64fde0293",
|
||||
...MockProvisionerJob,
|
||||
created_at: daysAgo(2),
|
||||
started_at: "2025-03-09T08:01:22.118677Z",
|
||||
completed_at: "2025-03-09T08:01:33.310184Z",
|
||||
status: "succeeded",
|
||||
worker_id: "d4f5452e-3d1b-4400-a7c1-233c2dee6f1a",
|
||||
file_id: "a99685a6-4441-4258-8102-f07e571204fb",
|
||||
tags: {
|
||||
cluster: "dogfood-v2",
|
||||
env: "gke",
|
||||
owner: "",
|
||||
scope: "organization",
|
||||
},
|
||||
queue_position: 0,
|
||||
queue_size: 24,
|
||||
organization_id: "703f72a1-76f6-4f89-9de6-8a3989693fe5",
|
||||
input: {
|
||||
workspace_build_id: "0153584a-6cbe-4c90-8e9e-4ffb40fd1069",
|
||||
},
|
||||
type: "workspace_build",
|
||||
metadata: {
|
||||
template_version_name: "54745b1",
|
||||
template_id: "0d286645-29aa-4eaf-9b52-cc5d2740c90b",
|
||||
template_name: "coder",
|
||||
template_display_name: "Write Coder on Coder",
|
||||
template_icon: "/emojis/1f3c5.png",
|
||||
workspace_id: "e1a7f977-28e7-4567-b91a-179a14c3658b",
|
||||
workspace_name: "nowjosias",
|
||||
},
|
||||
},
|
||||
},
|
||||
render: (args) => {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,16 +24,13 @@ import { pageTitle } from "utils/page";
|
||||
import { JobRow } from "./JobRow";
|
||||
|
||||
type OrganizationProvisionerJobsPageProps = {
|
||||
defaultOrganizationSettingsValue?: OrganizationSettingsValue;
|
||||
getProvisionerJobs?: typeof API.getProvisionerJobs;
|
||||
};
|
||||
|
||||
const OrganizationProvisionerJobsPage: FC<
|
||||
OrganizationProvisionerJobsPageProps
|
||||
> = ({ defaultOrganizationSettingsValue, getProvisionerJobs }) => {
|
||||
const { organization } = useOrganizationSettings(
|
||||
defaultOrganizationSettingsValue,
|
||||
);
|
||||
> = ({ getProvisionerJobs }) => {
|
||||
const { organization } = useOrganizationSettings();
|
||||
|
||||
if (!organization) {
|
||||
return <EmptyState message="Organization not found" />;
|
||||
|
Reference in New Issue
Block a user