Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new menu model and endpoint #4369

Merged
merged 1 commit into from
Oct 8, 2024
Merged

new menu model and endpoint #4369

merged 1 commit into from
Oct 8, 2024

Conversation

dgarros
Copy link
Collaborator

@dgarros dgarros commented Sep 18, 2024

This PR introduces a new model to store the information about the menu directly in the database.

In comparison with the current model, this gives the user more flexibility to create a nested menu with section and sub-section that isn't necessarily tight to a model.

The new menu is currently available on a new API endpoint /api/menu/new with the format presented below.

Each element of the menu is defined by a name and a namespace, similar to the node kind in the schema.
I'm not sold on the exact syntax but the idea was to avoid names conflict in the future.
To avoid confusing, the confusion between an element of the menu with the models in the schema, the namespace and the name are separated by : right now ...

The idea is that in order to fully control the behavior of the menu, a menu item should be created for each element of the schema that should be part of the menu.
In a separate PR, it will be possible to define a menu structure in a Git repository.

For compatibility reason and to keep it simple, if a model in the schema reference a location in the menu using the full identifier <namespace>:<name>, and if a menu item doesn't already exist for this model, a dynamic menu item will be created

{
    'sections': {
        'internal': [
            {
                'identifier': 'Builtin:ObjectManagement',
                'title': 'Object Management',
                'path': '',
                'icon': '',
                'kind': 'CoreMenuItem',
                'order_weight': 1000,
                'section': 'internal',
                'children': [
                    {
                        'identifier': 'Builtin:Groups',
                        'title': 'Groups',
                        'path': '/objects/CoreGroup',
                        'icon': 'mdi:group',
                        'kind': 'CoreMenuItem',
                        'order_weight': 1000,
                        'section': 'internal',
                        'children': []
                    },
                    {
                        'identifier': 'Builtin:Profiles',
                        'title': 'Profiles',
                        'path': '/objects/CoreProfile',
                        'icon': 'mdi:shape-plus-outline',
                        'kind': 'CoreMenuItem',
                        'order_weight': 2000,
                        'section': 'internal',
                        'children': []
                    },
                ]
            },
            {
                'identifier': 'Builtin:ChangeControl',
                'title': 'Change Control',
                'path': '',
                'icon': '',
                'kind': 'CoreMenuItem',
                'order_weight': 2000,
                'section': 'internal',
                'children': [
                    {
                        'identifier': 'Builtin:Branches',
                        'title': 'Branches',
                        'path': '/branche',
                        'icon': 'mdi:layers-triple',
                        'kind': 'CoreMenuItem',
                        'order_weight': 1000,
                        'section': 'internal',
                        'children': []
                    },
                ]
            },
        ],
        'object': [
            {
                'identifier': 'Builtin:Other',
                'title': 'Other',
                'path': '',
                'icon': '',
                'kind': 'CoreMenuItem',
                'order_weight': 2000,
                'section': 'object',
                'children': [
                    {
                        'identifier': 'Builtin:Tag',
                        'title': 'Tag',
                        'path': '/objects/BuiltinTag',
                        'icon': 'mdi:tag-multiple',
                        'kind': 'BuiltinTag',
                        'order_weight': 5000,
                        'section': 'object',
                        'children': []
                    },
                    {
                        'identifier': 'Test:ElectricCar',
                        'title': 'Electriccar',
                        'path': '/objects/TestElectricCar',
                        'icon': '',
                        'kind': 'TestElectricCar',
                        'order_weight': 5000,
                        'section': 'object',
                        'children': []
                    },
                ]
            }
        ]
    }
}

@github-actions github-actions bot added group/backend Issue related to the backend (API Server, Git Agent) group/python-sdk and removed group/python-sdk labels Sep 18, 2024
@dgarros dgarros force-pushed the dga-20240918-menu branch from 8f0eb5c to e7ededf Compare October 7, 2024 08:36
@dgarros dgarros marked this pull request as ready for review October 7, 2024 09:59
@dgarros dgarros requested review from a team October 7, 2024 10:15
@dgarros dgarros force-pushed the dga-20240918-menu branch from f4183ad to f288cc6 Compare October 7, 2024 20:25
@dgarros dgarros merged commit 8915858 into develop Oct 8, 2024
30 checks passed
@dgarros dgarros deleted the dga-20240918-menu branch October 8, 2024 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants