Skip to content

Content Manager plugin does not get overwritten by custom file / width of rendered component not listening to getInputSize #8950

@MatthiasDunker

Description

@MatthiasDunker

Bug report

Describe the bug

I added my own field. Visually it is some kind of schedule which is saved in JSON format and as longtext in the mySQL database. As it has some columns I wish it to be taking maximum available space in the admin UI to provide a good user experience, but instead it gets rendered taking 6 of the 12 available grid cols.
To get this working, I tried to overwrite the content-manager plugin and to set 12 cols as default size for components. But it does not seem to work (still taking 50 % of the space). Either the original file won’t be overwritten or I am looking at the wrong place.

Steps to reproduce the behavior

  1. Copy file packages/strapi-plugin-content-manager/admin/src/utils/layout.js to ./extensions/content-manager/admin/src/utils/layout.js
  2. Change default col span from 6 to 12 (see code snippet below).
  3. Rebuild Admin UI with yarn build
  4. Components still render with class .col-6 and take 50 % of the available space.

Expected behavior

Expecting the wrapper for the field to render with class="col-12" or class="col".

Code snippets

Here I altered default size of 6 to 12 (I guessed).

// ./extensions/content-manager/admin/src/utils/layout.js
const getInputSize = type => {
 switch (type) {
   case 'boolean':
   case 'date':
   case 'integer':
   case 'float':
   case 'biginteger':
   case 'decimal':
   case 'time':
     return 4;
   case 'json':
   case 'component':
   case 'richtext':
   case 'dynamiczone':
     return 12;
   default:
     // return 6;
     return 12;
 }
};

System

I am working with the latest docker image started by a docker-compose.yml

version: "3"

services:
  strapi:
    image: strapi/strapi
    container_name: ig-corporate-strapi
    restart: unless-stopped
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: ${DATABASE_HOST}
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
    networks:
      - ig-corporate-network
    volumes:
      - ./app:/srv/app
    ports:
      - "1337:1337"
      - "8010:8000" # admin dev mode
    depends_on:
      - mysql

  mysql:
    image: mysql:5.7
    container_name: ig-corporate-mysql
    restart: unless-stopped
    command: --default-authentication-plugin=mysql_native_password
    env_file: .env
    environment:
      MYSQL_DATABASE: ${DATABASE_NAME}
      MYSQL_USER: ${DATABASE_USERNAME}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
    networks:
      - ig-corporate-network
    volumes:
      - ./db:/var/lib/mysql
    ports:
      - 3306:3306

networks:
  ig-corporate-network:
    driver: bridge

volumes:
  strapidata:

#8094 could be a relational issue

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions