Skip to content

Commit de026a0

Browse files
authored
feat(base): Add install type to status bar (#5947)
1 parent 10d0798 commit de026a0

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

src/app/base/components/StatusBar/StatusBar.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ afterEach(() => {
3535
Object.assign(import.meta.env, { ...originalEnv });
3636
});
3737

38+
it("can show if the MAAS is a snap installation", () => {
39+
state.general.installType.data = "snap";
40+
41+
renderWithProviders(<StatusBar />, { state });
42+
43+
expect(screen.getByText(/(snap)/i)).toBeInTheDocument();
44+
});
45+
46+
it("can show if the MAAS is a deb installation", () => {
47+
state.general.installType.data = "deb";
48+
49+
renderWithProviders(<StatusBar />, { state });
50+
51+
expect(screen.getByText(/(deb)/i)).toBeInTheDocument();
52+
});
53+
3854
it("can show if a machine is currently commissioning", () => {
3955
state.machine.items = [
4056
factory.machineDetails({

src/app/base/components/StatusBar/StatusBar.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import {
44
AppStatus,
55
Button,
66
Icon,
7+
ICONS,
78
Link,
89
useToastNotification,
9-
ICONS,
1010
} from "@canonical/react-components";
1111
import {
12-
severityOrder,
1312
iconLookup,
13+
severityOrder,
1414
} from "@canonical/react-components/dist/components/Notifications/ToastNotification/ToastNotificationList";
1515
import classNames from "classnames";
1616
import { useSelector } from "react-redux";
@@ -26,7 +26,11 @@ import {
2626
isRack,
2727
isRegionAndRack,
2828
} from "@/app/store/controller/utils";
29-
import { version as versionSelectors } from "@/app/store/general/selectors";
29+
import { generalActions } from "@/app/store/general";
30+
import {
31+
installType as installTypeSelectors,
32+
version as versionSelectors,
33+
} from "@/app/store/general/selectors";
3034
import machineSelectors from "@/app/store/machine/selectors";
3135
import type { MachineDetails } from "@/app/store/machine/types";
3236
import {
@@ -116,6 +120,7 @@ export const StatusBar = (): React.ReactElement | null => {
116120
const maasName = useSelector(configSelectors.maasName);
117121
const allowUsabilla = useUsabilla();
118122
const msmRunning = useSelector(msmSelectors.running);
123+
const installType = useSelector(installTypeSelectors.get);
119124
const { toggleListView, notifications, countBySeverity, isListView } =
120125
useToastNotification();
121126

@@ -141,7 +146,7 @@ export const StatusBar = (): React.ReactElement | null => {
141146

142147
const hasNotifications = notifications.length > 0;
143148

144-
useFetchActions([msmActions.fetch]);
149+
useFetchActions([msmActions.fetch, generalActions.fetchInstallType]);
145150

146151
if (!(maasName && version)) {
147152
return null;
@@ -184,7 +189,9 @@ export const StatusBar = (): React.ReactElement | null => {
184189
<div className="p-status-bar__primary u-flex--no-shrink u-flex--wrap">
185190
<strong data-testid="status-bar-maas-name">{maasName} MAAS</strong>
186191
:&nbsp;
187-
<span data-testid="status-bar-version">{version}</span>
192+
<span data-testid="status-bar-version">
193+
{version} ({installType})
194+
</span>
188195
</div>
189196
<div className="p-status-bar__primary u-flex--no-shrink u-flex--wrap">
190197
<span data-testid="status-bar-msm-status">

0 commit comments

Comments
 (0)