mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-16 00:06:40 +01: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,6 +170,8 @@ const ApiTokenCreate = ({
|
|||||||
id='api_key_type'
|
id='api_key_type'
|
||||||
name="type" className={undefined} classes={undefined}
|
name="type" className={undefined} classes={undefined}
|
||||||
/>
|
/>
|
||||||
|
<ConditionallyRender condition={uiConfig.flags.E} show={
|
||||||
|
<>
|
||||||
<MySelect
|
<MySelect
|
||||||
disabled={data.type === TYPE_ADMIN}
|
disabled={data.type === TYPE_ADMIN}
|
||||||
options={selectableProjects}
|
options={selectableProjects}
|
||||||
@ -184,7 +189,11 @@ const ApiTokenCreate = ({
|
|||||||
onChange={setEnvironment}
|
onChange={setEnvironment}
|
||||||
label="Environment"
|
label="Environment"
|
||||||
id='api_key_environment'
|
id='api_key_environment'
|
||||||
name="environment" className={undefined} classes={undefined} />
|
name="environment" className={undefined} classes={undefined}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
} />
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</Dialogue>
|
</Dialogue>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user