Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from KelvinTegelaar:main #5

Merged
merged 61 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
298e1bc
add jsx
KelvinTegelaar Apr 3, 2024
b1cf7e2
potential fix.
KelvinTegelaar Apr 3, 2024
1d172a5
Fixes dynamic routes issues.
KelvinTegelaar Apr 3, 2024
0bd5e95
Allow retry button while running
JohnDuprey Apr 4, 2024
8192d34
Merge pull request #2302 from JohnDuprey/dev
JohnDuprey Apr 4, 2024
791e567
DefaultValue Switch and Input
OfficialEsco Apr 4, 2024
cd0e858
Merge pull request #2306 from Ren-Roros-Digital/defaultValue
KelvinTegelaar Apr 8, 2024
8659d9e
fixes columns not being correct.
KelvinTegelaar Apr 8, 2024
0e1bf28
set default size to A3, with fit to page enabled for reprinting.
KelvinTegelaar Apr 8, 2024
5c939cd
add sort for devices
KelvinTegelaar Apr 8, 2024
8c765c2
update footer
JohnDuprey Apr 9, 2024
f3d2bb9
use $orderby and $count for devices
JohnDuprey Apr 9, 2024
acf1eeb
removed unused vars
KelvinTegelaar Apr 9, 2024
d6fad2f
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Apr 9, 2024
c62d3de
Merge pull request #2309 from JohnDuprey/dev
JohnDuprey Apr 9, 2024
b9706b9
Merge pull request #21 from KelvinTegelaar/dev
kris6673 Apr 9, 2024
4e5007f
Change to use tenantID for DA
kris6673 Apr 9, 2024
9f3f9f4
Merge pull request #2311 from kris6673/dev
KelvinTegelaar Apr 9, 2024
3b78518
Update augmentt link
JohnDuprey Apr 10, 2024
33e8eaf
json translation prework
KelvinTegelaar Apr 10, 2024
6d9e415
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP into dev
KelvinTegelaar Apr 10, 2024
5889082
Partner webhooks
JohnDuprey Apr 10, 2024
ce40efa
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Apr 10, 2024
9d0cb5b
removed console logs
KelvinTegelaar Apr 10, 2024
6ce20e0
testing new layout
KelvinTegelaar Apr 10, 2024
ebcc929
Add webhook testing
JohnDuprey Apr 10, 2024
5d0fc9e
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Apr 11, 2024
2df3c74
Merge pull request #2314 from JohnDuprey/dev
JohnDuprey Apr 11, 2024
a7a1722
fixes new json view
KelvinTegelaar Apr 11, 2024
490710a
add displayName sort if available.
KelvinTegelaar Apr 11, 2024
db636c1
replaces json overview
KelvinTegelaar Apr 11, 2024
d973469
prettification
KelvinTegelaar Apr 11, 2024
f8b3f37
null safe edit user
KelvinTegelaar Apr 11, 2024
e4e581b
null safe adduser
KelvinTegelaar Apr 11, 2024
4a03aac
update augmentt logo
JohnDuprey Apr 11, 2024
3d3aca5
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Apr 11, 2024
5651726
added option to create templates for standards.
KelvinTegelaar Apr 11, 2024
058e225
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Apr 11, 2024
6f138e9
Include logdata object
JohnDuprey Apr 11, 2024
a6c0100
remove unused vars
KelvinTegelaar Apr 11, 2024
247603f
finsihed tester
KelvinTegelaar Apr 11, 2024
a4f0d2c
added policy tester to nav
KelvinTegelaar Apr 11, 2024
706dfac
Create dev_deploy.yml
JohnDuprey Apr 11, 2024
bad4bf3
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Apr 11, 2024
43280a9
Merge pull request #2317 from JohnDuprey/dev
JohnDuprey Apr 11, 2024
72fdd67
added listing of applications
KelvinTegelaar Apr 11, 2024
aa97c7e
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP into dev
KelvinTegelaar Apr 11, 2024
51adb04
Fix cellTable
JohnDuprey Apr 11, 2024
b982323
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Apr 11, 2024
77f8eea
removed beta
KelvinTegelaar Apr 12, 2024
06f7c22
logo spacing
KelvinTegelaar Apr 12, 2024
64a7f87
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Apr 12, 2024
add7a37
up version
KelvinTegelaar Apr 12, 2024
6738816
Merge pull request #2319 from JohnDuprey/dev
KelvinTegelaar Apr 12, 2024
4a10522
Merge branch 'main' into dev
KelvinTegelaar Apr 12, 2024
ae12818
deleted old routes.js
KelvinTegelaar Apr 12, 2024
fbacbf2
corrected app.jsx
KelvinTegelaar Apr 12, 2024
b3e104e
fix conflict issues
KelvinTegelaar Apr 12, 2024
e65658c
fixed app.jsx
KelvinTegelaar Apr 12, 2024
c518942
fixes annoying thing
KelvinTegelaar Apr 12, 2024
41dfc69
Merge pull request #2320 from KelvinTegelaar/dev
KelvinTegelaar Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CIPP Development Frontend CI/CD

