Skip to content

Commit ea70a76

Browse files
authored
Merge branch 'main' into sidebar-rerender-fix
2 parents ee9b2ff + 6e0b968 commit ea70a76

File tree

24 files changed

+96
-59
lines changed

24 files changed

+96
-59
lines changed

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@nestjs/core": "^11.0.1",
1414
"@nestjs/platform-express": "^11.1.5",
1515
"@nestjs/swagger": "^11.2.0",
16-
"@trycompai/db": "^1.3.7",
16+
"@trycompai/db": "^1.3.17",
1717
"archiver": "^7.0.1",
1818
"axios": "^1.12.2",
1919
"better-auth": "^1.3.27",

apps/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@tiptap/extension-table-row": "^3.4.4",
5252
"@trigger.dev/react-hooks": "4.0.6",
5353
"@trigger.dev/sdk": "4.0.6",
54-
"@trycompai/db": "^1.3.7",
54+
"@trycompai/db": "^1.3.17",
5555
"@trycompai/email": "workspace:*",
5656
"@types/canvas-confetti": "^1.9.0",
5757
"@types/react-syntax-highlighter": "^15.5.13",

apps/app/src/actions/organization/invite-member.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { ActionResponse } from '../types';
88

99
const inviteMemberSchema = z.object({
1010
email: z.string().email(),
11-
role: z.enum(['owner', 'admin', 'auditor', 'employee']),
11+
role: z.enum(['owner', 'admin', 'auditor', 'employee', 'contractor']),
1212
});
1313

1414
export const inviteMember = authActionClient

