Skip to content

Commit 608f3c2

Browse files
Merge pull request #2534 from KelvinTegelaar/dev
Dev to release
2 parents 742bfbe + 0f08cc2 commit 608f3c2

37 files changed

+2327
-608
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cipp",
3-
"version": "5.7.1",
3+
"version": "5.8.0",
44
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
55
"homepage": "https://cipp.app/",
66
"bugs": {

public/version_latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.7.1
1+
5.8.0

src/_nav.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ const _nav = [
7575
name: 'Roles',
7676
to: '/identity/administration/roles',
7777
},
78+
{
79+
component: CNavItem,
80+
name: 'JIT Admin',
81+
to: '/identity/administration/jit-admin',
82+
},
7883
{
7984
component: CNavItem,
8085
name: 'Offboarding Wizard',
@@ -771,6 +776,11 @@ const _nav = [
771776
name: 'Application Settings',
772777
to: '/cipp/settings',
773778
},
779+
{
780+
component: CNavItem,
781+
name: 'Extensions Settings',
782+
to: '/cipp/extensions',
783+
},
774784
{
775785
component: CNavItem,
776786
name: 'User Settings',

src/components/forms/RFFComponents.jsx

Lines changed: 85 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,54 @@ RFFCFormInputArray.propTypes = {
253253
...sharedPropTypes,
254254
}
255255

256+
export const RFFCFormInputList = ({ name, label, className = 'mb-3' }) => {
257+
return (
258+
<>
259+
<FieldArray name={name}>
260+
{({ fields }) => (
261+
<div>
262+
<div className="mb-2">
263+
{label && (
264+
<CFormLabel className="me-2" htmlFor={name}>
265+
{label}
266+
</CFormLabel>
267+
)}
268+
<CButton
269+
onClick={() => fields.push({ Key: '', Value: '' })}
270+
className="circular-button"
271+
title={'+'}
272+
>
273+
<FontAwesomeIcon icon={'plus'} />
274+
</CButton>
275+
</div>
276+
{fields.map((name, index) => (
277+
<div key={name} className={className}>
278+
<div>
279+
<Field name={`${name}`} component="input">
280+
{({ input, meta }) => {
281+
return <CFormInput placeholder="Value" {...input} className="mb-2" />
282+
}}
283+
</Field>
284+
</div>
285+
<CButton
286+
onClick={() => fields.remove(index)}
287+
className={`circular-button`}
288+
title={'-'}
289+
>
290+
<FontAwesomeIcon icon={'minus'} />
291+
</CButton>
292+
</div>
293+
))}
294+
</div>
295+
)}
296+
</FieldArray>
297+
</>
298+
)
299+
}
300+
RFFCFormInputList.propTypes = {
301+
...sharedPropTypes,
302+
}
303+
256304
export const RFFCFormRadio = ({
257305
name,
258306
label,
@@ -293,7 +341,6 @@ export const RFFCFormRadioList = ({
293341
name,
294342
options,
295343
className = 'mb-3',
296-
disabled = false,
297344
onClick,
298345
inline = false,
299346
}) => {
@@ -312,7 +359,6 @@ export const RFFCFormRadioList = ({
312359
onChange={input.onChange}
313360
type="radio"
314361
{...option}
315-
disabled={disabled}
316362
onClick={onClick}
317363
inline={inline}
318364
/>
@@ -465,10 +511,10 @@ export const RFFSelectSearch = ({
465511
isLoading = false,
466512
allowCreate = false,
467513
refreshFunction,
468-
props,
514+
...props
469515
}) => {
470516
const [inputText, setInputText] = useState('')
471-
const selectSearchvalues = values.map((val) => ({
517+
const selectSearchValues = values.map((val) => ({
472518
value: val.value,
473519
label: val.name,
474520
...val.props,
@@ -492,12 +538,33 @@ export const RFFSelectSearch = ({
492538
return (
493539
<Field name={name} validate={validate}>
494540
{({ meta, input }) => {
495-
const handleChange = onChange
496-
? (e) => {
497-
input.onChange(e)
498-
onChange(e)
499-
}
500-
: input.onChange
541+
const handleChange = (e) => {
542+
if (onChange) {
543+
onChange(e)
544+
}
545+
input.onChange(e)
546+
}
547+
548+
const selectProps = {
549+
classNamePrefix: 'react-select',
550+
...input,
551+
name,
552+
id: name,
553+
disabled,
554+
options: selectSearchValues,
555+
placeholder,
556+
isMulti: multi,
557+
inputValue: inputText,
558+
isLoading,
559+
onChange: handleChange,
560+
onInputChange: setOnInputChange,
561+
...props,
562+
//merge className from props into the default className
563+
className: props.className
564+
? `${props.className} react-select-container`
565+
: 'react-select-container',
566+
}
567+
501568
return (
502569
<div>
503570
<CFormLabel htmlFor={name}>
@@ -515,81 +582,16 @@ export const RFFSelectSearch = ({
515582
</CTooltip>
516583
)}
517584
</CFormLabel>
518-
{!allowCreate && onChange && (
519-
<Select
520-
className="react-select-container"
521-
classNamePrefix="react-select"
522-
{...input}
523-
isClearable={false}
524-
name={name}
525-
id={name}
526-
disabled={disabled}
527-
options={selectSearchvalues}
528-
placeholder={placeholder}
529-
isMulti={multi}
530-
onChange={handleChange}
531-
onInputChange={debounceOnInputChange}
532-
inputValue={inputText}
533-
isLoading={isLoading}
534-
{...props}
535-
/>
536-
)}
537-
{!allowCreate && !onChange && (
538-
<Select
539-
className="react-select-container"
540-
classNamePrefix="react-select"
541-
{...input}
542-
isClearable={true}
543-
name={name}
544-
id={name}
545-
disabled={disabled}
546-
options={selectSearchvalues}
547-
placeholder={placeholder}
548-
onInputChange={setOnInputChange}
549-
isMulti={multi}
550-
inputValue={inputText}
551-
isLoading={isLoading}
552-
{...props}
553-
/>
554-
)}
555-
{allowCreate && onChange && (
556-
<Creatable
557-
className="react-select-container"
558-
classNamePrefix="react-select"
559-
{...input}
560-
isClearable={false}
561-
name={name}
562-
id={name}
563-
disabled={disabled}
564-
options={selectSearchvalues}
565-
placeholder={placeholder}
566-
isMulti={multi}
567-
onChange={handleChange}
568-
onInputChange={debounceOnInputChange}
569-
inputValue={inputText}
570-
isLoading={isLoading}
571-
{...props}
572-
/>
585+
{allowCreate ? (
586+
<Creatable {...selectProps} isClearable={true} />
587+
) : (
588+
<Select {...selectProps} isClearable={!onChange} />
573589
)}
574-
{allowCreate && !onChange && (
575-
<Creatable
576-
className="react-select-container"
577-
classNamePrefix="react-select"
578-
{...input}
579-
isClearable={true}
580-
name={name}
581-
id={name}
582-
disabled={disabled}
583-
options={selectSearchvalues}
584-
placeholder={placeholder}
585-
onInputChange={setOnInputChange}
586-
isMulti={multi}
587-
inputValue={inputText}
588-
isLoading={isLoading}
589-
{...props}
590-
/>
590+
{meta.error && meta.touched && (
591+
<span className="text-danger">
592+
{typeof meta.error === 'object' ? Object.values(meta.error).join('') : meta.error}
593+
</span>
591594
)}
592-
{meta.error && meta.touched && <span className="text-danger">{meta.error}</span>}
593595
</div>
594596
)
595597
}}

src/components/forms/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
RFFCFormSelect,
1111
RFFSelectSearch,
1212
RFFCFormInputArray,
13+
RFFCFormInputList,
1314
} from 'src/components/forms/RFFComponents'
1415

1516
export {
@@ -24,4 +25,5 @@ export {
2425
RFFCFormSelect,
2526
RFFSelectSearch,
2627
RFFCFormInputArray,
28+
RFFCFormInputList,
2729
}

src/components/tables/CippTable.jsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ export default function CippTable({
414414
(modalMessage, modalUrl, modalType = 'GET', modalBody, modalInput, modalDropdown) => {
415415
if (modalType === 'GET') {
416416
ModalService.confirm({
417+
getData: () => inputRef.current?.value,
417418
body: (
418419
<div style={{ overflow: 'visible' }}>
419420
<div>{modalMessage}</div>
@@ -466,6 +467,18 @@ export default function CippTable({
466467
title: 'Confirm',
467468
onConfirm: async () => {
468469
const resultsarr = []
470+
const selectedValue = inputRef.current.value
471+
let additionalFields = {}
472+
if (inputRef.current.nodeName === 'SELECT') {
473+
const selectedItem = dropDownInfo.data.find(
474+
(item) => item[modalDropdown.valueField] === selectedValue,
475+
)
476+
if (selectedItem && modalDropdown.addedField) {
477+
Object.keys(modalDropdown.addedField).forEach((key) => {
478+
additionalFields[key] = selectedItem[modalDropdown.addedField[key]]
479+
})
480+
}
481+
}
469482
for (const row of selectedRows) {
470483
setLoopRunning(true)
471484
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
@@ -492,26 +505,13 @@ export default function CippTable({
492505
}
493506
}
494507
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
495-
const selectedValue = inputRef.current.value
496-
let additionalFields = {}
497-
if (inputRef.current.nodeName === 'SELECT') {
498-
const selectedItem = dropDownInfo.data.find(
499-
(item) => item[modalDropdown.valueField] === selectedValue,
500-
)
501-
if (selectedItem && modalDropdown.addedField) {
502-
Object.keys(modalDropdown.addedField).forEach((key) => {
503-
additionalFields[key] = selectedItem[modalDropdown.addedField[key]]
504-
})
505-
}
506-
}
507-
508508
const results = await genericPostRequest({
509509
path: NewModalUrl,
510510
values: {
511511
...modalBody,
512512
...newModalBody,
513513
...additionalFields,
514-
...{ input: inputRef.current.value },
514+
...{ input: selectedValue },
515515
},
516516
})
517517
resultsarr.push(results)

src/components/utilities/CippFuzzySearch.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Fuse from 'fuse.js'
44
function CippfuzzySearch(options) {
55
const fuse = new Fuse(options, {
66
keys: ['name', 'groupName', 'items.name'],
7-
threshold: 0.5,
7+
threshold: 0.3,
88
location: 0,
99
ignoreLocation: true,
1010
useExtendedSearch: true,
@@ -15,8 +15,8 @@ function CippfuzzySearch(options) {
1515
if (!value.length) {
1616
return options
1717
}
18-
19-
return fuse.search(value).map((_ref) => {
18+
const search = fuse.search(value)
19+
return search.map((_ref) => {
2020
let { item } = _ref
2121
return item
2222
})

src/components/utilities/CippListOffcanvas.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CippListOffcanvas.propTypes = {
3838
hideFunction: PropTypes.func.isRequired,
3939
}
4040

41-
export function OffcanvasListSection({ title, items }) {
41+
export function OffcanvasListSection({ title, items, showCardTitle = true }) {
4242
//console.log(items)
4343
const mappedItems = items.map((item, key) => ({ value: item.content, label: item.heading }))
4444
return (
@@ -48,7 +48,11 @@ export function OffcanvasListSection({ title, items }) {
4848
<CCard className="content-card">
4949
<CCardHeader className="d-flex justify-content-between align-items-center">
5050
<CCardTitle>
51-
<FontAwesomeIcon icon={faGlobe} className="mx-2" /> Extended Information
51+
{showCardTitle && (
52+
<>
53+
<FontAwesomeIcon icon={faGlobe} className="mx-2" /> Extended Information
54+
</>
55+
)}
5256
</CCardTitle>
5357
</CCardHeader>
5458
<CCardBody>
@@ -62,4 +66,5 @@ export function OffcanvasListSection({ title, items }) {
6266
OffcanvasListSection.propTypes = {
6367
title: PropTypes.string,
6468
items: PropTypes.array,
69+
showCardTitle: PropTypes.bool,
6570
}

0 commit comments

Comments
 (0)