Skip to content

Commit 176d281

Browse files
committed
hide tags UI in OSS behind TAG_VISIBILITY feature flag
Tags are an enterprise feature. Gate the Tags column, Add/Edit tag button, AddTagDialog, and filterByTags prop in the Workflow, Task, EventHandler, and Schedule definition pages behind featureFlags.isEnabled(FEATURES.TAG_VISIBILITY), which defaults to false in OSS.
1 parent 7c4dca1 commit 176d281

6 files changed

Lines changed: 308 additions & 268 deletions

File tree

ui-next/public/context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ window.conductor = {
1717
ENABLE_DARK_MODE_TOGGLE: true,
1818

1919
// Enterprise Features - DISABLED for OSS
20+
TAG_VISIBILITY: false,
2021
WORKFLOW_INTROSPECTION: false,
2122
WORKFLOW_SUMMARIZE: false,
2223
HUMAN_TASK: false,

ui-next/src/pages/definitions/EventHandler.tsx

Lines changed: 145 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { EVENT_HANDLERS_URL } from "utils/constants/route";
4242
import useCustomPagination from "utils/hooks/useCustomPagination";
4343
import { usePushHistory } from "utils/hooks/usePushHistory";
4444
import { useActionWithPath, useFetch } from "utils/query";
45+
import { featureFlags, FEATURES } from "utils/flags";
4546
import Header from "components/ui/Header";
4647
import {
4748
activeFilterGroups,
@@ -126,124 +127,134 @@ export default function EventDefinitionList() {
126127
);
127128

128129
const [confirmDeleteName, setConfirmDeleteName] = useState("");
130+
const tagsEnabled = featureFlags.isEnabled(FEATURES.TAG_VISIBILITY);
129131

130-
const columns = [
131-
{
132-
id: "name",
133-
name: "name",
134-
label: "Event handler name",
135-
renderer: (name: string, rec: ConductorEvent) => (
136-
<NavLink
137-
style={{ color: getLinkColor(rec) }}
138-
path={`${EVENT_HANDLERS_URL.BASE}/${name}`}
139-
>
140-
{name}
141-
</NavLink>
142-
),
143-
},
144-
{ id: "event", name: "event", label: "Event" },
145-
{
146-
id: "event_tags",
147-
name: "tags",
148-
label: "Tags",
149-
searchable: true,
150-
searchableFunc: (tags: TagDto[]) => createSearchableTags(tags),
151-
renderer: TagsRenderer,
152-
grow: 2,
153-
tooltip: "The tags associated with the event handler",
154-
},
155-
{
156-
id: "active",
157-
name: "active",
158-
label: "Status",
159-
searchable: true,
160-
searchableFunc: getStatusLabel,
161-
renderer(status: boolean) {
162-
return (
163-
<Box>
164-
<TagChip
165-
style={{
166-
background: status ? colors.successTag : colors.errorTag,
167-
padding: "0 12px",
168-
fontSize: "10px",
169-
fontWeight: 500,
170-
}}
171-
label={getStatusLabel(status)}
172-
/>
173-
</Box>
174-
);
132+
const columns = useMemo(
133+
() => [
134+
{
135+
id: "name",
136+
name: "name",
137+
label: "Event handler name",
138+
renderer: (name: string, rec: ConductorEvent) => (
139+
<NavLink
140+
style={{ color: getLinkColor(rec) }}
141+
path={`${EVENT_HANDLERS_URL.BASE}/${name}`}
142+
>
143+
{name}
144+
</NavLink>
145+
),
175146
},
176-
},
177-
{
178-
id: "actions",
179-
name: "actions",
180-
label: "Actions",
181-
sortable: false,
182-
searchable: false,
183-
grow: 0.5,
184-
right: true,
185-
renderer: (__: string, taskRowData: any) => (
186-
<Box sx={{ display: "flex", justifyContent: "space-evenly", gap: 2 }}>
187-
{taskRowData.active && (
188-
<Tooltip title={"Pause event"}>
147+
{ id: "event", name: "event", label: "Event" },
148+
...(tagsEnabled
149+
? [
150+
{
151+
id: "event_tags",
152+
name: "tags",
153+
label: "Tags",
154+
searchable: true,
155+
searchableFunc: (tags: TagDto[]) => createSearchableTags(tags),
156+
renderer: TagsRenderer,
157+
grow: 2,
158+
tooltip: "The tags associated with the event handler",
159+
},
160+
]
161+
: []),
162+
{
163+
id: "active",
164+
name: "active",
165+
label: "Status",
166+
searchable: true,
167+
searchableFunc: getStatusLabel,
168+
renderer(status: boolean) {
169+
return (
170+
<Box>
171+
<TagChip
172+
style={{
173+
background: status ? colors.successTag : colors.errorTag,
174+
padding: "0 12px",
175+
fontSize: "10px",
176+
fontWeight: 500,
177+
}}
178+
label={getStatusLabel(status)}
179+
/>
180+
</Box>
181+
);
182+
},
183+
},
184+
{
185+
id: "actions",
186+
name: "actions",
187+
label: "Actions",
188+
sortable: false,
189+
searchable: false,
190+
grow: 0.5,
191+
right: true,
192+
renderer: (__: string, taskRowData: any) => (
193+
<Box sx={{ display: "flex", justifyContent: "space-evenly", gap: 2 }}>
194+
{taskRowData.active && (
195+
<Tooltip title={"Pause event"}>
196+
<IconButton
197+
onClick={() => handlePauseResumeEvent(taskRowData, false)}
198+
color="primary"
199+
disabled={isTrialExpired}
200+
size="small"
201+
>
202+
<PauseIcon size={22} />
203+
</IconButton>
204+
</Tooltip>
205+
)}
206+
{tagsEnabled && (
207+
<Tooltip title={"Add/Edit tags"}>
208+
<IconButton
209+
id={`add-tags-${taskRowData.name}-btn`}
210+
disabled={isTrialExpired}
211+
onClick={() => {
212+
setAddTagDialogData({
213+
tags: taskRowData.tags || [],
214+
itemName: taskRowData.name,
215+
itemType: "event",
216+
} as TagDialogProps);
217+
setShowAddTagDialog(true);
218+
}}
219+
size="small"
220+
>
221+
<TagIcon size={20} />
222+
</IconButton>
223+
</Tooltip>
224+
)}
225+
{!taskRowData.active && (
226+
<Tooltip title={"Resume event"}>
227+
<IconButton
228+
onClick={() => handlePauseResumeEvent(taskRowData, true)}
229+
color="primary"
230+
size="small"
231+
disabled={isTrialExpired}
232+
>
233+
<PlayIcon size={22} />
234+
</IconButton>
235+
</Tooltip>
236+
)}
237+
<Tooltip title={"Delete event handler"}>
189238
<IconButton
190-
onClick={() => handlePauseResumeEvent(taskRowData, false)}
191-
color="primary"
239+
id={`delete-${taskRowData.name}-btn`}
240+
onClick={() => {
241+
setConfirmDeleteName(taskRowData?.name);
242+
}}
192243
disabled={isTrialExpired}
193244
size="small"
245+
sx={{
246+
whiteSpace: "nowrap",
247+
}}
194248
>
195-
<PauseIcon size={22} />
196-
</IconButton>
197-
</Tooltip>
198-
)}
199-
<Tooltip title={"Add/Edit tags"}>
200-
<IconButton
201-
id={`add-tags-${taskRowData.name}-btn`}
202-
disabled={isTrialExpired}
203-
onClick={() => {
204-
setAddTagDialogData({
205-
tags: taskRowData.tags || [],
206-
itemName: taskRowData.name,
207-
itemType: "event",
208-
} as TagDialogProps);
209-
setShowAddTagDialog(true);
210-
}}
211-
size="small"
212-
>
213-
<TagIcon size={20} />
214-
</IconButton>
215-
</Tooltip>
216-
{!taskRowData.active && (
217-
<Tooltip title={"Resume event"}>
218-
<IconButton
219-
onClick={() => handlePauseResumeEvent(taskRowData, true)}
220-
color="primary"
221-
size="small"
222-
disabled={isTrialExpired}
223-
>
224-
<PlayIcon size={22} />
249+
<DeleteIcon size={20} />
225250
</IconButton>
226251
</Tooltip>
227-
)}
228-
<Tooltip title={"Delete event handler"}>
229-
<IconButton
230-
id={`delete-${taskRowData.name}-btn`}
231-
onClick={() => {
232-
setConfirmDeleteName(taskRowData?.name);
233-
}}
234-
disabled={isTrialExpired}
235-
size="small"
236-
sx={{
237-
whiteSpace: "nowrap",
238-
}}
239-
>
240-
<DeleteIcon size={20} />
241-
</IconButton>
242-
</Tooltip>
243-
</Box>
244-
),
245-
},
246-
];
252+
</Box>
253+
),
254+
},
255+
],
256+
[isTrialExpired, tagsEnabled, handlePauseResumeEvent],
257+
);
247258

248259
const deleteEventHandler = useActionWithPath({
249260
onSuccess: () => {
@@ -306,22 +317,24 @@ export default function EventDefinitionList() {
306317
/>
307318
)}
308319

309-
<AddTagDialog
310-
open={showAddTagDialog && !!addTagDialogData}
311-
tags={addTagDialogData?.tags || []}
312-
itemType={addTagDialogData?.itemType}
313-
itemName={addTagDialogData?.itemName}
314-
onClose={() => {
315-
setShowAddTagDialog(false);
316-
setAddTagDialogData(null);
317-
}}
318-
onSuccess={() => {
319-
setShowAddTagDialog(false);
320-
setAddTagDialogData(null);
321-
refetch();
322-
}}
323-
apiPath={`/event/${addTagDialogData?.itemName}/tags`}
324-
/>
320+
{tagsEnabled && (
321+
<AddTagDialog
322+
open={showAddTagDialog && !!addTagDialogData}
323+
tags={addTagDialogData?.tags || []}
324+
itemType={addTagDialogData?.itemType}
325+
itemName={addTagDialogData?.itemName}
326+
onClose={() => {
327+
setShowAddTagDialog(false);
328+
setAddTagDialogData(null);
329+
}}
330+
onSuccess={() => {
331+
setShowAddTagDialog(false);
332+
setAddTagDialogData(null);
333+
refetch();
334+
}}
335+
apiPath={`/event/${addTagDialogData?.itemName}/tags`}
336+
/>
337+
)}
325338

326339
<SectionHeader
327340
_deprecate_marginTop={0}
@@ -441,7 +454,12 @@ export default function EventDefinitionList() {
441454
/>
442455
)
443456
}
444-
defaultShowColumns={["name", "event", "tags", "actions"]}
457+
defaultShowColumns={[
458+
"name",
459+
"event",
460+
...(tagsEnabled ? ["tags"] : []),
461+
"actions",
462+
]}
445463
keyField="name"
446464
data={activeNonActiveFiltered}
447465
columns={columns}

0 commit comments

Comments
 (0)