-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3655ed2
commit 2be3537
Showing
270 changed files
with
5,199 additions
and
2,891 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
src/cti_authoring_tool/src/assets/configuration/app.config.ts
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
52 changes: 52 additions & 0 deletions
52
src/cti_authoring_tool/src/assets/configuration/plugins/ImportCSVPlugin.ts
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Browser } from "@/assets/scripts/Utilities/Browser"; | ||
import { TabularProperty } from "@/assets/scripts/Page"; | ||
|
||
export class ImportCSVPlugin { | ||
|
||
/** | ||
* Creates a new {@link ImportCSVPlugin}. | ||
* @param property | ||
* The tabular property. | ||
*/ | ||
constructor(property: TabularProperty) { | ||
// Register "Import from CSV" action | ||
property.registerAction("import-csv", "Import from CSV", () => { | ||
Browser.openTextFileDialog().then(file => { | ||
let { contents } = file; | ||
// Validate contents | ||
if(contents === null || contents === undefined) { | ||
console.error(`Error: could not contents of file: '${ file.filename }'.`); | ||
} | ||
// Parse contents | ||
let objs = this.parseCsv(file.contents as string); | ||
// Add contents | ||
for(let obj of objs) { | ||
property.insertRow(property.createRow(obj)); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
* Parses a simple CSV file. | ||
* @param contents | ||
* The CSV file's contents. | ||
* @returns | ||
* The parsed CSV file. | ||
*/ | ||
private parseCsv(contents: string): any[] { | ||
let objs = []; | ||
let lines = contents.split(/\r?\n/g); | ||
let head = lines[0].split(/,/g); | ||
for(let i = 1; i < lines.length; i++) { | ||
let obj = [] | ||
let cells = lines[i].split(/\,/g); | ||
for(let j = 0; j < head.length; j++) { | ||
obj.push([head[j], cells[j]]); | ||
} | ||
objs.push(Object.fromEntries(obj)); | ||
} | ||
return objs; | ||
} | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Activity.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Artifact.ts
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
3 changes: 2 additions & 1 deletion
3
src/cti_authoring_tool/src/assets/configuration/properties/Assessment.ts
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,7 +1,8 @@ | ||
import { PropertyType } from "@/assets/scripts/AppConfiguration"; | ||
import { PropertyType } from "@/assets/scripts/PageEditor"; | ||
|
||
export const Assessment = { | ||
id: "assessment", | ||
name: "Assessment", | ||
path: "*.assessment", | ||
type: PropertyType.String | ||
} |
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Attribution.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Control.ts
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
3 changes: 2 additions & 1 deletion
3
src/cti_authoring_tool/src/assets/configuration/properties/Criticality.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/CveCvssScore.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/CveNumber.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/CvePatchApplied.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/CvePatchAvailable.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/CveRemediation.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/DateOfReport.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/DateReported.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Defend.ts
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
3 changes: 2 additions & 1 deletion
3
src/cti_authoring_tool/src/assets/configuration/properties/ExecutiveSummary.ts
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,7 +1,8 @@ | ||
import { PropertyType } from "@/assets/scripts/AppConfiguration"; | ||
import { PropertyType } from "@/assets/scripts/PageEditor"; | ||
|
||
export const ExecutiveSummary = { | ||
id: "executive_summary", | ||
name: "Executive Summary", | ||
path: "*.executive_summary", | ||
type: PropertyType.String | ||
} |
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/FirstObserved.ts
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
3 changes: 2 additions & 1 deletion
3
src/cti_authoring_tool/src/assets/configuration/properties/IndicatorAnalysis.ts
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,7 +1,8 @@ | ||
import { PropertyType } from "@/assets/scripts/AppConfiguration"; | ||
import { PropertyType } from "@/assets/scripts/PageEditor"; | ||
|
||
export const IndicatorAnalysis = { | ||
id: "indicator_analysis", | ||
path: "*.indicator_analysis", | ||
name: "Indicator Analysis", | ||
type: PropertyType.String, | ||
} |
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/Infrastructure.ts
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
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/IntelligenceRequirement.ts
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
23 changes: 23 additions & 0 deletions
23
src/cti_authoring_tool/src/assets/configuration/properties/IntelligenceRequirements.ts
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PropertyType } from "@/assets/scripts/PageEditor"; | ||
import { ImportCSVPlugin } from "../plugins/ImportCSVPlugin"; | ||
import { IntelligenceRequirement } from "./IntelligenceRequirement"; | ||
|
||
export const IntelligenceRequirements = { | ||
id: "intelligence_requirements", | ||
name: "Intelligence Requirements", | ||
path: "*.intelligence_requirements", | ||
type: PropertyType.BasicTable, | ||
layout: { | ||
cols: 1, | ||
}, | ||
plugins: [ | ||
{ module: ImportCSVPlugin } | ||
], | ||
properties: [ | ||
{ | ||
...IntelligenceRequirement, | ||
row: 0, | ||
col: 1 | ||
} | ||
] | ||
} |
2 changes: 1 addition & 1 deletion
2
src/cti_authoring_tool/src/assets/configuration/properties/InternalTelemetry.ts
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.