import ComputeEngineServiceMock from '../../../../../api/mocks/ComputeEngineServiceMock';
import DopTranslationServiceMock from '../../../../../api/mocks/DopTranslationServiceMock';
import GithubProvisioningServiceMock from '../../../../../api/mocks/GithubProvisioningServiceMock';
+import GitlabProvisioningServiceMock from '../../../../../api/mocks/GitlabProvisioningServiceMock';
import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock';
import SystemServiceMock from '../../../../../api/mocks/SystemServiceMock';
import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext';
let settingsHandler: SettingsServiceMock;
let computeEngineHandler: ComputeEngineServiceMock;
let dopTranslationHandler: DopTranslationServiceMock;
+let gitlabHandler: GitlabProvisioningServiceMock;
const mockedGitHubConfigurationResponse = mockGitHubConfiguration({
apiUrl: 'API url',
system = new SystemServiceMock();
settingsHandler = new SettingsServiceMock();
computeEngineHandler = new ComputeEngineServiceMock();
+ gitlabHandler = new GitlabProvisioningServiceMock();
});
afterEach(() => {
system.reset();
computeEngineHandler.reset();
dopTranslationHandler.reset();
+ gitlabHandler.reset();
});
const ghContainer = byRole('tabpanel', { name: 'github GitHub' });
updateGitHubConfiguration,
} from '../api/dop-translation';
import { translate } from '../helpers/l10n';
+import { ProvisioningType } from '../types/provisioning';
+import { useSyncWithGitHubNow } from './identity-provider/github';
/*
* Project bindings
export function useUpdateGitHubConfigurationMutation() {
const client = useQueryClient();
+ const { canSyncNow, synchronizeNow } = useSyncWithGitHubNow();
return useMutation({
mutationFn: ({
gitHubConfiguration,
});
client.setQueryData(['dop-translation', 'github-configs', 'fetch'], gitHubConfiguration);
client.invalidateQueries({ queryKey: ['identity_provider'] });
+ if (canSyncNow && gitHubConfiguration.provisioningType === ProvisioningType.auto) {
+ synchronizeNow();
+ }
addGlobalSuccessMessage(translate('settings.authentication.form.settings.save_success'));
},
});
import { mapReactQueryResult } from '../../helpers/react-query';
import { AlmSyncStatus, DevopsRolesMapping, ProvisioningType } from '../../types/provisioning';
import { TaskStatuses, TaskTypes } from '../../types/tasks';
-import { createQueryHook, StaleTime } from '../common';
+import { StaleTime, createQueryHook } from '../common';
export function useGitLabConfigurationsQuery() {
return useQuery({
export function useUpdateGitLabConfigurationMutation() {
const client = useQueryClient();
+ const { canSyncNow, synchronizeNow } = useSyncWithGitLabNow();
+
return useMutation({
mutationFn: ({
id,
total: 1,
},
});
+ if (canSyncNow && data.provisioningType === ProvisioningType.auto) {
+ synchronizeNow();
+ }
addGlobalSuccessMessage(translate('settings.authentication.form.settings.save_success'));
},
});