apps/app/src/actions/policies/publish-all.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ export const publishAllPoliciesAction = authActionClient
104104
where: {
105105
organizationId: parsedInput.organizationId,
106106
isActive: true,
107-
role: {
108-
contains: Role.employee,
109-
},
107+
OR: [
108+
{ role: { contains: Role.employee } },
109+
{ role: { contains: Role.contractor } },
110+
],
110111
},
111112
include: {
112113
user: {

apps/app/src/app/(app)/[orgId]/people/all/components/MemberRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export function MemberRow({ member, onRemove, onUpdateRole, canEdit }: MemberRow
9393
const canRemove = !isOwner;
9494

9595
const isEmployee = currentRoles.includes('employee');
96+
const isContractor = currentRoles.includes('contractor');
9697

9798
const handleDialogItemSelect = () => {
9899
focusRef.current = dropdownTriggerRef.current;
@@ -142,7 +143,7 @@ export function MemberRow({ member, onRemove, onUpdateRole, canEdit }: MemberRow
142143
<div className="min-w-0 flex-1 gap-2">
143144
<div className="flex items-center flex-wrap gap-1.5">
144145
<span className="truncate text-sm font-medium">{memberName}</span>
145-
{isEmployee && (
146+
{(isEmployee || isContractor) && (
146147
<Link
147148
href={`/${orgId}/people/${memberId}`}
148149
className="text-xs text-blue-600 hover:underline flex-shrink-0"

apps/app/src/app/(app)/[orgId]/people/all/components/MultiRoleCombobox.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,7 @@ export function MultiRoleCombobox({
111111
selectedRoles.length > 0 ? `${selectedRoles.length} selected` : placeholder || 'Select role(s)';
112112

113113
const filteredRoles = availableRoles.filter((role) => {
114-
const label = (() => {
115-
switch (role.value) {
116-
case 'admin':
117-
return 'Admin';
118-
case 'auditor':
119-
return 'Auditor';
120-
case 'employee':
121-
return 'Employee';
122-
case 'contractor':
123-
return 'Contractor';
124-
case 'owner':
125-
return 'Owner';
126-
default:
127-
return role.value;
128-
}
129-
})();
114+
const label = getRoleLabel(role.value);
130115
return label.toLowerCase().includes(searchTerm.toLowerCase());
131116
});
132117

apps/app/src/app/(app)/[orgId]/people/devices/components/HostDetails.tsx

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@ import { Button } from '@comp/ui/button';
22
import { Card, CardContent, CardHeader, CardTitle } from '@comp/ui/card';
33
import { cn } from '@comp/ui/cn';
44
import { ArrowLeft, CheckCircle2, XCircle } from 'lucide-react';
5+
import { useMemo } from 'react';
56
import type { Host } from '../types';
67

78
export const HostDetails = ({ host, onClose }: { host: Host; onClose: () => void }) => {
9+
const isMacOS = useMemo(() => {
10+
return host.cpu_type && (host.cpu_type.includes('arm64') || host.cpu_type.includes('intel'));
11+
}, [host]);
12+
13+
const mdmEnabledStatus = useMemo(() => {
14+
return {
15+
id: 'mdm',
16+
response: host?.mdm.connected_to_fleet ? 'pass' : 'fail',
17+
name: 'MDM Enabled',
18+
};
19+
}, [host]);
20+
821
return (
922
<div className="space-y-4">
1023
<Button variant="outline" className="w-min" onClick={onClose}>
@@ -17,28 +30,52 @@ export const HostDetails = ({ host, onClose }: { host: Host; onClose: () => void
1730
</CardHeader>
1831
<CardContent className="space-y-3">
1932
{host.policies.length > 0 ? (
20-
host.policies.map((policy) => (
21-
<div
22-
key={policy.id}
23-
className={cn(
24-
'hover:bg-muted/50 flex items-center justify-between rounded-md border border-l-4 p-3 shadow-sm transition-colors',
25-
policy.response === 'pass' ? 'border-l-primary' : 'border-l-red-500',
26-
)}
27-
>
28-
<p className="font-medium">{policy.name}</p>
29-
{policy.response === 'pass' ? (
30-
<div className="flex items-center gap-1 text-primary">
31-
<CheckCircle2 size={16} />
32-
<span>Pass</span>
33-
</div>
34-
) : (
35-
<div className="flex items-center gap-1 text-red-600">
36-
<XCircle size={16} />
37-
<span>Fail</span>
38-
</div>
39-
)}
40-
</div>
41-
))
33+
<>
34+
{host.policies.map((policy) => (
35+
<div
36+
key={policy.id}
37+
className={cn(
38+
'hover:bg-muted/50 flex items-center justify-between rounded-md border border-l-4 p-3 shadow-sm transition-colors',
39+
policy.response === 'pass' ? 'border-l-primary' : 'border-l-red-500',
40+
)}
41+
>
42+
<p className="font-medium">{policy.name}</p>
43+
{policy.response === 'pass' ? (
44+
<div className="flex items-center gap-1 text-primary">
45+
<CheckCircle2 size={16} />
46+
<span>Pass</span>
47+
</div>
48+
) : (
49+
<div className="flex items-center gap-1 text-red-600">
50+
<XCircle size={16} />
51+
<span>Fail</span>
52+
</div>
53+
)}
54+
</div>
55+
))}
56+
{isMacOS && (
57+
<div
58+
key={mdmEnabledStatus.id}
59+
className={cn(
60+
'hover:bg-muted/50 flex items-center justify-between rounded-md border border-l-4 p-3 shadow-sm transition-colors',
61+
mdmEnabledStatus.response === 'pass' ? 'border-l-primary' : 'border-l-red-500',
62+
)}
63+
>
64+
<p className="font-medium">{mdmEnabledStatus.name}</p>
65+
{mdmEnabledStatus.response === 'pass' ? (
66+
<div className="flex items-center gap-1 text-primary">
67+
<CheckCircle2 size={16} />
68+
<span>Pass</span>
69+
</div>
70+
) : (
71+
<div className="flex items-center gap-1 text-red-600">
72+
<XCircle size={16} />
73+
<span>Fail</span>
74+
</div>
75+
)}
76+
</div>
77+
)}
78+
</>
4279
) : (
4380
<p className="text-muted-foreground">No policies found for this device.</p>
4481
)}

apps/app/src/app/(app)/[orgId]/people/devices/types/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export interface Host {
6666
gigs_total_disk_space: number;
6767
disk_encryption_enabled: boolean;
6868
issues: object;
69-
mdm: object;
69+
mdm: MDM;
7070
refetch_critical_queries_until: string | null;
7171
last_restarted_at: string;
7272
policies: FleetPolicy[];
@@ -80,3 +80,12 @@ export interface Host {
8080
display_text: string;
8181
display_name: string;
8282
}
83+
84+
export type MDM = {
85+
connected_to_fleet: boolean;
86+
dep_profile_error: boolean;
87+
encryption_key_available: boolean;
88+
enrollment_status: string;
89+
name?: string;
90+
server_url?: string;
91+
};

apps/app/src/app/(app)/[orgId]/policies/[policyId]/data/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const getAssignees = async () => {
135135
where: {
136136
organizationId,
137137
role: {
138-
notIn: ['employee'],
138+
notIn: ['employee', 'contractor'],
139139
},
140140
},
141141
include: {

apps/app/src/app/(app)/[orgId]/risk/(overview)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const getAssignees = cache(async () => {
108108
organizationId: session.session.activeOrganizationId,
109109
isActive: true,
110110
role: {
111-
notIn: ['employee'],
111+
notIn: ['employee', 'contractor'],
112112
},
113113
},
114114
include: {

0 commit comments

Comments
 (0)