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