mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	Add upgrade plan
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
		
							parent
							
								
									5bbdccc9d2
								
							
						
					
					
						commit
						cc8944c20f
					
				@ -65,7 +65,7 @@ const UpgradePlanModal = ({ isOpen, onToggle }) => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
UpgradePlanModal.defaultProps = {
 | 
			
		||||
  isOpen: true,
 | 
			
		||||
  isOpen: false,
 | 
			
		||||
  onToggle: () => {},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,12 @@
 | 
			
		||||
import React, { useEffect } from 'react';
 | 
			
		||||
import React, { useCallback, useEffect, useState } from 'react';
 | 
			
		||||
import { List, Header } from '@buffetjs/custom';
 | 
			
		||||
import { Pencil } from '@buffetjs/icons';
 | 
			
		||||
import { Button } from '@buffetjs/core';
 | 
			
		||||
import { Duplicate, Pencil, Plus } from '@buffetjs/icons';
 | 
			
		||||
import matchSorter from 'match-sorter';
 | 
			
		||||
import { useIntl } from 'react-intl';
 | 
			
		||||
import { useHistory } from 'react-router-dom';
 | 
			
		||||
import { useGlobalContext, useQuery, useUserPermissions } from 'strapi-helper-plugin';
 | 
			
		||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
 | 
			
		||||
import { ListButton, useGlobalContext, useQuery, useUserPermissions } from 'strapi-helper-plugin';
 | 
			
		||||
import adminPermissions from '../../../permissions';
 | 
			
		||||
import PageTitle from '../../../components/SettingsPageTitle';
 | 
			
		||||
import { EmptyRole, RoleListWrapper, RoleRow } from '../../../components/Roles';
 | 
			
		||||
@ -15,6 +17,7 @@ import BaselineAlignment from './BaselineAlignment';
 | 
			
		||||
const RoleListPage = () => {
 | 
			
		||||
  const { formatMessage } = useIntl();
 | 
			
		||||
  const { push } = useHistory();
 | 
			
		||||
  const [isOpen, setIsOpen] = useState(false);
 | 
			
		||||
  const { settingsBaseURL } = useGlobalContext();
 | 
			
		||||
  const { roles, isLoading } = useRolesList();
 | 
			
		||||
  const { toggleHeaderSearch } = useSettingsHeaderSearchContext();
 | 
			
		||||
@ -34,6 +37,21 @@ const RoleListPage = () => {
 | 
			
		||||
    // eslint-disable-next-line react-hooks/exhaustive-deps
 | 
			
		||||
  }, []);
 | 
			
		||||
 | 
			
		||||
  const handleToggle = useCallback(() => setIsOpen(prev => !prev), []);
 | 
			
		||||
 | 
			
		||||
  const headerActions = [
 | 
			
		||||
    {
 | 
			
		||||
      label: formatMessage({
 | 
			
		||||
        id: 'Settings.roles.list.button.add',
 | 
			
		||||
        defaultMessage: 'Add new role',
 | 
			
		||||
      }),
 | 
			
		||||
      onClick: handleToggle,
 | 
			
		||||
      color: 'primary',
 | 
			
		||||
      type: 'button',
 | 
			
		||||
      icon: true,
 | 
			
		||||
    },
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  const resultsCount = results.length;
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
@ -53,6 +71,7 @@ const RoleListPage = () => {
 | 
			
		||||
        })}
 | 
			
		||||
        // Show a loader in the header while requesting data
 | 
			
		||||
        isLoading={isLoading}
 | 
			
		||||
        actions={headerActions}
 | 
			
		||||
      />
 | 
			
		||||
      <BaselineAlignment />
 | 
			
		||||
      <RoleListWrapper>
 | 
			
		||||
@ -69,18 +88,36 @@ const RoleListPage = () => {
 | 
			
		||||
            <RoleRow
 | 
			
		||||
              canUpdate={canUpdate}
 | 
			
		||||
              links={[
 | 
			
		||||
                {
 | 
			
		||||
                  icon: <Duplicate fill="#0e1622" />,
 | 
			
		||||
                  onClick: handleToggle,
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                  icon: canUpdate ? <Pencil fill="#0e1622" /> : null,
 | 
			
		||||
                  onClick: () => push(`${settingsBaseURL}/roles/${role.id}`),
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                  icon: <FontAwesomeIcon icon="trash-alt" />,
 | 
			
		||||
                  onClick: handleToggle,
 | 
			
		||||
                },
 | 
			
		||||
              ]}
 | 
			
		||||
              role={role}
 | 
			
		||||
            />
 | 
			
		||||
          )}
 | 
			
		||||
        />
 | 
			
		||||
        {!resultsCount && !isLoading && <EmptyRole />}
 | 
			
		||||
        <ListButton>
 | 
			
		||||
          <Button
 | 
			
		||||
            onClick={handleToggle}
 | 
			
		||||
            icon={<Plus fill="#007eff" width="11px" height="11px" />}
 | 
			
		||||
            label={formatMessage({
 | 
			
		||||
              id: 'Settings.roles.list.button.add',
 | 
			
		||||
              defaultMessage: 'Add new role',
 | 
			
		||||
            })}
 | 
			
		||||
          />
 | 
			
		||||
        </ListButton>
 | 
			
		||||
      </RoleListWrapper>
 | 
			
		||||
      <UpgradePlanModal />
 | 
			
		||||
      <UpgradePlanModal isOpen={isOpen} onToggle={handleToggle} />
 | 
			
		||||
    </>
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -4,4 +4,4 @@ const fs = require('fs-extra');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const appAdminPath = path.join(__dirname, 'admin');
 | 
			
		||||
 | 
			
		||||
module.exports = fs.existsSync(path.join(appAdminPath, 'eee'));
 | 
			
		||||
module.exports = fs.existsSync(path.join(appAdminPath, 'ee'));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user