mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-01-10 05:29:34 -06:00
displaying shortened git commit hash
This commit is contained in:
@@ -18,6 +18,7 @@ import DeploymentStatusBadge from "./deployment-status-badge";
|
||||
import { io } from "socket.io-client";
|
||||
import { podLogsSocket } from "@/lib/sockets";
|
||||
import { BuildLogsDialog } from "./build-logs-overlay";
|
||||
import ShortCommitHash from "@/components/custom/short-commit-hash";
|
||||
|
||||
export default function BuildsTab({
|
||||
app
|
||||
@@ -86,7 +87,7 @@ export default function BuildsTab({
|
||||
['buildJobName', 'Build Job Name', false],
|
||||
['status', 'Status', true, (item) => <DeploymentStatusBadge>{item.status}</DeploymentStatusBadge>],
|
||||
["startTime", "Started At", true, (item) => formatDateTime(item.createdAt)],
|
||||
['gitCommit', 'Git Commit', true],
|
||||
['gitCommit', 'Git Commit', true, (item) => <ShortCommitHash>{item.gitCommit}</ShortCommitHash>],
|
||||
]}
|
||||
data={appBuilds}
|
||||
hideSearchBar={true}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function Code({ children, copieable = true }: { children: string | null | undefined, copieable?: boolean }) {
|
||||
export function Code({ children, copieable = true, copieableValue }: { children: string | null | undefined, copieable?: boolean, copieableValue?: string }) {
|
||||
return (children &&
|
||||
<code className={'relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold ' + (copieable ? 'cursor-pointer' : '')}
|
||||
onClick={() => {
|
||||
if (!copieable) return;
|
||||
navigator.clipboard.writeText(children || '');
|
||||
navigator.clipboard.writeText(copieableValue || children || '');
|
||||
toast.success('Copied to clipboard');
|
||||
}}>
|
||||
{children}
|
||||
|
||||
11
src/components/custom/short-commit-hash.tsx
Normal file
11
src/components/custom/short-commit-hash.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { Code } from './code';
|
||||
|
||||
export default function ShortCommitHash({ children }: { children?: string }) {
|
||||
const shortHash = children ? children.slice(0, 7) : '';
|
||||
if (!shortHash) {
|
||||
return <></>;
|
||||
}
|
||||
return (<Code copieableValue={children}>{shortHash}</Code>);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user