on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- dev

jobs:
build_and_deploy_job:
if: github.event.repository.fork == false && github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: '/' # App source code path
api_location: '' # Api source code path - optional
output_location: '' # Built app content directory - optional
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event.repository.fork == false && github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name
action: 'close'
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
dist/
build/
importsMap.jsx
Generate-Import-Map.js
35 changes: 35 additions & 0 deletions Generate-Import-Map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Using ES Module syntax compatible with Node.js 18 and ensuring cross-platform compatibility
import fs from 'fs/promises'
import path from 'path'
import { fileURLToPath } from 'url'

// Convert __dirname equivalent for ES Modules
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

// Adjust the relative path as necessary to point to your routes.json location
const routesPath = path.join(__dirname, './src/routes.json') // Example path

// Load routes.json with an import assertion for JSON
const routes = await import(`file://${routesPath}`, { assert: { type: 'json' } }).then(
(module) => module.default,
)

let importsMap = "import React from 'react'\n export const importsMap = {\n"

routes.forEach((route) => {
if (route.component) {
// Adjust the import path to be relative to the importsMap.js file location
const importPath = route.component.replace('views', './views')
// Ensure paths are Unix-like for the dynamic import to work cross-platform
const unixImportPath = importPath.split(path.sep).join('/')
importsMap += ` "${route.path}": React.lazy(() => import('${unixImportPath}')), \n`
}
})

importsMap += '}\nexport default importsMap'

// Specify the output file path for the generated imports map
const outputPath = path.join(__dirname, './src/importsMap.jsx')
await fs.writeFile(outputPath, importsMap)
console.log('Import map generated.')
22 changes: 22 additions & 0 deletions Importmap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// generate-imports-map.js
const fs = require('fs')
const path = require('path')
const routes = require('./path/to/routes.json')

let importsMap = 'export const importsMap = {\n'

