Skip to content

Commit 59f9c8b

Browse files
committed
chore(connections-navigation): allow to duplicate view when readWrite is true
1 parent 45d206a commit 59f9c8b

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

packages/compass-connections-navigation/src/item-actions.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export const collectionItemActions = ({
199199
type: 'collection' | 'view' | 'timeseries';
200200
isRenameCollectionEnabled: boolean;
201201
}): NavigationItemActions => {
202-
const actions: NavigationItemActions = [
202+
const actions: NullableNavigationItemActions = [
203203
{
204204
action: 'open-in-new-tab',
205205
label: 'Open in new tab',
@@ -208,30 +208,34 @@ export const collectionItemActions = ({
208208
];
209209

210210
if (hasWriteActionsDisabled) {
211-
return actions;
211+
return stripNullActions(actions);
212212
}
213213

214-
if (canEditCollection && type === 'view') {
214+
if (type === 'view') {
215215
actions.push({ separator: true });
216216
actions.push(
217-
{
218-
action: 'drop-collection',
219-
label: 'Drop view',
220-
icon: 'Trash',
221-
},
217+
canEditCollection
218+
? {
219+
action: 'drop-collection',
220+
label: 'Drop view',
221+
icon: 'Trash',
222+
}
223+
: null,
222224
{
223225
action: 'duplicate-view',
224226
label: 'Duplicate view',
225227
icon: 'Copy',
226228
},
227-
{
228-
action: 'modify-view',
229-
label: 'Modify view',
230-
icon: 'Edit',
231-
}
229+
canEditCollection
230+
? {
231+
action: 'modify-view',
232+
label: 'Modify view',
233+
icon: 'Edit',
234+
}
235+
: null
232236
);
233237

234-
return actions;
238+
return stripNullActions(actions);
235239
}
236240

237241
if (type !== 'timeseries' && canEditCollection && isRenameCollectionEnabled) {
@@ -251,7 +255,7 @@ export const collectionItemActions = ({
251255
});
252256
}
253257

254-
return actions;
258+
return stripNullActions(actions);
255259
};
256260

257261
export const connectionContextMenuActions = ({

0 commit comments

Comments
 (0)