ef499b6d47
## Summary - Re-enable one lint rule that was temporarily disabled during the ESLint-to-Oxlint migration: - **`twenty/sort-css-properties-alphabetically`** in twenty-front — 578 violations auto-fixed across 390 files - Document why **`typescript/consistent-type-imports`** cannot be auto-fixed in twenty-server: NestJS relies on `emitDecoratorMetadata` for DI, so converting constructor parameter imports to `import type` erases them at compile time and breaks dependency injection at runtime - Right-size CI runners, reducing 8-core usage from 18 jobs to 3: | Change | Jobs | Rationale | |--------|------|-----------| | **Keep 8-core** | `ci-merge-queue/e2e-test`, `ci-front/front-sb-build`, `ci-front/front-build` | Heavy builds needing max CPU + memory (10GB NODE_OPTIONS, full Storybook webpack bundling) | | **8-core → 4-core** | `ci-server` (build, lint-typecheck, validation, test, integration-test), `ci-front/front-sb-test`, `ci-zapier/server-setup`, `ci-sdk/sdk-e2e-test` | Already sharded into 10-12 parallel instances, I/O-bound (DB/Redis), or moderate single builds | | **8-core → 2-core** | `ci-emails/emails-test` | Trivially lightweight (build + curl health check) | | **Removed** | `ci-front/front-chromatic-deployment` | Dead code — permanently disabled with `if: false` | - Fix merge queue CI issues: - **Concurrency**: Use `merge_group.base_ref` instead of unique merge group ref so new queue entries cancel previous runs - **Required status checks**: Add `merge_group` trigger to all 6 required CI workflows (front, server, shared, website, docker-compose, sdk) with `changed-files-check` auto-skipped for merge_group events — status check jobs auto-pass without re-running full CI - **Build caching**: Add Nx build cache restore/save to E2E test job with fallback to `main` branch cache for faster frontend and server builds ## Test plan - [ ] CI passes on this PR (verifies lint rule auto-fix works) - [ ] Verify 4-core runner jobs complete within their 30-minute timeouts - [ ] Verify merge queue status checks auto-pass (ci-front-status-check, ci-server-status-check, etc.) - [ ] Verify merge queue E2E concurrency cancels previous runs when a new PR enters the queue
181 lines
5.0 KiB
TypeScript
181 lines
5.0 KiB
TypeScript
import { styled } from '@linaria/react';
|
|
import { useLingui } from '@lingui/react/macro';
|
|
import { useState } from 'react';
|
|
import { IconCopy, IconTerminal } from 'twenty-ui/display';
|
|
import { LightIconButton } from 'twenty-ui/input';
|
|
import { themeCssVariables } from 'twenty-ui/theme-constants';
|
|
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
|
|
|
|
const StyledContainer = styled.div`
|
|
border-radius: ${themeCssVariables.border.radius.sm};
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
`;
|
|
|
|
const StyledHeader = styled.div`
|
|
align-items: center;
|
|
background: ${themeCssVariables.background.tertiary};
|
|
border-bottom: 1px solid ${themeCssVariables.border.color.medium};
|
|
display: flex;
|
|
gap: ${themeCssVariables.spacing[2]};
|
|
justify-content: space-between;
|
|
padding: ${themeCssVariables.spacing[1]} ${themeCssVariables.spacing[2]};
|
|
`;
|
|
|
|
const StyledHeaderLeft = styled.div`
|
|
align-items: center;
|
|
color: ${themeCssVariables.font.color.secondary};
|
|
display: flex;
|
|
font-size: ${themeCssVariables.font.size.sm};
|
|
gap: ${themeCssVariables.spacing[1]};
|
|
`;
|
|
|
|
const StyledTabContainer = styled.div`
|
|
display: flex;
|
|
gap: ${themeCssVariables.spacing[1]};
|
|
`;
|
|
|
|
const StyledTab = styled.button<{ isActive: boolean; hasError?: boolean }>`
|
|
background: ${({ isActive }) =>
|
|
isActive ? themeCssVariables.background.secondary : 'transparent'};
|
|
border: none;
|
|
border-radius: ${themeCssVariables.border.radius.xs};
|
|
color: ${({ isActive, hasError }) =>
|
|
hasError
|
|
? themeCssVariables.color.red
|
|
: isActive
|
|
? themeCssVariables.font.color.primary
|
|
: themeCssVariables.font.color.tertiary};
|
|
cursor: pointer;
|
|
font-size: ${themeCssVariables.font.size.xs};
|
|
font-weight: ${({ isActive }) =>
|
|
isActive
|
|
? themeCssVariables.font.weight.medium
|
|
: themeCssVariables.font.weight.regular};
|
|
padding: ${themeCssVariables.spacing['0.5']} ${themeCssVariables.spacing[1]};
|
|
|
|
&:hover {
|
|
background: ${themeCssVariables.background.secondary};
|
|
color: ${({ hasError }) =>
|
|
hasError
|
|
? themeCssVariables.color.red
|
|
: themeCssVariables.font.color.primary};
|
|
}
|
|
`;
|
|
|
|
const StyledOutputArea = styled.div<{ isError?: boolean }>`
|
|
background: ${themeCssVariables.background.tertiary};
|
|
color: ${({ isError }) =>
|
|
isError
|
|
? themeCssVariables.color.red
|
|
: themeCssVariables.font.color.primary};
|
|
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
|
|
font-size: ${themeCssVariables.font.size.sm};
|
|
line-height: 1.5;
|
|
max-height: 300px;
|
|
min-height: 100px;
|
|
overflow-y: auto;
|
|
padding: ${themeCssVariables.spacing[2]};
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
`;
|
|
|
|
const StyledEmptyMessage = styled.div`
|
|
color: ${themeCssVariables.font.color.tertiary};
|
|
font-style: italic;
|
|
`;
|
|
|
|
const StyledCursor = styled.span`
|
|
animation: blink 1s step-end infinite;
|
|
background: ${themeCssVariables.font.color.primary};
|
|
display: inline-block;
|
|
height: 1em;
|
|
margin-left: 2px;
|
|
vertical-align: text-bottom;
|
|
width: 8px;
|
|
|
|
@keyframes blink {
|
|
0%,
|
|
100% {
|
|
opacity: 1;
|
|
}
|
|
50% {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
`;
|
|
|
|
type TabType = 'stdout' | 'stderr';
|
|
|
|
type TerminalOutputProps = {
|
|
stdout: string;
|
|
stderr: string;
|
|
isRunning?: boolean;
|
|
};
|
|
|
|
export const TerminalOutput = ({
|
|
stdout,
|
|
stderr,
|
|
isRunning = false,
|
|
}: TerminalOutputProps) => {
|
|
const { t } = useLingui();
|
|
const { copyToClipboard } = useCopyToClipboard();
|
|
|
|
const hasStderr = stderr.length > 0;
|
|
const hasStdout = stdout.length > 0;
|
|
|
|
const defaultTab: TabType = hasStderr && !hasStdout ? 'stderr' : 'stdout';
|
|
const [userSelectedTab, setUserSelectedTab] = useState<TabType | null>(null);
|
|
const activeTab = userSelectedTab ?? defaultTab;
|
|
|
|
const currentOutput = activeTab === 'stdout' ? stdout : stderr;
|
|
|
|
return (
|
|
<StyledContainer>
|
|
<StyledHeader>
|
|
<StyledHeaderLeft>
|
|
<IconTerminal size={14} />
|
|
{t`Output`}
|
|
</StyledHeaderLeft>
|
|
<StyledTabContainer>
|
|
<StyledTab
|
|
isActive={activeTab === 'stdout'}
|
|
onClick={() => setUserSelectedTab('stdout')}
|
|
>
|
|
stdout
|
|
</StyledTab>
|
|
{hasStderr && (
|
|
<StyledTab
|
|
isActive={activeTab === 'stderr'}
|
|
hasError
|
|
onClick={() => setUserSelectedTab('stderr')}
|
|
>
|
|
stderr
|
|
</StyledTab>
|
|
)}
|
|
<LightIconButton
|
|
Icon={IconCopy}
|
|
onClick={() => copyToClipboard(currentOutput)}
|
|
title={t`Copy output`}
|
|
size="small"
|
|
accent="tertiary"
|
|
/>
|
|
</StyledTabContainer>
|
|
</StyledHeader>
|
|
<StyledOutputArea isError={activeTab === 'stderr'}>
|
|
{currentOutput ? (
|
|
<>
|
|
{currentOutput}
|
|
{isRunning && <StyledCursor />}
|
|
</>
|
|
) : (
|
|
<StyledEmptyMessage>
|
|
{isRunning ? t`Waiting for output...` : t`No output`}
|
|
</StyledEmptyMessage>
|
|
)}
|
|
</StyledOutputArea>
|
|
</StyledContainer>
|
|
);
|
|
};
|