@jupyterlab/git
Version:
A JupyterLab extension for version control using git
135 lines (134 loc) • 3.58 kB
TypeScript
import { TranslationBundle } from '@jupyterlab/translation';
import { CommandRegistry } from '@lumino/commands';
import * as React from 'react';
import { GitExtension } from '../model';
import { Git } from '../tokens';
/**
* Interface describing component properties.
*/
export interface IPastCommitNodeProps {
/**
* Commit data.
*/
commit: Git.ISingleCommitInfo;
/**
* List of branches.
*/
branches: Git.IBranch[];
/**
* List of tags.
*/
tagsList: Git.ITag[];
/**
* Extension data model.
*/
model: GitExtension;
/**
* Jupyter App commands registry
*/
commands: CommandRegistry;
/**
* The application language translator.
*/
trans: TranslationBundle;
/**
* The commit to compare against.
*/
isReferenceCommit?: boolean;
/**
* The commit to compare.
*/
isChallengerCommit?: boolean;
/**
* Callback invoked upon clicking to display a file diff.
*
* @param event - event object
*/
onOpenDiff?: (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => Promise<void>;
/**
* Callback invoked upon clicking to select a commit for comparison.
*
* If the callback is null, the button will be disabled.
*
* @param event - event object
*/
onSelectForCompare?: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
/**
* Callback invoked upon clicking to compare a commit against the selected.
*
* If the callback is null, the button will be disabled.
*
* @param event - event object
*/
onCompareWithSelected?: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
/**
* Whether the PastCommitNode is expanded
*/
expanded: boolean;
/**
* Callback to toggle expansion of the PastCommitNode
*
* @param sha the sha of the commit
*/
toggleCommitExpansion: (sha: string) => void;
/**
* Callback to store a reference of the rendered <li> element in HistorySideBar
*
* @param el the <li> element representing a past commit
*/
setRef: (el: HTMLLIElement | null) => void;
/**
* Callback to open a context menu on the commit
*/
contextMenu?: (commit: Git.ISingleCommitInfo, event: React.MouseEvent) => void;
}
/**
* React component for rendering an individual commit.
*/
export declare class PastCommitNode extends React.Component<React.PropsWithChildren<IPastCommitNodeProps>> {
/**
* Returns a React component for rendering an individual commit.
*
* @param props - component properties
* @returns React component
*/
constructor(props: React.PropsWithChildren<IPastCommitNodeProps>);
/**
* Renders the component.
*
* @returns React element
*/
render(): React.ReactElement;
/**
* Renders branch information.
*
* @returns array of React elements
*/
private _renderBranches;
/**
* Renders individual branch data.
*
* @param branch - branch data
* @returns React element
*/
private _renderBranch;
/**
* Renders tags information.
*
* @returns array of React elements
*/
private _renderTags;
/**
* Renders individual tag data.
*
* @param tag - tag data
* @returns React element
*/
private _renderTag;
/**
* Callback invoked upon clicking on an individual commit.
*
* @param event - event object
*/
private _onCommitClick;
}