From 7b9bf879b0f5413e07d69294c6fb896f1a80cffa Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 4 Mar 2024 16:34:18 -0600 Subject: [PATCH] path builder imageNew -> imagesNew, etc, to match route paths --- app/forms/instance-create.tsx | 2 +- app/pages/ProjectsPage.tsx | 6 ++--- app/pages/project/disks/DisksPage.tsx | 4 +-- .../project/floating-ips/FloatingIpsPage.tsx | 4 +-- app/pages/project/images/ImagesPage.tsx | 2 +- app/pages/project/instances/InstancesPage.tsx | 6 ++--- app/pages/project/snapshots/SnapshotsPage.tsx | 6 ++--- app/pages/project/vpcs/VpcsPage.tsx | 4 +-- app/pages/settings/SSHKeysPage.tsx | 4 +-- app/pages/system/networking/IpPoolsTab.tsx | 6 ++--- app/pages/system/silos/SiloIdpsTab.tsx | 2 +- app/pages/system/silos/SiloIpPoolsTab.tsx | 2 +- app/pages/system/silos/SilosPage.tsx | 6 ++--- app/routes.tsx | 2 +- app/util/path-builder.spec.ts | 24 ++++++++--------- app/util/path-builder.ts | 26 +++++++++---------- 16 files changed, 53 insertions(+), 53 deletions(-) diff --git a/app/forms/instance-create.tsx b/app/forms/instance-create.tsx index ef1008838e..ab32d0bc6c 100644 --- a/app/forms/instance-create.tsx +++ b/app/forms/instance-create.tsx @@ -377,7 +377,7 @@ export function CreateInstanceForm() { title="No project images found" body="An image needs to be uploaded to be seen here" buttonText="Upload image" - onClick={() => navigate(pb.projectImageNew(projectSelector))} + onClick={() => navigate(pb.projectImagesNew(projectSelector))} /> ) : ( diff --git a/app/pages/ProjectsPage.tsx b/app/pages/ProjectsPage.tsx index 3c1f62047d..287b4fe532 100644 --- a/app/pages/ProjectsPage.tsx +++ b/app/pages/ProjectsPage.tsx @@ -36,7 +36,7 @@ const EmptyState = () => ( title="No projects" body="You need to create a project to be able to see it here" buttonText="New project" - buttonTo={pb.projectNew()} + buttonTo={pb.projectsNew()} /> ) @@ -90,7 +90,7 @@ export default function ProjectsPage() { () => [ { value: 'New project', - onSelect: () => navigate(pb.projectNew()), + onSelect: () => navigate(pb.projectsNew()), }, ...(projects?.items || []).map((p) => ({ value: p.name, @@ -108,7 +108,7 @@ export default function ProjectsPage() { }>Projects - + New Project diff --git a/app/pages/project/disks/DisksPage.tsx b/app/pages/project/disks/DisksPage.tsx index 7697fc801e..0ac9448ef1 100644 --- a/app/pages/project/disks/DisksPage.tsx +++ b/app/pages/project/disks/DisksPage.tsx @@ -39,7 +39,7 @@ const EmptyState = () => ( title="No disks" body="You need to create a disk to be able to see it here" buttonText="New disk" - buttonTo={pb.diskNew(useProjectSelector())} + buttonTo={pb.disksNew(useProjectSelector())} /> ) @@ -117,7 +117,7 @@ export function DisksPage() { }>Disks - + New Disk diff --git a/app/pages/project/floating-ips/FloatingIpsPage.tsx b/app/pages/project/floating-ips/FloatingIpsPage.tsx index 1f74e6087a..cb33ebcda1 100644 --- a/app/pages/project/floating-ips/FloatingIpsPage.tsx +++ b/app/pages/project/floating-ips/FloatingIpsPage.tsx @@ -42,7 +42,7 @@ const EmptyState = () => ( title="No Floating IPs" body="You need to create a Floating IP to be able to see it here" buttonText="New Floating IP" - buttonTo={pb.floatingIpNew(useProjectSelector())} + buttonTo={pb.floatingIpsNew(useProjectSelector())} /> ) @@ -147,7 +147,7 @@ export function FloatingIpsPage() { }>Floating IPs - + New Floating IP diff --git a/app/pages/project/images/ImagesPage.tsx b/app/pages/project/images/ImagesPage.tsx index 70bd2d694c..06227cd37f 100644 --- a/app/pages/project/images/ImagesPage.tsx +++ b/app/pages/project/images/ImagesPage.tsx @@ -81,7 +81,7 @@ export function ImagesPage() { Upload image diff --git a/app/pages/project/instances/InstancesPage.tsx b/app/pages/project/instances/InstancesPage.tsx index 7a4be4960a..25d8f14673 100644 --- a/app/pages/project/instances/InstancesPage.tsx +++ b/app/pages/project/instances/InstancesPage.tsx @@ -31,7 +31,7 @@ const EmptyState = () => ( title="No instances" body="You need to create an instance to be able to see it here" buttonText="New instance" - buttonTo={pb.instanceNew(useProjectSelector())} + buttonTo={pb.instancesNew(useProjectSelector())} /> ) @@ -62,7 +62,7 @@ export function InstancesPage() { () => [ { value: 'New instance', - onSelect: () => navigate(pb.instanceNew(projectSelector)), + onSelect: () => navigate(pb.instancesNew(projectSelector)), }, ...(instances?.items || []).map((i) => ({ value: i.name, @@ -97,7 +97,7 @@ export function InstancesPage() { > - + New Instance diff --git a/app/pages/project/snapshots/SnapshotsPage.tsx b/app/pages/project/snapshots/SnapshotsPage.tsx index 6d6b453201..13fdf3aed6 100644 --- a/app/pages/project/snapshots/SnapshotsPage.tsx +++ b/app/pages/project/snapshots/SnapshotsPage.tsx @@ -45,7 +45,7 @@ const EmptyState = () => ( title="No snapshots" body="You need to create a snapshot to be able to see it here" buttonText="New snapshot" - buttonTo={pb.snapshotNew(useProjectSelector())} + buttonTo={pb.snapshotsNew(useProjectSelector())} /> ) @@ -72,7 +72,7 @@ export function SnapshotsPage() { { label: 'Create image', onActivate() { - navigate(pb.snapshotImageCreate({ ...projectSelector, snapshot: snapshot.name })) + navigate(pb.snapshotImagesNew({ ...projectSelector, snapshot: snapshot.name })) }, }, { @@ -94,7 +94,7 @@ export function SnapshotsPage() { }>Snapshots - + New Snapshot diff --git a/app/pages/project/vpcs/VpcsPage.tsx b/app/pages/project/vpcs/VpcsPage.tsx index ebc193d40e..c4ece58707 100644 --- a/app/pages/project/vpcs/VpcsPage.tsx +++ b/app/pages/project/vpcs/VpcsPage.tsx @@ -35,7 +35,7 @@ const EmptyState = () => ( title="No VPCs" body="You need to create a VPC to be able to see it here" buttonText="New VPC" - buttonTo={pb.vpcNew(useProjectSelector())} + buttonTo={pb.vpcsNew(useProjectSelector())} /> ) @@ -98,7 +98,7 @@ export function VpcsPage() { }>VPCs - + New Vpc diff --git a/app/pages/settings/SSHKeysPage.tsx b/app/pages/settings/SSHKeysPage.tsx index c1934ba0cf..c4d7e17f89 100644 --- a/app/pages/settings/SSHKeysPage.tsx +++ b/app/pages/settings/SSHKeysPage.tsx @@ -53,7 +53,7 @@ export function SSHKeysPage() { }>SSH Keys - + Add SSH key @@ -65,7 +65,7 @@ export function SSHKeysPage() { title="No SSH keys" body="You need to add a SSH key to be able to see it here" buttonText="Add SSH key" - onClick={() => navigate(pb.sshKeyNew())} + onClick={() => navigate(pb.sshKeysNew())} /> } > diff --git a/app/pages/system/networking/IpPoolsTab.tsx b/app/pages/system/networking/IpPoolsTab.tsx index 735f67c680..442796d58e 100644 --- a/app/pages/system/networking/IpPoolsTab.tsx +++ b/app/pages/system/networking/IpPoolsTab.tsx @@ -33,7 +33,7 @@ const EmptyState = () => ( title="No IP pools" body="You need to create an IP pool to be able to see it here" buttonText="New IP pool" - buttonTo={pb.ipPoolNew()} + buttonTo={pb.ipPoolsNew()} /> ) @@ -77,7 +77,7 @@ export function IpPoolsTab() { () => [ { value: 'New IP pool', - onSelect: () => navigate(pb.projectNew()), + onSelect: () => navigate(pb.projectsNew()), }, ...(pools.items || []).map((p) => ({ value: p.name, @@ -92,7 +92,7 @@ export function IpPoolsTab() { return ( <>
- + New IP Pool
diff --git a/app/pages/system/silos/SiloIdpsTab.tsx b/app/pages/system/silos/SiloIdpsTab.tsx index 0ac925eece..434610e3be 100644 --- a/app/pages/system/silos/SiloIdpsTab.tsx +++ b/app/pages/system/silos/SiloIdpsTab.tsx @@ -34,7 +34,7 @@ export function SiloIdpsTab() { return ( <>
- + New provider
diff --git a/app/pages/system/silos/SiloIpPoolsTab.tsx b/app/pages/system/silos/SiloIpPoolsTab.tsx index 19ccf30da8..8e703e4f5a 100644 --- a/app/pages/system/silos/SiloIpPoolsTab.tsx +++ b/app/pages/system/silos/SiloIpPoolsTab.tsx @@ -34,7 +34,7 @@ const EmptyState = () => ( title="No IP pools" body="You need to create an IP pool to be able to see it here" buttonText="New IP pool" - buttonTo={pb.ipPoolNew()} + buttonTo={pb.ipPoolsNew()} /> ) diff --git a/app/pages/system/silos/SilosPage.tsx b/app/pages/system/silos/SilosPage.tsx index 44ec385e91..475aac8737 100644 --- a/app/pages/system/silos/SilosPage.tsx +++ b/app/pages/system/silos/SilosPage.tsx @@ -37,7 +37,7 @@ const EmptyState = () => ( title="No silos" body="You need to create a silo to be able to see it here" buttonText="New silo" - buttonTo={pb.siloNew()} + buttonTo={pb.silosNew()} /> ) @@ -75,7 +75,7 @@ export default function SilosPage() { useQuickActions( useMemo( () => [ - { value: 'New silo', onSelect: () => navigate(pb.siloNew()) }, + { value: 'New silo', onSelect: () => navigate(pb.silosNew()) }, ...silos.items.map((o) => ({ value: o.name, onSelect: () => navigate(pb.silo({ silo: o.name })), @@ -92,7 +92,7 @@ export default function SilosPage() { }>Silos - + New silo diff --git a/app/routes.tsx b/app/routes.tsx index eec829efd8..f650729c6e 100644 --- a/app/routes.tsx +++ b/app/routes.tsx @@ -381,7 +381,7 @@ export const routes = createRoutesFromElements( handle={{ crumb: 'New snapshot' }} /> } loader={CreateImageFromSnapshotSideModalForm.loader} handle={{ crumb: 'Create image from snapshot' }} diff --git a/app/util/path-builder.spec.ts b/app/util/path-builder.spec.ts index 6476b096a3..1748e482ad 100644 --- a/app/util/path-builder.spec.ts +++ b/app/util/path-builder.spec.ts @@ -29,23 +29,23 @@ test('path builder', () => { { "deviceSuccess": "/device/success", "diskInventory": "/system/inventory/disks", - "diskNew": "/projects/p/disks-new", "disks": "/projects/p/disks", - "floatingIpNew": "/projects/p/floating-ips-new", + "disksNew": "/projects/p/disks-new", "floatingIps": "/projects/p/floating-ips", + "floatingIpsNew": "/projects/p/floating-ips-new", "instance": "/projects/p/instances/i", "instanceConnect": "/projects/p/instances/i/connect", "instanceMetrics": "/projects/p/instances/i/metrics", - "instanceNew": "/projects/p/instances-new", "instancePage": "/projects/p/instances/i/storage", "instanceStorage": "/projects/p/instances/i/storage", "instances": "/projects/p/instances", + "instancesNew": "/projects/p/instances-new", "inventory": "/system/inventory", "ipPool": "/system/networking/ip-pools/pl", "ipPoolEdit": "/system/networking/ip-pools/pl/edit", - "ipPoolNew": "/system/networking/ip-pools-new", "ipPoolRangeAdd": "/system/networking/ip-pools/pl/ranges-add", "ipPools": "/system/networking/ip-pools", + "ipPoolsNew": "/system/networking/ip-pools-new", "nics": "/projects/p/instances/i/network-interfaces", "profile": "/settings/profile", "project": "/projects/p", @@ -53,39 +53,39 @@ test('path builder', () => { "projectEdit": "/projects/p/edit", "projectImage": "/projects/p/images/im", "projectImageEdit": "/projects/p/images/im/edit", - "projectImageNew": "/projects/p/images-new", "projectImages": "/projects/p/images", - "projectNew": "/projects-new", + "projectImagesNew": "/projects/p/images-new", "projects": "/projects", + "projectsNew": "/projects-new", "rackInventory": "/system/inventory/racks", "samlIdp": "/system/silos/s/idps/saml/pr", "serialConsole": "/projects/p/instances/i/serial-console", "silo": "/system/silos/s", "siloAccess": "/access", - "siloIdpNew": "/system/silos/s/idps-new", + "siloIdpsNew": "/system/silos/s/idps-new", "siloImage": "/images/im", "siloImageEdit": "/images/im/edit", "siloImages": "/images", "siloIpPools": "/system/silos/s?tab=ip-pools", - "siloNew": "/system/silos-new", "siloUtilization": "/utilization", "silos": "/system/silos", + "silosNew": "/system/silos-new", "sled": "/system/inventory/sleds/sl", "sledInstances": "/system/inventory/sleds/sl/instances", "sledInventory": "/system/inventory/sleds", - "snapshotImageCreate": "/projects/p/snapshots/sn/image-new", - "snapshotNew": "/projects/p/snapshots-new", + "snapshotImagesNew": "/projects/p/snapshots/sn/images-new", "snapshots": "/projects/p/snapshots", - "sshKeyNew": "/settings/ssh-keys-new", + "snapshotsNew": "/projects/p/snapshots-new", "sshKeys": "/settings/ssh-keys", + "sshKeysNew": "/settings/ssh-keys-new", "system": "/system", "systemHealth": "/system/health", "systemIssues": "/system/issues", "systemUtilization": "/system/utilization", "vpc": "/projects/p/vpcs/v", "vpcEdit": "/projects/p/vpcs/v/edit", - "vpcNew": "/projects/p/vpcs-new", "vpcs": "/projects/p/vpcs", + "vpcsNew": "/projects/p/vpcs-new", } `) }) diff --git a/app/util/path-builder.ts b/app/util/path-builder.ts index 4357f5df95..817a04df7a 100644 --- a/app/util/path-builder.ts +++ b/app/util/path-builder.ts @@ -23,18 +23,18 @@ type IpPool = Required export const pb = { projects: () => `/projects`, - projectNew: () => `/projects-new`, + projectsNew: () => `/projects-new`, project: ({ project }: Project) => `${pb.projects()}/${project}`, projectEdit: (params: Project) => `${pb.project(params)}/edit`, projectAccess: (params: Project) => `${pb.project(params)}/access`, projectImages: (params: Project) => `${pb.project(params)}/images`, - projectImageNew: (params: Project) => `${pb.project(params)}/images-new`, + projectImagesNew: (params: Project) => `${pb.project(params)}/images-new`, projectImage: (params: Image) => `${pb.projectImages(params)}/${params.image}`, projectImageEdit: (params: Image) => `${pb.projectImage(params)}/edit`, instances: (params: Project) => `${pb.project(params)}/instances`, - instanceNew: (params: Project) => `${pb.project(params)}/instances-new`, + instancesNew: (params: Project) => `${pb.project(params)}/instances-new`, instance: (params: Instance) => `${pb.instances(params)}/${params.instance}`, /** @@ -54,20 +54,20 @@ export const pb = { serialConsole: (params: Instance) => `${pb.instance(params)}/serial-console`, - diskNew: (params: Project) => `${pb.project(params)}/disks-new`, + disksNew: (params: Project) => `${pb.project(params)}/disks-new`, disks: (params: Project) => `${pb.project(params)}/disks`, - snapshotNew: (params: Project) => `${pb.project(params)}/snapshots-new`, + snapshotsNew: (params: Project) => `${pb.project(params)}/snapshots-new`, snapshots: (params: Project) => `${pb.project(params)}/snapshots`, - snapshotImageCreate: (params: Snapshot) => - `${pb.project(params)}/snapshots/${params.snapshot}/image-new`, + snapshotImagesNew: (params: Snapshot) => + `${pb.project(params)}/snapshots/${params.snapshot}/images-new`, - vpcNew: (params: Project) => `${pb.project(params)}/vpcs-new`, + vpcsNew: (params: Project) => `${pb.project(params)}/vpcs-new`, vpcs: (params: Project) => `${pb.project(params)}/vpcs`, vpc: (params: Vpc) => `${pb.vpcs(params)}/${params.vpc}`, vpcEdit: (params: Vpc) => `${pb.vpc(params)}/edit`, floatingIps: (params: Project) => `${pb.project(params)}/floating-ips`, - floatingIpNew: (params: Project) => `${pb.project(params)}/floating-ips-new`, + floatingIpsNew: (params: Project) => `${pb.project(params)}/floating-ips-new`, siloUtilization: () => '/utilization', siloAccess: () => '/access', @@ -83,7 +83,7 @@ export const pb = { // there is only one tab on networking and it's IP pools, so we just treat // that as the networking route for now ipPools: () => '/system/networking/ip-pools', - ipPoolNew: () => '/system/networking/ip-pools-new', + ipPoolsNew: () => '/system/networking/ip-pools-new', ipPool: (params: IpPool) => `${pb.ipPools()}/${params.pool}`, ipPoolEdit: (params: IpPool) => `${pb.ipPool(params)}/edit`, ipPoolRangeAdd: (params: IpPool) => `${pb.ipPool(params)}/ranges-add`, @@ -96,15 +96,15 @@ export const pb = { sledInstances: ({ sledId }: Sled) => `/system/inventory/sleds/${sledId}/instances`, silos: () => '/system/silos', - siloNew: () => '/system/silos-new', + silosNew: () => '/system/silos-new', silo: ({ silo }: Silo) => `/system/silos/${silo}`, siloIpPools: (params: Silo) => `${pb.silo(params)}?tab=ip-pools`, - siloIdpNew: (params: Silo) => `${pb.silo(params)}/idps-new`, + siloIdpsNew: (params: Silo) => `${pb.silo(params)}/idps-new`, samlIdp: (params: IdentityProvider) => `${pb.silo(params)}/idps/saml/${params.provider}`, profile: () => '/settings/profile', sshKeys: () => '/settings/ssh-keys', - sshKeyNew: () => '/settings/ssh-keys-new', + sshKeysNew: () => '/settings/ssh-keys-new', deviceSuccess: () => '/device/success', }