Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kris6673 authored Jun 8, 2024
2 parents 8a80e8f + 0f08cc2 commit 3ec6070
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "5.7.1",
"version": "5.8.0",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7.1
5.8.0
36 changes: 30 additions & 6 deletions src/views/cipp/app-settings/components/SettingsGeneralRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'src/store/api/app.js'
import React, { useRef } from 'react'
import useConfirmModal from 'src/hooks/useConfirmModal.jsx'
import { CButton, CCard, CCardBody, CCardHeader, CCol, CRow } from '@coreui/react'
import { CButton, CCard, CCardBody, CCardHeader, CCol, CFormCheck, CRow } from '@coreui/react'
import { StatusIcon } from 'src/components/utilities/index.js'
import { CippCallout } from 'src/components/layout/index.js'
import Skeleton from 'react-loading-skeleton'
Expand All @@ -15,13 +15,15 @@ import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
import { SettingsPassword } from 'src/views/cipp/app-settings/components/SettingsPassword.jsx'
import { SettingsDNSResolver } from 'src/views/cipp/app-settings/components/SettingsDNSResolver.jsx'
import CippButtonCard from 'src/components/contentcards/CippButtonCard'
import { RFFCFormCheck } from 'src/components/forms'

/**
* Fetches and maintains DNS configuration settings for the application.
*
* @return {JSX.Element | void} The settings DNS component or nothing if data not ready.
*/
export function SettingsGeneralRow() {
const [setBackupSchedule, BackupScheduleResult] = useLazyGenericGetRequestQuery()
const [runBackup, RunBackupResult] = useLazyGenericGetRequestQuery()
const [restoreBackup, restoreBackupResult] = useLazyGenericPostRequestQuery()

Expand Down Expand Up @@ -49,6 +51,9 @@ export function SettingsGeneralRow() {
restoreBackup({ path: '/api/ExecRestoreBackup', values: e.target.result })
}
}
const handleBackupSchedule = () => {
setBackupSchedule({ path: `/api/ExecSetCIPPAutoBackup?Enabled=true` })
}

const handleClearCache = useConfirmModal({
body: <div>Are you sure you want to clear the cache?</div>,
Expand Down Expand Up @@ -115,6 +120,17 @@ export function SettingsGeneralRow() {
)}
Restore backup
</CButton>
<CButton
className="me-2"
name="file"
onClick={() => handleBackupSchedule()}
disabled={BackupScheduleResult.isFetching}
>
{BackupScheduleResult.isFetching && (
<FontAwesomeIcon icon={faCircleNotch} spin className="me-2" size="1x" />
)}
Create Automated Backup Task
</CButton>
</>
)
return (
Expand Down Expand Up @@ -179,16 +195,24 @@ export function SettingsGeneralRow() {
id="contained-button-file"
onChange={(e) => handleChange(e)}
/>
<small>
Use this button to backup the system configuration for CIPP. This will not include
authentication information or extension configuration.
</small>

<CRow className="mb-3">
<small>
Use this button to backup the system configuration for CIPP. This will not include
authentication information or extension configuration. You can also set an automated
daily backup schedule by clicking the button below. This will create a scheduled
task for you.
</small>
</CRow>
{restoreBackupResult.isSuccess && !restoreBackupResult.isFetching && (
<CippCallout color="success" dismissible>
{restoreBackupResult.data.Results}
</CippCallout>
)}
{BackupScheduleResult.isSuccess && !BackupScheduleResult.isFetching && (
<CippCallout color="success" dismissible>
{BackupScheduleResult.data.Results}
</CippCallout>
)}
{RunBackupResult.isSuccess && !restoreBackupResult.isFetching && (
<CippCallout color="success" dismissible>
<CButton onClick={() => downloadTxtFile(RunBackupResult.data.backup)}>
Expand Down
45 changes: 23 additions & 22 deletions src/views/tenant/standards/BPAReportBuilder.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from 'react'
import { CippPage, CippContentCard } from 'src/components/layout'
import { CippPage, CippContentCard, CippCallout } from 'src/components/layout'
import BPAReportSchema from 'src/data/BPAReport.schema.v1'
import BPAReportUISchema from 'src/data/BPAReport.uischema.v1'
import validator from '@rjsf/validator-ajv8'
Expand All @@ -24,7 +24,7 @@ import {
CFormLabel,
CTooltip,
} from '@coreui/react'
import { useGenericGetRequestQuery } from 'src/store/api/app'
import { useGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 'src/store/api/app'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import CopyToClipboard from 'react-copy-to-clipboard'
import PropTypes from 'prop-types'
Expand Down Expand Up @@ -109,6 +109,8 @@ const BPAReportBuilder = () => {
let query = useQuery()
const [refreshValue, setRefreshValue] = useState('')
const Report = query.get('Report')
const [newBPATemplate, newTemplateResult] = useLazyGenericPostRequestQuery()

const [filename, setFilename] = useState()
const [visibleA, setVisibleA] = useState(true)
const { data: templates = [], isLoading: templatesfetch } = useGenericGetRequestQuery({
Expand Down Expand Up @@ -151,13 +153,8 @@ const BPAReportBuilder = () => {

const handlePublish = async (event) => {
event.preventDefault()
const data = new FormData(event.target)
const ghuser = data.get('GitHubUser')
const reportfilename = data.get('ReportFilename')
const report = JSON.stringify(formData, null, 2)
const url =
'https://github.com/' + ghuser + '/CIPP-API/new/master/Config?filename=' + reportfilename
window.open(url, '_blank')
const data = formData
newBPATemplate({ path: '/api/AddBPATemplate', values: data })
}

const options = {
Expand Down Expand Up @@ -224,30 +221,34 @@ const BPAReportBuilder = () => {
</CForm>
</CCol>
<CCol>
<CForm onSubmit={handlePublish}>
<CForm id="publishForm" onSubmit={handlePublish}>
<CRow>
<CCol>
<CFormLabel>GitHub Username/Org Name</CFormLabel>
<CFormInput name="GitHubUser" required />
<CFormLabel>Report Filename</CFormLabel>
<CFormInput name="ReportFilename" value={filename} />
<CFormLabel>Store and Publish Report in CIPP</CFormLabel>
</CCol>
</CRow>
<CRow className="my-3">
<CRow className="mb-1">
<CTooltip
placement="left"
content="Click here to create a new BPA template in GitHub, the report will be copied to the clipboard"
content="Click here to create a new BPA template. To overwrite an existing template, enter the name of the existing template."
>
<CCol>
<CopyToClipboard text={JSON.stringify(formData, null, 2)}>
<CButton type="submit">
<FontAwesomeIcon className="me-2" icon="upload" />
Publish
</CButton>
</CopyToClipboard>
<CButton form="publishForm" type="submit">
<FontAwesomeIcon className="me-2" icon="upload" />
Publish
</CButton>
</CCol>
</CTooltip>
</CRow>
{newTemplateResult.isFetching && <CSpinner />}
{newTemplateResult.isSuccess && (
<CippCallout
color={newTemplateResult.isSuccess ? 'success' : 'danger'}
dismissible
>
{newTemplateResult?.data?.Results}
</CippCallout>
)}
</CForm>
</CCol>
</CRow>
Expand Down
3 changes: 2 additions & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
5.7.1
5.8.0

0 comments on commit 3ec6070

Please sign in to comment.