Skip to content

Commit

Permalink
Add support for dataKey on CippTablePage
Browse files Browse the repository at this point in the history
Add dev launcher and other scripts
  • Loading branch information
JohnDuprey committed Sep 3, 2024
1 parent 8e8f4b6 commit 388d903
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"name": "Launch in Windows Terminal",
"request": "launch",
"cwd": "${cwd}",
"script": ". '${cwd}\\Tools\\Start-CowDevEmulators.ps1'"
"script": ". '${cwd}\\Tools\\Start-CIPPDevEmulators.ps1'"
}
],
"compounds": [
Expand Down
12 changes: 12 additions & 0 deletions Tools/Start-CippDevEmulators.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Write-Host 'Starting CIPP Dev Emulators'
Get-Process node -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue
$Path = (Get-Item $PSScriptRoot).Parent.Parent.FullName

$Process = Read-Host -Prompt 'Start Process Function (y/N)?'

if ($Process -eq 'y') {
wt --title CIPP`; new-tab --title 'Azurite' -d $Path pwsh -c azurite`; new-tab --title 'FunctionApp' -d $Path\CIPP-API pwsh -c func start`; new-tab --title 'CIPP Frontend' -d $Path\CIPP pwsh -c npm run dev`; new-tab --title 'SWA' -d $Path\CIPP pwsh -c npm run start-swa`; new-tab --title 'CIPP-API-Processor' -d $Path\CIPP-API-Processor pwsh -c func start --port 7072
} else {
wt --title CIPP`; new-tab --title 'Azurite' -d $Path pwsh -c azurite`; new-tab --title 'FunctionApp' -d $Path\CIPP-API pwsh -c func start`; new-tab --title 'CIPP Frontend' -d $Path\CIPP pwsh -c npm run dev`; new-tab --title 'SWA' -d $Path\CIPP pwsh -c npm run start-swa
}

10 changes: 10 additions & 0 deletions Tools/Update-Version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Param($Version)
Set-Location (Get-Item $PSScriptRoot).Parent.FullName
$Files = @('version_latest.txt', 'public/version_latest.txt')
foreach ($File in $Files) {
Set-Content $File -Value $Version
}

$Package = Get-Content package.json | ConvertFrom-Json
$Package.version = $Version
$Package | ConvertTo-Json -Depth 10 | Set-Content package.json
7 changes: 6 additions & 1 deletion src/components/CippComponents/CippTablePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const CippTablePage = (props) => {
actions,
apiUrl,
apiData,
apiDataKey,
columns,
columnsFromApi,
name,
Expand Down Expand Up @@ -49,7 +50,11 @@ export const CippTablePage = (props) => {
noDataButton={noDataButton}
actions={actions}
simple={false}
api={{ url: apiUrl, data: { tenantFilter: tenant, ...apiData } }}
api={{
url: apiUrl,
data: { tenantFilter: tenant, ...apiData },
dataKey: apiDataKey,
}}
columns={columns}
columnsFromApi={columnsFromApi}
offCanvas={offCanvas}
Expand Down
39 changes: 27 additions & 12 deletions src/pages/[tenant]/identity/groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CippTablePage } from "../../../../components/CippComponents/CippTablePa
import { Layout as DashboardLayout } from "../../../../layouts/index.js";

const Page = () => {
const pageTitle = "Users";
const pageTitle = "Groups";
const actions = [
{
label: "Delete User",
Expand Down Expand Up @@ -30,19 +30,34 @@ const Page = () => {
return (
<CippTablePage
title={pageTitle}
columns={[
{
header: "Display Name",
accessorKey: "displayName",
},
{
header: "userPrincipalName",
accessorKey: "userPrincipalName",
},
]}
apiUrl="/api/ListUsers"
apiUrl="/api/ListGraphRequest"
apiData={{
Endpoint: "groups",
$select:
"id,createdDateTime,displayName,description,mail,mailEnabled,mailNickname,resourceProvisioningOptions,securityEnabled,visibility,organizationId,onPremisesSamAccountName,membershipRule,grouptypes,onPremisesSyncEnabled,resourceProvisioningOptions,userPrincipalName",
$expand: "members($select=userPrincipalName)",
$count: true,
}}
apiDataKey="Results"
actions={actions}
offCanvas={offCanvas}
simpleColumns={[
"displayName",
"description",
"mail",
"mailEnabled",
"mailNickname",
"resourceProvisioningOptions",
"securityEnabled",
"visibility",
"organizationId",
"onPremisesSamAccountName",
"membershipRule",
"grouptypes",
"onPremisesSyncEnabled",
"resourceProvisioningOptions",
"userPrincipalName",
]}
/>
);
};
Expand Down

0 comments on commit 388d903

Please sign in to comment.