diff --git a/packages/components/src/components/Graph/Graph.js b/packages/components/src/components/Graph/Graph.js
index eac741e15..d379b49fd 100644
--- a/packages/components/src/components/Graph/Graph.js
+++ b/packages/components/src/components/Graph/Graph.js
@@ -49,7 +49,7 @@ export default class Graph extends Component {
'org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers': isSubGraph
? 0
: 40,
- 'org.eclipse.elk.padding': '[top=26,left=0,bottom=1,right=0]',
+ 'org.eclipse.elk.padding': '[top=30,left=0,bottom=1,right=0]',
'org.eclipse.elk.separateConnectedComponents': false,
'org.eclipse.elk.spacing.nodeNode': isSubGraph ? 0 : 40
}
@@ -83,20 +83,22 @@ export default class Graph extends Component {
viewBox={`0 0 ${width} ${height}`}
preserveAspectRatio="xMidYMin meet"
>
-
-
-
-
-
+ {!isSubGraph && (
+
+
+
+
+
+ )}
(
diff --git a/packages/components/src/components/Graph/Graph.scss b/packages/components/src/components/Graph/Graph.scss
index 35a8c0dfe..f52740fd3 100644
--- a/packages/components/src/components/Graph/Graph.scss
+++ b/packages/components/src/components/Graph/Graph.scss
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-$edge-color: #979797;
+$edge-color: #8d8d8d;
.graph {
#edge-arrow path {
@@ -27,7 +27,7 @@ $edge-color: #979797;
.Task {
rect {
fill: #FFFFFF;
- stroke: #979797;
+ stroke: #8d8d8d;
}
.label-hitbox {
@@ -35,11 +35,11 @@ $edge-color: #979797;
}
text {
- fill: #6F6F6F;
+ fill: #8d8d8d;
}
- .chevron {
- fill: #565656;
+ .chevron, .status-icon {
+ fill: #8d8d8d;
}
}
diff --git a/packages/components/src/components/Graph/Graph.stories.js b/packages/components/src/components/Graph/Graph.stories.js
index 643625dcd..c8e60f4ab 100644
--- a/packages/components/src/components/Graph/Graph.stories.js
+++ b/packages/components/src/components/Graph/Graph.stories.js
@@ -41,7 +41,7 @@ const taskProps = {
type: 'Task',
label: 'build-and-push',
width: 160,
- height: 26
+ height: 30
};
const expandedProps = {
@@ -51,14 +51,14 @@ const expandedProps = {
id: '__step_build-and-push__build-image',
label: 'build-image',
width: 160,
- height: 26
+ height: 30
},
{
type: 'Step',
id: '__step_build-and-push__push-image',
label: 'push-image',
width: 160,
- height: 26
+ height: 30
}
],
edges: [],
diff --git a/packages/components/src/components/Graph/Node.js b/packages/components/src/components/Graph/Node.js
index 304b0a8c2..929cb961d 100644
--- a/packages/components/src/components/Graph/Node.js
+++ b/packages/components/src/components/Graph/Node.js
@@ -14,11 +14,11 @@ limitations under the License.
import React, { Component } from 'react';
import classNames from 'classnames';
-import CheckmarkFilled from '@carbon/icons-react/lib/checkmark--filled/16';
-import ChevronDown from '@carbon/icons-react/lib/chevron--down/16';
-import ChevronUp from '@carbon/icons-react/lib/chevron--up/16';
-import CloseFilled from '@carbon/icons-react/lib/close--filled/16';
-import Undefined from '@carbon/icons-react/lib/undefined/16';
+import CheckmarkFilled from '@carbon/icons-react/lib/checkmark--filled/20';
+import ChevronDown from '@carbon/icons-react/lib/chevron--down/20';
+import ChevronUp from '@carbon/icons-react/lib/chevron--up/20';
+import CloseFilled from '@carbon/icons-react/lib/close--filled/20';
+import Undefined from '@carbon/icons-react/lib/undefined/20';
import Graph from './Graph'; // eslint-disable-line import/no-cycle
import InlineLoading from './InlineLoading';
@@ -66,16 +66,21 @@ export default class Node extends Component {
StatusIcon = ;
}
- const maxLabelLength = 24;
+ const maxLabelLength = 19;
let labelText = label;
if (label.length > maxLabelLength) {
- labelText = `${label.substring(0, maxLabelLength)}\u2026`;
+ const charDisplay = maxLabelLength - 1;
+ const labelStart = label.substring(0, Math.ceil(charDisplay / 2));
+ const labelEnd = label.substring(
+ label.length - Math.floor(charDisplay / 2)
+ );
+ labelText = `${labelStart}\u2026${labelEnd}`;
}
let labelPosition = {
textAnchor: 'start',
- x: 30,
- y: 18
+ x: 36,
+ y: 20
};
if (type === 'Start' || type === 'End') {
@@ -91,7 +96,7 @@ export default class Node extends Component {
x: isSelected ? 0 : 1,
y: isSelected ? 0 : 1,
width: isSelected ? width : width - 2,
- height: isSelected ? 26 : 24
+ height: isSelected ? 30 : 28
};
const Chevron = children ? ChevronUp : ChevronDown;
@@ -120,7 +125,7 @@ export default class Node extends Component {
{StatusIcon}
{labelText}
{type === 'Task' && (
-
+
)}
{children && (
diff --git a/packages/components/src/components/Graph/NodeLink.js b/packages/components/src/components/Graph/NodeLink.js
index 42af601a0..90db56cbe 100644
--- a/packages/components/src/components/Graph/NodeLink.js
+++ b/packages/components/src/components/Graph/NodeLink.js
@@ -25,7 +25,7 @@ const NodeLink = ({ link }) => {
path.moveTo(startX, startY);
path.lineTo(startX, startY + (targetY - startY) * percent);
path.lineTo(targetX, startY + (targetY - startY) * percent);
- path.lineTo(targetX, targetY);
+ path.lineTo(targetX, targetY - 1); // stop short to prevent it showing around the arrow tip
return (
diff --git a/packages/utils/src/utils/buildGraphData.js b/packages/utils/src/utils/buildGraphData.js
index 84ee0bd9b..2b4d2cbd7 100644
--- a/packages/utils/src/utils/buildGraphData.js
+++ b/packages/utils/src/utils/buildGraphData.js
@@ -13,8 +13,8 @@ limitations under the License.
/* istanbul ignore file */
import { getStatus } from './status';
-const defaultHeight = 26;
-const defaultCharWidth = 9;
+const defaultHeight = 30;
+const defaultWidth = 200;
function getBaseNodes() {
const graph = {
@@ -149,20 +149,14 @@ function addNodes({ expanded, graph, pipeline, pipelineRun, tasks }) {
task.spec.steps &&
task.spec.steps.length > 0
) {
- const parentWidth = taskRef.name.length * defaultCharWidth + 40;
const subgraph = {
id: taskRef.name,
label: taskRef.name,
children: task.spec.steps.map(step => {
- let stepWidth = step.name.length * defaultCharWidth + 40;
- if (stepWidth < parentWidth) {
- stepWidth = parentWidth;
- }
-
const stepNode = {
id: `__step__${taskRef.name}__${step.name}`,
label: step.name,
- width: stepWidth,
+ width: defaultWidth,
height: defaultHeight,
nChildren: 0,
nParents: 0,
@@ -190,7 +184,7 @@ function addNodes({ expanded, graph, pipeline, pipelineRun, tasks }) {
node = {
id: taskRef.name,
label: taskRef.name,
- width: taskRef.name.length * defaultCharWidth + 40,
+ width: defaultWidth,
height: defaultHeight,
nChildren: 0,
nParents: 0,