🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

do_graphs

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

do_graphs

Do Graph is an open source package used to build/create/design dynamic graphs for your react project.

latest
npmnpm
Version
0.2.33
Version published
Weekly downloads
2
-96.36%
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

Do Graph is an open source package used to build/create/design dynamic graphs for your react project.

Installation

npm i do_graphs --save

Components

  • CustomDashboard: Dashboard to display and create list of dynamic chart pages.
  • LayoutPages: Page layout design using in-built charts and configure as per your requirement.
  • Layouts: View Dynamic created pages in your app. Use this component in your root/main file i.e, App.js.

Functions

  • getRoutLists: Fetch dynamic pages and list it using CustomDashboard component.
  • getMenuList: Fetch dynamic menu and list it using CustomDashboard component.

Props

  • CustomDashboard:
    a. routeBackendUrl: (mandatory) backend url of list of dynamically created route pages.
    b. isMenuLayoutPresent: (mandatory) true if your app has side menu bar.
    c. headers: (optional) API headers.

  • LayoutPages:
    a. routeBackendUrl: (mandatory) backend url of list of dynamically created route pages.
    b. menuBackendUrl: (mandatory) backend url of list of dynamically created menu.
    c. frontendUrl: (mandatory) frontend url of your application.
    d. headers: (optional) API headers.

Implementation

Use Layouts component in your App.js file to add dynamically ceated pages in your app. Example:

import { RouteContext, getRoutLists, getMenuList, Layouts, CustomDashboard, LayoutPages } from 'do_graphs';

const App = () => {
    const [routePages, setRoutePages] = useState([])
    const [menu, setMenu] = useState([])
    const getRoutes = async () => {
        const result: any = await getRoutLists(backendUrl, config) // return the list of pages from backend
        setRoutePages(result)
    }
    const getMenus = async () => {
        const result: any = await getMenuList(backendUrl, config) // return the list of menu from backend
        if (result?.length > 0) {
            setMenu(result)
        } else {
            setMenu([])
        }
    }
    useMemo(() => {
        getRoutes()
        getMenus()
    }, [])
    return (
        <RouteContext.Provider value={{ routePages, setRoutePages, menu, setMenu }}>
            <Route path={'/custom_layout'} element={<CustomDashboard routeBackendUrl={routeBackendUrl} isMenuLayoutPresent={isMenuLayoutPresent} headers={headers} />} />
            <Route path={'/layout/:id'} element={<LayoutPages routeBackendUrl={CustomRouteUrl} menuBackendUrl={CustomMenuUrl} frontendUrl={Frontend} headers={headers} />} />
            {routePages?.length > 0 && routePages?.map((it: any, n: number) => (
                <React.Fragment key={n}>
                  <Route path={it.path} element={(<Layouts title={it?.title} html={it?.element} menuId={it?.menu_id} />)} />
                </React.Fragment>
            ))}
        </RouteContext>
    )
}

export default App;

Keywords

react

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts