Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Roles in React is not defined #6733

Closed
xAgustin93 opened this issue Jun 18, 2020 · 14 comments · Fixed by #6738
Closed

Open Roles in React is not defined #6733

xAgustin93 opened this issue Jun 18, 2020 · 14 comments · Fixed by #6738

Comments

@xAgustin93
Copy link

Describe the bug
When you try to configure some role it fails that React is not defined

Steps to reproduce the behavior

  1. Go to roles
  2. Open one role
  3. See error

Screenshots
Captura de pantalla 2020-06-18 a las 21 47 00

System

  • Node.js version: v12.18.0
  • NPM version: 6.14.4
  • Strapi version: 3.0.3
  • Database: MongoDB
  • Operating system: MacOS
@aramane
Copy link

aramane commented Jun 18, 2020

Hello,
I have exactly the same problem.

System

  • Node.js version: v13.9.0
  • NPM version: 6.9.0
  • Strapi version: 3.0.3
  • Database: Mysql
  • Operating system: Windows 10

@kzkr
Copy link

kzkr commented Jun 18, 2020

Same here on Strapi version: 3.0.3
Thank you!

@1005hoon
Copy link

Same problem here on strapi version 3.0.3

@barbudour
Copy link

Some problem, version: 3.0.3

@jodacame
Copy link

jodacame commented Jun 18, 2020

Same problem, version: 3.0.3

@christopher4lis
Copy link

Also receiving this issue on v 3.0.3

@tahaygun
Copy link

Same problem, version 3.0.3

1 similar comment
@brandonrbridges
Copy link

Same problem, version 3.0.3

@dngrhm
Copy link

dngrhm commented Jun 19, 2020

Same problem
Version 3.0.3
OS Ubuntu 18.04
Database: Postgres

@xiaoyuch
Copy link

Same problem
Version 3.0.3
OS macos 10.15.5
Database: Mongodb

@impochun
Copy link

same problem.

Strapi version: 3.0.3 (node v12.18.1)
OS: Ubuntu 20.04 LTS

I followed the docs - Quick Start Guild to install & get familiar with Strapi, when I try to do "7. Set Roles and Permissions", this error shows.
At the same time, all others functions are normal.

@imaksp
Copy link
Contributor

imaksp commented Jun 19, 2020

@alexandrebodin may be related to this pull #6663, I think you should make new release, as strapi is now stable & this is breaking

@Lurtt
Copy link

Lurtt commented Jun 19, 2020

same problem!

soupette added a commit that referenced this issue Jun 19, 2020
Signed-off-by: soupette <cyril.lpz@gmail.com>
@soupette soupette mentioned this issue Jun 19, 2020
@soupette
Copy link
Contributor

soupette commented Jun 19, 2020

Hello @everyone there is an open PR that fixes the issue. We are really sorry about this issue and it should not have happened. In the meantime, until the release is made here's a workaround to make your administration works:

  1. Create a the extensions/users-permissions/admin/src/components/Controller/index.js file:
mkdir -p extensions/users-permissions/admin/src/components/Controller
touch extensions/users-permissions/admin/src/components/Controller/index.js
  1. Copy the following content:
/**
 *
 * Controller
 *
 */
import React from 'react';
import PropTypes from 'prop-types';
import { get, map } from 'lodash';
import { FormattedMessage } from 'react-intl';
import pluginId from '../../pluginId';
import { useEditPageContext } from '../../contexts/EditPage';
import InputCheckbox from '../InputCheckboxPlugin';

import { Header, Label, Separator, Wrapper } from './Components';

function Controller({ actions, inputNamePath, isOpen, name, inputSelected, setInputSelected }) {
  const { selectAllActions } = useEditPageContext();

  const areAllActionsSelected = () => {
    return Object.keys(actions).every(action => actions[action].enabled === true);
  };

  const handleChange = () => {
    selectAllActions(`${inputNamePath}.controllers.${name}`, !areAllActionsSelected());
  };

  const hasSomeActionsSelected = () => {
    return Object.keys(actions).some(action => actions[action].enabled === true);
  };

  const setNewInputSelected = name => {
    setInputSelected(name);
  };

  const labelId = areAllActionsSelected() ? 'unselectAll' : 'selectAll';

  return (
    <Wrapper>
      <Header>
        <div>{name}</div>
        <Separator />
        <div className="checkbox-wrapper">
          <div className="form-check">
            <Label
              className={`form-check-label ${areAllActionsSelected() &&
                'checked'} ${!areAllActionsSelected() &&
                hasSomeActionsSelected() &&
                'some-checked'}`}
              htmlFor={name}
            >
              <input
                className="form-check-input"
                checked={areAllActionsSelected()}
                id={name}
                name={name}
                onChange={handleChange}
                type="checkbox"
              />
              <FormattedMessage id={`${pluginId}.Controller.${labelId}`} />
            </Label>
          </div>
        </div>
      </Header>
      <div className="row">
        {map(Object.keys(actions).sort(), actionKey => (
          <InputCheckbox
            inputSelected={inputSelected}
            isOpen={isOpen}
            key={actionKey}
            label={actionKey}
            name={`${inputNamePath}.controllers.${name}.${actionKey}.enabled`}
            setNewInputSelected={setNewInputSelected}
            value={get(actions[actionKey], 'enabled')}
          />
        ))}
      </div>
    </Wrapper>
  );
}

Controller.defaultProps = {
  actions: {},
  inputNamePath: 'permissions.application',
  name: '',
};

Controller.propTypes = {
  actions: PropTypes.object,
  inputNamePath: PropTypes.string,
  isOpen: PropTypes.bool.isRequired,
  name: PropTypes.string,
};

export default Controller;
  1. Rebuild your app
# Using yarn
yarn strapi build --clean
# Using npm
npm run strapi build --clean

alexandrebodin added a commit that referenced this issue Jun 19, 2020
iicdii pushed a commit to iicdii/strapi that referenced this issue Jul 2, 2020
Signed-off-by: soupette <cyril.lpz@gmail.com>
Signed-off-by: harimkims <harimkims@gmail.com>
alexandrebodin added a commit that referenced this issue Aug 12, 2020
* Fixes #6733

Signed-off-by: soupette <cyril.lpz@gmail.com>

* v3.0.4

* Added instructions for installing the `pg` node module

I believe this is necessary to deploy to Google app engine - my deployment didn't work until I did this

* Revert "Added instructions for installing the `pg` node module"

This reverts commit 3da33ec.

Co-authored-by: soupette <cyril.lpz@gmail.com>
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.