@manojkmfsi/monodog 1.1.37 → 1.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/monodog-dashboard/dist/assets/index-C08ciT3A.js +20 -0
- package/monodog-dashboard/dist/assets/index-C08ciT3A.js.map +1 -0
- package/monodog-dashboard/dist/assets/index-Dc2vaUOq.css +1 -0
- package/monodog-dashboard/{index.html → dist/index.html} +2 -1
- package/monodog-dashboard/package.json +0 -3
- package/package.json +2 -2
- package/monodog-dashboard/THEME_SYSTEM.md +0 -309
- package/monodog-dashboard/__tests__/AuthCallbackPage.test.ts +0 -138
- package/monodog-dashboard/__tests__/ConfigInspector.test.ts +0 -33
- package/monodog-dashboard/__tests__/DependencyGraph.test.ts +0 -72
- package/monodog-dashboard/__tests__/HealthStatus.test.ts +0 -69
- package/monodog-dashboard/__tests__/LoginPage.test.ts +0 -79
- package/monodog-dashboard/__tests__/PackageDetail.test.ts +0 -22
- package/monodog-dashboard/__tests__/ReleaseManager.test.tsx +0 -510
- package/monodog-dashboard/__tests__/api-client.test.ts +0 -475
- package/monodog-dashboard/__tests__/components.test.ts +0 -117
- package/monodog-dashboard/__tests__/dashboard.utils.test.ts +0 -144
- package/monodog-dashboard/__tests__/dependency.utils.test.ts +0 -125
- package/monodog-dashboard/__tests__/monorepoService.unit.test.ts +0 -103
- package/monodog-dashboard/__tests__/packages.utils.test.ts +0 -37
- package/monodog-dashboard/__tests__/pages.test.ts +0 -103
- package/monodog-dashboard/package-lock.json +0 -4587
- package/monodog-dashboard/postcss.config.js +0 -6
- package/monodog-dashboard/src/components/App.tsx +0 -36
- package/monodog-dashboard/src/components/LoadingState.tsx +0 -18
- package/monodog-dashboard/src/components/PermissionGuard.tsx +0 -92
- package/monodog-dashboard/src/components/ProtectedRoute.tsx +0 -24
- package/monodog-dashboard/src/components/configuration/Configuration.tsx +0 -91
- package/monodog-dashboard/src/components/configuration/components/BrandingSettings.tsx +0 -128
- package/monodog-dashboard/src/components/configuration/components/ConfigurationHeader.tsx +0 -34
- package/monodog-dashboard/src/components/configuration/components/ConfigurationModal.tsx +0 -20
- package/monodog-dashboard/src/components/configuration/components/ConfigurationTabs.tsx +0 -30
- package/monodog-dashboard/src/components/configuration/components/FeatureToggles.tsx +0 -66
- package/monodog-dashboard/src/components/configuration/components/GeneralSettings.tsx +0 -77
- package/monodog-dashboard/src/components/configuration/components/MonorepoSettings.tsx +0 -179
- package/monodog-dashboard/src/components/configuration/components/index.ts +0 -8
- package/monodog-dashboard/src/components/configuration/types/config.types.ts +0 -52
- package/monodog-dashboard/src/components/configuration/utils/config.utils.tsx +0 -115
- package/monodog-dashboard/src/components/main-dashboard/Dashboard.tsx +0 -242
- package/monodog-dashboard/src/components/main-dashboard/Layout.tsx +0 -112
- package/monodog-dashboard/src/components/main-dashboard/components/Header.tsx +0 -47
- package/monodog-dashboard/src/components/main-dashboard/components/PackageDistribution.tsx +0 -35
- package/monodog-dashboard/src/components/main-dashboard/components/PackageSearchFilter.tsx +0 -47
- package/monodog-dashboard/src/components/main-dashboard/components/PackageTable.tsx +0 -87
- package/monodog-dashboard/src/components/main-dashboard/components/QuickActions.tsx +0 -60
- package/monodog-dashboard/src/components/main-dashboard/components/StatsCards.tsx +0 -73
- package/monodog-dashboard/src/components/main-dashboard/components/index.ts +0 -7
- package/monodog-dashboard/src/components/main-dashboard/types/dashboard.types.ts +0 -33
- package/monodog-dashboard/src/components/main-dashboard/utils/dashboard.utils.tsx +0 -70
- package/monodog-dashboard/src/components/modules/ci-integration/CIIntegration.tsx +0 -277
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildDetails.tsx +0 -228
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildList.tsx +0 -212
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildOverview.tsx +0 -158
- package/monodog-dashboard/src/components/modules/ci-integration/components/CIIntegrationHeader.tsx +0 -38
- package/monodog-dashboard/src/components/modules/ci-integration/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/ci-integration/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/ci-integration/components/PipelineStatus.tsx +0 -223
- package/monodog-dashboard/src/components/modules/ci-integration/components/index.ts +0 -8
- package/monodog-dashboard/src/components/modules/ci-integration/types/ci.types.ts +0 -97
- package/monodog-dashboard/src/components/modules/ci-integration/utils/ci.utils.tsx +0 -264
- package/monodog-dashboard/src/components/modules/config-inspector/ConfigInspector.tsx +0 -324
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigEditor.tsx +0 -93
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigInspectorHeader.tsx +0 -36
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigPreview.tsx +0 -89
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigSidebar.tsx +0 -141
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigToolbar.tsx +0 -184
- package/monodog-dashboard/src/components/modules/config-inspector/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/config-inspector/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/config-inspector/components/ValidationPanel.tsx +0 -155
- package/monodog-dashboard/src/components/modules/config-inspector/components/index.ts +0 -9
- package/monodog-dashboard/src/components/modules/config-inspector/types/config.types.ts +0 -100
- package/monodog-dashboard/src/components/modules/config-inspector/utils/config.utils.tsx +0 -704
- package/monodog-dashboard/src/components/modules/dependency-graph/DependencyGraph.tsx +0 -224
- package/monodog-dashboard/src/components/modules/dependency-graph/components/CircularDependencies.tsx +0 -177
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyDetails.tsx +0 -192
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyGraphHeader.tsx +0 -30
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyList.tsx +0 -177
- package/monodog-dashboard/src/components/modules/dependency-graph/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphLegend.tsx +0 -89
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphStats.tsx +0 -141
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphToolbar.tsx +0 -107
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphVisualization.tsx +0 -179
- package/monodog-dashboard/src/components/modules/dependency-graph/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/dependency-graph/components/index.ts +0 -11
- package/monodog-dashboard/src/components/modules/dependency-graph/types/dependency.types.ts +0 -105
- package/monodog-dashboard/src/components/modules/dependency-graph/utils/dependency.utils.tsx +0 -433
- package/monodog-dashboard/src/components/modules/health-status/HealthStatus.tsx +0 -739
- package/monodog-dashboard/src/components/modules/health-status/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/health-status/components/HealthActions.tsx +0 -122
- package/monodog-dashboard/src/components/modules/health-status/components/HealthAlerts.tsx +0 -151
- package/monodog-dashboard/src/components/modules/health-status/components/HealthMetrics.tsx +0 -132
- package/monodog-dashboard/src/components/modules/health-status/components/HealthStatusHeader.tsx +0 -30
- package/monodog-dashboard/src/components/modules/health-status/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/health-status/components/OverallHealthScore.tsx +0 -122
- package/monodog-dashboard/src/components/modules/health-status/components/PackageHealthList.tsx +0 -195
- package/monodog-dashboard/src/components/modules/health-status/types/health.types.ts +0 -80
- package/monodog-dashboard/src/components/modules/health-status/utils/health.utils.tsx +0 -220
- package/monodog-dashboard/src/components/modules/packages/PackageDetail.tsx +0 -255
- package/monodog-dashboard/src/components/modules/packages/PackagesOverview.tsx +0 -166
- package/monodog-dashboard/src/components/modules/packages/components/ConfigurationTab.tsx +0 -311
- package/monodog-dashboard/src/components/modules/packages/components/DependenciesTab.tsx +0 -154
- package/monodog-dashboard/src/components/modules/packages/components/ErrorState.tsx +0 -21
- package/monodog-dashboard/src/components/modules/packages/components/HealthMetricsTab.tsx +0 -275
- package/monodog-dashboard/src/components/modules/packages/components/LoadingState.tsx +0 -14
- package/monodog-dashboard/src/components/modules/packages/components/PackageDetailHeader.tsx +0 -167
- package/monodog-dashboard/src/components/modules/packages/components/PackageDetailTabs.tsx +0 -49
- package/monodog-dashboard/src/components/modules/packages/components/PackageStats.tsx +0 -70
- package/monodog-dashboard/src/components/modules/packages/components/PackagesTable.tsx +0 -163
- package/monodog-dashboard/src/components/modules/packages/components/RecentCommitsTab.tsx +0 -90
- package/monodog-dashboard/src/components/modules/packages/components/SearchAndFilter.tsx +0 -66
- package/monodog-dashboard/src/components/modules/packages/components/index.ts +0 -12
- package/monodog-dashboard/src/components/modules/packages/types/packages.types.ts +0 -101
- package/monodog-dashboard/src/components/modules/packages/utils/packages.utils.tsx +0 -178
- package/monodog-dashboard/src/components/pipeline/JobsList.tsx +0 -83
- package/monodog-dashboard/src/components/pipeline/LogViewer.tsx +0 -392
- package/monodog-dashboard/src/components/pipeline/PipelineManager.tsx +0 -562
- package/monodog-dashboard/src/components/pipeline/WorkflowRunsList.tsx +0 -272
- package/monodog-dashboard/src/components/pipeline/WorkflowTrigger.tsx +0 -182
- package/monodog-dashboard/src/components/pipeline/utils/pipeline.utils.tsx +0 -11
- package/monodog-dashboard/src/components/publish-control/PublishControl.tsx +0 -229
- package/monodog-dashboard/src/components/publish-control/components/ChangelogViewer.tsx +0 -103
- package/monodog-dashboard/src/components/publish-control/components/ErrorState.tsx +0 -23
- package/monodog-dashboard/src/components/publish-control/components/LoadingState.tsx +0 -10
- package/monodog-dashboard/src/components/publish-control/components/PackageReleaseTable.tsx +0 -140
- package/monodog-dashboard/src/components/publish-control/components/PublishHeader.tsx +0 -30
- package/monodog-dashboard/src/components/publish-control/components/QuickActionCards.tsx +0 -56
- package/monodog-dashboard/src/components/publish-control/components/ReleaseSchedule.tsx +0 -104
- package/monodog-dashboard/src/components/publish-control/components/index.ts +0 -8
- package/monodog-dashboard/src/components/publish-control/types/publish.types.ts +0 -39
- package/monodog-dashboard/src/components/publish-control/utils/publish.utils.ts +0 -59
- package/monodog-dashboard/src/components/release-manager/ReleaseManager.tsx +0 -342
- package/monodog-dashboard/src/components/release-manager/components/ChangesetPreview.tsx +0 -123
- package/monodog-dashboard/src/components/release-manager/components/ErrorState.tsx +0 -38
- package/monodog-dashboard/src/components/release-manager/components/LoadingState.tsx +0 -18
- package/monodog-dashboard/src/components/release-manager/components/PackageSelector.tsx +0 -137
- package/monodog-dashboard/src/components/release-manager/components/PublishConfirmation.tsx +0 -150
- package/monodog-dashboard/src/components/release-manager/components/ReleaseValidation.tsx +0 -138
- package/monodog-dashboard/src/components/release-manager/components/VersionBumpSelector.tsx +0 -142
- package/monodog-dashboard/src/components/release-manager/types/index.ts +0 -9
- package/monodog-dashboard/src/components/release-manager/types/release-manager.types.ts +0 -29
- package/monodog-dashboard/src/components/setup-guide/SetupGuide.tsx +0 -96
- package/monodog-dashboard/src/components/setup-guide/components/SetupHeader.tsx +0 -24
- package/monodog-dashboard/src/components/setup-guide/components/SetupModal.tsx +0 -24
- package/monodog-dashboard/src/components/setup-guide/components/SetupProgress.tsx +0 -29
- package/monodog-dashboard/src/components/setup-guide/components/StepContent.tsx +0 -272
- package/monodog-dashboard/src/components/setup-guide/components/StepNavigation.tsx +0 -62
- package/monodog-dashboard/src/components/setup-guide/components/index.ts +0 -6
- package/monodog-dashboard/src/components/setup-guide/types/setup.types.ts +0 -38
- package/monodog-dashboard/src/components/setup-guide/utils/setup.utils.ts +0 -79
- package/monodog-dashboard/src/constants/api-config.ts +0 -81
- package/monodog-dashboard/src/constants/index.ts +0 -9
- package/monodog-dashboard/src/constants/messages.ts +0 -40
- package/monodog-dashboard/src/icons/heroicons.ts +0 -65
- package/monodog-dashboard/src/icons/index.tsx +0 -1788
- package/monodog-dashboard/src/index.css +0 -175
- package/monodog-dashboard/src/main.tsx +0 -9
- package/monodog-dashboard/src/pages/AuthCallbackPage.tsx +0 -103
- package/monodog-dashboard/src/pages/CIPage.tsx +0 -6
- package/monodog-dashboard/src/pages/ConfigPage.tsx +0 -6
- package/monodog-dashboard/src/pages/DashboardPage.tsx +0 -6
- package/monodog-dashboard/src/pages/DependenciesPage.tsx +0 -6
- package/monodog-dashboard/src/pages/HealthPage.tsx +0 -6
- package/monodog-dashboard/src/pages/LoginPage.tsx +0 -77
- package/monodog-dashboard/src/pages/PackageDetailPage.tsx +0 -6
- package/monodog-dashboard/src/pages/PackagesPage.tsx +0 -6
- package/monodog-dashboard/src/pages/PipelinePage.tsx +0 -22
- package/monodog-dashboard/src/pages/PublishPage.tsx +0 -6
- package/monodog-dashboard/src/pages/ReleaseManagerPage.tsx +0 -9
- package/monodog-dashboard/src/pages/index.ts +0 -28
- package/monodog-dashboard/src/routes/AppRouter.tsx +0 -89
- package/monodog-dashboard/src/routes/AppRouterPages.tsx +0 -56
- package/monodog-dashboard/src/routes/index.ts +0 -10
- package/monodog-dashboard/src/routes/routes.config.ts +0 -94
- package/monodog-dashboard/src/services/api/api-client.ts +0 -189
- package/monodog-dashboard/src/services/api/index.ts +0 -30
- package/monodog-dashboard/src/services/api/types/api.types.ts +0 -63
- package/monodog-dashboard/src/services/auth-context.tsx +0 -344
- package/monodog-dashboard/src/services/monorepoService.ts +0 -733
- package/monodog-dashboard/src/services/permission-context.tsx +0 -193
- package/monodog-dashboard/src/theme/COMPONENT_UPDATES.md +0 -273
- package/monodog-dashboard/src/theme/INTEGRATION.md +0 -381
- package/monodog-dashboard/src/theme/README.md +0 -239
- package/monodog-dashboard/src/theme/examples.tsx +0 -386
- package/monodog-dashboard/src/theme/index.ts +0 -402
- package/monodog-dashboard/src/theme/migration-guide.md +0 -335
- package/monodog-dashboard/src/types/auth-context.types.ts +0 -51
- package/monodog-dashboard/src/types/component.types.ts +0 -96
- package/monodog-dashboard/src/types/icons.types.ts +0 -13
- package/monodog-dashboard/src/types/index.ts +0 -68
- package/monodog-dashboard/src/types/monorepo-service.types.ts +0 -53
- package/monodog-dashboard/src/types/permission-context.types.ts +0 -49
- package/monodog-dashboard/src/types/pipeline.types.ts +0 -89
- package/monodog-dashboard/src/types/routes.types.ts +0 -12
- package/monodog-dashboard/src/utils/cookies.ts +0 -47
- package/monodog-dashboard/tailwind.config.js +0 -68
- package/monodog-dashboard/tsconfig.app.json +0 -14
- package/monodog-dashboard/tsconfig.json +0 -17
- package/monodog-dashboard/tsconfig.node.json +0 -10
- package/monodog-dashboard/vite.config.ts +0 -9
|
@@ -1,562 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
|
-
import { ExclamationCircleIcon, CheckCircleIcon, ClockIcon, XCircleIcon } from '../../icons/index';
|
|
3
|
-
import LogViewer from './LogViewer';
|
|
4
|
-
import WorkflowRunsList from './WorkflowRunsList';
|
|
5
|
-
import WorkflowTrigger from './WorkflowTrigger';
|
|
6
|
-
import JobsList from './JobsList';
|
|
7
|
-
import { useAuth } from '../../services/auth-context';
|
|
8
|
-
import { monorepoService } from '../../services/monorepoService';
|
|
9
|
-
import { getSessionPermission } from './utils/pipeline.utils';
|
|
10
|
-
import { DASHBOARD_ERROR_MESSAGES, DASHBOARD_AUTH_MESSAGES } from '../../constants/messages';
|
|
11
|
-
import { DASHBOARD_API_ENDPOINTS } from '../../constants/api-config';
|
|
12
|
-
import apiClient from '../../services/api';
|
|
13
|
-
import type { WorkflowRun, HierarchicalStep } from '../../types';
|
|
14
|
-
|
|
15
|
-
interface Job {
|
|
16
|
-
id: number;
|
|
17
|
-
gitHubJobId: number;
|
|
18
|
-
name: string;
|
|
19
|
-
status: string;
|
|
20
|
-
conclusion: string | null;
|
|
21
|
-
htmlUrl: string;
|
|
22
|
-
startedAt: string | null;
|
|
23
|
-
completedAt: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface Pipeline {
|
|
27
|
-
id: string;
|
|
28
|
-
releaseVersion: string;
|
|
29
|
-
packageName: string;
|
|
30
|
-
workflowName: string;
|
|
31
|
-
currentStatus: string;
|
|
32
|
-
currentConclusion?: string | null;
|
|
33
|
-
workflowId: string;
|
|
34
|
-
workflowPath?: string;
|
|
35
|
-
lastRunId: string | null;
|
|
36
|
-
workflowRuns: WorkflowRun[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface PipelineManagerProps {
|
|
40
|
-
packageName?: string;
|
|
41
|
-
onNavigate?: (path: string) => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function parseStepsFromLogs(rawLogs: string): HierarchicalStep[] {
|
|
45
|
-
const lines = rawLogs.split('\n');
|
|
46
|
-
const steps: HierarchicalStep[] = [];
|
|
47
|
-
let currentStep: HierarchicalStep | null = null;
|
|
48
|
-
const stepStack: HierarchicalStep[] = [];
|
|
49
|
-
|
|
50
|
-
for (let i = 0; i < lines.length; i++) {
|
|
51
|
-
const line = lines[i];
|
|
52
|
-
const trimmedLine = line.trim();
|
|
53
|
-
|
|
54
|
-
// Detect level from indentation
|
|
55
|
-
const leadingSpaces = line.match(/^(\s*)/)?.[1].length || 0;
|
|
56
|
-
const level = Math.floor(leadingSpaces / 2); // Every 2 spaces = 1 level
|
|
57
|
-
|
|
58
|
-
// GitHub Actions group markers: ##[group]Step Name / ##[endgroup]
|
|
59
|
-
if (line.includes('##[group]')) {
|
|
60
|
-
// Extract new step name
|
|
61
|
-
const groupMatch = line.match(/##\[group\](.*?)(?:##\[endgroup\]|$)/);
|
|
62
|
-
const stepName = groupMatch ? groupMatch[1].trim() : `Step ${steps.length + 1}`;
|
|
63
|
-
|
|
64
|
-
const newStep: HierarchicalStep = {
|
|
65
|
-
name: stepName,
|
|
66
|
-
logs: [],
|
|
67
|
-
level: level,
|
|
68
|
-
children: [],
|
|
69
|
-
startIndex: i,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// Find correct parent based on level
|
|
73
|
-
while (stepStack.length > 0 && stepStack[stepStack.length - 1].level >= newStep.level) {
|
|
74
|
-
stepStack.pop();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Add to parent or root
|
|
78
|
-
if (stepStack.length > 0) {
|
|
79
|
-
const parent = stepStack[stepStack.length - 1];
|
|
80
|
-
if (!parent.children) parent.children = [];
|
|
81
|
-
parent.children.push(newStep);
|
|
82
|
-
} else {
|
|
83
|
-
steps.push(newStep);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
stepStack.push(newStep);
|
|
87
|
-
currentStep = newStep;
|
|
88
|
-
} else if (line.includes('##[endgroup]')) {
|
|
89
|
-
// End of group - don't add this line to logs
|
|
90
|
-
continue;
|
|
91
|
-
} else if (trimmedLine) {
|
|
92
|
-
// Regular log line (non-empty)
|
|
93
|
-
if (currentStep) {
|
|
94
|
-
currentStep.logs.push(line);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return steps;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function getStatusIcon(status: string, conclusion: string | null, isUpdating: boolean = false) {
|
|
103
|
-
if (isUpdating) {
|
|
104
|
-
return <ClockIcon className="h-6 w-6 text-yellow-500 animate-spin" />;
|
|
105
|
-
}
|
|
106
|
-
if (status === 'completed') {
|
|
107
|
-
if (conclusion === 'success') {
|
|
108
|
-
return <CheckCircleIcon className="h-6 w-6 text-green-600" />;
|
|
109
|
-
} else if (conclusion === 'failure') {
|
|
110
|
-
return <ExclamationCircleIcon className="h-6 w-6 text-red-600" />;
|
|
111
|
-
} else if (conclusion === 'cancelled') {
|
|
112
|
-
return <XCircleIcon className="h-6 w-6 text-gray-600" />;
|
|
113
|
-
} else if (conclusion === 'skipped') {
|
|
114
|
-
return <ClockIcon className="h-6 w-6 text-gray-600" />;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (status === 'in_progress' || status === 'queued') {
|
|
118
|
-
return <ClockIcon className="h-6 w-6 text-blue-600" />;
|
|
119
|
-
}
|
|
120
|
-
return <ClockIcon className="h-6 w-6 text-gray-600" />;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export default function PipelineManager({
|
|
124
|
-
packageName,
|
|
125
|
-
onNavigate,
|
|
126
|
-
}: PipelineManagerProps) {
|
|
127
|
-
const [pipelines, setPipelines] = useState<Pipeline[]>([]);
|
|
128
|
-
const [selectedRun, setSelectedRun] = useState<number | null>(null);
|
|
129
|
-
const [jobs, setJobs] = useState<Job[]>([]);
|
|
130
|
-
const [selectedJob, setSelectedJob] = useState<Job | null>(null);
|
|
131
|
-
const [jobLogs, setJobLogs] = useState<any>(null);
|
|
132
|
-
const [loading, setLoading] = useState(true);
|
|
133
|
-
const [error, setError] = useState<string | null>(null);
|
|
134
|
-
const [updatingPipelines, setUpdatingPipelines] = useState<Set<string>>(new Set());
|
|
135
|
-
const { hasPermission } = useAuth();
|
|
136
|
-
|
|
137
|
-
// Infinite scroll state
|
|
138
|
-
const [pipelineOffset, setPipelineOffset] = useState(0);
|
|
139
|
-
const [pipelineLoadingMore, setPipelineLoadingMore] = useState(false);
|
|
140
|
-
const pipelinePageSize = 10;
|
|
141
|
-
const runsPageSize = 20;
|
|
142
|
-
|
|
143
|
-
const { owner, repo } = useMemo(() => getSessionPermission() || {}, []);
|
|
144
|
-
|
|
145
|
-
// Fetch all pipelines on initial load (only once)
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
const fetchPipelinesOnce = async () => {
|
|
148
|
-
try {
|
|
149
|
-
const url = DASHBOARD_API_ENDPOINTS.PIPELINES.LIST;
|
|
150
|
-
|
|
151
|
-
const response = await apiClient.get(url);
|
|
152
|
-
|
|
153
|
-
if (!response.success) {
|
|
154
|
-
if (response.error?.status === 401 || response.error?.status === 403) {
|
|
155
|
-
window.location.href = '/login';
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
// If endpoint doesn't exist (404), use empty array instead of throwing
|
|
159
|
-
if (response.error?.status === 404) {
|
|
160
|
-
console.warn('Pipelines endpoint not available');
|
|
161
|
-
setPipelines([]);
|
|
162
|
-
setLoading(false);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
throw new Error(`Failed to fetch pipelines: ${response.error?.message}`);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const pipelineData = Array.isArray(response.data) ? response.data : [];
|
|
169
|
-
setPipelines(pipelineData);
|
|
170
|
-
|
|
171
|
-
setLoading(false);
|
|
172
|
-
} catch (err) {
|
|
173
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
174
|
-
setLoading(false);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
fetchPipelinesOnce();
|
|
179
|
-
const interval = setInterval(fetchPipelinesOnce, 5000);
|
|
180
|
-
|
|
181
|
-
return () => clearInterval(interval);
|
|
182
|
-
}, [owner, repo, packageName]);
|
|
183
|
-
|
|
184
|
-
// Poll all non success pipeline for status updates
|
|
185
|
-
useEffect(() => {
|
|
186
|
-
|
|
187
|
-
const pollPipelineStatus = async () => {
|
|
188
|
-
try {
|
|
189
|
-
// Fetch the most recent workflow run for the selected pipeline
|
|
190
|
-
pipelines.forEach(async (pipeline)=>{
|
|
191
|
-
|
|
192
|
-
if (pipeline.workflowId && pipeline.currentStatus !== 'completed' && !updatingPipelines.has(pipeline.workflowId)) {
|
|
193
|
-
|
|
194
|
-
const runsUrl = DASHBOARD_API_ENDPOINTS.WORKFLOWS.LIST(owner, repo) + `?workflow_id=${pipeline.workflowId}&per_page=${runsPageSize}&page=1`;
|
|
195
|
-
const runsResponse = await apiClient.get(runsUrl);
|
|
196
|
-
|
|
197
|
-
if (runsResponse.success) {
|
|
198
|
-
const runsData = runsResponse.data;
|
|
199
|
-
const latestRun = runsData.workflow_runs?.[0] || runsData.runs?.[0];
|
|
200
|
-
|
|
201
|
-
if (latestRun) {
|
|
202
|
-
// Check if status or conclusion has changed
|
|
203
|
-
const statusChanged = latestRun.status !== pipeline.currentStatus;
|
|
204
|
-
const conclusionChanged = latestRun.conclusion !== pipeline.currentConclusion;
|
|
205
|
-
|
|
206
|
-
if (statusChanged || conclusionChanged) {
|
|
207
|
-
// Mark as updating
|
|
208
|
-
setUpdatingPipelines(prev => new Set(prev).add(pipeline.workflowId));
|
|
209
|
-
|
|
210
|
-
try {
|
|
211
|
-
// Update pipeline status in the database
|
|
212
|
-
const updateResponse = await apiClient.put(
|
|
213
|
-
DASHBOARD_API_ENDPOINTS.PIPELINES.STATUS(pipeline.id),
|
|
214
|
-
{
|
|
215
|
-
currentStatus: latestRun.status,
|
|
216
|
-
currentConclusion: latestRun.conclusion || null,
|
|
217
|
-
lastRunId: latestRun.id,
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
// Update the selected pipeline with new status
|
|
222
|
-
const updatedPipeline = {
|
|
223
|
-
...pipeline,
|
|
224
|
-
currentStatus: latestRun.status,
|
|
225
|
-
currentConclusion: latestRun.conclusion || null,
|
|
226
|
-
lastRunId: latestRun.id,
|
|
227
|
-
};
|
|
228
|
-
console.log(updatedPipeline)
|
|
229
|
-
if(updatedPipeline.currentStatus == 'completed'){
|
|
230
|
-
const updatedPackages = await monorepoService.refreshPackages();
|
|
231
|
-
}
|
|
232
|
-
// setSelectedPipeline(updatedPipeline);
|
|
233
|
-
|
|
234
|
-
// Also update in the pipelines list
|
|
235
|
-
setPipelines(prevPipelines =>
|
|
236
|
-
prevPipelines.map(p =>
|
|
237
|
-
p.id === pipeline.id ? updatedPipeline : p
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
} catch (updateError) {
|
|
241
|
-
console.warn('Failed to update pipeline status:', updateError);
|
|
242
|
-
} finally {
|
|
243
|
-
// Remove updating flag
|
|
244
|
-
setUpdatingPipelines(prev => {
|
|
245
|
-
const updated = new Set(prev);
|
|
246
|
-
updated.delete(pipeline.workflowId);
|
|
247
|
-
return updated;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
} catch (err) {
|
|
258
|
-
console.warn('Failed to poll pipeline status:', err);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// Poll immediately, then every 10 seconds
|
|
263
|
-
pollPipelineStatus();
|
|
264
|
-
const interval = setInterval(pollPipelineStatus, 10000);
|
|
265
|
-
|
|
266
|
-
return () => clearInterval(interval);
|
|
267
|
-
}, [pipelines, owner, repo]);
|
|
268
|
-
|
|
269
|
-
// Fetch jobs for selected run
|
|
270
|
-
useEffect(() => {
|
|
271
|
-
if (!selectedRun) return;
|
|
272
|
-
|
|
273
|
-
const fetchJobs = async () => {
|
|
274
|
-
try {
|
|
275
|
-
const response = await apiClient.get(
|
|
276
|
-
DASHBOARD_API_ENDPOINTS.WORKFLOWS.RUNS(owner, repo, selectedRun)
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
if (!response.success) {
|
|
280
|
-
if (response.error?.status === 401 || response.error?.status === 403) {
|
|
281
|
-
window.location.href = '/login';
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
throw new Error(`Failed to fetch jobs: ${response.error?.message}`);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
setJobs(response.data.jobs || []);
|
|
288
|
-
|
|
289
|
-
// Auto-select first job
|
|
290
|
-
// if (data.jobs && data.jobs.length > 0 && !selectedJob) {
|
|
291
|
-
// setSelectedJob(data.jobs[0]);
|
|
292
|
-
// }
|
|
293
|
-
} catch (err) {
|
|
294
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
const interval = setInterval(fetchJobs, 5000);
|
|
299
|
-
fetchJobs();
|
|
300
|
-
|
|
301
|
-
return () => clearInterval(interval);
|
|
302
|
-
}, [selectedRun, owner, repo]);
|
|
303
|
-
|
|
304
|
-
// Fetch logs for selected job
|
|
305
|
-
useEffect(() => {
|
|
306
|
-
if (!selectedJob) return;
|
|
307
|
-
|
|
308
|
-
const fetchLogs = async () => {
|
|
309
|
-
try {
|
|
310
|
-
const response = await apiClient.get(
|
|
311
|
-
DASHBOARD_API_ENDPOINTS.WORKFLOWS.LOGS(owner, repo, selectedJob.gitHubJobId)
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
if (!response.success) {
|
|
315
|
-
if (response.error?.status === 403) {
|
|
316
|
-
setError(DASHBOARD_ERROR_MESSAGES.PERMISSION_ERROR);
|
|
317
|
-
} else if (response.error?.status === 401) {
|
|
318
|
-
setError(DASHBOARD_AUTH_MESSAGES.SESSION_EXPIRED);
|
|
319
|
-
window.location.href = '/login';
|
|
320
|
-
} else {
|
|
321
|
-
console.log(response)
|
|
322
|
-
const errorDetails = response.error?.details || 'Unknown error';
|
|
323
|
-
setError(`${DASHBOARD_ERROR_MESSAGES.FAILED_TO_FETCH_LOGS}: ${errorDetails}`);
|
|
324
|
-
}
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const data = response.data;
|
|
329
|
-
|
|
330
|
-
// Check if logs are empty
|
|
331
|
-
if (data.meta && data.meta.isEmpty) {
|
|
332
|
-
setJobLogs('');
|
|
333
|
-
setError(DASHBOARD_ERROR_MESSAGES.FAILED_TO_FETCH_LOGS);
|
|
334
|
-
} else {
|
|
335
|
-
setJobLogs(data.logs || data);
|
|
336
|
-
setError(null);
|
|
337
|
-
}
|
|
338
|
-
} catch (err) {
|
|
339
|
-
const errorMsg = err instanceof Error ? err.message : DASHBOARD_ERROR_MESSAGES.FAILED_TO_FETCH_LOGS;
|
|
340
|
-
setError(`${DASHBOARD_ERROR_MESSAGES.FAILED_TO_FETCH_LOGS}: ${errorMsg}`);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
// Fetch logs on selection
|
|
345
|
-
fetchLogs();
|
|
346
|
-
|
|
347
|
-
// Poll for updated logs if job is still running
|
|
348
|
-
if (selectedJob.status !== 'completed') {
|
|
349
|
-
const interval = setInterval(fetchLogs, 5000);
|
|
350
|
-
return () => clearInterval(interval);
|
|
351
|
-
}
|
|
352
|
-
}, [selectedJob, owner, repo]);
|
|
353
|
-
|
|
354
|
-
const handleSelectJob = (job: Job) => {
|
|
355
|
-
setSelectedJob(job);
|
|
356
|
-
setJobLogs(null);
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Handle infinite scroll for pipelines list
|
|
360
|
-
const handlePipelinesScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
|
361
|
-
const element = e.currentTarget;
|
|
362
|
-
const isNearBottom = element.scrollHeight - element.scrollTop - element.clientHeight < 100;
|
|
363
|
-
|
|
364
|
-
if (isNearBottom && !pipelineLoadingMore && pipelines.length >= pipelinePageSize) {
|
|
365
|
-
loadMorePipelines();
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
const loadMorePipelines = async () => {
|
|
370
|
-
if (pipelineLoadingMore) return;
|
|
371
|
-
|
|
372
|
-
setPipelineLoadingMore(true);
|
|
373
|
-
try {
|
|
374
|
-
const url = DASHBOARD_API_ENDPOINTS.PIPELINES.LIST + `?offset=${pipelineOffset + pipelinePageSize}&limit=${pipelinePageSize}`;
|
|
375
|
-
|
|
376
|
-
const response = await apiClient.get(url);
|
|
377
|
-
if (!response.success) throw new Error('Failed to fetch more pipelines');
|
|
378
|
-
|
|
379
|
-
const newPipelines = response.data;
|
|
380
|
-
setPipelines(prev => [...prev, ...newPipelines]);
|
|
381
|
-
setPipelineOffset(prev => prev + pipelinePageSize);
|
|
382
|
-
} catch (err) {
|
|
383
|
-
console.error('Error loading more pipelines:', err);
|
|
384
|
-
} finally {
|
|
385
|
-
setPipelineLoadingMore(false);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
const handleSelectRun = (runId: number) => {
|
|
390
|
-
setSelectedRun(runId);
|
|
391
|
-
setSelectedJob(null);
|
|
392
|
-
setJobs([]);
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
if (loading && pipelines.length === 0) {
|
|
396
|
-
return (
|
|
397
|
-
<div className="flex items-center justify-center py-12">
|
|
398
|
-
<div className="animate-spin">
|
|
399
|
-
<ClockIcon className="h-8 w-8 text-blue-600" />
|
|
400
|
-
</div>
|
|
401
|
-
</div>
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
return (
|
|
406
|
-
<div>
|
|
407
|
-
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 h-[50vh] overflow-hidden">
|
|
408
|
-
{/* Pipelines List */}
|
|
409
|
-
<div className="lg:col-span-1 overflow-y-auto border-r border-gray-200" onScroll={handlePipelinesScroll}>
|
|
410
|
-
<div className="p-4 space-y-4">
|
|
411
|
-
<div className="flex items-center justify-between">
|
|
412
|
-
<h3 className="text-lg font-semibold text-gray-900">Pipelines</h3>
|
|
413
|
-
{hasPermission('maintain') && (
|
|
414
|
-
<WorkflowTrigger
|
|
415
|
-
owner={owner}
|
|
416
|
-
repo={repo}
|
|
417
|
-
/>
|
|
418
|
-
)}
|
|
419
|
-
</div>
|
|
420
|
-
|
|
421
|
-
{error && (
|
|
422
|
-
<div className="p-3 bg-red-50 border border-red-200 rounded-lg">
|
|
423
|
-
<p className="text-xs text-red-700">{error}</p>
|
|
424
|
-
</div>
|
|
425
|
-
)}
|
|
426
|
-
|
|
427
|
-
<div className="space-y-2">
|
|
428
|
-
{pipelines.length === 0 ? (
|
|
429
|
-
<p className="text-sm text-gray-500">No pipelines found</p>
|
|
430
|
-
) : (
|
|
431
|
-
<>
|
|
432
|
-
{pipelines.map((pipeline) => (
|
|
433
|
-
<div
|
|
434
|
-
key={pipeline.id}
|
|
435
|
-
className={`w-full text-left p-3 rounded-lg border transition-colors border-gray-200 hover:bg-gray-50`}
|
|
436
|
-
>
|
|
437
|
-
<div className="flex items-start gap-2">
|
|
438
|
-
{getStatusIcon(pipeline.currentStatus, pipeline.currentConclusion || null, updatingPipelines.has(pipeline.id))}
|
|
439
|
-
<div className="min-w-0 flex-1">
|
|
440
|
-
<p className="font-medium text-sm text-gray-900 truncate">
|
|
441
|
-
{pipeline.packageName}
|
|
442
|
-
</p>
|
|
443
|
-
<p className="text-xs text-gray-500">
|
|
444
|
-
v{pipeline.releaseVersion}
|
|
445
|
-
</p>
|
|
446
|
-
<p className="text-xs text-gray-400 mt-1">
|
|
447
|
-
{pipeline.workflowName}
|
|
448
|
-
</p>
|
|
449
|
-
</div>
|
|
450
|
-
</div>
|
|
451
|
-
</div>
|
|
452
|
-
))}
|
|
453
|
-
{pipelineLoadingMore && (
|
|
454
|
-
<div className="flex justify-center py-4">
|
|
455
|
-
<div className="animate-spin">
|
|
456
|
-
<ClockIcon className="h-5 w-5 text-blue-600" />
|
|
457
|
-
</div>
|
|
458
|
-
</div>
|
|
459
|
-
)}
|
|
460
|
-
</>
|
|
461
|
-
)}
|
|
462
|
-
</div>
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
|
|
466
|
-
{/* Workflow Runs List */}
|
|
467
|
-
<div className="lg:col-span-1 overflow-y-auto border-r border-gray-200">
|
|
468
|
-
<div className="p-4 space-y-4">
|
|
469
|
-
<h3 className="text-lg font-semibold text-gray-900">Runs</h3>
|
|
470
|
-
<WorkflowRunsList
|
|
471
|
-
owner={owner}
|
|
472
|
-
repo={repo}
|
|
473
|
-
packageName={packageName}
|
|
474
|
-
onSelectRun={handleSelectRun}
|
|
475
|
-
runId={selectedRun}
|
|
476
|
-
limit={runsPageSize}
|
|
477
|
-
/>
|
|
478
|
-
</div>
|
|
479
|
-
</div>
|
|
480
|
-
|
|
481
|
-
{/* Jobs List */}
|
|
482
|
-
<div className="lg:col-span-1 overflow-y-auto border-r border-gray-200">
|
|
483
|
-
<div className="p-4 space-y-4">
|
|
484
|
-
<h3 className="text-lg font-semibold text-gray-900">Jobs</h3>
|
|
485
|
-
<div className="space-y-2">
|
|
486
|
-
{jobs.length ? (
|
|
487
|
-
<JobsList
|
|
488
|
-
jobs={jobs}
|
|
489
|
-
selectedJob={selectedJob}
|
|
490
|
-
onSelectJob={handleSelectJob}
|
|
491
|
-
/>
|
|
492
|
-
) : selectedRun ? (
|
|
493
|
-
<div className="flex items-center justify-center h-full">
|
|
494
|
-
<div className="animate-spin">
|
|
495
|
-
<ClockIcon className="h-8 w-8 text-blue-600" />
|
|
496
|
-
</div>
|
|
497
|
-
</div>
|
|
498
|
-
) : (
|
|
499
|
-
<div className="flex items-center justify-center h-full text-gray-500">
|
|
500
|
-
<p className="text-sm">Select a run to view jobs</p>
|
|
501
|
-
</div>
|
|
502
|
-
)}
|
|
503
|
-
</div>
|
|
504
|
-
</div>
|
|
505
|
-
</div>
|
|
506
|
-
</div>
|
|
507
|
-
{/* Log Viewer */}
|
|
508
|
-
<div className="lg:col-span-1 overflow-hidden border-t pt-2 h-[50vh]">
|
|
509
|
-
<div className="p-4 h-full overflow-hidden flex flex-col">
|
|
510
|
-
<h3 className="text-lg font-semibold text-gray-900">Logs</h3>
|
|
511
|
-
{selectedJob && jobLogs ? (
|
|
512
|
-
<LogViewer
|
|
513
|
-
steps={(() => {
|
|
514
|
-
const hierarchicalSteps = parseStepsFromLogs(jobLogs);
|
|
515
|
-
|
|
516
|
-
let stepCounter = 0;
|
|
517
|
-
const addStepNumbers = (steps: HierarchicalStep[]): any[] => {
|
|
518
|
-
return steps.map((step) => {
|
|
519
|
-
stepCounter++;
|
|
520
|
-
const startedAt = step.logs.at(0)?.split(" ")[0];
|
|
521
|
-
const completedAt = step.logs.at(-1)?.split(" ")[0];
|
|
522
|
-
return {
|
|
523
|
-
stepNumber: stepCounter,
|
|
524
|
-
stepName: step.name,
|
|
525
|
-
level: step.level,
|
|
526
|
-
status: '',
|
|
527
|
-
conclusion: '',
|
|
528
|
-
startedAt: startedAt,
|
|
529
|
-
completedAt: completedAt,
|
|
530
|
-
logs: step.logs.map((line: string, lineIdx: number) => ({
|
|
531
|
-
lineNumber: lineIdx + 1,
|
|
532
|
-
timestamp: new Date().toISOString(),
|
|
533
|
-
content: line,
|
|
534
|
-
ansiContent: line,
|
|
535
|
-
})),
|
|
536
|
-
children: step.children ? addStepNumbers(step.children) : undefined,
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
};
|
|
540
|
-
return addStepNumbers(hierarchicalSteps);
|
|
541
|
-
})()}
|
|
542
|
-
jobName={selectedJob.name}
|
|
543
|
-
jobStatus={selectedJob.status}
|
|
544
|
-
jobConclusion={selectedJob.conclusion}
|
|
545
|
-
gitHubLogsUrl={selectedJob.htmlUrl}
|
|
546
|
-
/>
|
|
547
|
-
) : selectedJob ? (
|
|
548
|
-
<div className="flex items-center justify-center h-full">
|
|
549
|
-
<div className="animate-spin">
|
|
550
|
-
<ClockIcon className="h-8 w-8 text-blue-600" />
|
|
551
|
-
</div>
|
|
552
|
-
</div>
|
|
553
|
-
) : (
|
|
554
|
-
<div className="flex items-center justify-center h-full text-gray-500">
|
|
555
|
-
<p className="text-sm">Select a job to view logs</p>
|
|
556
|
-
</div>
|
|
557
|
-
)}
|
|
558
|
-
</div>
|
|
559
|
-
</div>
|
|
560
|
-
</div>
|
|
561
|
-
);
|
|
562
|
-
}
|