Skip to content

Commit

Permalink
Merge pull request #1000 from cdapio/bugfix/CDAP-20605
Browse files Browse the repository at this point in the history
  • Loading branch information
de-lan authored May 3, 2023
2 parents ea4d6d1 + 23b939b commit f813dc4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ISourceControlManagementConfig } from './types';
import SourceControlManagementForm from './SourceControlManagementForm';
import PrimaryTextButton from 'components/shared/Buttons/PrimaryTextButton';
import { getCurrentNamespace } from 'services/NamespaceStore';
import { validateSourceControlManagement } from '../store/ActionCreator';
import { getSourceControlManagement } from '../store/ActionCreator';
import Alert from 'components/shared/Alert';
import ButtonLoadingHoc from 'components/shared/Buttons/ButtonLoadingHoc';

Expand Down Expand Up @@ -75,7 +75,7 @@ export const SourceControlManagement = () => {
const validateConfigAndRedirect = () => {
setLoading(true);
const namespace = getCurrentNamespace();
validateSourceControlManagement(namespace).subscribe(
getSourceControlManagement(namespace).subscribe(
() => {
window.location.href = `/ns/${namespace}/scm/sync`;
},
Expand Down
17 changes: 0 additions & 17 deletions app/cdap/components/NamespaceAdmin/store/ActionCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,6 @@ export const addOrValidateSourceControlManagementForm = (
).map(() => getAndSetSourceControlManagement(namespace));
};

// This validation function directly reads config from api and validate
export const validateSourceControlManagement = (namespace) => {
return getSourceControlManagement(namespace).pipe(
switchMap((res: any) => {
const [config, token] = res;
config.auth.token = token;
return MyNamespaceApi.setSourceControlManagement(
{ namespace },
getBodyForSubmit(config, true)
);
}),
catchError((err) => {
throw err;
})
);
};

export const deleteSourceControlManagement = (
namespace,
formState: ISourceControlManagementConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import IconSVG from 'components/shared/IconSVG';
import PrimaryOutlinedButton from 'components/shared/Buttons/PrimaryOutlinedButton';
import { defaultState, PullPipelineWizard, reducer } from './PullPipelineWizard';
import PrimaryContainedButton from 'components/shared/Buttons/PrimaryContainedButton';
import { validateSourceControlManagement } from 'components/NamespaceAdmin/store/ActionCreator';
import { getSourceControlManagement } from 'components/NamespaceAdmin/store/ActionCreator';
import ButtonLoadingHoc from 'components/shared/Buttons/ButtonLoadingHoc';
import { useFeatureFlagDefaultFalse } from 'services/react/customHooks/useFeatureFlag';
import { getHydratorUrl } from 'services/UiUtils/UrlGenerator';
Expand Down Expand Up @@ -113,7 +113,7 @@ export default function ResourceCenterPipelineEntity({

const pullPipelineBtnHandler = () => {
dispatch({ type: 'SET_LOADING', payload: { loading: true } });
validateSourceControlManagement(namespace).subscribe(
getSourceControlManagement(namespace).subscribe(
() => {
dispatch({ type: 'TOGGLE_MODAL' });
},
Expand Down

0 comments on commit f813dc4

Please sign in to comment.