Merge pull request #1441 from scm-manager/feature/repository_overview_tooltips

Feature/repository overview tooltips
This commit is contained in:
René Pfeuffer
2020-11-25 15:47:55 +01:00
committed by GitHub
8 changed files with 262 additions and 56 deletions

View File

@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Add tooltips to short links on repository overview ([#1441](https://github.com/scm-manager/scm-manager/pull/1441))
## [2.10.1] - 2020-11-24
### Fixed
- Improved logging of failures during plugin installation ([#1442](https://github.com/scm-manager/scm-manager/pull/1442))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 269 KiB

View File

@@ -50439,36 +50439,70 @@ exports[`Storyshots RepositoryEntry Avatar EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50553,36 +50587,70 @@ exports[`Storyshots RepositoryEntry Before Title EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50664,36 +50732,70 @@ exports[`Storyshots RepositoryEntry Default 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50775,27 +50877,56 @@ exports[`Storyshots RepositoryEntry Quick Link EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="level-item"
@@ -50809,9 +50940,14 @@ exports[`Storyshots RepositoryEntry Quick Link EP 1`] = `
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div

View File

@@ -27,10 +27,11 @@ import { CardColumn, DateFromNow } from "@scm-manager/ui-components";
import RepositoryEntryLink from "./RepositoryEntryLink";
import RepositoryAvatar from "./RepositoryAvatar";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { withTranslation, WithTranslation } from "react-i18next";
type DateProp = Date | string;
type Props = {
type Props = WithTranslation & {
repository: Repository;
// @VisibleForTesting
// the baseDate is only to avoid failing snapshot tests
@@ -43,29 +44,67 @@ class RepositoryEntry extends React.Component<Props> {
};
renderBranchesLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["branches"]) {
return <RepositoryEntryLink icon="code-branch" to={repositoryLink + "/branches/"} />;
return (
<RepositoryEntryLink
icon="code-branch"
to={repositoryLink + "/branches/"}
tooltip={t("repositoryRoot.tooltip.branches")}
/>
);
}
return null;
};
renderTagsLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["tags"]) {
return (
<RepositoryEntryLink icon="tags" to={repositoryLink + "/tags/"} tooltip={t("repositoryRoot.tooltip.tags")} />
);
}
return null;
};
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["changesets"]) {
return <RepositoryEntryLink icon="exchange-alt" to={repositoryLink + "/code/changesets/"} />;
return (
<RepositoryEntryLink
icon="exchange-alt"
to={repositoryLink + "/code/changesets/"}
tooltip={t("repositoryRoot.tooltip.commits")}
/>
);
}
return null;
};
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["sources"]) {
return <RepositoryEntryLink icon="code" to={repositoryLink + "/code/sources/"} />;
return (
<RepositoryEntryLink
icon="code"
to={repositoryLink + "/code/sources/"}
tooltip={t("repositoryRoot.tooltip.sources")}
/>
);
}
return null;
};
renderModifyLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["update"]) {
return <RepositoryEntryLink icon="cog" to={repositoryLink + "/settings/general"} />;
return (
<RepositoryEntryLink
icon="cog"
to={repositoryLink + "/settings/general"}
tooltip={t("repositoryRoot.tooltip.settings")}
/>
);
}
return null;
};
@@ -74,6 +113,7 @@ class RepositoryEntry extends React.Component<Props> {
return (
<>
{this.renderBranchesLink(repository, repositoryLink)}
{this.renderTagsLink(repository, repositoryLink)}
{this.renderChangesetsLink(repository, repositoryLink)}
{this.renderSourcesLink(repository, repositoryLink)}
<ExtensionPoint name={"repository.card.quickLink"} props={{ repository, repositoryLink }} renderAll={true} />
@@ -118,4 +158,4 @@ class RepositoryEntry extends React.Component<Props> {
}
}
export default RepositoryEntry;
export default withTranslation("repos")(RepositoryEntry);

View File

@@ -25,10 +25,12 @@ import React from "react";
import { Link } from "react-router-dom";
import styled from "styled-components";
import { Icon } from "@scm-manager/ui-components";
import Tooltip from "../Tooltip";
type Props = {
to: string;
icon: string;
tooltip?: string;
};
const PointerEventsLink = styled(Link)`
@@ -37,10 +39,20 @@ const PointerEventsLink = styled(Link)`
class RepositoryEntryLink extends React.Component<Props> {
render() {
const { to, icon } = this.props;
const { to, icon, tooltip } = this.props;
let content = <Icon className="fa-lg" name={icon} color="inherit" />;
if (tooltip) {
content = (
<Tooltip message={tooltip} location="top">
{content}
</Tooltip>
);
}
return (
<PointerEventsLink className="level-item" to={to}>
<Icon className="fa-lg" name={icon} color="inherit" />
{content}
</PointerEventsLink>
);
}

View File

@@ -36,6 +36,13 @@
"settingsNavLink": "Einstellungen",
"generalNavLink": "Generell",
"permissionsNavLink": "Berechtigungen"
},
"tooltip": {
"branches": "Branches",
"tags": "Tags",
"commits": "Commits",
"sources": "Sources",
"settings": "Einstellungen"
}
},
"overview": {

View File

@@ -36,6 +36,13 @@
"settingsNavLink": "Settings",
"generalNavLink": "General",
"permissionsNavLink": "Permissions"
},
"tooltip": {
"branches": "Branches",
"tags": "Tags",
"commits": "Commits",
"sources": "Sources",
"settings": "Settings"
}
},
"overview": {