Skip to content

Devtools Modules: Check for duplicate names, route while adding and editing modules #646

@oyeaussie

Description

@oyeaussie

Currently we do the following checks:

        if ($data['module_type'] === 'components') {
            $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndRoute';
            $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['route']);
        } else if ($data['module_type'] === 'packages' || $data['module_type'] === 'middlewares') {
            $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndClass';
            $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['class']);
        } else if ($data['module_type'] === 'views') {
            $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndName';
            $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['name']);
        }

We also check for Repo to make sure that we have different repo assigned to the new module.

In case the developer decides to move some modules to a different organization, which will change the repo URL but the name/route of the module can be same. This will overwrite the previous module. Example:

We have a package module Test in apptype demo with repo org demo. So the repo url will be:
/demo/demo-packages-category-test

If we add another package module Test in apptype demo with repo org demonew the repo url will be:
/demonew/demo-packages-category-test

This is fine with respect to the repo url as they are different. But, the problem is when you will install both the packages, they will overwrite the files inside the apptype space.

This should be checked during module add/edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions