mirror of
https://github.com/ansible/awx.git
synced 2026-04-17 16:00:18 -02:30
Add RBAC to org views
This commit is contained in:
@@ -16,11 +16,14 @@ class Provider extends Component {
|
||||
version: null,
|
||||
custom_logo: null,
|
||||
custom_login_info: null,
|
||||
me: {},
|
||||
...props.value
|
||||
}
|
||||
};
|
||||
|
||||
this.fetchConfig = this.fetchConfig.bind(this);
|
||||
this.fetchMe = this.fetchMe.bind(this);
|
||||
this.updateConfig = this.updateConfig.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
@@ -30,6 +33,47 @@ class Provider extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
updateConfig = (config) => {
|
||||
const {
|
||||
ansible_version,
|
||||
custom_virtualenvs,
|
||||
version
|
||||
} = config;
|
||||
|
||||
this.setState(prevState => ({
|
||||
value: {
|
||||
...prevState.value,
|
||||
ansible_version,
|
||||
custom_virtualenvs,
|
||||
version
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
async fetchMe () {
|
||||
const { api, handleHttpError } = this.props;
|
||||
try {
|
||||
const { data: { results: [me] } } = await api.getMe();
|
||||
this.setState(prevState => ({
|
||||
value: {
|
||||
...prevState.value,
|
||||
me
|
||||
},
|
||||
}));
|
||||
} catch (err) {
|
||||
handleHttpError(err) || this.setState({
|
||||
value: {
|
||||
ansible_version: null,
|
||||
custom_virtualenvs: null,
|
||||
version: null,
|
||||
custom_logo: null,
|
||||
custom_login_info: null,
|
||||
me: {}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async fetchConfig () {
|
||||
const { api, handleHttpError } = this.props;
|
||||
|
||||
@@ -47,13 +91,15 @@ class Provider extends Component {
|
||||
custom_login_info
|
||||
}
|
||||
} = await api.getRoot();
|
||||
const { data: { results: [me] } } = await api.getMe();
|
||||
this.setState({
|
||||
value: {
|
||||
ansible_version,
|
||||
custom_virtualenvs,
|
||||
version,
|
||||
custom_logo,
|
||||
custom_login_info
|
||||
custom_login_info,
|
||||
me
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
@@ -63,7 +109,8 @@ class Provider extends Component {
|
||||
custom_virtualenvs: null,
|
||||
version: null,
|
||||
custom_logo: null,
|
||||
custom_login_info: null
|
||||
custom_login_info: null,
|
||||
me: {}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -75,7 +122,13 @@ class Provider extends Component {
|
||||
const { children } = this.props;
|
||||
|
||||
return (
|
||||
<ConfigContext.Provider value={value}>
|
||||
<ConfigContext.Provider
|
||||
value={{
|
||||
...(propsValue || stateValue),
|
||||
fetchMe: this.fetchMe,
|
||||
updateConfig: this.updateConfig
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ConfigContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user