Skip to content

Commit 9ab5c61

Browse files
JAORMXclaude
andcommitted
style(dashboard): fix prettier formatting
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8994765 commit 9ab5c61

File tree

2 files changed

+72
-38
lines changed

2 files changed

+72
-38
lines changed

ui/compliance-dashboard/src/dashboard.ts

Lines changed: 68 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ export function initDashboard(): void {
102102
profilesListEl = getRequiredElement<HTMLDivElement>('profiles-list');
103103
repositoriesListEl = getRequiredElement<HTMLDivElement>('repositories-list');
104104
profileFilterEl = getRequiredElement<HTMLInputElement>('profile-filter');
105-
profileStatusFilterEl = getRequiredElement<HTMLSelectElement>('profile-status-filter');
105+
profileStatusFilterEl = getRequiredElement<HTMLSelectElement>(
106+
'profile-status-filter'
107+
);
106108
repoFilterEl = getRequiredElement<HTMLInputElement>('repo-filter');
107109
statusFilterEl = getRequiredElement<HTMLSelectElement>('status-filter');
108110

@@ -202,15 +204,11 @@ function handleToolResult(result: ToolResultParams): void {
202204
// Try to identify the data type and update accordingly
203205
// API returns profiles as array directly
204206
if (isProfilesArray(data)) {
205-
console.log(
206-
'[Dashboard] Received profiles data:',
207-
data.length,
208-
'profiles'
209-
);
207+
console.log('[Dashboard] Received profiles data:', data.length, 'profiles');
210208
profiles = data;
211209
updateSummaryCards();
212210
renderProfiles();
213-
// API returns profile status with nested profile_status object
211+
// API returns profile status with nested profile_status object
214212
} else if (isProfileStatusApiResponse(data)) {
215213
const status: ProfileStatusResult = {
216214
profile_id: data.profile_status.profile_id,
@@ -222,7 +220,7 @@ function handleToolResult(result: ToolResultParams): void {
222220
profileStatuses.set(status.profile_id, status);
223221
updateSummaryCards();
224222
renderProfiles();
225-
// API returns repositories as { results: [...] }
223+
// API returns repositories as { results: [...] }
226224
} else if (isRepositoriesApiResponse(data)) {
227225
console.log(
228226
'[Dashboard] Received repositories data:',
@@ -241,15 +239,20 @@ function handleToolResult(result: ToolResultParams): void {
241239
* Type guard for ProfilesResult - API returns array directly
242240
*/
243241
function isProfilesArray(data: unknown): data is Profile[] {
244-
return Array.isArray(data) && data.every(item =>
245-
typeof item === 'object' && item !== null && 'name' in item
242+
return (
243+
Array.isArray(data) &&
244+
data.every(
245+
(item) => typeof item === 'object' && item !== null && 'name' in item
246+
)
246247
);
247248
}
248249

249250
/**
250251
* Type guard for ProfileStatusApiResponse - API returns nested structure
251252
*/
252-
function isProfileStatusApiResponse(data: unknown): data is ProfileStatusApiResponse {
253+
function isProfileStatusApiResponse(
254+
data: unknown
255+
): data is ProfileStatusApiResponse {
253256
return (
254257
typeof data === 'object' &&
255258
data !== null &&
@@ -261,7 +264,9 @@ function isProfileStatusApiResponse(data: unknown): data is ProfileStatusApiResp
261264
/**
262265
* Type guard for RepositoriesApiResponse - API returns { results: [...] }
263266
*/
264-
function isRepositoriesApiResponse(data: unknown): data is RepositoriesApiResponse {
267+
function isRepositoriesApiResponse(
268+
data: unknown
269+
): data is RepositoriesApiResponse {
265270
return (
266271
typeof data === 'object' &&
267272
data !== null &&
@@ -549,9 +554,12 @@ function renderProfiles(): void {
549554
if (statusFilter) {
550555
const status = profileStatuses.get(p.id);
551556
const overallStatus = getOverallStatus(status);
552-
if (statusFilter === 'success' && overallStatus !== 'success') return false;
553-
if (statusFilter === 'failure' && overallStatus !== 'failure') return false;
554-
if (statusFilter === 'pending' && overallStatus !== 'pending') return false;
557+
if (statusFilter === 'success' && overallStatus !== 'success')
558+
return false;
559+
if (statusFilter === 'failure' && overallStatus !== 'failure')
560+
return false;
561+
if (statusFilter === 'pending' && overallStatus !== 'pending')
562+
return false;
555563
}
556564

557565
return matchesName;
@@ -614,7 +622,10 @@ function renderProfiles(): void {
614622
/**
615623
* Render profile rules for expanded view.
616624
*/
617-
function renderProfileRules(status: ProfileStatusResult | undefined, profileId: string): string {
625+
function renderProfileRules(
626+
status: ProfileStatusResult | undefined,
627+
profileId: string
628+
): string {
618629
if (
619630
!status?.rule_evaluation_status ||
620631
status.rule_evaluation_status.length === 0
@@ -623,8 +634,10 @@ function renderProfileRules(status: ProfileStatusResult | undefined, profileId:
623634
}
624635

625636
const rules = status.rule_evaluation_status;
626-
const failingCount = rules.filter(r => r.status === 'failure' || r.status === 'error').length;
627-
const passingCount = rules.filter(r => r.status === 'success').length;
637+
const failingCount = rules.filter(
638+
(r) => r.status === 'failure' || r.status === 'error'
639+
).length;
640+
const passingCount = rules.filter((r) => r.status === 'success').length;
628641
const safeProfileId = escapeAttr(profileId);
629642

630643
return `
@@ -639,7 +652,8 @@ function renderProfileRules(status: ProfileStatusResult | undefined, profileId:
639652
const safeStatus = escapeAttr(rule.status || 'pending');
640653
const entityName = rule.entity_info?.name || 'Unknown entity';
641654
const entityType = rule.entity_info?.entity_type || 'entity';
642-
const isFailing = rule.status === 'failure' || rule.status === 'error';
655+
const isFailing =
656+
rule.status === 'failure' || rule.status === 'error';
643657
const isPassing = rule.status === 'success';
644658
645659
return `
@@ -772,8 +786,11 @@ function renderRepositories(): void {
772786
const safeRepoId = escapeAttr(repoName);
773787
const safeStatus = escapeAttr(status);
774788
const ruleCount = rules?.length || 0;
775-
const passingCount = rules?.filter((r) => r.status === 'success').length || 0;
776-
const failingCount = rules?.filter((r) => r.status === 'failure' || r.status === 'error').length || 0;
789+
const passingCount =
790+
rules?.filter((r) => r.status === 'success').length || 0;
791+
const failingCount =
792+
rules?.filter((r) => r.status === 'failure' || r.status === 'error')
793+
.length || 0;
777794

778795
return `
779796
<div class="list-item" data-repo-id="${safeRepoId}">
@@ -786,9 +803,11 @@ function renderRepositories(): void {
786803
${escapeHtml(repoName)}
787804
</div>
788805
<div class="list-item-meta">
789-
${ruleCount > 0
790-
? `${passingCount} passing, ${failingCount} failing`
791-
: 'No rule evaluations'}
806+
${
807+
ruleCount > 0
808+
? `${passingCount} passing, ${failingCount} failing`
809+
: 'No rule evaluations'
810+
}
792811
</div>
793812
</div>
794813
<span class="status-badge ${safeStatus}">
@@ -805,26 +824,33 @@ function renderRepositories(): void {
805824
.join('');
806825

807826
// Add click handlers for repo expansion
808-
repositoriesListEl.querySelectorAll('.list-item[data-repo-id]').forEach((item) => {
809-
item.addEventListener('click', () => {
810-
const repoId = (item as HTMLElement).dataset.repoId;
811-
if (repoId) {
812-
toggleRepoExpand(repoId);
813-
}
827+
repositoriesListEl
828+
.querySelectorAll('.list-item[data-repo-id]')
829+
.forEach((item) => {
830+
item.addEventListener('click', () => {
831+
const repoId = (item as HTMLElement).dataset.repoId;
832+
if (repoId) {
833+
toggleRepoExpand(repoId);
834+
}
835+
});
814836
});
815-
});
816837
}
817838

818839
/**
819840
* Render rules for a repository's expanded view.
820841
*/
821-
function renderRepoRules(rules: RuleEvaluationStatus[] | undefined, repoId: string): string {
842+
function renderRepoRules(
843+
rules: RuleEvaluationStatus[] | undefined,
844+
repoId: string
845+
): string {
822846
if (!rules || rules.length === 0) {
823847
return '<div class="empty-state">No rule evaluations for this repository</div>';
824848
}
825849

826-
const failingCount = rules.filter(r => r.status === 'failure' || r.status === 'error').length;
827-
const passingCount = rules.filter(r => r.status === 'success').length;
850+
const failingCount = rules.filter(
851+
(r) => r.status === 'failure' || r.status === 'error'
852+
).length;
853+
const passingCount = rules.filter((r) => r.status === 'success').length;
828854
const safeRepoId = escapeAttr(repoId);
829855

830856
return `
@@ -837,7 +863,8 @@ function renderRepoRules(rules: RuleEvaluationStatus[] | undefined, repoId: stri
837863
${rules
838864
.map((rule) => {
839865
const safeStatus = escapeAttr(rule.status || 'pending');
840-
const isFailing = rule.status === 'failure' || rule.status === 'error';
866+
const isFailing =
867+
rule.status === 'failure' || rule.status === 'error';
841868
const isPassing = rule.status === 'success';
842869
843870
return `
@@ -884,7 +911,9 @@ function setupRuleFilterHandlers(): void {
884911

885912
if (!filterBtn) return;
886913

887-
const filterBar = filterBtn.closest('.rule-filter-bar') as HTMLElement | null;
914+
const filterBar = filterBtn.closest(
915+
'.rule-filter-bar'
916+
) as HTMLElement | null;
888917
if (!filterBar) return;
889918

890919
const targetId = filterBar.dataset.filterTarget;
@@ -900,7 +929,9 @@ function setupRuleFilterHandlers(): void {
900929
filterBtn.classList.add('active');
901930

902931
// Filter rules
903-
const rulesList = document.querySelector(`[data-rules-list="${CSS.escape(targetId)}"]`);
932+
const rulesList = document.querySelector(
933+
`[data-rules-list="${CSS.escape(targetId)}"]`
934+
);
904935
if (!rulesList) return;
905936

906937
rulesList.querySelectorAll('.rule-item-detailed').forEach((item) => {

ui/compliance-dashboard/src/mcp-client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ export class MCPAppsClient {
229229
args.project_id = projectId;
230230
}
231231
// API returns array directly, wrap it for dashboard
232-
const profiles = await this.callTool<Profile[]>('minder_list_profiles', args);
232+
const profiles = await this.callTool<Profile[]>(
233+
'minder_list_profiles',
234+
args
235+
);
233236
return { profiles: Array.isArray(profiles) ? profiles : [] };
234237
}
235238

0 commit comments

Comments
 (0)