Skip to content

Commit

Permalink
feat(coral): Remove feature flags for topic overview, edit and promote (
Browse files Browse the repository at this point in the history
#1636)

* Remove feature flag for topic-overview

Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>

* Remove feature flag for promote-topic.

Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>

* Remove feature flag for edit-topic

Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>

---------

Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
  • Loading branch information
programmiri authored Aug 17, 2023
1 parent 9c8e845 commit bbb4ee1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ const mockedTopics = mockedTopicNames.map((name, index) =>
createMockTopic({ topicName: name, topicId: index })
);

const isFeatureFlagActiveMock = jest.fn();
jest.mock("src/services/feature-flags/utils", () => ({
isFeatureFlagActive: () => isFeatureFlagActiveMock(),
}));

const tableRowHeader = ["Topic", "Environments", "Team"];

describe("TopicTable.tsx", () => {
Expand All @@ -33,7 +28,6 @@ describe("TopicTable.tsx", () => {
describe("shows all topics as a table", () => {
beforeAll(() => {
mockIntersectionObserver();
isFeatureFlagActiveMock.mockResolvedValue(true);
customRender(
<TopicTable
topics={mockedTopics}
Expand Down Expand Up @@ -119,46 +113,6 @@ describe("TopicTable.tsx", () => {
});
});

describe("renders link to angular app if feature-flag is not enabled", () => {
beforeAll(() => {
mockIntersectionObserver();
isFeatureFlagActiveMock.mockReturnValue(false);
customRender(
<TopicTable
topics={mockedTopics}
ariaLabel={"Topics overview, page 1 of 10"}
/>,
{ memoryRouter: true }
);
});

afterAll(() => {
cleanup();
jest.resetAllMocks();
});

mockedTopics.forEach((topic) => {
it(`renders the topic name "${topic.topicName}" as a link to the detail view as row header`, () => {
const table = screen.getByRole("table", {
name: "Topics overview, page 1 of 10",
});
const rowHeader = within(table).getByRole("cell", {
name: topic.topicName,
});
const link = within(rowHeader).getByRole("link", {
name: topic.topicName,
});

expect(rowHeader).toBeVisible();
expect(link).toBeVisible();
expect(link).toHaveAttribute(
"href",
`http://localhost/topicOverview?topicname=${topic.topicName}`
);
});
});
});

describe("enables user to keyboard navigate from topic name to topic name", () => {
beforeEach(() => {
mockIntersectionObserver();
Expand Down
13 changes: 0 additions & 13 deletions coral/src/app/features/topics/browse/components/TopicTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import {
} from "@aivenio/aquarium";
import link from "@aivenio/aquarium/dist/src/icons/link";
import { Link } from "react-router-dom";
import { createTopicOverviewLink } from "src/app/features/topics/browse/utils/create-topic-overview-link";
import { Topic } from "src/domain/topic";
import useFeatureFlag from "src/services/feature-flags/hook/useFeatureFlag";
import { FeatureFlag } from "src/services/feature-flags/types";
import { EnvironmentInfo } from "src/domain/environment/environment-types";

type TopicListProps = {
Expand All @@ -29,22 +26,12 @@ interface TopicsTableRow {

function TopicTable(props: TopicListProps) {
const { topics, ariaLabel } = props;
const topicDetailsEnabled = useFeatureFlag(
FeatureFlag.FEATURE_FLAG_TOPIC_OVERVIEW
);

const columns: Array<DataTableColumn<TopicsTableRow>> = [
{
type: "custom",
headerName: "Topic",
UNSAFE_render: ({ topicName, envId }: TopicsTableRow) => {
if (!topicDetailsEnabled) {
return (
<a href={createTopicOverviewLink(topicName)}>
{topicName} <InlineIcon icon={link} />
</a>
);
}
return (
<Link to={`/topic/${topicName}/overview`} state={envId}>
{topicName} <InlineIcon icon={link} />
Expand Down
18 changes: 6 additions & 12 deletions coral/src/app/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ const routes: Array<RouteObject> = [
path: Routes.TOPICS,
element: <Topics />,
},
createRouteBehindFeatureFlag({
{
path: Routes.TOPIC_OVERVIEW,
element: <TopicDetailsPage />,
featureFlag: FeatureFlag.FEATURE_FLAG_TOPIC_OVERVIEW,
redirectRouteWithoutFeatureFlag: Routes.TOPICS,
children: [
{
path: TOPIC_OVERVIEW_TAB_ID_INTO_PATH[
Expand Down Expand Up @@ -113,7 +111,7 @@ const routes: Array<RouteObject> = [
id: TopicOverviewTabEnum.SETTINGS,
},
],
}),
},
{
path: Routes.CONNECTORS,
element: <ConnectorsPage />,
Expand Down Expand Up @@ -237,18 +235,14 @@ const routes: Array<RouteObject> = [
path: Routes.TOPIC_SCHEMA_REQUEST,
element: <SchemaRequest />,
},
createRouteBehindFeatureFlag({
{
path: Routes.TOPIC_PROMOTION_REQUEST,
element: <TopicPromotionRequestPage />,
featureFlag: FeatureFlag.FEATURE_FLAG_PROMOTE_TOPIC,
redirectRouteWithoutFeatureFlag: Routes.TOPICS,
}),
createRouteBehindFeatureFlag({
},
{
path: Routes.TOPIC_EDIT_REQUEST,
element: <TopicEditRequestPage />,
featureFlag: FeatureFlag.FEATURE_FLAG_EDIT_TOPIC,
redirectRouteWithoutFeatureFlag: Routes.TOPICS,
}),
},
createRouteBehindFeatureFlag({
path: Routes.CONNECTOR_EDIT_REQUEST,
element: <ConnectorEditRequest />,
Expand Down
3 changes: 0 additions & 3 deletions coral/src/services/feature-flags/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
enum FeatureFlag {
FEATURE_FLAG_TOPIC_OVERVIEW = "FEATURE_FLAG_TOPIC_OVERVIEW",
FEATURE_FLAG_CONNECTOR_OVERVIEW = "FEATURE_FLAG_CONNECTOR_OVERVIEW",
FEATURE_FLAG_PROMOTE_TOPIC = "FEATURE_FLAG_PROMOTE_TOPIC",
FEATURE_FLAG_EDIT_TOPIC = "FEATURE_FLAG_EDIT_TOPIC",
FEATURE_FLAG_EDIT_CONNECTOR = "FEATURE_FLAG_EDIT_CONNECTOR",
}

Expand Down
9 changes: 0 additions & 9 deletions coral/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,13 @@ export default defineConfig(({ mode }) => {
"process.env": {
ROUTER_BASENAME: getRouterBasename(environment),
API_BASE_URL: getApiBaseUrl(environment),
FEATURE_FLAG_TOPIC_OVERVIEW: ["development", "remote-api", "local-api"]
.includes(mode)
.toString(),
FEATURE_FLAG_CONNECTOR_OVERVIEW: [
"development",
"remote-api",
"local-api",
]
.includes(mode)
.toString(),
FEATURE_FLAG_PROMOTE_TOPIC: ["development", "remote-api", "local-api"]
.includes(mode)
.toString(),
FEATURE_FLAG_EDIT_TOPIC: ["development", "remote-api", "local-api"]
.includes(mode)
.toString(),
FEATURE_FLAG_EDIT_CONNECTOR: ["development", "remote-api", "local-api"]
.includes(mode)
.toString(),
Expand Down

0 comments on commit bbb4ee1

Please sign in to comment.