All files / core/blong-kukum/test/fixture/e2e-realm/meta/model e2eGadgetModel.ts

0% Statements 0/82
0% Branches 0/1
0% Functions 0/1
0% Lines 0/82

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                                                                                                                                                                     
import unchanged from '@feasibleone/blong';
import {model} from '@feasibleone/blong';

/**
 * meta/model/e2eGadgetModel.ts — model spec for the `gadget` entity.
 *
 * Drives the auto-generated Browse/New/Open pages. `public: true` exposes the
 * standard CRUD operations on the gateway, validated by blong-server's
 * subject.validation — no manual gateway override is needed.
 *
 * The field names here must match meta/type/e2e.ts: the Playwright
 * helpers drive this page by name, so a rename has to happen in both places.
 */
export default model(
    () =>
        async function e2eGadgetModel() {
            return {
                subject: 'e2e',
                object: 'gadget',
                objectTitle: 'Gadget',
                public: true,
                nameField: 'gadget.gadgetName',
                schema: {
                    properties: {
                        gadget: {
                            properties: {
                                gadgetName: {title: 'Name', filter: true, sort: true},
                                gadgetStatus: {
                                    title: 'Status',
                                    widget: {
                                        options: [
                                            {value: 'draft', label: 'Draft'},
                                            {value: 'sent', label: 'Sent'},
                                            {value: 'paid', label: 'Paid'},
                                            {value: 'void', label: 'Void'},
                                        ],
                                    },
                                },
                            },
                            widget: {columns: ['gadgetName', 'gadgetStatus']},
                        },
                    },
                },
                cards: {
                    browse: {label: 'Gadgets', widgets: ['gadget']},
                    edit: {
                        label: 'Gadget Details',
                        className: 'col-12 md:col-8',
                        widgets: ['gadget.gadgetName', 'gadget.gadgetStatus'],
                    },
                },
                browser: {
                    title: 'Gadgets',
                    icon: 'pi pi-file',
                    toolbar: [
                        {
                            label: 'Create',
                            icon: 'pi pi-plus',
                            action: 'component/e2e.gadget.new',
                            permission: 'e2eGadgetAdd',
                        },
                        {
                            label: 'Edit',
                            icon: 'pi pi-pencil',
                            enabled: 'current',
                            method: 'component/e2e.gadget.open',
                            params: '${current}',
                        },
                        {
                            label: 'Delete',
                            icon: 'pi pi-trash',
                            enabled: 'selected',
                            confirm: 'Delete selected gadget?',
                            method: 'e2e.gadget.remove',
                            refresh: true,
                            params: {gadgetId: '${gadgetId}'},
                        },
                    ],
                },
            };
        },
);