add stories for RepositoryEntry

This commit is contained in:
Eduard Heimbuch
2020-03-25 14:10:22 +01:00
parent 16c89f4b9f
commit 3a2aa7a55c
7 changed files with 238 additions and 11 deletions

View File

@@ -1,3 +1,27 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.web.api; package sonia.scm.web.api;
import de.otto.edison.hal.HalRepresentation; import de.otto.edison.hal.HalRepresentation;

View File

@@ -0,0 +1,67 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
export default {
contact: "",
creationDate: "2020-03-23T08:26:01.164Z",
description: "",
healthCheckFailures: [],
lastModified: "2020-03-23T08:26:01.876Z",
namespace: "scmadmin",
name: "Git",
type: "git",
_links: {
self: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git" },
delete: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git" },
update: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git" },
permissions: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/permissions/" },
protocol: [
{ href: "ssh://scmadmin@localhost:4567/repo/scmadmin/Git", name: "ssh" },
{ href: "http://localhost:8081/scm/repo/scmadmin/Git", name: "http" }
],
tags: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/tags/" },
branches: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/branches/" },
incomingChangesets: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/incoming/{source}/{target}/changesets",
templated: true
},
incomingDiff: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/incoming/{source}/{target}/diff",
templated: true
},
incomingDiffParsed: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/incoming/{source}/{target}/diff/parsed",
templated: true
},
changesets: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/changesets/" },
sources: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/Git/sources/" },
authorMappingConfig: {
href: "http://localhost:8081/scm/api/v2/authormapping/configuration/scmadmin/Git"
},
unfavorize: { href: "http://localhost:8081/scm/api/v2/unfavorize/scmadmin/Git" },
favorites: [
{ href: "http://localhost:8081/scm/api/v2/unfavorize/scmadmin/Git", name: "unfavorize" },
{ href: "http://localhost:8081/scm/api/v2/favorize/scmadmin/Git", name: "favorize" }
]
}
};

View File

@@ -0,0 +1,67 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
export default {
contact: "",
creationDate: "2020-03-23T08:26:01.164Z",
description: "",
healthCheckFailures: [],
lastModified: "2020-03-23T08:26:01.876Z",
namespace: "scmadmin",
name: "Mercurial",
type: "hg",
_links: {
self: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial" },
delete: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial" },
update: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial" },
permissions: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/permissions/" },
protocol: [
{ href: "ssh://scmadmin@localhost:4567/repo/scmadmin/mercurial", name: "ssh" },
{ href: "http://localhost:8081/scm/repo/scmadmin/mercurial", name: "http" }
],
tags: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/tags/" },
branches: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/branches/" },
incomingChangesets: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/incoming/{source}/{target}/changesets",
templated: true
},
incomingDiff: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/incoming/{source}/{target}/diff",
templated: true
},
incomingDiffParsed: {
href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/incoming/{source}/{target}/diff/parsed",
templated: true
},
changesets: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/changesets/" },
sources: { href: "http://localhost:8081/scm/api/v2/repositories/scmadmin/mercurial/sources/" },
authorMappingConfig: {
href: "http://localhost:8081/scm/api/v2/authormapping/configuration/scmadmin/mercurial"
},
unfavorize: { href: "http://localhost:8081/scm/api/v2/unfavorize/scmadmin/mercurial" },
favorites: [
{ href: "http://localhost:8081/scm/api/v2/unfavorize/scmadmin/mercurial", name: "unfavorize" },
{ href: "http://localhost:8081/scm/api/v2/favorize/scmadmin/mercurial", name: "favorize" }
]
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -0,0 +1,72 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import { storiesOf } from "@storybook/react";
import React from "react";
import styled from "styled-components";
import GitRepository from "../__resources__/Git-Repository";
import HgRepository from "../__resources__/Hg-Repository";
// @ts-ignore ignore unknown png
import Git from "../__resources__/git-logo.png";
// @ts-ignore ignore unknown png
import Hg from "../__resources__/hg-logo.png";
import RepositoryEntry from "./RepositoryEntry";
import { Binder, BinderContext } from "@scm-manager/ui-extensions";
import { Repository } from "@scm-manager/ui-types";
const Container = styled.div`
padding: 2rem 6rem;
`;
const bindAvatar = (binder: Binder, avatar: string) => {
binder.bind("repos.repository-avatar", () => {
return avatar;
});
};
const bindBeforeTitle = (binder: Binder, beforeTitle: string) => {
binder.bind("repository.card.beforeTitle", () => {
return beforeTitle;
});
};
const withBinder = (binder: Binder, repository: Repository) => {
return (
<BinderContext.Provider value={binder}>
<RepositoryEntry repository={repository} />
</BinderContext.Provider>
);
};
storiesOf("RepositoryEntry", module)
.addDecorator(storyFn => <Container>{storyFn()}</Container>)
.add("Git-Repo", () => {
const binder = new Binder("git-story");
bindAvatar(binder, "Git");
return withBinder(binder, GitRepository);
})
.add("Hg-Repo", () => {
const binder = new Binder("hg-story");
bindBeforeTitle(binder, "Hg");
return withBinder(binder, HgRepository);
});

