Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
57 changes: 46 additions & 11 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@ textarea {
margin-bottom: 10px;
}

#auto-generation {
#auto-generation,
#exemptions {
border-radius: 15px;
padding: 20px;
padding-bottom: 25px;
margin-top: 20px;
margin-bottom: 20px;
background: lightgray;
width: 100%;
max-width: 800px;
box-sizing: border-box;
background: #e6e6e6;
width: 100%;
max-width: 800px;
box-sizing: border-box;
}

#exemptions {
max-width: 1300px;
}

#github-url-form {
#github-url-form,
#exemptions-checklist {
margin-top: 25px;
width: 100%;
}

#repo-url {
width: 100%;
max-width: 750px;
box-sizing: border-box;
width: 100%;
max-width: 750px;
box-sizing: border-box;
}

#repo-url-button {
Expand All @@ -50,12 +56,41 @@ textarea {
padding-right: 20px;
}

.step-header {
display: flex;
align-items: center;
gap: 0.5em;
}

.step-number {
margin-top: 10px;
background-color: #337AB7;
color: white;
font-weight: bold;
width: 30px;
height: 30px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
}

.exemptions-quiz-container #quiz-subheading {
margin: 10px 0px 20px 0px;
}

/* .results-container p {
margin: 20px 0px;
} */

