All files / components/CATME CATMETeamUploadCard.jsx

100% Statements 3/3
100% Branches 2/2
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63        5x                     50x                                                   23x                                          
import { Alert, Card } from "react-bootstrap";
import CATMEAuditResults from "main/components/CATME/CATMEAuditResults";
import CATMEUploadForm from "main/components/CATME/CATMEUploadForm";
 
const uploadConfig = {
  endpoint: "createteams",
  formLabel: "Upload CATME teams",
  fileLabel: "CATME team assignments CSV file",
  buttonLabel: "Upload teams",
  pendingLabel: "Uploading teams…",
  missingFileMessage: "Choose a CATME TeamMaker CSV file to upload teams.",
  errorMessage: "Unable to upload teams. Please try again.",
};
 
export default function CATMETeamUploadCard({ courseId, courseViewPath }) {
  return (
    <Card as="section" aria-label="CATME team upload" className="mt-4">
      <Card.Header as="h2" className="h5">
        Upload Teams from CATME
      </Card.Header>
      <Card.Body>
        <p>Upload team assignments from CATME TeamMaker to this course.</p>
        <ol>
          <li>
            In CATME, navigate to <code>/faculty/tm_display_results</code> and
            click <strong>Export to CSV</strong>.
          </li>
          <li>Upload that file here.</li>
          <li>
            Read the audit results. If the roster matches, a job creates the
            teams automatically; otherwise, correct the differences in CATME and
            upload a fresh export.
          </li>
        </ol>
        <p>
          Creates or reuses teams in Frontiers and preserves existing
          memberships. Students without a team name are skipped. To also create
          the teams in GitHub, use Push Teams to GitHub on the Teams tab.
        </p>
        <CATMEUploadForm courseId={courseId} config={uploadConfig}>
          {(result) =>
            result.message ? (
              <Alert variant="success" role="status" className="mt-3">
                <p>
                  {result.message}. Team creation is running in the background.
                </p>
                <a href={`/${courseViewPath}/courses/${courseId}?tab=jobs`}>
                  View progress in the Jobs tab
                </a>
              </Alert>
            ) : (
              <>
                <p className="mt-3">No team-creation job was launched.</p>
                <CATMEAuditResults result={result} />
              </>
            )
          }
        </CATMEUploadForm>
      </Card.Body>
    </Card>
  );
}