View File

@@ -3656,6 +3656,11 @@ babel-code-frame@^6.22.0:
esutils "^2.0.2" esutils "^2.0.2"
js-tokens "^3.0.2" js-tokens "^3.0.2"
babel-core@7.0.0-bridge.0:
version "7.0.0-bridge.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg==
babel-eslint@^10.0.3: babel-eslint@^10.0.3:
version "10.0.3" version "10.0.3"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a"
@@ -6801,7 +6806,7 @@ fast-safe-stringify@^1.0.8, fast-safe-stringify@^1.2.1:
resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-1.2.3.tgz#9fe22c37fb2f7f86f06b8f004377dbf8f1ee7bc1" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-1.2.3.tgz#9fe22c37fb2f7f86f06b8f004377dbf8f1ee7bc1"
integrity sha512-QJYT/i0QYoiZBQ71ivxdyTqkwKkQ0oxACXHYxH2zYHJEgzi2LsbjgvtzTbLi1SZcF190Db2YP7I7eTsU2egOlw== integrity sha512-QJYT/i0QYoiZBQ71ivxdyTqkwKkQ0oxACXHYxH2zYHJEgzi2LsbjgvtzTbLi1SZcF190Db2YP7I7eTsU2egOlw==
fault@^1.0.0, fault@^1.0.2: fault@^1.0.0:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13" resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13"
integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA== integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==
@@ -7340,7 +7345,7 @@ gitconfiglocal@^1.0.0:
dependencies: dependencies:
ini "^1.3.2" ini "^1.3.2"
gitdiff-parser@^0.1.2: gitdiff-parser@^0.1.2, "gitdiff-parser@https://github.com/scm-manager/gitdiff-parser#ed3fe7de73dbb0a06c3e6adbbdf22dbae6e66351":
version "0.1.2" version "0.1.2"
resolved "https://github.com/scm-manager/gitdiff-parser#ed3fe7de73dbb0a06c3e6adbbdf22dbae6e66351" resolved "https://github.com/scm-manager/gitdiff-parser#ed3fe7de73dbb0a06c3e6adbbdf22dbae6e66351"
@@ -9649,7 +9654,7 @@ lower-case@^1.1.1:
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
lowlight@^1.13.0: lowlight@1.13.1, lowlight@^1.13.0, lowlight@~1.11.0:
version "1.13.1" version "1.13.1"
resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.13.1.tgz#c4f0e03906ebd23fedf2d258f6ab2f6324cf90eb" resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.13.1.tgz#c4f0e03906ebd23fedf2d258f6ab2f6324cf90eb"
integrity sha512-kQ71/T6RksEVz9AlPq07/2m+SU/1kGvt9k39UtvHX760u4SaWakaYH7hYgH5n6sTsCWk4MVYzUzLU59aN5CSmQ== integrity sha512-kQ71/T6RksEVz9AlPq07/2m+SU/1kGvt9k39UtvHX760u4SaWakaYH7hYgH5n6sTsCWk4MVYzUzLU59aN5CSmQ==
@@ -9657,14 +9662,6 @@ lowlight@^1.13.0:
fault "^1.0.0" fault "^1.0.0"
highlight.js "~9.16.0" highlight.js "~9.16.0"
lowlight@~1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.11.0.tgz#1304d83005126d4e8b1dc0f07981e9b689ec2efc"
integrity sha512-xrGGN6XLL7MbTMdPD6NfWPwY43SNkjf/d0mecSx/CW36fUZTjRHEq0/Cdug3TWKtRXLWi7iMl1eP0olYxj/a4A==
dependencies:
fault "^1.0.2"
highlight.js "~9.13.0"
lru-cache@^5.1.1: lru-cache@^5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"