standalone class has methods to work with Standalone App Dashboard to build sharable urls to modify standalone url params
How to use
Copy import { Plugin } from '@root'
const { standalone } = Plugin
const MyCustomComponent = props => {
return (
< div >
< p >Current Standalone AppID: ${ standalone .id}`</ p >
</ div >
)
}
export default MyCustomComponent
Available methods
Property
Type
Description
Returns
Current standalone url params
Check if Dashboard is running in standalone app
Check if Dashboard is running in any standalone
Helper function to build a sharable url with custom params
Current standalone url with the current params
Add custom params to current standalone url
Remove params from current url standalone
Check if the loggedIn user has permission to run StandaloneApp
id
The current standalone id
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
import { Plugin } from '@root'
const { standalone } = Plugin
console .log ( standalone .id) // 'writer'
params
The current standalone url params
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3
*/
import { Plugin } from '@root'
const { standalone } = Plugin
console .log ( standalone .params) // {article: '123-321-1-2-3'}
isApp
Check if Dashboard is running in Standalone App mode
Copy import { Plugin } from '@root'
const { standalone } = Plugin
/* Current url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
console .log ( Standalone .isApp ()) // true
/* Current url:
https://naviga.dashboard.navigacloud.com
*/
console .log ( standalone .isApp ()) // false
isStandalone
Check if Dashboard is running in any Standalone mode
Copy import { Plugin } from '@root'
const { standalone } = Plugin
/* Current url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
console .log ( standalone .isStandalone ()) // true
/* Current url:
https://naviga.dashboard.navigacloud.com
*/
console .log ( standalone .isStandalone ()) // false
buildPath
Build standalone url for plugin with custom params
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
import { Plugin } from '@root'
const { standalone } = Plugin
const params = {
article : '123-321-1-2-3'
}
const standalonePath = standalone .buildPath (params)
console .log (standalonePath) // https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3
buildPath() will return a built standalone path to your plugin's bundle even if the current running standalone url belongs to another plugin.
You can ignore that by passing true as an argument so Dashboard will return a built path from the running standalone url that the user stands on
getShareablePath
Get a sharable url for the current standalone app
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3&tabs=false
*/
import { Plugin } from '@root'
const { standalone } = Plugin
const standalonePath = standalone .getShareablePath ()
console .log (standalonePath) // https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3&tabs=false
getShareablePath() will return a shareable standalone path to your plugin's bundle even if the current running standalone url belongs to another plugin.
You can ignore that by passing true as an argument so Dashboard will return the actual running standalone url that the user stands on
addParams
Add custom params to the current standalone url
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
import { Plugin } from '@root'
const { standalone } = Plugin
const newParams = {
article : '123-321-1-2-3'
}
standalone .addParams (newParams)
/* url:
https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3
*/
removeParams
Remove params from the current standalone url
Copy /* Current url:
https://naviga.dashboard.navigacloud.com/app/writer?article=123-321-1-2-3
*/
import { Plugin } from '@root'
const { standalone } = Plugin
const paramsToRemove = [ 'article' ]
standalone .removeParams (paramsToRemove)
/* url:
https://naviga.dashboard.navigacloud.com/app/writer
*/
hasPermission
Check if loggedIn user has permission to run StandaloneApp
Copy /* Current permission roles:
admin ✅
powerUser ✅
user ❌
readonly ❌
*/
import { Plugin } from '@root'
const { standalone } = Plugin
// User logged as an admin:
standalone .hasPermission () // return true
// User logged as a powerUser:
standalone .hasPermission () // return true
// User logged as a user:
standalone .hasPermission () // return false
// User logged as a readonly:
standalone .hasPermission () // return false