Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show import log in import events #22

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,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
- Link to import log for repository import events ([#22](https://github.com/scm-manager/scm-landingpage-plugin/pull/22))

## 1.3.1 - 2021-01-29
### Fixed
- Fix "change committed" link in the latest activities ([#21](https://github.com/scm-manager/scm-landingpage-plugin/pull/21))
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* 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
Expand All @@ -31,7 +31,7 @@ dependencies {
}

scmPlugin {
scmVersion = "2.11.0"
scmVersion = "2.13.1-SNAPSHOT"
displayName = "Landingpage"
description = "Creates a personal landingpage for each user"
author = "Cloudogu GmbH"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void handleEvent(sonia.scm.repository.RepositoryImportEvent event) {
String repository = eventRepo.getNamespace() + "/" + eventRepo.getName();
User creator = SecurityUtils.getSubject().getPrincipals().oneByType(User.class);

store.add(new RepositoryImportEvent(permission, repository, creator.getName(), creator.getDisplayName(), creator.getMail(), event.isFailed()));
store.add(new RepositoryImportEvent(permission, repository, creator.getName(), creator.getDisplayName(), creator.getMail(), event.isFailed(), event.getLogId()));
}

@XmlRootElement
Expand All @@ -70,14 +70,16 @@ static class RepositoryImportEvent extends MyEvent {
private String creatorDisplayName;
private String creatorMail;
private boolean failed;
private String logId;

RepositoryImportEvent(String permission, String repository, String creatorName, String creatorDisplayName, String creatorMail, boolean failed) {
RepositoryImportEvent(String permission, String repository, String creatorName, String creatorDisplayName, String creatorMail, boolean failed, String logId) {
super(RepositoryImportEvent.class.getSimpleName(), permission);
this.repository = repository;
this.creatorName = creatorName;
this.creatorDisplayName = creatorDisplayName;
this.creatorMail = creatorMail;
this.failed = failed;
this.logId = logId;
}
}
}
17 changes: 17 additions & 0 deletions src/main/js/events/RepositoryImportEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import styled from "styled-components";
import { CardColumnSmall, Icon, DateFromNow, AvatarImage } from "@scm-manager/ui-components";
import { binder } from "@scm-manager/ui-extensions";
import { MyEventComponent, MyEventType } from "../types";
import { Link } from "react-router-dom";

type RepositoryImportEventType = MyEventType & {
repository: string;
Expand All @@ -35,6 +36,7 @@ type RepositoryImportEventType = MyEventType & {
creatorMail: string;
date: Date;
failed: boolean;
logId?: string;
};

const StyledGravatar = styled(AvatarImage)`
Expand Down Expand Up @@ -65,10 +67,25 @@ const RepositoryImportEvent: MyEventComponent<RepositoryImportEventType> = ({ ev
)}
</strong>
);

let logLink;
if (event.logId) {
logLink = (
<>
{" ("}
<Link to={`/importlog/${event.logId}`}>
{t("scm-landingpage-plugin.myevents.repositoryImport.logLink")}
</Link>
)
</>
);
}

const footerLeft = (
<>
{t("scm-landingpage-plugin.myevents.repositoryImport.description")}{" "}
<span className="has-text-info">{event.creatorDisplayName}</span>
{logLink}
</>
);

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/locales/de/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"repositoryImport": {
"titleFailed": "Import fehlgeschlagen: {{repository}}",
"titleSuccess": "Import abgeschlossen: {{repository}}",
"description": "Gestartet von"
"description": "Gestartet von",
"logLink": "Importprotokoll"
},
"repositoryRenamed": {
"title": "Repository wurde umbenannt:"
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/locales/en/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"repositoryImport": {
"titleFailed": "Import failed: {{repository}}",
"titleSuccess": "Import finished: {{repository}}",
"description": "Started by"
"description": "Started by",
"logLink": "import log"
},
"repositoryRenamed": {
"title": "Repository was renamed:"
Expand Down