Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
29 changes: 29 additions & 0 deletions src/app/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,35 @@ describe('DAG Node', () => {
const style = await stateElement.getAttribute('style');
expect(style).toContain(`background: ${customBgColor}`);
}));

it('Allows overriding the state icon color for a node',
fakeAsync(async () => {
const customStateIconColor = 'rgb(128, 0, 128)';
const node = new DagNode('c', 'execution', 'FAILED', {
stateIconColor: customStateIconColor,
});
fixture.componentInstance.fakeNode = node;

const stateElement = await harness.nodeStateElement();
const style = await stateElement.getAttribute('style');
expect(style).toContain(`color: ${customStateIconColor}`);
}));

it('Allows overriding the state icon color for a group',
fakeAsync(async () => {
const customStateIconColor = 'rgb(128, 0, 128)';
const group = new DagGroup('group-id', [], [], [], 'FAILED', {
stateIconColor: customStateIconColor,
hasControlNode: true,
});
fixture.componentInstance.fakeNode = group.generateControlNode()!;
fixture.detectChanges();

const stateElement = await harness.nodeStateElement();
const style = await stateElement.getAttribute('style');
expect(style).toContain(`color: ${customStateIconColor}`);
}));

});

describe('Internals', () => {
Expand Down
6 changes: 4 additions & 2 deletions src/app/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ export class DagNodeEl implements OnInit, OnDestroy {

getNodeStateColor(node: DagNode) {
const {state, icon} = node;
return isNoState(state) ?
icon!.color :
if (isNoState(state)) {
return icon!.color;
}
return node.stateIconColor ||
this.fetchIcon(this.iconForState(state), 'color');
}

Expand Down
11 changes: 11 additions & 0 deletions src/app/node_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class DagGroup implements
callout: NodeCallout = '';
modifiers = new Set<NodeModifier>();
stateBgColor = '';
stateIconColor = '';
stateTooltip = '';
iconTooltip = '';
subType?: unknown;
Expand Down Expand Up @@ -298,6 +299,7 @@ export class DagGroup implements
customControlNode = undefined,
expanded = false,
stateBgColor = '',
stateIconColor = '',
stateTooltip = '',
iconTooltip = '',
treatAsLoop = false,
Expand Down Expand Up @@ -326,6 +328,7 @@ export class DagGroup implements
customControlNode,
expanded,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
subType,
Expand Down Expand Up @@ -508,6 +511,7 @@ export interface DagNodeMeta {
displayName?: string;
state?: NodeState;
stateBgColor?: string;
stateIconColor?: string;
stateTooltip?: string;
iconTooltip?: string;
/**
Expand Down Expand Up @@ -638,6 +642,7 @@ export class DagNode implements
subType: unknown;
state: NodeState = 'NO_STATE_STATIC';
stateBgColor: string = '';
stateIconColor: string = '';
stateTooltip: string = '';
iconTooltip: string = '';
conditionalQuery = '';
Expand Down Expand Up @@ -669,6 +674,7 @@ export class DagNode implements
modifiers = new Set<NodeModifier>(),
callout = '',
stateBgColor = '',
stateIconColor = '',
stateTooltip = '',
iconTooltip = '',
subType = undefined,
Expand All @@ -680,6 +686,7 @@ export class DagNode implements
type,
state,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
icon: icon ? {...icon} : icon,
Expand Down Expand Up @@ -783,6 +790,7 @@ export class DagNode implements
icon,
state,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
options,
Expand Down Expand Up @@ -813,6 +821,7 @@ export class DagNode implements
modifiers,
callout,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
subType,
Expand Down Expand Up @@ -850,6 +859,7 @@ export class DagNode implements
displayName,
groupLabel,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
subType,
Expand Down Expand Up @@ -877,6 +887,7 @@ export class DagNode implements
displayName,
groupLabel,
stateBgColor,
stateIconColor,
stateTooltip,
iconTooltip,
subType,
Expand Down
Loading