Skip to content

Commit c3eeca9

Browse files
Merge pull request #1969 from johnduprey/dev
GraphExplorer update
2 parents 24d3a19 + 82c3e84 commit c3eeca9

File tree

3 files changed

+358
-106
lines changed

3 files changed

+358
-106
lines changed

src/components/forms/RFFComponents.jsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ export const RFFCFormSelect = ({
299299
className = 'mb-3',
300300
validate,
301301
disabled = false,
302+
props,
302303
}) => {
303304
// handler for ignoring the first element ('the placeholder')
304305
const selectValidate = (value, allValues, meta) => {
@@ -320,10 +321,11 @@ export const RFFCFormSelect = ({
320321
valid={!meta.error && meta.touched}
321322
invalid={meta.error && meta.touched}
322323
disabled={disabled}
324+
{...props}
323325
>
324326
<option value={placeholder}>{placeholder}</option>
325-
{values.map(({ label, value }, idx) => (
326-
<option key={`${idx}-${value}`} value={value}>
327+
{values.map(({ label, value, ...props }, idx) => (
328+
<option key={`${idx}-${value}`} value={value} {...props}>
327329
{label}
328330
</option>
329331
))}
@@ -383,11 +385,14 @@ export const RFFSelectSearch = ({
383385
disabled = false,
384386
retainInput = true,
385387
isLoading = false,
388+
refreshFunction,
389+
props,
386390
}) => {
387391
const [inputText, setInputText] = useState('')
388392
const selectSearchvalues = values.map((val) => ({
389393
value: val.value,
390394
label: val.name,
395+
...val.props,
391396
}))
392397

393398
const debounceOnInputChange = useMemo(() => {
@@ -410,7 +415,16 @@ export const RFFSelectSearch = ({
410415
{({ meta, input }) => {
411416
return (
412417
<div>
413-
<CFormLabel htmlFor={name}>{label}</CFormLabel>
418+
<CFormLabel htmlFor={name}>
419+
{label}
420+
{refreshFunction && (
421+
<CTooltip content="Refresh" placement="right">
422+
<CButton onClick={refreshFunction} variant="ghost" className="ms-1" size="sm">
423+
<FontAwesomeIcon icon="sync" />
424+
</CButton>
425+
</CTooltip>
426+
)}
427+
</CFormLabel>
414428
{onChange && (
415429
<Select
416430
className="react-select-container"
@@ -427,6 +441,7 @@ export const RFFSelectSearch = ({
427441
onInputChange={debounceOnInputChange}
428442
inputValue={inputText}
429443
isLoading={isLoading}
444+
{...props}
430445
/>
431446
)}
432447
{!onChange && (
@@ -444,6 +459,7 @@ export const RFFSelectSearch = ({
444459
isMulti={multi}
445460
inputValue={inputText}
446461
isLoading={isLoading}
462+
{...props}
447463
/>
448464
)}
449465
{meta.error && meta.touched && <span className="text-danger">{meta.error}</span>}
@@ -460,6 +476,7 @@ RFFSelectSearch.propTypes = {
460476
placeholder: PropTypes.string,
461477
onInputChange: PropTypes.func,
462478
isLoading: PropTypes.bool,
479+
refreshFunction: PropTypes.func,
463480
values: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string, name: PropTypes.string }))
464481
.isRequired,
465482
}

src/components/tables/CellTable.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ export default function cellTable(
1919
} else {
2020
columnProp = column
2121
}
22+
2223
if (!Array.isArray(columnProp) && typeof columnProp === 'object') {
2324
columnProp = Object.entries(columnProp).map((row) => {
2425
return { Name: row[0], Value: row[1] }
2526
})
27+
} else if (Array.isArray(columnProp) && Object.entries(columnProp).length === 1) {
28+
columnProp = columnProp.map((row) => {
29+
return {
30+
Value: row,
31+
}
32+
})
2633
}
27-
console.log(Array.isArray(columnProp))
2834

2935
const handleTable = ({ columnProp }) => {
3036
const QueryColumns = []
@@ -73,7 +79,6 @@ export default function cellTable(
7379

7480
// Use dangerButton to determine button class
7581
const buttonClassName = dangerButton ? 'btn-danger' : ''
76-
7782
return (
7883
<CButton
7984
className={buttonClassName}

0 commit comments

Comments
 (0)