Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
spinen-Earl authored Oct 4, 2023
2 parents 21e72d8 + ecaab12 commit 4c08412
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 40 deletions.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.0
4.3.1
37 changes: 15 additions & 22 deletions src/components/tables/CippDatatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,23 @@ export default function CippDatatable({ path, params, ...rest }) {
isFetching,
error,
} = useListDatatableQuery({ path, params: { refreshGuid, $filter: graphFilter, ...params } })

var defaultFilterText = ''
if (params?.Parameters?.$filter) {
defaultFilterText = 'Graph: ' + params?.Parameters?.$filter
}
return (
<>
{data[0]?.Queued ? (
<>
<CCallout color="info">{data[0]?.QueueMessage}</CCallout>
<CippTable
{...rest}
data={[]}
isFetching={isFetching}
error={error}
refreshFunction={setRefreshGuid}
graphFilterFunction={setGraphFilter}
/>
</>
) : (
<CippTable
{...rest}
data={data}
isFetching={isFetching}
error={error}
refreshFunction={setRefreshGuid}
graphFilterFunction={setGraphFilter}
/>
)}
{data[0]?.Queued && <CCallout color="info">{data[0]?.QueueMessage}</CCallout>}
<CippTable
{...rest}
data={data[0]?.Queued ? [] : data}
isFetching={isFetching}
error={error}
defaultFilterText={defaultFilterText}
refreshFunction={setRefreshGuid}
graphFilterFunction={setGraphFilter}
/>
</>
)
}
Expand Down
12 changes: 8 additions & 4 deletions src/components/tables/CippTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export default function CippTable({
graphFilterFunction = null,
columns = [],
dynamicColumns = true,
defaultFilterText = '',
isModal = false,
filterlist,
tableProps: {
keyField = 'id',
Expand All @@ -137,7 +139,7 @@ export default function CippTable({
const inputRef = useRef('')
const [loopRunning, setLoopRunning] = React.useState(false)
const [massResults, setMassResults] = React.useState([])
const [filterText, setFilterText] = React.useState('')
const [filterText, setFilterText] = React.useState(defaultFilterText)
const [filterviaURL, setFilterviaURL] = React.useState(false)
const [updatedColumns, setUpdatedColumns] = React.useState(columns)
const [selectedRows, setSelectedRows] = React.useState(false)
Expand All @@ -147,7 +149,7 @@ export default function CippTable({
const [modalContent, setModalContent] = useState(null)
//get the search params called "tableFilter" and set the filter to that.
const [searchParams, setSearchParams] = useSearchParams()
if (searchParams.get('tableFilter') && !filterviaURL) {
if (searchParams.get('tableFilter') && !filterviaURL && !isModal) {
setFilterText(searchParams.get('tableFilter'))
setFilterviaURL(true)
}
Expand Down Expand Up @@ -219,8 +221,10 @@ export default function CippTable({
}, [filterText])

const filterData = (data, filterText) => {
const debouncedSetSearchParams = debounce(debounceSetSearchParams, 1000)
debouncedSetSearchParams()
if (!isModal) {
const debouncedSetSearchParams = debounce(debounceSetSearchParams, 1000)
debouncedSetSearchParams()
}
if (filterText.startsWith('Graph:')) {
var query = filterText.slice(6).trim()
debounceSetGraphFilter(query)
Expand Down
2 changes: 1 addition & 1 deletion src/components/utilities/SharedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { CippTable } from 'src/components/tables'
function mapBodyComponent({ componentType, data, componentProps }) {
switch (componentType) {
case 'table':
return <CippTable data={data || []} {...componentProps} />
return <CippTable data={data || []} isModal={true} {...componentProps} />
case 'list':
return <div>{Array.isArray(data) && data.map((el, idx) => <div key={idx}>{el}</div>)}</div>
case 'text':
Expand Down
2 changes: 1 addition & 1 deletion src/data/Extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "CIPP-API",
"cat": "API",
"forceSyncButton": false,
"helpText": "This integration allows you to use to enable API access outside of CIPP usage. Requires Global Administrator permissions inside your tenant for activation of the API. These credentials will only be shown once.",
"helpText": "This integration allows you to enable CIPP-API access outside of CIPP. Requires Global Administrator permissions inside your tenant for activation of the API. The API credentials will only be shown once.",
"SettingOptions": [
{
"type": "checkbox",
Expand Down
6 changes: 3 additions & 3 deletions src/views/cipp/CIPPSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,8 @@ const ExtensionsTab = () => {
}

const MappingsTab = () => {
const [listHaloBackend, listBackendHaloResult] = useLazyGenericGetRequestQuery()
const [setHaloExtensionconfig, extensionHaloConfigResult] = useLazyGenericPostRequestQuery()
const [listHaloBackend, listBackendHaloResult = []] = useLazyGenericGetRequestQuery()
const [setHaloExtensionconfig, extensionHaloConfigResult = []] = useLazyGenericPostRequestQuery()

const onHaloSubmit = (values) => {
setHaloExtensionconfig({
Expand Down Expand Up @@ -1608,7 +1608,7 @@ const MappingsTab = () => {
<CCardText>
Use the table below to map your client to the correct PSA client
{listBackendHaloResult.isSuccess &&
listBackendHaloResult.data.Tenants.map((tenant) => (
listBackendHaloResult.data.Tenants?.map((tenant) => (
<RFFSelectSearch
key={tenant.customerId}
name={tenant.customerId}
Expand Down
15 changes: 8 additions & 7 deletions src/views/identity/administration/EditGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ const EditGroup = () => {
let query = useQuery()
const groupId = query.get('groupId')
const tenantDomain = query.get('tenantDomain')

const [queryError, setQueryError] = useState(false)

const [refreshToken, setRefresh] = useState('')
const {
data: group = {},
isFetching,
Expand All @@ -47,14 +46,14 @@ const EditGroup = () => {
isFetching: membersisFetching,
error: membersError,
isSuccess: membersIsSuccess,
} = useListGroupMembersQuery({ tenantDomain, groupId })
} = useListGroupMembersQuery({ tenantDomain, groupId, refreshToken })

const {
data: owners = [],
isFetching: ownersisFetching,
error: ownersError,
isSuccess: ownersIsSuccess,
} = useListGroupOwnersQuery({ tenantDomain, groupId })
} = useListGroupOwnersQuery({ tenantDomain, groupId, refreshToken })
const {
data: users = [],
isFetching: usersIsFetching,
Expand All @@ -66,6 +65,7 @@ const EditGroup = () => {
isFetching: contactsIsFetching,
error: contactsError,
} = useListContactsQuery({ tenantDomain })
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()

const [roleInfo, setroleInfo] = React.useState([])
useEffect(() => {
Expand All @@ -86,7 +86,7 @@ const EditGroup = () => {
})
setroleInfo(ownerWithRole.concat(memberwithRole))
}
}, [owners, members, ownersIsSuccess, membersIsSuccess])
}, [owners, members, ownersIsSuccess, membersIsSuccess, postResults])

useEffect(() => {
if (!groupId || !tenantDomain) {
Expand All @@ -97,7 +97,6 @@ const EditGroup = () => {
setQueryError(true)
}
}, [groupId, tenantDomain, dispatch])
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
const onSubmit = (values) => {
const shippedValues = {
tenantID: tenantDomain,
Expand All @@ -114,7 +113,9 @@ const EditGroup = () => {
mail: group[0].mail,
}
//window.alert(JSON.stringify(shippedValues))
genericPostRequest({ path: '/api/EditGroup', values: shippedValues })
genericPostRequest({ path: '/api/EditGroup', values: shippedValues }).then((res) => {
setRefresh(postResults.requestId)
})
}
const tableColumns = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/views/tenant/administration/ListAlertsQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const ListAlertsQueue = () => {
label: 'Delete webhook',
color: 'info',
modal: true,
modalUrl: `/api/RemoveWebhookAlert?CIPPID=!CIPPID&tenantfilter=!tenantName`,
modalUrl: `/api/RemoveWebhookAlert?CIPPID=!RowKey&tenantfilter=!PartitionKey`,
modalMessage: 'Are you sure you want to delete this webhook alert?',
},
],
Expand Down
1 change: 1 addition & 0 deletions version_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.3.1

0 comments on commit 4c08412

Please sign in to comment.