How to use the ra-core.linkToRecord function in ra-core

To help you get started, we’ve selected a few ra-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / packages / ra-ui-materialui / src / list / DatagridRow.spec.js View on Github external
it("should redirect to show page if the 'show' option is selected", () => {
            const { getByText, history } = renderWithRouter(
                
                    
                
            );
            fireEvent.click(getByText('hello'));
            expect(history.location.pathname).toEqual(
                linkToRecord(defaultProps.basePath, defaultProps.id, 'show')
            );
        });
github marmelab / react-admin / packages / ra-ui-materialui / src / list / DatagridRow.js View on Github external
handleRedirection = (path, event) => {
        const { basePath, id, push } = this.props;

        switch (path) {
            case 'edit':
                push(linkToRecord(basePath, id));
                return;
            case 'show':
                push(linkToRecord(basePath, id, 'show'));
                return;
            case 'expand':
                this.handleToggleExpanded(event);
                return;
            case 'toggleSelection':
                this.handleToggle(event);
                return;
            default:
                if (path) push(path);
                return;
        }
    };
github marmelab / react-admin / packages / ra-ui-materialui / src / button / ShowButton.js View on Github external
const ShowButton = ({
    basePath = '',
    label = 'ra.action.show',
    record = {},
    icon: Icon = ImageEye,
    ...rest
}) => (
    <button label="{label}">
        
    </button>
);
github Kirk-Wang / Blog / react-admin-demo / src / products / GridList.tsx View on Github external
{data[id].width}x{data[id].height},{" "}
                                
                            
                        }
                        actionIcon={
                            
                                
                            
                        }
                    /&gt;
                
            ))}
github marmelab / react-admin / packages / ra-ui-materialui / src / list / DatagridRow.js View on Github external
handleRedirection = (path, event) => {
        const { basePath, id, push } = this.props;

        switch (path) {
            case 'edit':
                push(linkToRecord(basePath, id));
                return;
            case 'show':
                push(linkToRecord(basePath, id, 'show'));
                return;
            case 'expand':
                this.handleToggleExpanded(event);
                return;
            case 'toggleSelection':
                this.handleToggle(event);
                return;
            default:
                if (path) push(path);
                return;
        }
    };
github bootstrap-styled / ra-ui / src / components / list / SimpleList.js View on Github external
const LinkOrNot = ({
  linkType,
  basePath,
  id,
  children,
}) =&gt; linkType === 'edit' || linkType === true ? (
  
    {children}
  
) : linkType === 'show' ? (
  
    {children}
  
) : (
  <span>{children}</span>
);
github bootstrap-styled / ra-ui / src / components / list / DatagridRow.js View on Github external
handleRedirection = (path, event) => {
    const { basePath, id, push } = this.props;

    if (path === 'edit') {
      push(linkToRecord(basePath, id));
      return;
    }
    if (path === 'show') {
      push(linkToRecord(basePath, id, 'show'));
      return;
    }

    if (path === 'expand') {
      this.handleToggleExpanded(event);
      return;
    }

    push(path);
  };
github marmelab / react-admin / packages / ra-ui-materialui / src / list / DatagridRow.js View on Github external
async event => {
            if (!rowClick) return;
            event.persist();

            const effect =
                typeof rowClick === 'function'
                    ? await rowClick(id, basePath, record)
                    : rowClick;
            switch (effect) {
                case 'edit':
                    history.push(linkToRecord(basePath, id));
                    return;
                case 'show':
                    history.push(linkToRecord(basePath, id, 'show'));
                    return;
                case 'expand':
                    handleToggleExpand(event);
                    return;
                case 'toggleSelection':
                    handleToggleSelection(event);
                    return;
                default:
                    if (effect) history.push(effect);
                    return;
            }
        },
        [
github marmelab / react-admin / examples / demo / src / products / GridList.js View on Github external
{ids.map(id =&gt; (
                
                    <img alt="" src="{data[id].thumbnail}">
                    
                                {data[id].width}x{data[id].height},{' '}
github marmelab / react-admin / examples / graphcool-demo / src / products / GridList.js View on Github external
{data[id].width}x{data[id].height},{' '}
                                
                            
                        }
                        actionIcon={
                            
                                
                            
                        }
                    /&gt;
                
            ))}