npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-monitor-dag

v1.2.3

Published

一个基于React的运维/监控DAG图

Downloads

996

Readme

English| [简体中文](. /README. md)

✨ Feature

  • support the direction of left-to-right, top-to-bottom
  • support for custom status, custom status note in upper left corner
  • support for custom node styles and hover, focus status
  • support edge's label style
  • support the toolltips of node, endpoint, edge's label
  • support right-click menu of nodes and edges
  • support minimap and highlight status
  • support edge flow animation

📦 Install

npm install react-monitor-dag

API

MonitorDag properties

| Property | Description | Type | Default | |:-----------------:|:-----------------------------------------------------------------:|:---------------------------------------------------------------:|:-----------------------------------------------------------------------:| | data | data | any | - | | width | component width | number | string | - | | height | component height | number | string  | - | | className | component className | string | - | | nodeMenu | Node Right-click Menu Configuration | Array< menu> | (node) => Array< menu> | - | | nodeMenuClassName | Node Right-click Menu classname | string | - | | edgeMenu | Edge Right-click Menu Configuration | Array< [menu] | groupMenu | Group Right-click Menu Configuration | Array< [menu] (#menu-type)> | [ ] | | config | As configured aboveconfig Prop | any | - | | polling | support pollingpolling Prop | object | { } | | registerStatus | Register status, which adds class to the node based on its status | object | key:value, registered by user, corresponded to the status field of node | | statusNote | Status note in upper left cornerstatusNote Prop | object | { } | | onClickNode | Single Click Node Event | (node) => void | - | | onContextmenuNode | Right-Click Node Event | (node) => void | - | | onDblClickNode | Double Click Node Event | (node) => void | - | | onClickEdge | Single Click Edge Event | (edge) => void | - | | onClickLabel | Single Click Label Event | (label, edge) => void | - | | onContextmenuEdge | Right-Click Edge Event | (edge) => void | - | | onContextmenuGroup | Right-Click Group Event | (data) => void |
| onChangePage | Single-Click Group Pagination Event | (data) => void | | onNodeStatusChange | The canvas has a callback after the node state changes | (data) => void |

right-click menu configuration for'Node/Edge'

| Property | Description | Type | Default | |:--------:|:---------------------------------------:|:-----------------------------------------------:|:-------:| | title | name of each column | string | - | | key | unique flag for each column menu | string | - | | render | Customize the style of each column menu | (key) => void | - | | onClick | Click Callback for Each Column | (key, data) => void | - |

config

the configuration of canvas

| Property | Description | Type | Default | |:------------------:|:--------------------------------:|:-------------------------------------------------------------:|:---------------------------------:| | direction | the dag's direction | string | left-right | top-bottom | | edge | the configuration of edge | edge Prop { } | - | | labelRender | rendering method of edge's label | (label) => void | - | | labelTipsRender | rendering tooltips of edge label | (data) => void | - | | nodeRender | rendering of nodes | (data) => void | - | | nodeTipsRender | rendering tooltips of node | (data) => void | - | | endpointTipsRender | rendering tooltips of endpoint | (data) => void | - | | minimap | whether to show minimap | minimap Prop { } | - | | delayDraw | Delayed rendering. This component must ensure that the canvas container rendering (including animation execution) is completed before rendering, otherwise the coordinates will be offset, for example:Animation of Ant Design Modal | number | 0 | | autoLayout | custom layout | autoLayout Prop {} | - | | diffOptions | Collection of diff fields for node updates| Array< string> | - | | onLoaded | canvas loaded event| (data: {nodes, edges, groups}) => {} | - |

edge

the configuration of edge

| Property | Description | Type | Default | |:--------:|:------------------:|:----------------------------------:|:-------:| | type | the type of edge | string | - | | config | the config of edge | any | - |

group

the configuration of group

| Property | Description | Type | Default | |:------:|:--------:|:----------------------------------:|:-----:| | enableSearch | whether to enable the node group search node | boolean | false | | enablePagination | whether to turn on the page | boolean | true | | pageSize | nmber of per page | number | 20 | | rowCnt | the number of nodes are displayed in each row of the node group | number | 5 |

minimap

the configuration of minimap

| Property | Description | Type | Default | |:--------:|:-----------------------:|:---------------------------------------------------------------------------:|:-------:| | enable | whether to show minimap | boolean | - | | config | the config of minimap | minimap Config Prop { } | - |

autoLayout Config

the custom layout config

| Property | Description | Type | Default | |:--------:|:-----------------------:|:-------------------------------:|:-------:| | enable | whether to enable custom layout | boolean | - | | isAlways | whether to rearrange the layout after adding nodes | boolean | - | | config | algorithm configuration | { } | - |

minimap Config

the config of minimap

| Property | Description | Type | Default | |:---------------:|:-----------------:|:-------------------------------:|:-------:| | nodeColor | node color | any | - | | activeNodeColor | node active color | any | - |

polling

support polling

| Property | Description | Type | Default | |:--------:|:--------------------------:|:------------------------------------------:|:-------:| | enable | whether to support polling | boolean | - | | interval | interval of polling | number | - | | getData | the method of get data | (data) => void | - |

statusNote

Status note in upper left corner

| Property | Description | Type | Default | |:--------:|:-------------------------------------------:|:---------------------------------------------------------:|:-------:| | enable | whether to show status in upper left corner | boolean | - | | notes | the configuration of status note | notes Prop { } | - |

notes

the configuration of status note

| Property | Description | Type | Default | |:---------:|:----------------:|:-----------------------------------:|:-------:| | code | status code | string | - | | className | status className | string | - | | text | status text | string | - | | render | custom rendering methods | function | - |

🔗API

import MonitorDag from 'react-monitor-dag';
import 'react-monitor-dag/dist/index.css';
<MonitorDag
  data={data}
  nodeMenu={menu}                   // Node Right-click Menu Configuration
  edgeMenu={menu}                   // Edge Right-click Menu Configuration
  groupMenu={menu}                   // Group Right-click Menu Configuration
  onClickNode={(node) => {}}        // Single Click Node Event
  onContextmenuNode={(node) => {}}  // Right Click Node Event
  onDblClickNode={(node) => {}}     // Double Click Node Event
  onClickEdge={(edge) => {}}        // Single Click Edge Event
  onContextmenuEdge={(edge) => {}}  // Right Click Edge Event
  onContextmenuGroup={(data) => {}}   // Right Click Group Event
  onChangePage={(data) => {}}        // Single Click Group Pagination Event
  onNodeStatusChange={(data) => {}}  // The canvas has a callback after the node state changes
  polling={{                        // support polling
    enable: true,
    interval: 5000,                 // interval of polling 
    getData: (data) => {            // the method of get data

    }
  }}
  registerStatus={{                 // Register status, which adds class to the node based on its status
    success: 'success-class',
    fail: 'fail-class',
    timeout: 'timeout-class',
    running: 'runnning-class',
    waitting: 'waiting-class',
    other: 'other-class'
  }}
  statusNote={{                      // Status note in upper left corner
    enable: true,
    notes: [{
      code: 'success',
      className: 'success-class',
      text: '运行成功',
    }]
  }}
>
</MonitorDag>
interface menu { // right-click menu configuration for'Node/Edge'
  title ? : string, // name of each column
    key: string, // unique flag for each column menu
    render ? (key: string) : void, // Customize the style of each column menu
    onClick ? (key: string, data: any) : void, // Click Callback for Each Column
}

interface config {
  direction: string, // the dag's direction: 'left-right' or 'top-bottom'
    edge: { // the configuration of edge
      type: string,
      config: any
    },
    labelRender ? (label: JSX.Element) : void, // rendering method of edge's label
    labelTipsRender ? (data: any) : void, // rendering tooltips of edge label
    nodeRender ? (data: any) : void, // rendering of nodes
    nodeTipsRender ? (data: any) : void, // rendering tooltips of node
    endpointTipsRender ? (data: any) : void, // rendering tooltips of endpoint
    minimap: { // whether to show minimap
      enable: boolean,
      config: {
        nodeColor: any, // node color
        activeNodeColor: any // node active color
      }
    }
}

interface props {
  data: any, // data
    width ? : number | string, // component width
    height ? : number | string, // component height
    className ? : string, // component className
    nodeMenu: Array < menu > , // Node Right-click Menu Configuration
    edgeMenu: Array < menu > , // Edge Right-click Menu Configuration
    groupMenu: Array < menu > , // Group Right-click Menu Configuration
    config ? : any, // As configured above
    polling ? : { // support polling
      enable: boolean,
      interval: number, // interval of polling 
      getData(data): void // the method of get data
    },
    registerStatus ? : { // Register status, which adds class to the node based on its status
      success: string,
      fail: string
    },
    statusNote ? : { // Status note in upper left corner
      enable: boolean,
      notes: [{
        code: string,
        className: string,
        text: string,
        render?:() => JSX.Element
      }]
    },
    onClickNode ? (node: any) : void, // Single Click Node Event
    onContextmenuNode ? (node: any) : void, // Right-Click Node Event
    onDblClickNode ? (node: any) : void, // Double Click Node Event
    onClickEdge ? (edge: any) : void, // Single Click Edge Event
    onClickLabel ? (label: string, edge: any) : void, // Single Click Label Event
    onContextmenuEdge ? (edge: any) : void, // Right-Click Edge Event
    onContextmenuGroup?(edge: any): void,   // Right-Click Group Event
    onChangePage?(data:any): void,          // Single-Click Group Pagination Event
    onNodeStatusChange?(data: any): void           // The canvas has a callback after the node state changes
}

If you need more customized requirements, you can refer to issue or butterfly to customize your needs