@keyframes slideDown {
from {
from {
opacity: 0;
transform: translateY(-10px);
}
to {

to {
opacity: 1;
transform: translateY(0);
}
Expand Down
232 changes: 161 additions & 71 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,85 +1,175 @@
<html>
<head>
<meta charset="utf-8">
<!-- USWDS not working -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uswds/2.11.2/css/uswds.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.form.io/formiojs/formio.form.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.form.io/uswds/uswds.min.css"> -->
<!-- <link rel="stylesheet" href="https://unpkg.com/formiojs@3.0.0-alpha.13/dist/formio.full.min.css"> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/uswds/2.11.2/js/uswds.min.js"></script> -->
<!-- <script src="https://cdn.form.io/formiojs/formio.form.min.js"></script> -->
<!-- <script src="https://cdn.form.io/uswds/uswds.min.js"></script> -->
<!-- <script src="https://cdn.form.io/formiojs/formio.full.js"></script> -->
<!-- <script src="https://cdn.form.io/js/formio.embed.js"></script> -->

<link rel="icon" type="image/x-icon" href="favicon.ico">

<!-- Uses bootstrap for now -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel="stylesheet" href="css/styles.css">
<head>
<meta charset="utf-8">
<!-- USWDS not working -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uswds/2.11.2/css/uswds.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.form.io/formiojs/formio.form.min.css"> -->
<!-- <link rel="stylesheet" href="https://cdn.form.io/uswds/uswds.min.css"> -->
<!-- <link rel="stylesheet" href="https://unpkg.com/formiojs@3.0.0-alpha.13/dist/formio.full.min.css"> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/uswds/2.11.2/js/uswds.min.js"></script> -->
<!-- <script src="https://cdn.form.io/formiojs/formio.form.min.js"></script> -->
<!-- <script src="https://cdn.form.io/uswds/uswds.min.js"></script> -->
<!-- <script src="https://cdn.form.io/formiojs/formio.full.js"></script> -->
<!-- <script src="https://cdn.form.io/js/formio.embed.js"></script> -->

<!-- Working Form.io CDN -->
<script src="https://unpkg.com/formiojs@4.21.6/dist/formio.full.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/formiojs@4.21.6/dist/formio.full.min.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="favicon.ico">

<!-- Render the form -->
<script src="js/generateFormComponents.js"></script>
<script src="js/formDataToJson.js"></script>
<script src="js/autoGenerateFields.js"></script>
<script type="text/javascript">
createFormComponents()
.then((components) => {
Formio.createForm(document.getElementById("formio"), {
display: "form",
theme: "primary",
settings: {
pdf: {
id: "1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
src: "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
},
<!-- Uses bootstrap for now -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel="stylesheet" href="css/styles.css">

<!-- Working Form.io CDN -->
<script src="https://unpkg.com/formiojs@4.21.6/dist/formio.full.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/formiojs@4.21.6/dist/formio.full.min.css" rel="stylesheet">

<!-- Render the form -->
<script src="js/generateFormComponents.js"></script>
<script src="js/formDataToJson.js"></script>
<script src="js/exemptionQuizHandler.js"></script>
<script src="js/autoGenerateFields.js"></script>
<script type="text/javascript">
createFormComponents()
.then((components) => {
Formio.createForm(document.getElementById("formio"), {
display: "form",
theme: "primary",
settings: {
pdf: {
id: "1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
src: "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
},
components: components,
}).then(function (form) {
window.formIOInstance = form;
form.on("submit", function (submission) {
console.log("form submission here:", submission);
createCodeJson(submission.data);
});
},
components: components,
}).then(function (form) {
window.formIOInstance = form;
form.on("submit", function (submission) {
console.log("form submission here:", submission);
createCodeJson(submission.data);
});
})
.catch((error) => {
console.error("Error creating components:", error);
});
</script>
</head>
<body>
<div id="form-header"></div>
})
.catch((error) => {
console.error("Error creating components:", error);
});
</script>
</head>

<div id="notification" style="display: none;">
<p id="notification-message"></p>
<body>
<div id="form-header"></div>

<div id="exemptions">
<div id="exemptions-header"></div>
<div class="exemptions-quiz-container">
<h4 id="quiz-subheading"> Answer the series of questions below to determine if your project falls under the
4 exemption categories according to the SHARE IT Act. </h4>
<div id="exemptions-quiz">
<fieldset class="usa-fieldset">
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-national-security-systems" type="checkbox"
name="exemption-condition" value="exemptByNationalSecurity">
<label class="usa-checkbox__label" for="check-national-security-systems">
Is the project primarily for use in national security systems, as defined in Section 11103
of title 40, USC?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-intelligence-community" type="checkbox"
name="exemption-condition" value="exemptByIntelligence">
<label class="usa-checkbox__label" for="check-intelligence-community">Is the project created by
an agency or part of an agency that is an element of the intelligence community, as defined
in section 3(4) of the National Security Act of 1947?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-freedom-information-act" type="checkbox"
name="exemption-condition" value="exemptByFOIA">
<label class="usa-checkbox__label" for="check-freedom-information-act">Is the project exempt
under section 552(b) of title 5, USC (commonly known as the "Freedom of Information
Act")?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-EAR" type="checkbox" name="exemption-condition"
value="exemptByEAR">
<label class="usa-checkbox__label" for="check-EAR">Is the project prohibited under Export
Administration Regulations?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-ITAR" type="checkbox" name="exemption-condition"
value="exemptByITAR">
<label class="usa-checkbox__label" for="check-ITAR">Is the project prohibited under
International Traffic in Arms Regulations (ITAR)?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-TSA" type="checkbox" name="exemption-condition"
value="exemptByTSA">
<label class="usa-checkbox__label" for="check-TSA">Is the project prohibited under Regulations
of the Transportation Security Administration related to the protection of sensitive
information?
</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-classified-information" type="checkbox"
name="exemption-condition" value="exemptByClassifiedInformation">
<label class="usa-checkbox__label" for="check-classified-information">Is the project prohibited
under federal laws and regulations governing the sharing of classified information? </label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-privacy" type="checkbox" name="exemption-condition"
value="exemptByPrivacyRisk">
<label class="usa-checkbox__label" for="check-privacy">
Does the source code create an identifiable risk to the privacy of an individual?</label>
</div>
<div class="usa-checkbox">
<input class="usa-checkbox__input" id="check-none" type="checkbox" name="exemption-condition"
value="none">
<label class="usa-checkbox__label" for="check-none">None of the above </label>
</div>
</fieldset>
<button type="button" onclick="determineExemptions()">Submit</button>
</div>
</div>

<div id="auto-generation">
<p id="auto-generation-header"></p>
<form id="github-url-form">
<label for="repo-url">GitHub Repository URL</label><br>
<input type="text" id="repo-url" name="repo-url"><br>
<input type="submit" id="repo-url-button" value="Submit">
</form>
<div class="results" style="display: none;">
<div class="results-container">
<p class="exemption-result">Your project </p>
</div>
<button onclick="handleClick(event)">Try Again</button>
</div>
</div>

<div id="notification" style="display: none;">
<p id="notification-message"></p>
</div>

<div id="formio"></div>
<div id="auto-generation">
<p id="auto-generation-header"></p>
<form id="github-url-form">
<label for="repo-url">GitHub Repository URL</label><br>
<input type="text" id="repo-url" name="repo-url"><br>
<input type="submit" id="repo-url-button" value="Submit">
</form>
</div>

<div id="output">
<label for="json-result">Your JSON Metadata </label>
<textarea class="form-control" rows="10" id="json-result" readonly></textarea>
<button type="button" class="btn btn-outline" href="#" onclick="copyToClipboard(event)">Copy</button>
<button type="button" class="btn btn-outline" href="#" onclick="downloadFile(event)">Download</button>
<button type="button" class="btn btn-outline" href="#" onclick="createProjectPR(event)">Create Pull Request</button>
<button type="button" class="btn btn-outline" href="#" onclick="emailFile(event)">Email</button>
<div id="form-subheader">
<div class="step-header">
<div class="step-number">3</div>
<h3>Complete the entire form to generate the code.json file</h3>
</div>
</div>
<br>

<div id="formio"></div>

<div id="output">
<label for="json-result">Your JSON Metadata </label>
<textarea class="form-control" rows="10" id="json-result" readonly></textarea>
<button type="button" class="btn btn-outline" href="#" onclick="copyToClipboard(event)">Copy</button>
<button type="button" class="btn btn-outline" href="#" onclick="downloadFile(event)">Download</button>
<button type="button" class="btn btn-outline" href="#" onclick="createProjectPR(event)">Create Pull
Request</button>
<button type="button" class="btn btn-outline" href="#" onclick="emailFile(event)">Email</button>
</div>

</body>

</body>
</html>
</html>
18 changes: 12 additions & 6 deletions js/autoGenerateFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,13 @@ async function preFillFields(repoData, languages) {

// Updating URL
if (repoData.html_url) {
form.getComponent('repositoryURL').setValue(repoData.html_url)
if (repoData.private) {
// Private repositories must have "private" as their repositoryURL value
form.getComponent('repositoryURL').setValue("private")
}
else {
form.getComponent('repositoryURL').setValue(repoData.html_url)
}
}

// Updating forks
Expand Down Expand Up @@ -306,11 +312,11 @@ async function preFillFields(repoData, languages) {
}

// fields to potentially automate
// clones, but this is only tracked for every 14 days
// status, by checking if its public, we can assume its production and check if its archival
// laborHours, by running a script? this might be harder since we need SCC
// maturityModel, we could check to see if certain files / sections live within a repo and make a guess like that
// usageType, by assuming that if its public = openSource and if private = governmnetWideReuse
// clones, but this is only tracked for every 14 days
// status, by checking if its public, we can assume its production and check if its archival
// laborHours, by running a script? this might be harder since we need SCC
// maturityModel, we could check to see if certain files / sections live within a repo and make a guess like that
// usageType, by assuming that if its public = openSource and if private = governmnetWideReuse

notificationSystem.success("Repository data loaded successfully!")

Expand Down
Loading
Loading