Skip to content

Commit

Permalink
Merge pull request #80 from center-for-threat-informed-defense/AF-156…
Browse files Browse the repository at this point in the history
…_hide_flow_references

AF-156 Hide Tactic+Technique References from Flow
  • Loading branch information
mikecarenzo committed Jul 20, 2023
2 parents 4e75a18 + c8c9060 commit 1230825
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
12 changes: 7 additions & 5 deletions src/attack_flow_builder/src/assets/builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const config: AppConfiguration = {
}
}
},
created : { type: PropertyType.Date, value: new Date(), is_visible: false }
created : { type: PropertyType.Date, value: new Date(), is_visible_chart: false, is_visible_sidebar: false }
},
style: DarkTheme.Page()
},
Expand Down Expand Up @@ -117,9 +117,9 @@ const config: AppConfiguration = {
properties: {
name : { type: PropertyType.String, is_primary: true, is_required: true },
tactic_id : { type: PropertyType.String },
tactic_ref : { type: PropertyType.String },
tactic_ref : { type: PropertyType.String, is_visible_chart: false, is_visible_sidebar: true },
technique_id : { type: PropertyType.String },
technique_ref : { type: PropertyType.String },
technique_ref : { type: PropertyType.String, is_visible_chart: false, is_visible_sidebar: true },
description : { type: PropertyType.String },
confidence : {
type: PropertyType.Enum,
Expand Down Expand Up @@ -197,7 +197,8 @@ const config: AppConfiguration = {
type: PropertyType.String,
value: "OR",
is_primary: true,
is_visible: false,
is_visible_chart: false,
is_visible_sidebar: false,
is_editable: false,
}
},
Expand All @@ -214,7 +215,8 @@ const config: AppConfiguration = {
type: PropertyType.String,
value: "AND",
is_primary: true,
is_visible: false,
is_visible_chart: false,
is_visible_sidebar: false,
is_editable: false,
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class BranchBlockModel extends DiagramObjectModel {
continue;

// Ignore hidden fields
if(!(value.descriptor.is_visible ?? true))
if(!(value.descriptor.is_visible_chart ?? true))
continue;

// Ignore the primary key
Expand Down Expand Up @@ -402,7 +402,7 @@ export class BranchBlockModel extends DiagramObjectModel {
for(let [key, value] of this.props.value) {
if(key === this.props.primaryKey)
continue;
if(!(value.descriptor.is_visible ?? true))
if(!(value.descriptor.is_visible_chart ?? true))
continue;
if(value.isDefined())
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class DictionaryBlockModel extends DiagramObjectModel {
continue;

// Ignore hidden fields
if(!(value.descriptor.is_visible ?? true))
if(!(value.descriptor.is_visible_chart ?? true))
continue;

// Ignore the primary key
Expand Down Expand Up @@ -337,7 +337,7 @@ export class DictionaryBlockModel extends DiagramObjectModel {
for(let [key, value] of this.props.value) {
if(key === this.props.primaryKey)
continue;
if(!(value.descriptor.is_visible ?? true))
if(!(value.descriptor.is_visible_chart ?? true))
continue;
if(value.isDefined())
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ type ValueDescriptorBase<K extends ValueTypes> = {
type: K,
value?: ValueTypeScriptType[K]
is_primary?: boolean,
is_visible?: boolean
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
is_editable? : boolean,
is_required? : boolean,
}
Expand Down Expand Up @@ -88,7 +89,8 @@ export type ListPropertyDescriptor = {
value?: any,
min_items?: number,
is_primary?: boolean,
is_visible?: boolean,
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
is_editable? : boolean
}

Expand All @@ -98,7 +100,8 @@ export type DictionaryPropertyDescriptor = {
[key: string]: PropertyDescriptor
},
is_primary?: boolean,
is_visible?: boolean,
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
}

export type ListValue
Expand Down Expand Up @@ -134,7 +137,8 @@ type ValueDictionaryListDescriptor = {
form: ValueDictionaryDescriptor,
value?: any,
is_primary?: boolean,
is_visible?: boolean,
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
is_editable? : boolean
}

Expand All @@ -146,7 +150,8 @@ type ValueDictionaryDescriptor = {
| ValueListDescriptor
},
is_primary?: boolean,
is_visible?: boolean,
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
}

type ValueListDescriptor = {
Expand All @@ -155,7 +160,8 @@ type ValueListDescriptor = {
value?: any,
min_items?: number,
is_primary?: boolean,
is_visible?: boolean,
is_visible_chart?: boolean,
is_visible_sidebar?: boolean,
is_editable? : boolean
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default defineComponent({
*/
hasVisibleProperties(): boolean {
for(let value of this._property.value.values()) {
if(value.descriptor.is_visible ?? true)
if(value.descriptor.is_visible_sidebar ?? true)
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({
*/
fields(): [string, Property][] {
return [...this.property.value.entries()].filter(
o => o[1].descriptor.is_visible ?? true
o => o[1].descriptor.is_visible_sidebar ?? true
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default defineComponent({
return false;
}
for(let value of this.property.value.values()) {
if(value.descriptor.is_visible ?? true)
if(value.descriptor.is_visible_sidebar ?? true)
return true;
}
return false;
Expand Down

0 comments on commit 1230825

Please sign in to comment.