Commit a289e20d authored by Fernando's avatar Fernando

Rework loading state

* Rework hasLoading to use isLoading
* Remove unused mutations due to set endpoint action being removed
* Remove hasLoading mutations
parent 406e57ce
......@@ -53,11 +53,11 @@ export default {
...this.getInitialData(),
};
// TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/235114
if(this.glFeatures.approvalSuggestions){
return { ...defaults, name: this.defaultRuleName || ''};
if (this.glFeatures.approvalSuggestions) {
return { ...defaults, name: this.defaultRuleName || '' };
}
return defaults
return defaults;
},
computed: {
...mapState(['settings']),
......
......@@ -23,11 +23,11 @@ export default {
...mapState('securityConfiguration', ['configuration']),
...mapState({
rules: state => state.approvals.rules,
hasApprovalsLoaded: state => state.approvals.hasLoaded,
hasSecurityConfigurationLoaded: state => state.securityConfiguration.hasLoaded,
isApprovalsLoading: state => state.approvals.isLoading,
isSecurityConfigurationLoading: state => state.securityConfiguration.isLoading,
}),
isRulesLoading() {
return !this.hasApprovalsLoaded || !this.hasSecurityConfigurationLoaded;
return this.isApprovalsLoading || this.isSecurityConfigurationLoading;
},
securityRules() {
return [
......
......@@ -2,9 +2,7 @@ import axios from '~/lib/utils/axios_utils';
import * as Sentry from '@sentry/browser';
import * as types from './mutation_types';
export const setSecurityConfigurationEndpoint = ({ commit }, endpoint) =>
commit(types.SET_SECURITY_CONFIGURATION_ENDPOINT, endpoint);
// eslint-disable-next-line import/prefer-default-export
export const fetchSecurityConfiguration = ({ commit, state }) => {
if (!state.securityConfigurationPath) {
return commit(types.RECEIVE_SECURITY_CONFIGURATION_ERROR);
......
export const SET_SECURITY_CONFIGURATION_ENDPOINT = 'SET_SECURITY_CONFIGURATION_ENDPOINT';
export const REQUEST_SECURITY_CONFIGURATION = 'REQUEST_SECURITY_CONFIGURATION';
export const RECEIVE_SECURITY_CONFIGURATION_SUCCESS = 'RECEIVE_SECURITY_CONFIGURATION_SUCCESS';
export const RECEIVE_SECURITY_CONFIGURATION_ERROR = 'RECEIVE_SECURITY_CONFIGURATION_ERROR';
import * as types from './mutation_types';
export default {
[types.SET_SECURITY_CONFIGURATION_ENDPOINT](state, payload) {
state.securityConfigurationPath = payload;
},
[types.REQUEST_SECURITY_CONFIGURATION](state) {
state.isLoading = true;
state.errorLoading = false;
},
[types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS](state, payload) {
state.isLoading = false;
state.hasLoaded = true;
state.errorLoading = false;
state.configuration = payload;
},
......
export default ({ securityConfigurationPath }) => ({
securityConfigurationPath,
isLoading: false,
hasLoaded: false,
errorLoading: false,
configuration: {},
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment