Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import IntegrationsSection from './IntegrationsSection';
const IntegrationTilesPage = ({
apiTokens,
clusterInitBundles,
authProviders,
backups,
imageIntegrations,
notifiers,
Expand All @@ -29,13 +28,14 @@ const IntegrationTilesPage = ({

switch (source) {
case 'authProviders': {
// Integrations Authentication Tokens differ from Access Control Auth providers.
if (type === 'apitoken') {
return apiTokens;
}
if (type === 'clusterInitBundle') {
return clusterInitBundles;
}
return authProviders.filter(typeLowerMatches);
return [];
}
case 'notifiers': {
return notifiers.filter(typeLowerMatches);
Expand Down Expand Up @@ -126,11 +126,6 @@ const IntegrationTilesPage = ({
};

IntegrationTilesPage.propTypes = {
authProviders: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
})
).isRequired,
apiTokens: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
Expand All @@ -153,7 +148,6 @@ IntegrationTilesPage.propTypes = {
};

const mapStateToProps = createStructuredSelector({
authProviders: selectors.getAuthProviders,
apiTokens: selectors.getAPITokens,
clusterInitBundles: selectors.getClusterInitBundles,
notifiers: selectors.getNotifiers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { selectors } from 'reducers';
import { Integration, IntegrationSource, IntegrationType } from '../utils/integrationUtils';

const selectIntegrations = createStructuredSelector({
authProviders: selectors.getAuthProviders,
apiTokens: selectors.getAPITokens,
clusterInitBundles: selectors.getClusterInitBundles,
notifiers: selectors.getNotifiers,
Expand All @@ -26,7 +25,6 @@ const useIntegrations = ({ source, type }: UseIntegrations): UseIntegrationsResp
const {
apiTokens,
clusterInitBundles,
authProviders,
notifiers,
backups,
imageIntegrations,
Expand All @@ -39,13 +37,14 @@ const useIntegrations = ({ source, type }: UseIntegrations): UseIntegrationsResp

switch (source) {
case 'authProviders': {
// Integrations Authentication Tokens differ from Access Control Auth providers.
if (type === 'apitoken') {
return apiTokens;
}
if (type === 'clusterInitBundle') {
return clusterInitBundles;
}
return authProviders.filter(typeLowerMatches);
return [];
}
case 'notifiers': {
return notifiers.filter(typeLowerMatches);
Expand Down
18 changes: 2 additions & 16 deletions ui/apps/platform/src/sagas/authSagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import queryString from 'qs';
import Raven from 'raven-js';
import { Base64 } from 'js-base64';

import {
loginPath,
testLoginResultsPath,
accessControlPath,
authResponsePrefix,
integrationsPath,
} from 'routePaths';
import { takeEveryLocation, takeEveryNewlyMatchedLocation } from 'utils/sagaEffects';
import { loginPath, testLoginResultsPath, authResponsePrefix } from 'routePaths';
import { takeEveryLocation } from 'utils/sagaEffects';
import * as AuthService from 'services/AuthService';
import fetchUsersAttributes from 'services/AttributesService';
import { fetchUserRolePermissions } from 'services/RolesService';
Expand Down Expand Up @@ -339,13 +333,6 @@ function* watchDeleteAuthProvider() {
yield takeLatest(types.DELETE_AUTH_PROVIDER, deleteAuthProvider);
}

function* watchLocationForAuthProviders() {
const effects = [accessControlPath, integrationsPath].map((path) =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to remove accessControlPath? Or is it still used for something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will follow up to remove the other references.

takeEveryNewlyMatchedLocation(path, getAuthProviders)
);
yield all(effects);
}

function* fetchAvailableProviderTypes() {
try {
const result = yield call(AuthService.fetchAvailableProviderTypes);
Expand Down Expand Up @@ -383,7 +370,6 @@ export default function* auth() {
}

yield all([
fork(watchLocationForAuthProviders),
takeEveryLocation(loginPath, handleLoginPageRedirect),
fork(watchSaveAuthProvider),
fork(watchDeleteAuthProvider),
Expand Down
22 changes: 0 additions & 22 deletions ui/apps/platform/src/sagas/authSagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,6 @@ const createStateSelectors = (authProviders = [], authStatus = AUTH_STATUS.LOADI
];

describe('Auth Sagas', () => {
it('should get and put auth providers when on access page', () => {
const authProviders = [{ name: 'ap1', validated: true }];
const fetchMock = jest
.fn()
.mockReturnValueOnce({ response: [] })
.mockReturnValueOnce({ response: authProviders });

return expectSaga(saga)
.provide([
...createStateSelectors(),
[call(AuthService.fetchAuthProviders), dynamic(fetchMock)],
[call(AuthService.fetchLoginAuthProviders), dynamic(fetchMock)],
[call(AuthService.logout), null],
[call(fetchUserRolePermissions), { response: {} }],
[call(AuthService.fetchAvailableProviderTypes), { response: [] }],
])
.put(actions.fetchAuthProviders.success(authProviders))
.dispatch(createLocationChange('/'))
.dispatch(createLocationChange('/main/access'))
.silentRun();
});

it('should not do a service call to get auth providers when location changes to violations, policies, etc.', () => {
const fetchMock = jest.fn().mockReturnValue({ response: [] });
return expectSaga(saga)
Expand Down