-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restyle export page, fix various bugs
Add automatic preview refresh, restyle and add tooltip Rearrange export page sections into one page Fix section id query bugs, rework cases where no courses are selected Add additional fields to export types, fix download data with no courses Add statuses for export page
- Loading branch information
1 parent
3dd7785
commit 4d1732f
Showing
7 changed files
with
275 additions
and
137 deletions.
There are no files selected for viewing
40 changes: 31 additions & 9 deletions
40
csm_web/frontend/src/components/data_export/DataExport.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
import React, { useState } from "react"; | ||
import { useProfiles } from "../../utils/queries/base"; | ||
import { Role } from "../../utils/types"; | ||
import LoadingSpinner from "../LoadingSpinner"; | ||
import { ExportType } from "./DataExportTypes"; | ||
import { ExportPage } from "./ExportPage"; | ||
import { ExportSelector } from "./ExportSelector"; | ||
|
||
export const DataExport = () => { | ||
const [dataExportType, setDataExportType] = useState<ExportType | null>(null); | ||
const { data: profiles, isSuccess: profilesLoaded, isError: profilesError } = useProfiles(); | ||
|
||
if (profilesError) { | ||
return <b>Error loading user profiles.</b>; | ||
} else if (!profilesLoaded) { | ||
return <LoadingSpinner className="spinner-centered" />; | ||
} else if (profilesLoaded && !profiles.some(profile => profile.role === Role.COORDINATOR)) { | ||
return <b>Permission denied; you are not a coordinator for any course.</b>; | ||
} | ||
|
||
return ( | ||
<div className="data-export-container"> | ||
{dataExportType === null ? ( | ||
<ExportSelector | ||
onContinue={(exportType: ExportType) => { | ||
setDataExportType(exportType); | ||
}} | ||
/> | ||
) : ( | ||
<ExportPage dataExportType={dataExportType} onBack={() => setDataExportType(null)} /> | ||
)} | ||
<div className="data-export-header"> | ||
<h2 className="data-export-page-title">Export Data</h2> | ||
</div> | ||
<div className="data-export-body"> | ||
<div className="data-export-sidebar"> | ||
<ExportSelector | ||
onSelect={(exportType: ExportType) => { | ||
setDataExportType(exportType); | ||
}} | ||
/> | ||
</div> | ||
<div className="data-export-content"> | ||
{dataExportType === null ? ( | ||
<div>Select export type to start.</div> | ||
) : ( | ||
<ExportPage dataExportType={dataExportType!} /> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.