bernhardh / nova-dynamic-views

A nova package for dynamically overwrite the custom placeholders
16 stars 9 forks source link

Custom component is not shown on the resource page #10

Closed telefoniero closed 2 years ago

telefoniero commented 2 years ago

Hello! I've done all steps according to your instruction (applying screens), but there are no words, as it is by default.

This is NovaServiceProvider.php file.

Снимок экрана 2022-02-01 в 11 33 31

This is my Record's resource file.

Снимок экрана 2022-02-01 в 11 34 04

There is a 'watch' process working on in terminal, on my ToolbarBtn.

Снимок экрана 2022-02-01 в 11 34 35

This is basic template of a component.

Снимок экрана 2022-02-01 в 11 35 32

And this is Nova's Record page, there are no new components.

Снимок экрана 2022-02-01 в 11 35 56

Please, help!

telefoniero commented 2 years ago

Forgot to mention: this is MyIndexToolbarBtn.php file, so the name of the component is similar to what I use in my resource's file

Снимок экрана 2022-02-01 в 11 37 02
telefoniero commented 2 years ago

Here is my composer.json file in a root filder.

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "acme/color-picker": "*",
        "acme/quantity-tracker": "*",
        "bernhardh/nova-dynamic-views": "^1.4",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.8.*",
        "laravel/nova": "*",
        "laravel/tinker": "^1.0",
        "acme/my-index-toolbar-btn": "*"
    },
    "repositories": [
        {
            "type": "path",
            "url": "./nova"
        },
        {
            "type": "path",
            "url": "./nova-components/ColorPicker"
        },
        {
            "type": "path",
            "url": "./nova-components/QuantityTracker"
        },
        {
            "type": "path",
            "url": "./nova-components/MyIndexToolbarBtn"
        }
    ],
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}
telefoniero commented 2 years ago

@bernhardh, there is also no default method for custom-index-toolbar found. Idk, if I've done everything properly.

bernhardh commented 2 years ago

First of all: I haven't used this package nor nova for over a year. So maybe something changed in the meantime. My old installations of nova are still working with this package. But I will try to help you anyway.

What is the content of your tools.js file of your MyIndexToolbarBtn?

bernhardh commented 2 years ago

Maybe this helps, this is a sample component which I require like this in the composer.json of a test project:

{
    ...
    "require": {
        "acme/custom-resource-toolbar": "*",
    },
    ...
    "repositories": [
        ...
        {
            "type": "path",
            "url": "./nova-components/CustomResourceToolbar"
        },
    ]
}

In the resource:

    /**
     * Using the `custom-index-header` placeholder component
     */
    public function customIndexToolbarComponents()
    {
        return CustomComponents::make('flex w-full justify-end items-center mx-3')
            ->addItem('custom-resource-toolbar', [
                'label' => 'Button 1'
            ])
            ->addItem('custom-resource-toolbar', [
                'label' => 'Button 2'
            ]);
    }

Which result to this:

image

And attached you will find the component itself.

CustomResourceToolbar.zip

Hope this helps.

telefoniero commented 2 years ago

@bernhardh, hi again! There was an error on assets' compiling, which i didn't notice. There's no problem anymore. Thanks a lot for your attention!