mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-14 13:33:00 +00:00
Render tabel cells with multiple data items as RowListItem
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, Fragment } from "react";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
@@ -29,6 +29,13 @@ const AccessServerButton = ({ url }) => (
|
|||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const RowListItem = ({ text }) => (
|
||||||
|
<span className="server-dashboard-row-list-item">{text}</span>
|
||||||
|
);
|
||||||
|
RowListItem.propTypes = {
|
||||||
|
text: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
const ServerDashboard = (props) => {
|
const ServerDashboard = (props) => {
|
||||||
let base_url = window.base_url || "/";
|
let base_url = window.base_url || "/";
|
||||||
// sort methods
|
// sort methods
|
||||||
@@ -236,8 +243,13 @@ const ServerDashboard = (props) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
// cast arrays (e.g. roles, groups) to string
|
value = (
|
||||||
value = value.sort().join(", ");
|
<Fragment>
|
||||||
|
{value.sort().flatMap((v) => (
|
||||||
|
<RowListItem text={v} />
|
||||||
|
))}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
result[key] = value;
|
result[key] = value;
|
||||||
return result;
|
return result;
|
||||||
@@ -254,7 +266,6 @@ const ServerDashboard = (props) => {
|
|||||||
}}
|
}}
|
||||||
valueStyle={{
|
valueStyle={{
|
||||||
padding: "4px",
|
padding: "4px",
|
||||||
whiteSpace: "unset",
|
|
||||||
}}
|
}}
|
||||||
data={sortedData}
|
data={sortedData}
|
||||||
/>
|
/>
|
||||||
|
@@ -30,3 +30,11 @@
|
|||||||
tr.noborder > td {
|
tr.noborder > td {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-dashboard-row-list-item {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 5px;
|
||||||
|
margin: 2px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user