You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, we have all menu items, buttons and other user interface components hard-coded in xod-client, xod-client-browser, and xod-client-electron without grouping by feature name. We want to add the possibility to disable some features, which means that disabled feature hides related menu items and components.
User story
To disable features I need to edit config.json in the xod-client package (or dist/config.json).
For example, I want to hide the whole Deploy menu item with all children elements and buttons in the UI, also I want to disable a possibility to change a workspace and add a library:
Here is a list of features, that can be disabled within this issue:
switchWorkspace
addLibary
publishLibrary
getApiToken to hide a components in Project Preferences to specify a token for XOD Cloud API
accountPane to hide account pane, switch visibility button and View > Toggle Acount Pane menu item
help - for anything that relates to Help menu:
version
openTutorialProject
documentation
shortcutsDoc
forum
deploy - for anything that relates to deploy:
uploadToArduino
runSimulation
showCodeForArduino
connectSerial
updatePackages
In case that all features listed in a menu item are disabled, the whole parent menu item should be hidden. But it should not affect other features with the parent menu item feature name.
Acceptance criteria
properties in config file effects to menu items and UI components visibility
config file is a separate chunk (does not included in the bundle.js)
after hiding some menu items there should be no more than one separator in a row
if all features in a menu are hidden (without grouping), the parent menu item should be hidden too. But it should not affect other components, which relates to the feature name of the parent menu item.
How to implement
Place a config.json in a separate Webpack chunk
Add featureName: [FeatureName] property to each menu item
Import config where it needed (E.G., xod-client/src/utils/menu.js)
Introduce a new filtering function in xod-client/src/utils/menu.js, which will reject menu items (pay attention, menu items are nested) if at least one feature from the list mentioned above is disabled.
Use this function in each getMenuBarItems method of App container in xod-client-browser and xod-client-electron to avoid rendering hidden menu items (even it defined in this method, like Help -> Version)
In addition, filter out separators from menus, which placed in the beginning, in the end, or more than one in a row.
Wrap some React components with HOC Feature :: [FeatureName] -> Component -> Component, which avoids rendering it if the at least one feature from the list is disabled
How to test
Mock the imported config.json with test config that hides some menu items and check does it exists on the page using puppeteer.
To mock the import, we probably need to install one new dev dependency, like testdouble.js.
Please, elaborate on User Story. An example of config.json to hide, say, “Upload to Arduino” and “Update packages” is much desired.
Also, keep Grammarly enabled
nkrkv
changed the title
As Enterprise Customer I want to hide some menu items and buttons based on config
As enterprise admin I want to hide some menu items and buttons based on config
Aug 11, 2020
Now, the scope of the feature should be defined. It would be quite pointless to hide Edit → Copy, for example. From the input info and some thoughts, the following is the subject to be hidden:
File → Switch Workspace
File → Add Library / Publish Library
Deploy → <every item>
Help → Open Tutorial Project
Help → Documentation
Help → Forum
Please, give these action consistent names and add to the issue body.
brusherru
changed the title
As enterprise admin I want to hide some menu items and buttons based on config
As enterprise admin I want to disable some features via IDE config
Aug 18, 2020
Rationale
At the moment, we have all menu items, buttons and other user interface components hard-coded in
xod-client
,xod-client-browser
, andxod-client-electron
without grouping by feature name. We want to add the possibility to disable some features, which means that disabled feature hides related menu items and components.User story
To disable features I need to edit
config.json
in thexod-client
package (ordist/config.json
).For example, I want to hide the whole
Deploy
menu item with all children elements and buttons in the UI, also I want to disable a possibility to change a workspace and add a library:Here is a list of features, that can be disabled within this issue:
switchWorkspace
addLibary
publishLibrary
getApiToken
to hide a components in Project Preferences to specify a token for XOD Cloud APIaccountPane
to hide account pane, switch visibility button andView > Toggle Acount Pane
menu itemhelp
- for anything that relates to Help menu:version
openTutorialProject
documentation
shortcutsDoc
forum
deploy
- for anything that relates to deploy:uploadToArduino
runSimulation
showCodeForArduino
connectSerial
updatePackages
In case that all features listed in a menu item are disabled, the whole parent menu item should be hidden. But it should not affect other features with the parent menu item feature name.
Acceptance criteria
bundle.js
)How to implement
config.json
in a separate Webpack chunkfeatureName: [FeatureName]
property to each menu itemxod-client/src/utils/menu.js
)xod-client/src/utils/menu.js
, which will reject menu items (pay attention, menu items are nested) if at least one feature from the list mentioned above is disabled.getMenuBarItems
method ofApp
container inxod-client-browser
andxod-client-electron
to avoid rendering hidden menu items (even it defined in this method, like Help -> Version)Feature :: [FeatureName] -> Component -> Component
, which avoids rendering it if the at least one feature from the list is disabledHow to test
Mock the imported
config.json
with test config that hides some menu items and check does it exists on the page using puppeteer.To mock the import, we probably need to install one new dev dependency, like
testdouble.js
.For the electron version, probably we need to do something like suggested in this comment: electron-userland/spectron#21 (comment)
The text was updated successfully, but these errors were encountered: