mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
[Gitar] Cleaning up stale flag: integrationEvents with value true (#7940)
This commit is contained in:
parent
48423fa980
commit
3a15fa7689
@ -52,7 +52,6 @@ import { IntegrationDelete } from './IntegrationDelete/IntegrationDelete';
|
||||
import { IntegrationStateSwitch } from './IntegrationStateSwitch/IntegrationStateSwitch';
|
||||
import { capitalizeFirst } from 'utils/capitalizeFirst';
|
||||
import { IntegrationHowToSection } from '../IntegrationHowToSection/IntegrationHowToSection';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
import { IntegrationEventsModal } from '../IntegrationEvents/IntegrationEventsModal';
|
||||
import AccessContext from 'contexts/AccessContext';
|
||||
|
||||
@ -116,7 +115,6 @@ export const IntegrationForm: VFC<IntegrationFormProps> = ({
|
||||
});
|
||||
const [eventsModalOpen, setEventsModalOpen] = useState(false);
|
||||
const { isAdmin } = useContext(AccessContext);
|
||||
const integrationEventsEnabled = useUiFlag('integrationEvents');
|
||||
|
||||
const submitText = editMode ? 'Update' : 'Create';
|
||||
const url = `${uiConfig.unleashUrl}/api/admin/addons${
|
||||
@ -318,7 +316,7 @@ export const IntegrationForm: VFC<IntegrationFormProps> = ({
|
||||
integration
|
||||
</StyledHeaderTitle>
|
||||
<ConditionallyRender
|
||||
condition={editMode && isAdmin && integrationEventsEnabled}
|
||||
condition={editMode && isAdmin}
|
||||
show={
|
||||
<Link onClick={() => setEventsModalOpen(true)}>
|
||||
View events
|
||||
|
@ -25,8 +25,6 @@ import useAddons from 'hooks/api/getters/useAddons/useAddons';
|
||||
import useToast from 'hooks/useToast';
|
||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
import Visibility from '@mui/icons-material/Visibility';
|
||||
import { PermissionHOC } from 'component/common/PermissionHOC/PermissionHOC';
|
||||
import { IntegrationEventsModal } from 'component/integrations/IntegrationEvents/IntegrationEventsModal';
|
||||
@ -55,7 +53,6 @@ export const IntegrationCardMenu: VFC<IIntegrationCardMenuProps> = ({
|
||||
const { refetchAddons } = useAddons();
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
const [eventsModalOpen, setEventsModalOpen] = useState(false);
|
||||
const integrationEventsEnabled = useUiFlag('integrationEvents');
|
||||
|
||||
const closeMenu = () => {
|
||||
setIsMenuOpen(false);
|
||||
@ -131,24 +128,19 @@ export const IntegrationCardMenu: VFC<IIntegrationCardMenuProps> = ({
|
||||
}}
|
||||
onClose={handleMenuClick}
|
||||
>
|
||||
<ConditionallyRender
|
||||
condition={integrationEventsEnabled}
|
||||
show={
|
||||
<PermissionHOC permission={ADMIN}>
|
||||
{({ hasAccess }) => (
|
||||
<MenuItem
|
||||
onClick={() => setEventsModalOpen(true)}
|
||||
disabled={!hasAccess}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Visibility />
|
||||
</ListItemIcon>
|
||||
<ListItemText>View events</ListItemText>
|
||||
</MenuItem>
|
||||
)}
|
||||
</PermissionHOC>
|
||||
}
|
||||
/>
|
||||
<PermissionHOC permission={ADMIN}>
|
||||
{({ hasAccess }) => (
|
||||
<MenuItem
|
||||
onClick={() => setEventsModalOpen(true)}
|
||||
disabled={!hasAccess}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Visibility />
|
||||
</ListItemIcon>
|
||||
<ListItemText>View events</ListItemText>
|
||||
</MenuItem>
|
||||
)}
|
||||
</PermissionHOC>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setIsToggleOpen(true);
|
||||
|
@ -5,7 +5,6 @@ import useSWRInfinite, {
|
||||
} from 'swr/infinite';
|
||||
import { formatApiPath } from 'utils/formatPath';
|
||||
import type { IntegrationEvents } from 'interfaces/integrationEvent';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
import AccessContext from 'contexts/AccessContext';
|
||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||
|
||||
@ -21,15 +20,13 @@ export const useIntegrationEvents = (
|
||||
options: SWRInfiniteConfiguration = {},
|
||||
) => {
|
||||
const { isAdmin } = useContext(AccessContext);
|
||||
const integrationEventsEnabled = useUiFlag('integrationEvents');
|
||||
|
||||
const getKey: SWRInfiniteKeyLoader = (
|
||||
pageIndex: number,
|
||||
previousPageData: IntegrationEvents,
|
||||
) => {
|
||||
// Does not meet conditions
|
||||
if (!integrationId || !isAdmin || !integrationEventsEnabled)
|
||||
return null;
|
||||
if (!integrationId || !isAdmin) return null;
|
||||
|
||||
// Reached the end
|
||||
if (previousPageData && !previousPageData.integrationEvents.length)
|
||||
|
@ -89,7 +89,6 @@ export type UiFlags = {
|
||||
navigationSidebar?: boolean;
|
||||
flagCreator?: boolean;
|
||||
resourceLimits?: boolean;
|
||||
integrationEvents?: boolean;
|
||||
newEventSearch?: boolean;
|
||||
archiveProjects?: boolean;
|
||||
projectListImprovements?: boolean;
|
||||
|
@ -120,7 +120,6 @@ exports[`should create default config 1`] = `
|
||||
},
|
||||
"filterInvalidClientMetrics": false,
|
||||
"googleAuthEnabled": false,
|
||||
"integrationEvents": false,
|
||||
"killInsightsUI": false,
|
||||
"killScheduledChangeRequestCache": false,
|
||||
"maintenanceMode": false,
|
||||
|
@ -92,9 +92,7 @@ export default abstract class Addon {
|
||||
async registerEvent(
|
||||
integrationEvent: IntegrationEventWriteModel,
|
||||
): Promise<void> {
|
||||
if (this.flagResolver.isEnabled('integrationEvents')) {
|
||||
await this.integrationEventsService.registerEvent(integrationEvent);
|
||||
}
|
||||
await this.integrationEventsService.registerEvent(integrationEvent);
|
||||
}
|
||||
|
||||
destroy?(): void;
|
||||
|
@ -44,8 +44,6 @@ export class IntegrationEventsService {
|
||||
}
|
||||
|
||||
async cleanUpEvents(): Promise<void> {
|
||||
if (!this.flagResolver.isEnabled('integrationEvents')) return;
|
||||
|
||||
await this.integrationEventsStore.cleanUpEvents();
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,7 @@ beforeAll(async () => {
|
||||
db.stores,
|
||||
{
|
||||
experimental: {
|
||||
flags: {
|
||||
integrationEvents: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
},
|
||||
db.rawDatabase,
|
||||
|
@ -38,7 +38,7 @@ import {
|
||||
type IntegrationEventsSchema,
|
||||
integrationEventsSchema,
|
||||
} from '../../openapi/spec/integration-events-schema';
|
||||
import { BadDataError, NotFoundError } from '../../error';
|
||||
import { BadDataError } from '../../error';
|
||||
import type { IntegrationEventsService } from '../../services';
|
||||
|
||||
type AddonServices = Pick<
|
||||
@ -276,10 +276,6 @@ Note: passing \`null\` as a value for the description property will set it to an
|
||||
>,
|
||||
res: Response<IntegrationEventsSchema>,
|
||||
): Promise<void> {
|
||||
if (!this.flagResolver.isEnabled('integrationEvents')) {
|
||||
throw new NotFoundError('This feature is not enabled');
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
|
||||
if (Number.isNaN(Number(id))) {
|
||||
|
@ -59,7 +59,6 @@ export type IFlagKey =
|
||||
| 'resourceLimits'
|
||||
| 'extendedMetrics'
|
||||
| 'removeUnsafeInlineStyleSrc'
|
||||
| 'integrationEvents'
|
||||
| 'originMiddleware'
|
||||
| 'newEventSearch'
|
||||
| 'archiveProjects'
|
||||
@ -292,10 +291,6 @@ const flags: IFlags = {
|
||||
process.env.UNLEASH_EXPERIMENTAL_REMOVE_UNSAFE_INLINE_STYLE_SRC,
|
||||
false,
|
||||
),
|
||||
integrationEvents: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_INTEGRATION_EVENTS,
|
||||
false,
|
||||
),
|
||||
originMiddleware: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_ORIGIN_MIDDLEWARE,
|
||||
false,
|
||||
|
@ -52,7 +52,6 @@ process.nextTick(async () => {
|
||||
enableLegacyVariants: false,
|
||||
resourceLimits: true,
|
||||
extendedMetrics: true,
|
||||
integrationEvents: true,
|
||||
originMiddleware: true,
|
||||
newEventSearch: true,
|
||||
projectListImprovements: true,
|
||||
|
Loading…
Reference in New Issue
Block a user