-
-
- {renderCounts(activeView, modelStatusData)}
- {shouldShow("apps", activeView) && (
-
- )}
- {shouldShow("units", activeView) && (
-
- )}
- {shouldShow("machines", activeView) && (
-
- )}
- {shouldShow("relations", activeView) && (
- <>
- {shouldShow("relations-title", activeView) && (
-
Relations ({relationTableRows.length})
+ {!modelStatusData ? (
+
+
+
+ ) : (
+
+
+
+
+ {renderCounts(activeView, modelStatusData)}
+ {shouldShow("apps", activeView) &&
+ applicationTableRows.length > 0 && (
+
)}
+ {shouldShow("units", activeView) && unitTableRows.length > 0 && (
- {shouldShow("relations-title", activeView) && (
-
- Cross-model relations (
- {consumedTableRows.length + offersTableRows.length})
-
- )}
- {consumedTableRows.length ? (
-
- ) : null}
- {offersTableRows.length ? (
+ )}
+ {shouldShow("machines", activeView) &&
+ machinesTableRows.length > 0 && (
- ) : null}
- >
- )}
+ )}
+ {shouldShow("relations", activeView) &&
+ relationTableRows.length > 0 && (
+ <>
+ {shouldShow("relations-title", activeView) && (
+ Relations ({relationTableRows.length})
+ )}
+
+ {shouldShow("relations-title", activeView) && (
+
+ Cross-model relations (
+ {consumedTableRows.length + offersTableRows.length})
+
+ )}
+ {consumedTableRows.length ? (
+
+ ) : null}
+ {offersTableRows.length ? (
+
+ ) : null}
+ >
+ )}
+
+
+
setQuery(closePanelConfig)}
+ isLoading={!entity}
+ className={`${activePanel}-panel`}
+ >
+ {activePanel === "apps" && (
+
+ )}
+ {activePanel === "machines" && (
+
+ )}
+ {activePanel === "units" && (
+
+ )}
+
-
setQuery(closePanelConfig)}
- />
- setQuery(closePanelConfig)}
- />
- setQuery(closePanelConfig)}
- />
-
+ )}
{generateTerminalComponent(modelUUID, controllerWSHost)}
);
diff --git a/src/pages/Models/Details/ModelDetails.test.js b/src/pages/Models/Details/ModelDetails.test.js
index 5158155b0..1af3e9663 100644
--- a/src/pages/Models/Details/ModelDetails.test.js
+++ b/src/pages/Models/Details/ModelDetails.test.js
@@ -31,7 +31,7 @@ describe("ModelDetail Container", () => {
);
expect(wrapper.find("Topology").length).toBe(1);
- expect(wrapper.find(".model-details__main table").length).toBe(4);
+ expect(wrapper.find(".model-details__main table").length).toBe(2);
});
it("renders the details pane for models shared-with-me", () => {
@@ -186,14 +186,10 @@ describe("ModelDetail Container", () => {
);
- expect(wrapper.find(".slide-panel.apps-panel").prop("aria-hidden")).toBe(
- true
- );
+ expect(wrapper.find(".slide-panel.apps-panel").length).toBe(0);
const applicationRow = wrapper.find(`tr[data-app="${testApp}"]`);
applicationRow.simulate("click");
- expect(wrapper.find(".slide-panel.apps-panel").prop("aria-hidden")).toBe(
- false
- );
+ expect(wrapper.find(".slide-panel.apps-panel").length).toBe(1);
expect(
wrapper.find(".slide-panel.apps-panel .panel-header .entity-name").text()
).toBe("kibana");
@@ -213,14 +209,12 @@ describe("ModelDetail Container", () => {
);
- expect(
- wrapper.find(".slide-panel.machines-panel").prop("aria-hidden")
- ).toBe(true);
- const machineRow = wrapper.find(`tr[data-machine="${testMachine}"]`);
+ expect(wrapper.find(".slide-panel.machines-panel").length).toBe(0);
+ const machineRow = wrapper.find(
+ `.model-details__main tr[data-machine="${testMachine}"]`
+ );
machineRow.simulate("click");
- expect(
- wrapper.find(".slide-panel.machines-panel").prop("aria-hidden")
- ).toBe(false);
+ expect(wrapper.find(".slide-panel.machines-panel").length).toBe(1);
expect(
wrapper
.find(".slide-panel.machines-panel .panel-header .entity-name")
@@ -242,14 +236,10 @@ describe("ModelDetail Container", () => {
);
- expect(wrapper.find(".slide-panel.units-panel").prop("aria-hidden")).toBe(
- true
- );
+ expect(wrapper.find(".slide-panel.units-panel").length).toBe(0);
const unitRow = wrapper.find(`tr[data-unit="${testUnit}"]`);
unitRow.simulate("click");
- expect(wrapper.find(".slide-panel.units-panel").prop("aria-hidden")).toBe(
- false
- );
+ expect(wrapper.find(".slide-panel.units-panel").length).toBe(1);
expect(
wrapper.find(".slide-panel.units-panel .panel-header .entity-name").text()
).toBe("kibana/0");
diff --git a/src/pages/Models/Details/_model-details.scss b/src/pages/Models/Details/_model-details.scss
index 6d6fcf007..a84615521 100644
--- a/src/pages/Models/Details/_model-details.scss
+++ b/src/pages/Models/Details/_model-details.scss
@@ -9,6 +9,14 @@
padding-bottom: 3rem;
padding-top: 1rem;
+ &__loading {
+ align-items: center;
+ display: flex;
+ justify-items: center;
+ min-height: calc(100vh - 48px);
+ width: 100%;
+ }
+
@media (min-width: $breakpoint-medium) {
gap: 1rem;
grid-template-columns: 230px 1fr;
@@ -49,23 +57,21 @@
}
}
-@mixin model-details-main {
- .model-details__main {
- .subordinate-row {
- border-top: none !important;
- }
+@mixin model-details-subordinates {
+ .subordinate-row {
+ border-top: none !important;
+ }
- .subordinate {
- margin-right: 0.5rem;
- padding-left: 1.5rem;
- position: relative;
+ .subordinate {
+ margin-right: 0.5rem;
+ padding-left: 1.5rem;
+ position: relative;
- &::before {
- content: url("../../../static/images/unit-tree.svg");
- left: 0.75rem;
- position: absolute;
- top: -0.25rem;
- }
+ &::before {
+ content: url("../../../static/images/unit-tree.svg");
+ left: 0.75rem;
+ position: absolute;
+ top: -0.25rem;
}
}
}
@@ -190,8 +196,8 @@
}
.model-details__apps,
- [data-enable-panels="true"] .model-details__machines,
- [data-enable-panels="true"] .model-details__units {
+ .model-details__machines,
+ .model-details__units {
tbody tr:hover {
background-color: #e7f9ff;
cursor: pointer;
@@ -214,6 +220,6 @@
@include model-details-layout;
@include model-details-header;
@include model-details-title;
-@include model-details-main;
+@include model-details-subordinates;
@include model-details-tables;
@include model-details-entity-icons;
diff --git a/src/pages/Models/Details/generators.js b/src/pages/Models/Details/generators.js
index a421fc9d9..e46518222 100644
--- a/src/pages/Models/Details/generators.js
+++ b/src/pages/Models/Details/generators.js
@@ -183,7 +183,7 @@ export function generateApplicationRows(
os: "Ubuntu",
notes: "-",
},
- onClick: (e) => onRowClick(e, app),
+ onClick: () => onRowClick(key, "apps"),
"data-app": key,
className: selectedEntity === key ? "is-selected" : "",
};
@@ -250,7 +250,7 @@ export function generateUnitRows(
port,
message,
},
- onClick: (e) => onRowClick(e, unitId),
+ onClick: () => onRowClick(unitId, "units"),
"data-unit": unitId,
className: selectedEntity === unitId ? "is-selected" : "",
});
@@ -267,7 +267,8 @@ export function generateUnitRows(
subordinate.charm,
key,
true,
- baseAppURL
+ baseAppURL,
+ true // disable link
),
className: "u-truncate",
},
@@ -366,7 +367,7 @@ export function generateMachineRows(
instanceId: machine.instanceId,
message: machine?.agentStatus?.info,
},
- onClick: (e) => onRowClick(e, machineId),
+ onClick: () => onRowClick(machineId, "machines"),
"data-machine": machineId,
className: selectedEntity === machineId ? "is-selected" : "",
};
diff --git a/src/scss/custom/_status_icons.scss b/src/scss/custom/_status_icons.scss
index cff73a385..a914ef699 100644
--- a/src/scss/custom/_status_icons.scss
+++ b/src/scss/custom/_status_icons.scss
@@ -32,13 +32,18 @@
}
&.is-running,
- &.is-started,
- &.is-active {
+ &.is-started {
&::before {
color: $color-mid-light;
}
}
+ &.is-active {
+ &::before {
+ color: $color-positive;
+ }
+ }
+
&.is-unknown {
&::before {
border: 1px solid $color-mid-light;