routes.forEach(route => {
if (route.component) {
// Convert the path to a format that's relative to where you'll be importing from
const importPath = route.component.replace('views', './views')
const componentName = path.basename(importPath)

// Create an import statement for the component
importsMap += "${route.path}": React.lazy(() = > import('${importPath}')), \n`;
}
})

importsMap += '};\n'

fs.writeFileSync(path.resolve(__dirname,'./src/importsMap.js'), importsMap)
console.log('Import map generated.')
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "5.4.2",
"version": "5.5.0",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand All @@ -14,6 +14,7 @@
"license": "AGPL-3.0",
"author": "CIPP Contributors",
"scripts": {
"prebuild": "node Generate-Import-Map.js",
"build": "echo react-scripts build && vite build",
"changelog": "auto-changelog --starting-version 3.0.0 --commit-limit false --hide-credit",
"lint": "eslint \"src/**/*.js\"",
Expand Down Expand Up @@ -43,6 +44,7 @@
"@rjsf/core": "^5.12.1",
"@rjsf/utils": "^5.12.1",
"@rjsf/validator-ajv8": "^5.12.1",
"@uiw/react-json-view": "^2.0.0-alpha.23",
"axios": "^1.6.2",
"buffer": "^6.0.3",
"chart.js": "^3.5.1",
Expand Down
Binary file added public/img/augmentt-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/augmentt-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/img/netfriends.png
Binary file not shown.
Binary file removed public/img/netfriends_dark.png
Binary file not shown.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.2
5.5.0
43 changes: 14 additions & 29 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@ import React, { Suspense } from 'react'
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom'
import { PrivateRoute, FullScreenLoading, ErrorBoundary } from 'src/components/utilities'
import 'src/scss/style.scss'
import routes from 'src/routes'
import { Helmet } from 'react-helmet-async'
import adminRoutes from './adminRoutes'
import Skeleton from 'react-loading-skeleton'
import TimeAgo from 'javascript-time-ago'
import en from 'javascript-time-ago/locale/en.json'
TimeAgo.addDefaultLocale(en)
import { library } from '@fortawesome/fontawesome-svg-core'
import { fas } from '@fortawesome/free-solid-svg-icons'
import routes from 'src/routes'
import { useAuthCheck } from './components/utilities/CippauthCheck'
import importsMap from './importsMap'

library.add(fas)

// Containers
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))
const dynamicImport = (path) => {
return importsMap[path] || null
}

// Pages
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))
const Page401 = React.lazy(() => import('./views/pages/page401/Page401'))
const Page403 = React.lazy(() => import('./views/pages/page403/Page403'))
const Page404 = React.lazy(() => import('./views/pages/page404/Page404'))
const Page500 = React.lazy(() => import('./views/pages/page500/Page500'))
const PageLogOut = React.lazy(() => import('src/views/pages/LogoutRedirect/PageLogOut'))
const Login = React.lazy(() => import('./views/pages/login/Login'))
const Logout = React.lazy(() => import('./views/pages/login/Logout'))
//we loop through the routes array, dynamicly create the component by using dynamicImport, add the component to the route array as 'component' key.

const App = () => {
return (
Expand All @@ -50,6 +53,10 @@ const App = () => {
}
>
{routes.map((route, idx) => {
const allowedRoles = route.allowedRoles
const Routecomponent = dynamicImport(route.path)
console.log('route', route)
console.log('Routecomponent', Routecomponent)
return (
route.component && (
<Route
Expand All @@ -58,35 +65,13 @@ const App = () => {
exact={route.exact}
name={route.name}
element={
<Suspense fallback={<Skeleton />}>
<Helmet>
<title>CIPP - {route.name}</title>
</Helmet>
<ErrorBoundary key={route.name}>
<route.component />
</ErrorBoundary>
</Suspense>
}
/>
)
)
})}
{adminRoutes.map((route, idx) => {
return (
route.component && (
<Route
key={`route-${idx}`}
path={route.path}
exact={route.exact}
name={route.name}
element={
<PrivateRoute routeType="admin">
<PrivateRoute allowedRoles={allowedRoles}>
<Suspense fallback={<Skeleton />}>
<Helmet>
<title>CIPP - {route.name}</title>
</Helmet>
<ErrorBoundary key={route.name}>
<route.component />
<Routecomponent />
</ErrorBoundary>
</Suspense>
</PrivateRoute>
Expand Down
10 changes: 5 additions & 5 deletions src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ const _nav = [
name: 'Deploy CA Policies',
to: '/tenant/conditional/deploy',
},
{
component: CNavItem,
name: 'CA Policy Tester',
to: '/tenant/conditional/test-policy',
},
{
component: CNavItem,
name: 'CA Vacation Mode',
Expand All @@ -254,11 +259,6 @@ const _nav = [
name: 'CA Templates',
to: '/tenant/conditional/list-template',
},
{
component: CNavItem,
name: 'Add CA Template',
to: '/tenant/conditional/add-template',
},
{
component: CNavItem,
name: 'Named Locations',
Expand Down
76 changes: 0 additions & 76 deletions src/adminRoutes.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/buttons/PdfButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useSelector } from 'react-redux'

function ExportPDFButton(props) {
const base64 = useSelector((state) => state.app.reportImage)
const exportPDF = (pdfData, pdfHeaders, pdfSize = 'A4', reportName = 'report') => {
const exportPDF = (pdfData, pdfHeaders, pdfSize = 'A3', reportName = 'report') => {
const unit = 'pt'
const size = pdfSize // Use A1, A2, A3 or A4
const orientation = 'landscape' // portrait or landscape
Expand Down
9 changes: 8 additions & 1 deletion src/components/forms/RFFComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,16 @@ export const RFFCFormSwitch = ({
disabled = false,
initialValue,
onClick,
defaultValue,
}) => {
return (
<Field initialValue={initialValue} name={name} type="checkbox" validate={validate}>
<Field
defaultValue={defaultValue}
initialValue={initialValue}
name={name}
type="checkbox"
validate={validate}
>
{({ meta, input }) => (
<ConditionWrapper
condition={helpText}
Expand Down
Loading