Skip to content

Commit 3038293

Browse files
committed
inferredFromPrivileges rather
1 parent ac16b4d commit 3038293

File tree

26 files changed

+188
-141
lines changed

26 files changed

+188
-141
lines changed

packages/collection-model/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ interface CollectionProps {
8383
sourceName: string | null;
8484
source: Collection;
8585
properties: { id: string; options?: Record<string, unknown> }[];
86-
is_ghost_namespace: boolean;
86+
inferred_from_privileges: boolean;
8787
}
8888

8989
type CollectionDataService = Pick<

packages/compass-collection/src/plugin-tab-title.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type PluginTitleProps = {
2424

2525
function PluginTitle({
2626
editViewName,
27-
isGhostNamespace,
27+
inferredFromPrivileges,
2828
isReadonly,
2929
isTimeSeries,
3030
sourceName,
@@ -68,12 +68,12 @@ function PluginTitle({
6868
? 'Visibility'
6969
: collectionType === 'timeseries'
7070
? 'TimeSeries'
71-
: isGhostNamespace
71+
: inferredFromPrivileges
7272
? 'EmptyFolder'
7373
: 'Folder'
7474
}
7575
data-namespace={ns}
76-
isGhostNamespace={isGhostNamespace}
76+
inferredFromPrivileges={inferredFromPrivileges}
7777
/>
7878
);
7979
}

packages/compass-components/src/components/workspace-tabs/tab.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const draggingTabStyles = css({
138138
cursor: 'grabbing !important',
139139
});
140140

141-
const nonExistentStyles = css({
141+
const inferredFromPrivilegesStyles = css({
142142
color: palette.gray.base,
143143
});
144144

@@ -184,7 +184,7 @@ export type WorkspaceTabPluginProps = {
184184
connectionName?: string;
185185
type: string;
186186
title: React.ReactNode;
187-
isGhostNamespace?: boolean;
187+
inferredFromPrivileges?: boolean;
188188
iconGlyph: GlyphName | 'Logo' | 'Server';
189189
tooltip?: [string, string][];
190190
};
@@ -206,7 +206,7 @@ function Tab({
206206
type,
207207
title,
208208
tooltip,
209-
isGhostNamespace,
209+
inferredFromPrivileges,
210210
isSelected,
211211
isDragging,
212212
onSelect,
@@ -271,7 +271,7 @@ function Tab({
271271
className={cx(
272272
tabStyles,
273273
themeClass,
274-
isGhostNamespace && nonExistentStyles,
274+
inferredFromPrivileges && inferredFromPrivilegesStyles,
275275
isSelected && selectedTabStyles,
276276
isSelected && tabTheme && selectedThemedTabStyles,
277277
isDragging && draggingTabStyles,

packages/compass-connections-navigation/src/connections-navigation-tree.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const connections: Connection[] = [
4343
collectionsStatus: 'initial',
4444
collectionsLength: 5,
4545
collections: [],
46-
isGhostNamespace: false,
46+
inferredFromPrivileges: false,
4747
},
4848
{
4949
_id: 'db_ready',
@@ -57,26 +57,26 @@ const connections: Connection[] = [
5757
type: 'collection',
5858
sourceName: '',
5959
pipeline: [],
60-
isGhostNamespace: false,
60+
inferredFromPrivileges: false,
6161
},
6262
{
6363
_id: 'db_ready.woof',
6464
name: 'woof',
6565
type: 'timeseries',
6666
sourceName: '',
6767
pipeline: [],
68-
isGhostNamespace: false,
68+
inferredFromPrivileges: false,
6969
},
7070
{
7171
_id: 'db_ready.bwok',
7272
name: 'bwok',
7373
type: 'view',
7474
sourceName: '',
7575
pipeline: [],
76-
isGhostNamespace: false,
76+
inferredFromPrivileges: false,
7777
},
7878
],
79-
isGhostNamespace: false,
79+
inferredFromPrivileges: false,
8080
},
8181
],
8282
isReady: true,

packages/compass-connections-navigation/src/navigation-item-icon.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import type { GlyphName } from '@mongodb-js/compass-components';
55
import { WithStatusMarker } from './with-status-marker';
66
import { isLocalhost } from 'mongodb-build-info';
77

8-
const NON_EXISTANT_NAMESPACE_TEXT =
9-
'Your privileges grant you access to this namespace, but it does not currently exist';
8+
const INFERRED_FROM_PRIVILEGES_TEXT =
9+
'Your privileges grant you access to this namespace, but it might not currently exist';
1010

1111
const tooltipTriggerStyles = css({
1212
display: 'flex',
@@ -35,21 +35,21 @@ const IconWithTooltip = ({
3535

3636
export const NavigationItemIcon = ({ item }: { item: SidebarTreeItem }) => {
3737
if (item.type === 'database') {
38-
if (item.isGhostNamespace) {
38+
if (item.inferredFromPrivileges) {
3939
return (
4040
<IconWithTooltip
41-
text={NON_EXISTANT_NAMESPACE_TEXT}
41+
text={INFERRED_FROM_PRIVILEGES_TEXT}
4242
glyph="EmptyDatabase"
4343
/>
4444
);
4545
}
4646
return <Icon glyph="Database" />;
4747
}
4848
if (item.type === 'collection') {
49-
if (item.isGhostNamespace) {
49+
if (item.inferredFromPrivileges) {
5050
return (
5151
<IconWithTooltip
52-
text={NON_EXISTANT_NAMESPACE_TEXT}
52+
text={INFERRED_FROM_PRIVILEGES_TEXT}
5353
glyph="EmptyFolder"
5454
/>
5555
);

packages/compass-connections-navigation/src/styled-navigation-item.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export default function StyledNavigationItem({
4141
!showDisabledConnections || getConnectable(connectionId);
4242
const isDisconnectedConnection =
4343
item.type === 'connection' && item.connectionStatus !== 'connected';
44-
const isGhostNamespaceNamespace =
44+
const inferredFromPrivilegesNamespace =
4545
(item.type === 'database' || item.type === 'collection') &&
46-
item.isGhostNamespace;
46+
item.inferredFromPrivileges;
4747

4848
if (colorCode && colorCode !== DefaultColorCode) {
4949
style['--item-bg-color'] = connectionColorToHex(colorCode);
@@ -53,14 +53,14 @@ export default function StyledNavigationItem({
5353

5454
if (
5555
isDisconnectedConnection ||
56-
isGhostNamespaceNamespace ||
56+
inferredFromPrivilegesNamespace ||
5757
!isConnectable
5858
) {
5959
style['--item-color'] = inactiveColor;
6060
}
6161

6262
// We always show these as inactive
63-
if (isGhostNamespaceNamespace || !isConnectable) {
63+
if (inferredFromPrivilegesNamespace || !isConnectable) {
6464
style['--item-color-active'] = inactiveColor;
6565
}
6666
return style;

packages/compass-connections-navigation/src/tree-data.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type Database = {
5454
collectionsStatus: DatabaseOrCollectionStatus;
5555
collectionsLength: number;
5656
collections: Collection[];
57-
isGhostNamespace: boolean;
57+
inferredFromPrivileges: boolean;
5858
};
5959

6060
type PlaceholderTreeItem = VirtualPlaceholderItem & {
@@ -68,7 +68,7 @@ export type Collection = {
6868
type: 'view' | 'collection' | 'timeseries';
6969
sourceName: string | null;
7070
pipeline: unknown[];
71-
isGhostNamespace: boolean;
71+
inferredFromPrivileges: boolean;
7272
};
7373

7474
export type NotConnectedConnectionTreeItem = VirtualTreeItem & {
@@ -103,7 +103,7 @@ export type DatabaseTreeItem = VirtualTreeItem & {
103103
connectionItem: ConnectedConnectionTreeItem;
104104
dbName: string;
105105
hasWriteActionsDisabled: boolean;
106-
isGhostNamespace: boolean;
106+
inferredFromPrivileges: boolean;
107107
};
108108

109109
export type CollectionTreeItem = VirtualTreeItem & {
@@ -115,7 +115,7 @@ export type CollectionTreeItem = VirtualTreeItem & {
115115
databaseItem: DatabaseTreeItem;
116116
namespace: string;
117117
hasWriteActionsDisabled: boolean;
118-
isGhostNamespace: boolean;
118+
inferredFromPrivileges: boolean;
119119
};
120120

121121
export type SidebarActionableItem =
@@ -262,7 +262,7 @@ const databaseToItems = ({
262262
collections,
263263
collectionsLength,
264264
collectionsStatus,
265-
isGhostNamespace,
265+
inferredFromPrivileges,
266266
},
267267
connectionId,
268268
connectionItem,
@@ -298,7 +298,7 @@ const databaseToItems = ({
298298
dbName: id,
299299
isExpandable: true,
300300
hasWriteActionsDisabled,
301-
isGhostNamespace,
301+
inferredFromPrivileges,
302302
};
303303

304304
const sidebarData: SidebarTreeItem[] = [databaseTI];
@@ -327,7 +327,7 @@ const databaseToItems = ({
327327

328328
return sidebarData.concat(
329329
collections.map(
330-
({ _id: id, name, type, isGhostNamespace }, collectionIndex) => ({
330+
({ _id: id, name, type, inferredFromPrivileges }, collectionIndex) => ({
331331
id: `${connectionId}.${id}`, // id is the namespace of the collection, so includes db as well
332332
level: level + 1,
333333
name,
@@ -340,7 +340,7 @@ const databaseToItems = ({
340340
namespace: id,
341341
hasWriteActionsDisabled,
342342
isExpandable: false,
343-
isGhostNamespace,
343+
inferredFromPrivileges,
344344
})
345345
)
346346
);

packages/compass-sidebar/src/components/use-filtered-connections.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ const sidebarConnections: SidebarConnection[] = [
5151
type: 'collection',
5252
sourceName: '',
5353
pipeline: [],
54-
isGhostNamespace: false,
54+
inferredFromPrivileges: false,
5555
},
5656
{
5757
_id: 'coll_ready_1_1_2',
5858
name: 'coll_ready_shared_name',
5959
type: 'collection',
6060
sourceName: '',
6161
pipeline: [],
62-
isGhostNamespace: false,
62+
inferredFromPrivileges: false,
6363
},
6464
],
6565
collectionsLength: 1,
6666
collectionsStatus: 'ready',
67-
isGhostNamespace: false,
67+
inferredFromPrivileges: false,
6868
},
6969
{
7070
_id: 'db_ready_1_2',
@@ -76,20 +76,20 @@ const sidebarConnections: SidebarConnection[] = [
7676
type: 'collection',
7777
sourceName: '',
7878
pipeline: [],
79-
isGhostNamespace: false,
79+
inferredFromPrivileges: false,
8080
},
8181
{
8282
_id: 'coll_ready_1_2_2',
8383
name: 'coll_ready_shared_name',
8484
type: 'collection',
8585
sourceName: '',
8686
pipeline: [],
87-
isGhostNamespace: false,
87+
inferredFromPrivileges: false,
8888
},
8989
],
9090
collectionsLength: 1,
9191
collectionsStatus: 'ready',
92-
isGhostNamespace: false,
92+
inferredFromPrivileges: false,
9393
},
9494
],
9595
databasesStatus: 'ready',
@@ -116,20 +116,20 @@ const sidebarConnections: SidebarConnection[] = [
116116
type: 'collection',
117117
sourceName: '',
118118
pipeline: [],
119-
isGhostNamespace: false,
119+
inferredFromPrivileges: false,
120120
},
121121
{
122122
_id: 'coll_ready_2_2',
123123
name: 'coll_ready_2_2',
124124
type: 'collection',
125125
sourceName: '',
126126
pipeline: [],
127-
isGhostNamespace: false,
127+
inferredFromPrivileges: false,
128128
},
129129
],
130130
collectionsLength: 1,
131131
collectionsStatus: 'ready',
132-
isGhostNamespace: false,
132+
inferredFromPrivileges: false,
133133
},
134134
],
135135
databasesStatus: 'ready',

packages/compass-sidebar/src/modules/databases.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ async function createDatabases(dbs: any[] = []) {
1717
};
1818
}
1919
);
20-
return data.map(({ is_ghost_namespace, collections, ...rest }) => ({
20+
return data.map(({ inferred_from_privileges, collections, ...rest }) => ({
2121
...rest,
22-
isGhostNamespace: is_ghost_namespace,
23-
collections: collections.map(({ is_ghost_namespace, ...coll }) => ({
22+
inferredFromPrivileges: inferred_from_privileges,
23+
collections: collections.map(({ inferred_from_privileges, ...coll }) => ({
2424
...coll,
25-
isGhostNamespace: is_ghost_namespace,
25+
inferredFromPrivileges: inferred_from_privileges,
2626
})),
2727
}));
2828
}

packages/compass-sidebar/src/modules/databases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ export type Database = Pick<
4545
InstanceDatabase,
4646
'_id' | 'name' | 'collectionsStatus' | 'collectionsLength'
4747
> & {
48-
isGhostNamespace: boolean;
48+
inferredFromPrivileges: boolean;
4949
collections: Array<
5050
Pick<
5151
InstanceDatabase['collections'][number],
5252
'_id' | 'name' | 'type' | 'sourceName' | 'pipeline'
5353
> & {
54-
isGhostNamespace: boolean;
54+
inferredFromPrivileges: boolean;
5555
}
5656
>;
5757
};

0 commit comments

Comments
 (0)