Skip to content

Commit

Permalink
Make Bootstrap 5 styles the global default (#9417)
Browse files Browse the repository at this point in the history
  • Loading branch information
Etheryte authored Nov 4, 2024
1 parent 7713baf commit 9d66d8f
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 48 deletions.
2 changes: 1 addition & 1 deletion java/code/src/com/suse/manager/webui/utils/ViewHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,6 @@ public boolean hasSshPushContactMethod(Server server) {
*/
@Deprecated
public boolean isBootstrapReady(String uri) {
return BOOTSTRAP_READY_PAGES.contains(uri);
return true;
}
}
6 changes: 3 additions & 3 deletions java/code/webapp/WEB-INF/pages/ssm/systems/misc/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<thead>
<tr>
<th align="left"><bean:message key="ssm.misc.index.syspref.preference"/></th>
<th width="5%"><bean:message key="yes"/></th>
<th width="5%"><bean:message key="no"/></th>
<th width="5%"><bean:message key="ssm.misc.index.syspref.nochange"/></th>
<th width="5%" class="text-center"><bean:message key="yes"/></th>
<th width="5%" class="text-center"><bean:message key="no"/></th>
<th width="5%" class="text-center"><bean:message key="ssm.misc.index.syspref.nochange"/></th>
</tr>
</thead>

Expand Down
1 change: 1 addition & 0 deletions java/spacewalk-java.changes.eth.all-view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update numerous page layouts
3 changes: 3 additions & 0 deletions web/html/src/branding/css/base/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,9 @@ a time:hover {
.action-button-wrapper {
float: right;
overflow: auto;
display: flex;
align-items: center;
gap: 8px;

button,
input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ th {
a {
border: none;
padding: 0;
font-weight: bold;
color: $eos-bc-gray-1000;
font-weight: bold !important;
color: $eos-bc-gray-1000 !important;
}
}
5 changes: 5 additions & 0 deletions web/html/src/branding/css/susemanager/components/lists.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ul,
ol,
dl {
padding-left: 2rem;
}
5 changes: 5 additions & 0 deletions web/html/src/branding/css/susemanager/components/mark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mark {
padding: 0.2em;
background-color: #fcf8e3;
color: #000;
}
4 changes: 4 additions & 0 deletions web/html/src/branding/css/susemanager/components/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ thead tr {
font-weight: bold !important;
background: transparent;
}

.text-center {
text-align: center;
}
}

tbody tr,
Expand Down
2 changes: 2 additions & 0 deletions web/html/src/branding/css/susemanager/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
@import "./components/help-block.scss";
@import "./components/collapse.scss";
@import "./components/icons.scss";
@import "./components/mark.scss";
@import "./components/lists.scss";

@import "./bootstrap-fixes.scss";

Expand Down
1 change: 1 addition & 0 deletions web/html/src/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = (env, argv) => {
* Scripts and dependencies we're migrating from susemanager-frontend-libs to spacewalk-web
*/
{
// from: path.resolve(__dirname, "../node_modules/bootstrap5/dist/js/bootstrap.min.js"),
from: path.resolve(__dirname, "../node_modules/bootstrap/dist/js/bootstrap.min.js"),
to: path.resolve(__dirname, "../dist/javascript/legacy"),
},
Expand Down
7 changes: 7 additions & 0 deletions web/html/src/components/virtual-list/VirtualList.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:global(.old-theme),
:global(.new-theme) {
.listWrapper {
flex: 1 1 auto;
width: auto;
}
}
4 changes: 3 additions & 1 deletion web/html/src/components/virtual-list/VirtualList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as React from "react";

import { Virtuoso } from "react-virtuoso";

import styles from "./VirtualList.module.less";

type ListProps<T> = {
renderItem: (item: T) => JSX.Element;
items: T[];
Expand All @@ -17,7 +19,7 @@ const VirtualList = <T,>(props: ListProps<T>) => {
const computeItemKey = (index: number, item: T) => props.itemKey(item);

return (
<div style={{ flex: "1 1 auto" }}>
<div className={styles.listWrapper}>
<Virtuoso
data={props.items}
itemContent={itemContent}
Expand Down
8 changes: 2 additions & 6 deletions web/html/src/core/spa/view-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type PathString = `/rhn/${string}`;
* A list of updated page pathnames, e.g. `"/rhn/manager/foo/bar"`
* NB! This must be in sync with java/code/src/com/suse/manager/webui/utils/ViewHelper.java
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const BOOTSTRAP_READY_PAGES: PathString[] = [
"/rhn/YourRhn.do",
"/rhn/account/UserPreferences.do",
Expand Down Expand Up @@ -61,10 +62,5 @@ const BOOTSTRAP_READY_PAGES: PathString[] = [
];

export const onEndNavigate = () => {
const pathname = window.location.pathname as PathString;
if (BOOTSTRAP_READY_PAGES.includes(pathname)) {
document.body.className = document.body.className.replace("old-theme", "new-theme");
} else {
document.body.className = document.body.className.replace("new-theme", "old-theme");
}
document.body.className = document.body.className.replace("old-theme", "new-theme");
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
padding: 0px;
}

.gapped_label {
margin-bottom: 30px;
display: inline-block;
}

.initial_selected {
color: #02a49c !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,46 +192,48 @@ const ChannelsSelection = (props: PropsType) => {
{rows && (
<div className="row" style={{ display: "flex" }}>
<div className="col-lg-3 control-label">
<label className="row" style={{ marginBottom: "30px" }}>
<label className={`row ${styles.gapped_label}`}>
{`${t("Child Channels")} (${selectedChannelIds.size})`}
</label>
<div className="row panel panel-default panel-body text-left">
<div style={{ position: "relative" }}>
<input
type="text"
className="form-control"
placeholder="Search a channel"
value={search}
onChange={(event) => {
const newSearch = event.target.value;
setSearch(newSearch);
onSearch(newSearch);
}}
/>
<span className={`${styles.search_icon_container} clear`}>
<i
onClick={() => {
setSearch("");
onSearch("");
<div className="row panel panel-default text-left">
<div className="panel-body ">
<div style={{ position: "relative" }}>
<input
type="text"
className="form-control"
placeholder="Search a channel"
value={search}
onChange={(event) => {
const newSearch = event.target.value;
setSearch(newSearch);
onSearch(newSearch);
}}
className="fa fa-times-circle-o no-margin"
title={t("Clear Search")}
/>
</span>
<span className={`${styles.search_icon_container} clear`}>
<i
onClick={() => {
setSearch("");
onSearch("");
}}
className="fa fa-times-circle-o no-margin"
title={t("Clear Search")}
/>
</span>
</div>
<hr />
<ChannelsFilters
activeFilters={activeFilters}
onChange={(value) => {
const newActiveFilters = xor(activeFilters, [value]);
setActiveFilters(newActiveFilters);
channelProcessor.setActiveFilters(newActiveFilters).then((newRows) => {
if (newRows) {
setRows(newRows);
}
});
}}
/>
</div>
<hr />
<ChannelsFilters
activeFilters={activeFilters}
onChange={(value) => {
const newActiveFilters = xor(activeFilters, [value]);
setActiveFilters(newActiveFilters);
channelProcessor.setActiveFilters(newActiveFilters).then((newRows) => {
if (newRows) {
setRows(newRows);
}
});
}}
/>
</div>
</div>
<VirtualList items={rows} renderItem={Row} defaultItemHeight={29} itemKey={(row) => row.base.id} />
Expand Down
1 change: 1 addition & 0 deletions web/spacewalk-web.changes.eth.all-view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update numerous page layouts

0 comments on commit 9d66d8f

Please sign in to comment.