mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
Source default login logo from static files
This commit is contained in:
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -7,7 +7,7 @@ import { LoginForm, LoginPage as PFLoginPage } from '@patternfly/react-core';
|
|||||||
import { RootAPI } from '../../api';
|
import { RootAPI } from '../../api';
|
||||||
import { BrandName } from '../../variables';
|
import { BrandName } from '../../variables';
|
||||||
|
|
||||||
import brandLogo from './brand-logo.svg';
|
const loginLogoSrc = '/static/media/logo-login.svg';
|
||||||
|
|
||||||
const LoginPage = styled(PFLoginPage)`
|
const LoginPage = styled(PFLoginPage)`
|
||||||
& .pf-c-brand {
|
& .pf-c-brand {
|
||||||
@@ -46,11 +46,13 @@ class AWXLogin extends Component {
|
|||||||
const {
|
const {
|
||||||
data: { custom_logo, custom_login_info },
|
data: { custom_logo, custom_login_info },
|
||||||
} = await RootAPI.read();
|
} = await RootAPI.read();
|
||||||
const logo = custom_logo ? `data:image/jpeg;${custom_logo}` : brandLogo;
|
const logo = custom_logo
|
||||||
|
? `data:image/jpeg;${custom_logo}`
|
||||||
|
: loginLogoSrc;
|
||||||
|
|
||||||
this.setState({ logo, loginInfo: custom_login_info });
|
this.setState({ logo, loginInfo: custom_login_info });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({ logo: brandLogo });
|
this.setState({ logo: loginLogoSrc });
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ describe('<Login />', () => {
|
|||||||
);
|
);
|
||||||
const { loginHeaderLogo } = await findChildren(loginWrapper);
|
const { loginHeaderLogo } = await findChildren(loginWrapper);
|
||||||
const { alt, src } = loginHeaderLogo.props();
|
const { alt, src } = loginHeaderLogo.props();
|
||||||
expect([alt, src]).toEqual(['AWX', 'brand-logo.svg']);
|
expect(alt).toEqual('AWX');
|
||||||
|
expect(src).toContain('logo-login.svg');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -109,7 +110,8 @@ describe('<Login />', () => {
|
|||||||
);
|
);
|
||||||
const { loginHeaderLogo } = await findChildren(loginWrapper);
|
const { loginHeaderLogo } = await findChildren(loginWrapper);
|
||||||
const { alt, src } = loginHeaderLogo.props();
|
const { alt, src } = loginHeaderLogo.props();
|
||||||
expect([alt, src]).toEqual(['AWX', 'brand-logo.svg']);
|
expect(alt).toEqual('AWX');
|
||||||
|
expect(src).toContain('logo-login.svg');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user