mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
apply prettier, removed flow related config and added tsconfig
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { ExtensionPoint } from '@scm-manager/ui-extensions';
|
||||
import { Repository } from '@scm-manager/ui-types';
|
||||
import { Image } from '@scm-manager/ui-components';
|
||||
import React from "react";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import { Image } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
@@ -15,7 +15,7 @@ class RepositoryAvatar extends React.Component<Props> {
|
||||
<ExtensionPoint
|
||||
name="repos.repository-avatar"
|
||||
props={{
|
||||
repository,
|
||||
repository
|
||||
}}
|
||||
>
|
||||
<Image src="/images/blib.jpg" alt="Logo" />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Repository } from '@scm-manager/ui-types';
|
||||
import { CardColumn, DateFromNow } from '@scm-manager/ui-components';
|
||||
import RepositoryEntryLink from './RepositoryEntryLink';
|
||||
import RepositoryAvatar from './RepositoryAvatar';
|
||||
import React from "react";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import { CardColumn, DateFromNow } from "@scm-manager/ui-components";
|
||||
import RepositoryEntryLink from "./RepositoryEntryLink";
|
||||
import RepositoryAvatar from "./RepositoryAvatar";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
@@ -14,11 +14,11 @@ class RepositoryEntry extends React.Component<Props> {
|
||||
};
|
||||
|
||||
renderBranchesLink = (repository: Repository, repositoryLink: string) => {
|
||||
if (repository._links['branches']) {
|
||||
if (repository._links["branches"]) {
|
||||
return (
|
||||
<RepositoryEntryLink
|
||||
icon="code-branch"
|
||||
to={repositoryLink + '/branches'}
|
||||
to={repositoryLink + "/branches"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -26,11 +26,11 @@ class RepositoryEntry extends React.Component<Props> {
|
||||
};
|
||||
|
||||
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
|
||||
if (repository._links['changesets']) {
|
||||
if (repository._links["changesets"]) {
|
||||
return (
|
||||
<RepositoryEntryLink
|
||||
icon="exchange-alt"
|
||||
to={repositoryLink + '/changesets'}
|
||||
to={repositoryLink + "/changesets"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -38,20 +38,20 @@ class RepositoryEntry extends React.Component<Props> {
|
||||
};
|
||||
|
||||
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
|
||||
if (repository._links['sources']) {
|
||||
if (repository._links["sources"]) {
|
||||
return (
|
||||
<RepositoryEntryLink icon="code" to={repositoryLink + '/sources'} />
|
||||
<RepositoryEntryLink icon="code" to={repositoryLink + "/sources"} />
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
renderModifyLink = (repository: Repository, repositoryLink: string) => {
|
||||
if (repository._links['update']) {
|
||||
if (repository._links["update"]) {
|
||||
return (
|
||||
<RepositoryEntryLink
|
||||
icon="cog"
|
||||
to={repositoryLink + '/settings/general'}
|
||||
to={repositoryLink + "/settings/general"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { Icon } from '@scm-manager/ui-components';
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { Icon } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
to: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { CardColumnGroup } from '@scm-manager/ui-components';
|
||||
import { RepositoryGroup } from '@scm-manager/ui-types';
|
||||
import RepositoryEntry from './RepositoryEntry';
|
||||
import React from "react";
|
||||
import { CardColumnGroup } from "@scm-manager/ui-components";
|
||||
import { RepositoryGroup } from "@scm-manager/ui-types";
|
||||
import RepositoryEntry from "./RepositoryEntry";
|
||||
|
||||
type Props = {
|
||||
group: RepositoryGroup;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import { Repository } from '@scm-manager/ui-types';
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
|
||||
import groupByNamespace from './groupByNamespace';
|
||||
import RepositoryGroupEntry from './RepositoryGroupEntry';
|
||||
import groupByNamespace from "./groupByNamespace";
|
||||
import RepositoryGroupEntry from "./RepositoryGroupEntry";
|
||||
|
||||
type Props = {
|
||||
repositories: Repository[];
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
import groupByNamespace from './groupByNamespace';
|
||||
import groupByNamespace from "./groupByNamespace";
|
||||
|
||||
const base = {
|
||||
type: 'git',
|
||||
_links: {},
|
||||
type: "git",
|
||||
_links: {}
|
||||
};
|
||||
|
||||
const slartiBlueprintsFjords = {
|
||||
...base,
|
||||
namespace: 'slarti',
|
||||
name: 'fjords-blueprints',
|
||||
namespace: "slarti",
|
||||
name: "fjords-blueprints"
|
||||
};
|
||||
|
||||
const slartiFjords = {
|
||||
...base,
|
||||
namespace: 'slarti',
|
||||
name: 'fjords',
|
||||
namespace: "slarti",
|
||||
name: "fjords"
|
||||
};
|
||||
|
||||
const hitchhikerRestand = {
|
||||
...base,
|
||||
namespace: 'hitchhiker',
|
||||
name: 'restand',
|
||||
namespace: "hitchhiker",
|
||||
name: "restand"
|
||||
};
|
||||
const hitchhikerPuzzle42 = {
|
||||
...base,
|
||||
namespace: 'hitchhiker',
|
||||
name: 'puzzle42',
|
||||
namespace: "hitchhiker",
|
||||
name: "puzzle42"
|
||||
};
|
||||
|
||||
const hitchhikerHeartOfGold = {
|
||||
...base,
|
||||
namespace: 'hitchhiker',
|
||||
name: 'heartOfGold',
|
||||
namespace: "hitchhiker",
|
||||
name: "heartOfGold"
|
||||
};
|
||||
|
||||
const zaphodMarvinFirmware = {
|
||||
...base,
|
||||
namespace: 'zaphod',
|
||||
name: 'marvin-firmware',
|
||||
namespace: "zaphod",
|
||||
name: "marvin-firmware"
|
||||
};
|
||||
|
||||
it('should group the repositories by their namespace', () => {
|
||||
it("should group the repositories by their namespace", () => {
|
||||
const repositories = [
|
||||
zaphodMarvinFirmware,
|
||||
slartiBlueprintsFjords,
|
||||
hitchhikerRestand,
|
||||
slartiFjords,
|
||||
hitchhikerHeartOfGold,
|
||||
hitchhikerPuzzle42,
|
||||
hitchhikerPuzzle42
|
||||
];
|
||||
|
||||
const expected = [
|
||||
{
|
||||
name: 'hitchhiker',
|
||||
name: "hitchhiker",
|
||||
repositories: [
|
||||
hitchhikerHeartOfGold,
|
||||
hitchhikerPuzzle42,
|
||||
hitchhikerRestand,
|
||||
],
|
||||
hitchhikerRestand
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'slarti',
|
||||
repositories: [slartiFjords, slartiBlueprintsFjords],
|
||||
name: "slarti",
|
||||
repositories: [slartiFjords, slartiBlueprintsFjords]
|
||||
},
|
||||
{
|
||||
name: 'zaphod',
|
||||
repositories: [zaphodMarvinFirmware],
|
||||
},
|
||||
name: "zaphod",
|
||||
repositories: [zaphodMarvinFirmware]
|
||||
}
|
||||
];
|
||||
|
||||
expect(groupByNamespace(repositories)).toEqual(expected);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Repository, RepositoryGroup } from '@scm-manager/ui-types';
|
||||
import { Repository, RepositoryGroup } from "@scm-manager/ui-types";
|
||||
|
||||
export default function groupByNamespace(
|
||||
repositories: Repository[],
|
||||
repositories: Repository[]
|
||||
): RepositoryGroup[] {
|
||||
let groups = {};
|
||||
for (let repository of repositories) {
|
||||
@@ -11,7 +11,7 @@ export default function groupByNamespace(
|
||||
if (!group) {
|
||||
group = {
|
||||
name: groupName,
|
||||
repositories: [],
|
||||
repositories: []
|
||||
};
|
||||
groups[groupName] = group;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import RepositoryList from './RepositoryList';
|
||||
import RepositoryList from "./RepositoryList";
|
||||
export default RepositoryList;
|
||||
|
||||
Reference in New Issue
Block a user