mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-11-03 20:15:52 +01:00 
			
		
		
		
	Implement file lock for git (#1838)
Adds a "file lock" command that can be used to mark files as locked by a specific user. This command is implemented for git using a store to keep the locks. Additionally, the Git LFS locking API is implemented. To display locks, the scm-manager/scm-file-lock-plugin can be used. Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
		@@ -21,44 +21,43 @@
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
 * SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
import React from "react";
 | 
			
		||||
import React, { FC } from "react";
 | 
			
		||||
import classNames from "classnames";
 | 
			
		||||
import { createAttributesForTesting } from "./devBuild";
 | 
			
		||||
 | 
			
		||||
type Props = {
 | 
			
		||||
  title?: string;
 | 
			
		||||
  iconStyle: string;
 | 
			
		||||
  iconStyle?: string;
 | 
			
		||||
  name: string;
 | 
			
		||||
  color: string;
 | 
			
		||||
  color?: string;
 | 
			
		||||
  className?: string;
 | 
			
		||||
  onClick?: (event: React.MouseEvent) => void;
 | 
			
		||||
  onEnter?: (event: React.KeyboardEvent) => void;
 | 
			
		||||
  testId?: string;
 | 
			
		||||
  tabIndex?: number;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default class Icon extends React.Component<Props> {
 | 
			
		||||
  static defaultProps = {
 | 
			
		||||
    iconStyle: "fas",
 | 
			
		||||
    color: "grey-light"
 | 
			
		||||
  };
 | 
			
		||||
const Icon: FC<Props> = ({
 | 
			
		||||
  iconStyle = "fas",
 | 
			
		||||
  color = "grey-light",
 | 
			
		||||
  title,
 | 
			
		||||
  name,
 | 
			
		||||
  className,
 | 
			
		||||
  onClick,
 | 
			
		||||
  testId,
 | 
			
		||||
  tabIndex = -1,
 | 
			
		||||
  onEnter,
 | 
			
		||||
}) => {
 | 
			
		||||
  return (
 | 
			
		||||
    <i
 | 
			
		||||
      onClick={onClick}
 | 
			
		||||
      onKeyPress={(event) => event.key === "Enter" && onEnter && onEnter(event)}
 | 
			
		||||
      title={title}
 | 
			
		||||
      className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)}
 | 
			
		||||
      tabIndex={tabIndex}
 | 
			
		||||
      {...createAttributesForTesting(testId)}
 | 
			
		||||
    />
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    const { title, iconStyle, name, color, className, onClick, testId } = this.props;
 | 
			
		||||
    if (title) {
 | 
			
		||||
      return (
 | 
			
		||||
        <i
 | 
			
		||||
          onClick={onClick}
 | 
			
		||||
          title={title}
 | 
			
		||||
          className={classNames(iconStyle, "fa-fw", "fa-" + name, `has-text-${color}`, className)}
 | 
			
		||||
          {...createAttributesForTesting(testId)}
 | 
			
		||||
        />
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    return (
 | 
			
		||||
      <i
 | 
			
		||||
        onClick={onClick}
 | 
			
		||||
        className={classNames(iconStyle, "fa-" + name, `has-text-${color}`, className)}
 | 
			
		||||
        {...createAttributesForTesting(testId)}
 | 
			
		||||
      />
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
export default Icon;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user