From 0e89df1f2fa290e92fb2c0153083f2c45fc875e3 Mon Sep 17 00:00:00 2001 From: Harald Pehl Date: Tue, 23 Apr 2024 12:08:23 +0200 Subject: [PATCH] Add demo pages --- console/op/assets.kts | 3 +- console/op/src/assets/halop-logo.svg | 170 ++++ console/op/src/assets/logo-light.svg | 586 -------------- console/op/src/assets/logo.svg | 741 ------------------ .../main/java/org/jboss/hal/op/HomePage.java | 56 -- .../jboss/hal/op/{Constants.java => Ids.java} | 2 +- .../src/main/java/org/jboss/hal/op/Main.java | 8 +- .../jboss/hal/op/cdi/NavigationProducer.java | 41 + .../hal/op/cdi/PlaceManagerProducer.java | 9 +- .../op/configuration/ConfigurationPage.java | 49 ++ .../jboss/hal/op/dashboard/DashboardPage.java | 102 +++ .../hal/op/deployment/DeploymentsPage.java | 49 ++ .../org/jboss/hal/op/runtime/RuntimePage.java | 49 ++ .../jboss/hal/op/{ => skeleton}/NotFound.java | 2 +- .../jboss/hal/op/{ => skeleton}/Skeleton.java | 26 +- 15 files changed, 494 insertions(+), 1399 deletions(-) create mode 100644 console/op/src/assets/halop-logo.svg delete mode 100755 console/op/src/assets/logo-light.svg delete mode 100755 console/op/src/assets/logo.svg delete mode 100644 console/op/src/main/java/org/jboss/hal/op/HomePage.java rename console/op/src/main/java/org/jboss/hal/op/{Constants.java => Ids.java} (95%) create mode 100644 console/op/src/main/java/org/jboss/hal/op/cdi/NavigationProducer.java create mode 100644 console/op/src/main/java/org/jboss/hal/op/configuration/ConfigurationPage.java create mode 100644 console/op/src/main/java/org/jboss/hal/op/dashboard/DashboardPage.java create mode 100644 console/op/src/main/java/org/jboss/hal/op/deployment/DeploymentsPage.java create mode 100644 console/op/src/main/java/org/jboss/hal/op/runtime/RuntimePage.java rename console/op/src/main/java/org/jboss/hal/op/{ => skeleton}/NotFound.java (97%) rename console/op/src/main/java/org/jboss/hal/op/{ => skeleton}/Skeleton.java (66%) diff --git a/console/op/assets.kts b/console/op/assets.kts index b80b8c7..a5007a2 100755 --- a/console/op/assets.kts +++ b/console/op/assets.kts @@ -35,8 +35,7 @@ val packageName = "org.jboss.hal.op" val className = "Assets" val target = "src/main/java" val resources = listOf( - Resource("logo", File(args[0], "src/assets/logo.svg"), "data:image/svg+xml;base64,", true), - Resource("logoLight", File(args[0], "src/assets/logo-light.svg"), "data:image/svg+xml;base64,", true), + Resource("logo", File(args[0], "src/assets/halop-logo.svg"), "data:image/svg+xml;base64,", true) ) val targetPath = Path(args[0], "$target/${packageName.replace('.', '/')}") diff --git a/console/op/src/assets/halop-logo.svg b/console/op/src/assets/halop-logo.svg new file mode 100644 index 0000000..94f85d8 --- /dev/null +++ b/console/op/src/assets/halop-logo.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + halOP + \ No newline at end of file diff --git a/console/op/src/assets/logo-light.svg b/console/op/src/assets/logo-light.svg deleted file mode 100755 index 55b5d4e..0000000 --- a/console/op/src/assets/logo-light.svg +++ /dev/null @@ -1,586 +0,0 @@ - - - - - HAL9000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - HAL9000 - - - - MorningLemon - - - German - - - HAL - 9000 - HAL9000 - robot - space - - - The famous red eye of HAL 9000 from Stanley Kubricks Film "2001: A Space Odyssey". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/console/op/src/assets/logo.svg b/console/op/src/assets/logo.svg deleted file mode 100755 index fcd4f45..0000000 --- a/console/op/src/assets/logo.svg +++ /dev/null @@ -1,741 +0,0 @@ - - - - - HAL9000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - HAL9000 - - - - MorningLemon - - - German - - - HAL - 9000 - HAL9000 - robot - space - - - The famous red eye of HAL 9000 from Stanley Kubricks Film "2001: A Space Odyssey". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/console/op/src/main/java/org/jboss/hal/op/HomePage.java b/console/op/src/main/java/org/jboss/hal/op/HomePage.java deleted file mode 100644 index dae9e53..0000000 --- a/console/op/src/main/java/org/jboss/hal/op/HomePage.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2024 Red Hat - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jboss.hal.op; - -import jakarta.inject.Inject; - -import org.jboss.elemento.router.Page; -import org.jboss.elemento.router.Route; - -import elemental2.dom.HTMLElement; - -import static java.util.Collections.singletonList; - -import static org.patternfly.component.list.DescriptionList.descriptionList; -import static org.patternfly.component.list.DescriptionListDescription.descriptionListDescription; -import static org.patternfly.component.list.DescriptionListGroup.descriptionListGroup; -import static org.patternfly.component.list.DescriptionListTerm.descriptionListTerm; -import static org.patternfly.component.page.PageMainSection.pageMainSection; -import static org.patternfly.style.Brightness.light; - -@Route("/") -public class HomePage implements Page { - - @Inject - Environment environment; - - @Override - public Iterable elements() { - return singletonList(pageMainSection() - .background(light) - .add(descriptionList() - .addGroup(descriptionListGroup() - .addTerm(descriptionListTerm("ID")) - .addDescription(descriptionListDescription(environment.id)) - .addTerm(descriptionListTerm("Name")) - .addDescription(descriptionListDescription(environment.name)) - .addTerm(descriptionListTerm("Version")) - .addDescription(descriptionListDescription(environment.version)) - .addTerm(descriptionListTerm("Mode")) - .addDescription(descriptionListDescription(environment.mode)))) - .element()); - } -} diff --git a/console/op/src/main/java/org/jboss/hal/op/Constants.java b/console/op/src/main/java/org/jboss/hal/op/Ids.java similarity index 95% rename from console/op/src/main/java/org/jboss/hal/op/Constants.java rename to console/op/src/main/java/org/jboss/hal/op/Ids.java index 615e7ae..b7de076 100644 --- a/console/op/src/main/java/org/jboss/hal/op/Constants.java +++ b/console/op/src/main/java/org/jboss/hal/op/Ids.java @@ -15,7 +15,7 @@ */ package org.jboss.hal.op; -public interface Constants { +public interface Ids { String MAIN_ID = "hop-main-id"; } diff --git a/console/op/src/main/java/org/jboss/hal/op/Main.java b/console/op/src/main/java/org/jboss/hal/op/Main.java index cca4904..c2145ba 100644 --- a/console/op/src/main/java/org/jboss/hal/op/Main.java +++ b/console/op/src/main/java/org/jboss/hal/op/Main.java @@ -19,16 +19,20 @@ import jakarta.inject.Inject; import org.jboss.elemento.router.PlaceManager; +import org.jboss.hal.op.skeleton.Skeleton; import org.kie.j2cl.tools.di.annotation.Application; import org.kie.j2cl.tools.processors.annotations.GWT3EntryPoint; +import org.patternfly.component.navigation.Navigation; -import static org.jboss.elemento.Elements.body; +import static elemental2.dom.DomGlobal.document; +import static org.jboss.elemento.Elements.insertFirst; @SuppressWarnings("unused") @Application(packages = {"org.jboss.hal"}) public class Main { @Inject PlaceManager placeManager; + @Inject Navigation navigation; @GWT3EntryPoint public void onModuleLoad() { @@ -37,7 +41,7 @@ public void onModuleLoad() { @PostConstruct void init() { - body().add(new Skeleton()); + insertFirst(document.body, new Skeleton(navigation)); placeManager.start(); } } diff --git a/console/op/src/main/java/org/jboss/hal/op/cdi/NavigationProducer.java b/console/op/src/main/java/org/jboss/hal/op/cdi/NavigationProducer.java new file mode 100644 index 0000000..178821b --- /dev/null +++ b/console/op/src/main/java/org/jboss/hal/op/cdi/NavigationProducer.java @@ -0,0 +1,41 @@ +/* + * Copyright 2024 Red Hat + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.hal.op.cdi; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; + +import org.jboss.elemento.router.PlaceManager; +import org.patternfly.component.navigation.Navigation; +import org.patternfly.component.navigation.NavigationType.Horizontal; + +import static org.patternfly.component.navigation.NavigationItem.navigationItem; + +public class NavigationProducer { + + @Inject PlaceManager placeManager; + + @Produces + @ApplicationScoped + public Navigation navigation() { + return Navigation.navigation(Horizontal.primary) + .addItem(navigationItem("/", "Dashboard", placeManager.href("/"))) + .addItem(navigationItem("/deployments", "Deployments", placeManager.href("/deployments"))) + .addItem(navigationItem("/configuration", "Configuration", placeManager.href("/configuration"))) + .addItem(navigationItem("/runtime", "Runtime", placeManager.href("/runtime"))); + } +} diff --git a/console/op/src/main/java/org/jboss/hal/op/cdi/PlaceManagerProducer.java b/console/op/src/main/java/org/jboss/hal/op/cdi/PlaceManagerProducer.java index e826bda..ccdd3c2 100644 --- a/console/op/src/main/java/org/jboss/hal/op/cdi/PlaceManagerProducer.java +++ b/console/op/src/main/java/org/jboss/hal/op/cdi/PlaceManagerProducer.java @@ -23,14 +23,16 @@ import org.jboss.elemento.router.PlaceManager; import org.jboss.elemento.router.Routes; import org.jboss.hal.op.Environment; -import org.jboss.hal.op.NotFound; +import org.jboss.hal.op.skeleton.NotFound; +import org.patternfly.component.navigation.Navigation; -import static org.jboss.hal.op.Constants.MAIN_ID; +import static org.jboss.hal.op.Ids.MAIN_ID; public class PlaceManagerProducer { @Inject Environment environment; @Inject Routes routes; + @Inject Navigation navigation; @Produces @ApplicationScoped @@ -40,6 +42,7 @@ public PlaceManager placeManager() { .root(By.id(MAIN_ID)) .title(title -> "HAL • " + title) .notFound(NotFound::new) - .register(routes.places()); + .register(routes.places()) + .afterPlace((placeManager, place, page) -> navigation.select(place.route)); } } diff --git a/console/op/src/main/java/org/jboss/hal/op/configuration/ConfigurationPage.java b/console/op/src/main/java/org/jboss/hal/op/configuration/ConfigurationPage.java new file mode 100644 index 0000000..459dd95 --- /dev/null +++ b/console/op/src/main/java/org/jboss/hal/op/configuration/ConfigurationPage.java @@ -0,0 +1,49 @@ +/* + * Copyright 2024 Red Hat + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.hal.op.configuration; + +import jakarta.inject.Inject; + +import org.jboss.elemento.router.Page; +import org.jboss.elemento.router.PlaceManager; +import org.jboss.elemento.router.Route; + +import elemental2.dom.HTMLElement; + +import static java.util.Collections.singletonList; + +import static org.jboss.elemento.Elements.h; +import static org.jboss.elemento.Elements.p; +import static org.jboss.elemento.router.Link.link; +import static org.patternfly.component.page.PageMainSection.pageMainSection; +import static org.patternfly.component.text.TextContent.textContent; +import static org.patternfly.style.Brightness.light; + +@Route("/configuration") +public class ConfigurationPage implements Page { + + @Inject PlaceManager placeManager; + + @Override + public Iterable elements() { + return singletonList(pageMainSection().background(light) + .add(textContent() + .add(h(1, "Configuration")) + .add(p().textContent("Not yet implemented!")) + .add(p().add(link(placeManager, "/").textContent("Home")))) + .element()); + } +} diff --git a/console/op/src/main/java/org/jboss/hal/op/dashboard/DashboardPage.java b/console/op/src/main/java/org/jboss/hal/op/dashboard/DashboardPage.java new file mode 100644 index 0000000..61fcce8 --- /dev/null +++ b/console/op/src/main/java/org/jboss/hal/op/dashboard/DashboardPage.java @@ -0,0 +1,102 @@ +/* + * Copyright 2024 Red Hat + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.hal.op.dashboard; + +import jakarta.enterprise.context.Dependent; +import org.jboss.elemento.router.Page; +import org.jboss.elemento.router.Route; + +import elemental2.dom.HTMLElement; + +import static java.util.Arrays.asList; +import static org.jboss.elemento.Elements.p; +import static org.patternfly.component.card.Card.card; +import static org.patternfly.component.card.CardBody.cardBody; +import static org.patternfly.component.card.CardTitle.cardTitle; +import static org.patternfly.component.page.PageMainBody.pageMainBody; +import static org.patternfly.component.page.PageMainSection.pageMainSection; +import static org.patternfly.component.text.TextContent.textContent; +import static org.patternfly.component.title.Title.title; +import static org.patternfly.layout.grid.Grid.grid; +import static org.patternfly.layout.grid.GridItem.gridItem; +import static org.patternfly.style.Brightness.light; + +@Dependent +@Route("/") +public class DashboardPage implements Page { + + @Override + public Iterable elements() { + return asList(pageMainSection().limitWidth().background(light) + .addBody(pageMainBody() + .add(textContent() + .add(title(1).text("WildFly Application Server")) + .add(p().textContent("Dashboard")))) + .element(), + pageMainSection().limitWidth() + .add(pageMainBody() + .add(grid().gutter() + .addItem(gridItem().span(8) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 8")))) + .addItem(gridItem().span(4).rowSpan(2) + .add(card().fullHeight() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 4, rowSpan = 2")))) + .addItem(gridItem().span(2).rowSpan(3) + .add(card().fullHeight() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2, rowSpan = 3")))) + .addItem(gridItem().span(2) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2")))) + .addItem(gridItem().span(4) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 4")))) + .addItem(gridItem().span(2) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2")))) + .addItem(gridItem().span(2) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2")))) + .addItem(gridItem().span(2) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2")))) + .addItem(gridItem().span(4) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 4")))) + .addItem(gridItem().span(2) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 2")))) + .addItem(gridItem().span(4) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 4")))) + .addItem(gridItem().span(4) + .add(card() + .addTitle(cardTitle().textContent("Card")) + .addBody(cardBody().textContent("span = 4")))))) + .element()); + } +} diff --git a/console/op/src/main/java/org/jboss/hal/op/deployment/DeploymentsPage.java b/console/op/src/main/java/org/jboss/hal/op/deployment/DeploymentsPage.java new file mode 100644 index 0000000..59b2486 --- /dev/null +++ b/console/op/src/main/java/org/jboss/hal/op/deployment/DeploymentsPage.java @@ -0,0 +1,49 @@ +/* + * Copyright 2024 Red Hat + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.hal.op.deployment; + +import jakarta.inject.Inject; + +import org.jboss.elemento.router.Page; +import org.jboss.elemento.router.PlaceManager; +import org.jboss.elemento.router.Route; + +import elemental2.dom.HTMLElement; + +import static java.util.Collections.singletonList; + +import static org.jboss.elemento.Elements.h; +import static org.jboss.elemento.Elements.p; +import static org.jboss.elemento.router.Link.link; +import static org.patternfly.component.page.PageMainSection.pageMainSection; +import static org.patternfly.component.text.TextContent.textContent; +import static org.patternfly.style.Brightness.light; + +@Route("/deployments") +public class DeploymentsPage implements Page { + + @Inject PlaceManager placeManager; + + @Override + public Iterable elements() { + return singletonList(pageMainSection().background(light) + .add(textContent() + .add(h(1, "Deployments")) + .add(p().textContent("Not yet implemented!")) + .add(p().add(link(placeManager, "/").textContent("Home")))) + .element()); + } +} diff --git a/console/op/src/main/java/org/jboss/hal/op/runtime/RuntimePage.java b/console/op/src/main/java/org/jboss/hal/op/runtime/RuntimePage.java new file mode 100644 index 0000000..e68179f --- /dev/null +++ b/console/op/src/main/java/org/jboss/hal/op/runtime/RuntimePage.java @@ -0,0 +1,49 @@ +/* + * Copyright 2024 Red Hat + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.hal.op.runtime; + +import jakarta.inject.Inject; + +import org.jboss.elemento.router.Page; +import org.jboss.elemento.router.PlaceManager; +import org.jboss.elemento.router.Route; + +import elemental2.dom.HTMLElement; + +import static java.util.Collections.singletonList; + +import static org.jboss.elemento.Elements.h; +import static org.jboss.elemento.Elements.p; +import static org.jboss.elemento.router.Link.link; +import static org.patternfly.component.page.PageMainSection.pageMainSection; +import static org.patternfly.component.text.TextContent.textContent; +import static org.patternfly.style.Brightness.light; + +@Route("/runtime") +public class RuntimePage implements Page { + + @Inject PlaceManager placeManager; + + @Override + public Iterable elements() { + return singletonList(pageMainSection().background(light) + .add(textContent() + .add(h(1, "Runtime")) + .add(p().textContent("Not yet implemented!")) + .add(p().add(link(placeManager, "/").textContent("Home")))) + .element()); + } +} diff --git a/console/op/src/main/java/org/jboss/hal/op/NotFound.java b/console/op/src/main/java/org/jboss/hal/op/skeleton/NotFound.java similarity index 97% rename from console/op/src/main/java/org/jboss/hal/op/NotFound.java rename to console/op/src/main/java/org/jboss/hal/op/skeleton/NotFound.java index adc3b3c..b51cc3b 100644 --- a/console/op/src/main/java/org/jboss/hal/op/NotFound.java +++ b/console/op/src/main/java/org/jboss/hal/op/skeleton/NotFound.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.hal.op; +package org.jboss.hal.op.skeleton; import org.jboss.elemento.router.Page; import org.jboss.elemento.router.Place; diff --git a/console/op/src/main/java/org/jboss/hal/op/Skeleton.java b/console/op/src/main/java/org/jboss/hal/op/skeleton/Skeleton.java similarity index 66% rename from console/op/src/main/java/org/jboss/hal/op/Skeleton.java rename to console/op/src/main/java/org/jboss/hal/op/skeleton/Skeleton.java index ba18f88..275cc3a 100644 --- a/console/op/src/main/java/org/jboss/hal/op/Skeleton.java +++ b/console/op/src/main/java/org/jboss/hal/op/skeleton/Skeleton.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.hal.op; +package org.jboss.hal.op.skeleton; import org.jboss.elemento.By; import org.jboss.elemento.IsElement; +import org.patternfly.component.navigation.Navigation; import org.patternfly.style.Classes; import elemental2.dom.HTMLElement; @@ -24,16 +25,23 @@ import static org.jboss.elemento.Elements.a; import static org.jboss.elemento.Elements.span; import static org.jboss.hal.op.Assets.logo; -import static org.jboss.hal.op.Constants.MAIN_ID; +import static org.jboss.hal.op.Ids.MAIN_ID; import static org.patternfly.component.backtotop.BackToTop.backToTop; import static org.patternfly.component.brand.Brand.brand; import static org.patternfly.component.page.Masthead.masthead; import static org.patternfly.component.page.MastheadBrand.mastheadBrand; +import static org.patternfly.component.page.MastheadContent.mastheadContent; import static org.patternfly.component.page.MastheadMain.mastheadMain; import static org.patternfly.component.page.Page.page; import static org.patternfly.component.page.PageMain.pageMain; import static org.patternfly.component.skiptocontent.SkipToContent.skipToContent; +import static org.patternfly.component.toolbar.Toolbar.toolbar; +import static org.patternfly.component.toolbar.ToolbarContent.toolbarContent; +import static org.patternfly.component.toolbar.ToolbarItem.toolbarItem; import static org.patternfly.style.Classes.component; +import static org.patternfly.style.Classes.fullHeight; +import static org.patternfly.style.Classes.modifier; +import static org.patternfly.style.Classes.static_; import static org.patternfly.style.Classes.util; import static org.patternfly.style.Variable.componentVar; import static org.patternfly.style.Variables.Height; @@ -42,17 +50,21 @@ public class Skeleton implements IsElement { private final HTMLElement root; - Skeleton() { + public Skeleton(Navigation navigation) { root = page() .addSkipToContent(skipToContent(MAIN_ID)) .addMasthead(masthead() .addMain(mastheadMain() .addBrand(mastheadBrand(a("/")) - .addBrand(brand(logo, "HAL Console") - .style(componentVar(component(Classes.brand), Height).name, "36px"))) - .add(span().css(util("ml-sm")).textContent("HAL Console")))) + .addBrand(brand(logo, "HAL Management Console") + .style(componentVar(component(Classes.brand), Height).name, "36px")))) + .addContent(mastheadContent() + .addToolbar(toolbar().css(modifier(fullHeight), modifier(static_)) + .addContent(toolbarContent() + .add(toolbarItem().css(modifier("overflow-container")) + .add(navigation)))))) .addMain(pageMain(MAIN_ID)) - .add(backToTop().css("ws-back-to-top") + .add(backToTop() .scrollableSelector(By.id(MAIN_ID))) .element(); }