Dashboard-Plugin
Docs HomeDashboard plugins and appsInfomakerNaviga global
  • About
  • Intro
  • Getting started
  • The anatomy of a plugin
  • Manifest structure
  • Getting started
    • Get Dashboard-Plugin
    • Build
  • What's new
  • Components
    • Agent
      • Actions
    • Application
    • Widget
    • Health
    • Modal
    • Settings
  • API and GUI
    • API
      • Overview
      • register
        • Reducers
        • Portals
        • Requirements
        • Permissions
        • Default config
        • Config Modifiers
      • cache
      • store
      • encrypt
      • decrypt
      • createUUID
      • getLanguage
      • getTextDirection
      • getTimeFormat
      • getKeyCharFromCode
      • getKeyCodeFromChar
      • event
      • Logger
      • buildRouteUrlWithDispatchableEvent
      • getUser
      • getAction
      • getPortal
      • getConfig
      • getLocalize
      • getAvailableActions
      • getAvailablePortals
      • request
      • setHealth
      • openModal
      • closeModal
      • confirm
      • notifications
      • hasPermission
      • standalone
      • withUser
      • useModal
      • useSheet
      • useUser
      • useConfig
      • useLocalize
      • useApplication
      • useMappings
      • useStandalone
    • GUI
      • Core GUI
      • Style-Guide
    • Modules
      • GUI
      • Utility
      • NavigaID
        • getUserToken
        • getApplicationToken
        • getGroupsFromToken
  • Mappings
  • Plugins deployments
  • S3 upload
  • Deprecations
    • 4.1.0
    • 4.0.0
    • 2.1.0
Powered by GitBook
On this page

Was this helpful?

  1. API and GUI
  2. API

getPortal

by passing the Portal id to `getPortal` it will return the portal component and ready to use in your plugin.

How to use

import { Plugin } from '@root'
import { useRef } from 'react'

const Application = () => {
    const myAwesomePortal = useRef(Plugin.getPortal('my-awesome-portal'))

    const handleOnImageLoaded = () => {
        console.log('Loaded')
    }

    if (myAwesomePortal.current) {
        const PortalComponent = myAwesomePortal.current

        return (
            <Wrapper>
                <PortalComponent
                    onImageLoaded={handleOnImageLoaded}
                    imageSrc={'https://s3-eu-west-1.amazonaws.com/dashboard-graphics/Dashboard-Icon.png'}
                />
            </Wrapper>
        )
    } else {
        return (
            <Wrapper>
                {'No portal found 😥'}
            </Wrapper>
        )
    }
}

export {
    Application
}
PreviousgetActionNextgetConfig

Last updated 4 years ago

Was this helpful?