mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02:00
fix: api-token only show env if enabled
This commit is contained in:
parent
0253bdedba
commit
b3f099c034
@ -5,6 +5,8 @@ import { styles as commonStyles } from '../../../component/common';
|
|||||||
import { IApiTokenCreate } from '../../../hooks/api/actions/useApiTokensApi/useApiTokensApi';
|
import { IApiTokenCreate } from '../../../hooks/api/actions/useApiTokensApi/useApiTokensApi';
|
||||||
import useEnvironments from '../../../hooks/api/getters/useEnvironments/useEnvironments';
|
import useEnvironments from '../../../hooks/api/getters/useEnvironments/useEnvironments';
|
||||||
import useProjects from '../../../hooks/api/getters/useProjects/useProjects';
|
import useProjects from '../../../hooks/api/getters/useProjects/useProjects';
|
||||||
|
import useUiConfig from '../../../hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
|
import ConditionallyRender from '../../common/ConditionallyRender';
|
||||||
import Dialogue from '../../common/Dialogue';
|
import Dialogue from '../../common/Dialogue';
|
||||||
import MySelect from '../../common/select';
|
import MySelect from '../../common/select';
|
||||||
import { useStyles } from './styles';
|
import { useStyles } from './styles';
|
||||||
@ -40,6 +42,7 @@ const ApiTokenCreate = ({
|
|||||||
const [error, setError] = useState<IDataError>({});
|
const [error, setError] = useState<IDataError>({});
|
||||||
const { projects } = useProjects();
|
const { projects } = useProjects();
|
||||||
const { environments } = useEnvironments();
|
const { environments } = useEnvironments();
|
||||||
|
const { uiConfig } = useUiConfig();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(environments && environments.length > 0 && data.type === TYPE_CLIENT && !data.environment) {
|
if(environments && environments.length > 0 && data.type === TYPE_CLIENT && !data.environment) {
|
||||||
@ -167,24 +170,30 @@ const ApiTokenCreate = ({
|
|||||||
id='api_key_type'
|
id='api_key_type'
|
||||||
name="type" className={undefined} classes={undefined}
|
name="type" className={undefined} classes={undefined}
|
||||||
/>
|
/>
|
||||||
<MySelect
|
<ConditionallyRender condition={uiConfig.flags.E} show={
|
||||||
disabled={data.type === TYPE_ADMIN}
|
<>
|
||||||
options={selectableProjects}
|
<MySelect
|
||||||
value={data.project}
|
disabled={data.type === TYPE_ADMIN}
|
||||||
onChange={setProject}
|
options={selectableProjects}
|
||||||
label="Project"
|
value={data.project}
|
||||||
id='api_key_project'
|
onChange={setProject}
|
||||||
name="project" className={undefined} classes={undefined}
|
label="Project"
|
||||||
/>
|
id='api_key_project'
|
||||||
<MySelect
|
name="project" className={undefined} classes={undefined}
|
||||||
disabled={data.type === TYPE_ADMIN}
|
/>
|
||||||
options={selectableEnvs}
|
<MySelect
|
||||||
value={data.environment}
|
disabled={data.type === TYPE_ADMIN}
|
||||||
required
|
options={selectableEnvs}
|
||||||
onChange={setEnvironment}
|
value={data.environment}
|
||||||
label="Environment"
|
required
|
||||||
id='api_key_environment'
|
onChange={setEnvironment}
|
||||||
name="environment" className={undefined} classes={undefined} />
|
label="Environment"
|
||||||
|
id='api_key_environment'
|
||||||
|
name="environment" className={undefined} classes={undefined}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
} />
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</Dialogue>
|
</Dialogue>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user