1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

refactor: improve GeneralSelect prop types (#841)

* refactor: improve GeneralSelect prop types

* refactor: intercept ui config requests in auth spec
This commit is contained in:
olav 2022-04-06 12:08:57 +02:00 committed by GitHub
parent 6efa9fe75c
commit 73652b66e9
4 changed files with 19 additions and 21 deletions

View File

@ -4,7 +4,7 @@ export {};
describe('auth', () => { describe('auth', () => {
it('renders the password login', () => { it('renders the password login', () => {
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: false, defaultHidden: false,
@ -29,7 +29,7 @@ describe('auth', () => {
}); });
it('renders does not render password login if defaultHidden is true', () => { it('renders does not render password login if defaultHidden is true', () => {
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: true, defaultHidden: true,
@ -48,7 +48,7 @@ describe('auth', () => {
it('renders google auth when options are specified', () => { it('renders google auth when options are specified', () => {
const ssoPath = '/auth/google/login'; const ssoPath = '/auth/google/login';
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: true, defaultHidden: true,
@ -77,7 +77,7 @@ describe('auth', () => {
it('renders oidc auth when options are specified', () => { it('renders oidc auth when options are specified', () => {
const ssoPath = '/auth/oidc/login'; const ssoPath = '/auth/oidc/login';
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: true, defaultHidden: true,
@ -106,7 +106,7 @@ describe('auth', () => {
it('renders saml auth when options are specified', () => { it('renders saml auth when options are specified', () => {
const ssoPath = '/auth/saml/login'; const ssoPath = '/auth/saml/login';
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: true, defaultHidden: true,
@ -133,7 +133,7 @@ describe('auth', () => {
}); });
it('can visit forgot password when password auth is enabled', () => { it('can visit forgot password when password auth is enabled', () => {
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: false, defaultHidden: false,
@ -151,7 +151,7 @@ describe('auth', () => {
it('renders demo auth correctly', () => { it('renders demo auth correctly', () => {
const email = 'hello@hello.com'; const email = 'hello@hello.com';
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: false, defaultHidden: false,
@ -174,7 +174,7 @@ describe('auth', () => {
it('renders email auth correctly', () => { it('renders email auth correctly', () => {
const email = 'hello@hello.com'; const email = 'hello@hello.com';
cy.intercept('GET', '/api/admin/user', { cy.intercept('GET', '/api/admin/**', {
statusCode: 401, statusCode: 401,
body: { body: {
defaultHidden: false, defaultHidden: false,

View File

@ -92,7 +92,6 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
label="Token Type" label="Token Type"
id="api_key_type" id="api_key_type"
name="type" name="type"
// @ts-expect-error
IconComponent={KeyboardArrowDownOutlined} IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput} className={styles.selectInput}
/> />
@ -105,7 +104,8 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
options={selectableProjects} options={selectableProjects}
onChange={e => setProject(e.target.value as string)} onChange={e => setProject(e.target.value as string)}
label="Project" label="Project"
// @ts-expect-error id="api_key_project"
name="project"
IconComponent={KeyboardArrowDownOutlined} IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput} className={styles.selectInput}
/> />
@ -120,7 +120,6 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
label="Environment" label="Environment"
id="api_key_environment" id="api_key_environment"
name="environment" name="environment"
// @ts-expect-error
IconComponent={KeyboardArrowDownOutlined} IconComponent={KeyboardArrowDownOutlined}
className={styles.selectInput} className={styles.selectInput}
/> />

View File

@ -125,14 +125,7 @@ export const ConstraintAccordionEditHeader = ({
autoFocus autoFocus
options={constraintNameOptions} options={constraintNameOptions}
value={localConstraint.contextName || ''} value={localConstraint.contextName || ''}
onChange={( onChange={e => setContextName(String(e.target.value))}
e: React.ChangeEvent<{
name?: string;
value: unknown;
}>
) => {
setContextName(e.target.value as string);
}}
className={styles.headerSelect} className={styles.headerSelect}
/> />
</div> </div>

View File

@ -1,5 +1,11 @@
import React from 'react'; import React from 'react';
import { FormControl, InputLabel, MenuItem, Select } from '@material-ui/core'; import {
FormControl,
InputLabel,
MenuItem,
Select,
SelectProps,
} from '@material-ui/core';
import { SELECT_ITEM_ID } from 'utils/testIds'; import { SELECT_ITEM_ID } from 'utils/testIds';
import { KeyboardArrowDownOutlined } from '@material-ui/icons'; import { KeyboardArrowDownOutlined } from '@material-ui/icons';
@ -10,7 +16,7 @@ export interface ISelectOption {
disabled?: boolean; disabled?: boolean;
} }
export interface ISelectMenuProps { export interface ISelectMenuProps extends SelectProps {
name: string; name: string;
id: string; id: string;
value?: string; value?: string;