diff --git a/package-lock.json b/package-lock.json index 73d7d952b..009279a17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5040,9 +5040,12 @@ "@formatjs/intl-pluralrules": "^1.2.1", "@formatjs/intl-relativetimeformat": "^4.1.1", "@tektoncd/dashboard-utils": "file:packages/utils", + "@vx/network": "0.0.192", "ansi-to-react": "^5.0.0", "carbon-components": "^10.4.1", "carbon-components-react": "^7.4.1", + "d3-path": "^1.0.8", + "elkjs": "^0.5.1", "js-yaml": "^3.13.0", "prop-types": "^15.7.2", "react-window": "^1.8.5" @@ -8674,9 +8677,9 @@ "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==" }, "d3-dispatch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.5.tgz", - "integrity": "sha512-vwKx+lAqB1UuCeklr6Jh1bvC4SZgbSqbkGBLClItFBIYH4vqDJCA7qfoy14lXmJdnBOdxndAMxjCbImJYW7e6g==" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.6.tgz", + "integrity": "sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==" }, "d3-force": { "version": "1.2.1", @@ -8690,19 +8693,19 @@ } }, "d3-path": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.8.tgz", - "integrity": "sha512-J6EfUNwcMQ+aM5YPOB8ZbgAZu6wc82f/0WFxrxwV6Ll8wBwLaHLKCqQ5Imub02JriCVVdPjgI+6P3a4EWJCxAg==" + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", + "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==" }, "d3-quadtree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.6.tgz", - "integrity": "sha512-NUgeo9G+ENQCQ1LsRr2qJg3MQ4DJvxcDNCiohdJGHt5gRhBW6orIB5m5FJ9kK3HNL8g9F4ERVoBzcEwQBfXWVA==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.7.tgz", + "integrity": "sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA==" }, "d3-timer": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.9.tgz", - "integrity": "sha512-rT34J5HnQUHhcLvhSB9GjCkN0Ddd5Y8nCwDBG2u6wQEeYxT/Lf51fTFFkldeib/sE/J0clIe0pnCfs6g/lRbyg==" + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.10.tgz", + "integrity": "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==" }, "damerau-levenshtein": { "version": "1.0.5", diff --git a/package.json b/package.json index 8a595f950..28ba1d38d 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,10 @@ "@formatjs/intl-pluralrules": "^1.2.1", "@tektoncd/dashboard-components": "file:./packages/components", "@tektoncd/dashboard-utils": "file:./packages/utils", - "@vx/network": "0.0.192", "carbon-components": "^10.6.1", "carbon-components-react": "^7.6.1", "classnames": "^2.2.6", "core-js": "^3.0.1", - "d3-path": "^1.0.8", - "elkjs": "^0.5.1", "es6-promise": "^4.2.6", "history": "^4.9.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/components/package.json b/packages/components/package.json index 403cda3fa..41d22bf31 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -14,9 +14,12 @@ "@formatjs/intl-pluralrules": "^1.2.1", "@formatjs/intl-relativetimeformat": "^4.1.1", "@tektoncd/dashboard-utils": "file:../utils", + "@vx/network": "0.0.192", "ansi-to-react": "^5.0.0", "carbon-components": "^10.4.1", "carbon-components-react": "^7.4.1", + "d3-path": "^1.0.8", + "elkjs": "^0.5.1", "js-yaml": "^3.13.0", "prop-types": "^15.7.2", "react-window": "^1.8.5" diff --git a/packages/components/src/components/Graph/Graph.js b/packages/components/src/components/Graph/Graph.js index 47266c23d..eac741e15 100644 --- a/packages/components/src/components/Graph/Graph.js +++ b/packages/components/src/components/Graph/Graph.js @@ -63,7 +63,7 @@ export default class Graph extends Component { nodes: g.children }); }) - .catch(console.error); + .catch(console.error); // eslint-disable-line no-console }; render() { diff --git a/packages/components/src/components/Graph/PipelineGraph.js b/packages/components/src/components/Graph/PipelineGraph.js index 4c04c46c2..1ec802543 100644 --- a/packages/components/src/components/Graph/PipelineGraph.js +++ b/packages/components/src/components/Graph/PipelineGraph.js @@ -12,9 +12,9 @@ limitations under the License. */ /* istanbul ignore file */ import React, { Component } from 'react'; +import { buildGraphData } from '@tektoncd/dashboard-utils'; import Graph from './Graph'; -import buildGraphData from './buildGraphData'; export default class PipelineGraph extends Component { state = { diff --git a/packages/components/src/components/index.js b/packages/components/src/components/index.js index 434c0ded7..942123ae0 100644 --- a/packages/components/src/components/index.js +++ b/packages/components/src/components/index.js @@ -15,11 +15,13 @@ export { default as Breadcrumbs } from './Breadcrumbs'; export { default as CancelButton } from './CancelButton'; export { default as ErrorBoundary } from './ErrorBoundary'; export { default as FormattedDate } from './FormattedDate'; +export { default as Graph } from './Graph/Graph'; export { default as Header } from './Header'; export { default as LabelFilter } from './LabelFilter'; export { default as Log } from './Log'; export { default as LogoutButton } from './LogoutButton'; export { default as PageErrorBoundary } from './PageErrorBoundary'; +export { default as PipelineGraph } from './Graph/PipelineGraph'; export { default as PipelineRun } from './PipelineRun'; export { default as PipelineRuns } from './PipelineRuns'; export { default as Rerun } from './Rerun'; diff --git a/packages/components/src/components/Graph/buildGraphData.js b/packages/utils/src/utils/buildGraphData.js similarity index 99% rename from packages/components/src/components/Graph/buildGraphData.js rename to packages/utils/src/utils/buildGraphData.js index 52f1f237c..84ee0bd9b 100644 --- a/packages/components/src/components/Graph/buildGraphData.js +++ b/packages/utils/src/utils/buildGraphData.js @@ -11,7 +11,7 @@ See the License for the specific language governing permissions and limitations under the License. */ /* istanbul ignore file */ -import { getStatus } from '@tektoncd/dashboard-utils'; +import { getStatus } from './status'; const defaultHeight = 26; const defaultCharWidth = 9; diff --git a/packages/utils/src/utils/index.js b/packages/utils/src/utils/index.js index 03d1bdab3..d533cf222 100644 --- a/packages/utils/src/utils/index.js +++ b/packages/utils/src/utils/index.js @@ -17,7 +17,9 @@ import Time16 from '@carbon/icons-react/lib/time/16'; import CloseFilled from '@carbon/icons-react/lib/close--filled/16'; import { Spinner } from '@tektoncd/dashboard-components'; +export { default as buildGraphData } from './buildGraphData'; export { paths, urls } from './router'; +export { getStatus } from './status'; export const ALL_NAMESPACES = '*'; @@ -110,11 +112,6 @@ export function stepsStatus(taskSteps, taskRunStepsStatus = []) { return steps; } -export function getStatus(resource) { - const { conditions = [] } = resource.status || {}; - return conditions.find(condition => condition.type === 'Succeeded') || {}; -} - export function isRunning(reason, status) { return status === 'Unknown' && reason === 'Running'; } diff --git a/packages/utils/src/utils/status.js b/packages/utils/src/utils/status.js new file mode 100644 index 000000000..0ebd320eb --- /dev/null +++ b/packages/utils/src/utils/status.js @@ -0,0 +1,17 @@ +/* +Copyright 2019 The Tekton Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +export function getStatus(resource) { + const { conditions = [] } = resource.status || {}; + return conditions.find(condition => condition.type === 'Succeeded') || {}; +}