Skip to content

feat: add switch details view MAASENG-6324#6109

Open
nehjoshi wants to merge 6 commits into
canonical:mainfrom
nehjoshi:switch-details
Open

feat: add switch details view MAASENG-6324#6109
nehjoshi wants to merge 6 commits into
canonical:mainfrom
nehjoshi:switch-details

Conversation

@nehjoshi

@nehjoshi nehjoshi commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Done

  • Added the "details" view for switches, which currently only has the "summary" tab, displaying the target image and the management MAC address

QA steps

Since adding a switch requires a boot resource of type "ONIE", it is easier to just hardcode some sample data in the UI. Before QAing, make the following changes:

In src/app/switches/views/SwitchDetails/SwitchDetails.tsx:

  // const { data: switchDetails } = useGetSwitch({
  //   path: { switch_id: switchId! },
  // });
  const switchDetails = {
    id: switchId ?? 1,
    name: "sample-switch-01",
    management_mac: "00:11:22:33:44:55",
    target_image_id: 1,
    target_image: "ubuntu/jammy",
  };

In src/app/switches/components/SwitchesTable/SwitchesTable.tsx:

const switches = {
    data: {
      items: [
        {
          id: 1,
          name: "sample-switch-01",
          management_mac: "00:11:22:33:44:55",
          target_image_id: 1,
          target_image: "ubuntu/jammy",
        },
      ],
      total: 1,
    },
    isPending: false,
  };
  // const switches = useSwitches({ query: { page: debouncedPage, size } });

In src/app/switches/components/SwitchDetailsSummary/SwitchDetailsSummary.tsx:

  // const { data: details } = useGetSwitch({ path: { switch_id: id } });
  const details = {
    id,
    target_image: "Ubuntu NOS",
    management_mac: "00:11:22:33:44:55",
  };

And enable the VITE_APP_SWITCH_PROVISIONING feature flag in .env.

  • Sign in to MAAS
  • Go to "Switches" from the side navigation
  • Ensure the table is populated with 1 row
  • Ensure the "status" and "ZTP enabled" columns are no longer shown
  • Click on the name of the switch
  • Ensure you are on the details page of the switch
  • Ensure two cards are shown: one for the target image, one for the management MAC address
  • Ensure only the summary tab is visible (the "logs" and "scripts" tabs will be added later)
  • Undo the changes you made in SwitchDetailsSummary.tsx and SwitchDetails.tsx
  • Go to the page for a non-existant switch (e.g. /MAAS/r/switches/4/summary)
  • Ensure the not found page is visible

Fixes

Resolves MAASENG-6324

Screenshots

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant