Skip to content

Commit

Permalink
chore: linting fixes (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
superlinkx authored Aug 22, 2024
1 parent 83909a3 commit 225e5f3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 36 deletions.
15 changes: 0 additions & 15 deletions cmd/api/src/database/mocks/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions cmd/api/src/model/unified_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func FromDAWGSNode(node *graph.Node, includeProperties bool) UnifiedNode {
}

return UnifiedNode{
Label: label,
Kind: analysis.GetNodeKind(node).String(),
ObjectId: objectId,
IsTierZero: strings.Contains(systemTags, ad.AdminTierZero),
Label: label,
Kind: analysis.GetNodeKind(node).String(),
ObjectId: objectId,
IsTierZero: strings.Contains(systemTags, ad.AdminTierZero),
IsOwnedObject: strings.Contains(systemTags, OwnedAssetGroupTag),
LastSeen: lastSeen,
Properties: properties,
LastSeen: lastSeen,
Properties: properties,
}
}

Expand Down
18 changes: 12 additions & 6 deletions cmd/ui/src/ducks/explore/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ const graphDataReducer = (state = initialGraphDataState, action: types.GraphActi
} else if (action.type === types.SAVE_RESPONSE_FOR_EXPORT) {
draft.export = action.payload;
} else if (action.type === types.TOGGLE_TIER_ZERO_NODE) {
let systemTags = []
let systemTags = [];
// Check if system_tags contains tags then split, else leave empty
{ state.chartProps.items[action.nodeId].data.system_tags ?
systemTags = state.chartProps.items[action.nodeId].data.system_tags.split(" ") : null }
{
state.chartProps.items[action.nodeId].data.system_tags
? (systemTags = state.chartProps.items[action.nodeId].data.system_tags.split(' '))
: null;
}
if (systemTags.includes(TIER_ZERO_TAG)) {
// Remove tag
systemTags.splice(systemTags.indexOf(TIER_ZERO_TAG), 1);
Expand All @@ -64,10 +67,13 @@ const graphDataReducer = (state = initialGraphDataState, action: types.GraphActi
draft.chartProps.items[action.nodeId].data.system_tags = systemTags.join(' ');
}
} else if (action.type === types.TOGGLE_OWNED_OBJECT_NODE) {
let systemTags = []
let systemTags = [];
// Check if system_tags contains tags then split, else leave empty
{ state.chartProps.items[action.nodeId].data.system_tags ?
systemTags = state.chartProps.items[action.nodeId].data.system_tags.split(" ") : null }
{
state.chartProps.items[action.nodeId].data.system_tags
? (systemTags = state.chartProps.items[action.nodeId].data.system_tags.split(' '))
: null;
}
if (systemTags.includes(OWNED_OBJECT_TAG)) {
// Remove tag
systemTags.splice(systemTags.indexOf(OWNED_OBJECT_TAG), 1);
Expand Down
10 changes: 7 additions & 3 deletions cmd/ui/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,13 @@ export const transformToFlatGraphResponse = (graph: GraphResponse) => {
for (const [key, value] of Object.entries(graph.data.nodes)) {
const lastSeen = getLastSeenValue(value);
// Check and add needed system_tags to node
const tags = []
{ value.isTierZero ? tags.push('admin_tier_0') : null }
{ value.isOwnedObject? tags.push('owned') : null }
const tags = [];
{
value.isTierZero ? tags.push('admin_tier_0') : null;
}
{
value.isOwnedObject ? tags.push('owned') : null;
}
result[key] = {
label: {
text: value.label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const AssetGroupMenuItem: FC<{ assetGroupId: number; assetGroupName: string }> =
},
onSuccess: () => {
if (selectedNode?.graphId) {
if(isMenuItemForTierZero) {
if (isMenuItemForTierZero) {
dispatch(toggleTierZeroNode(selectedNode.graphId));
} else if (isMenuItemForOwnedObject) {
dispatch(toggleOwnedObjectNode(selectedNode.graphId));
Expand Down
10 changes: 5 additions & 5 deletions cmd/ui/src/views/Explore/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ const initGraphNodes = (graph: MultiDirectedGraph, nodes: GraphNodes, themedOpti
const icon = NODE_ICON[node.kind] || UNKNOWN_ICON;
nodeParams.color = icon.color;
nodeParams.image = icon.url || '';
nodeParams.glyphs = []
nodeParams.glyphs = [];

// Tier zero nodes should be marked with a gem glyph
if (node.isTierZero) {
nodeParams.type = 'glyphs';
nodeParams.glyphs.push({
location: GlyphLocation.TOP_RIGHT,
image: themedOptions.glyph.tierZeroGlyph.url || '',
...themedOptions.glyph.colors,
});
location: GlyphLocation.TOP_RIGHT,
image: themedOptions.glyph.tierZeroGlyph.url || '',
...themedOptions.glyph.colors,
});
}
if (node.isOwnedObject) {
nodeParams.type = 'glyphs';
Expand Down

0 comments on commit 225e5f3

Please sign in to comment.