mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
small fixes
This commit is contained in:
@@ -27,9 +27,9 @@ class PluginEntry extends React.Component<Props> {
|
||||
const { classes } = this.props;
|
||||
if (plugin._links && plugin._links.install && plugin._links.install.href) {
|
||||
return (
|
||||
<a className={classes.link} href={plugin._links.install.href}>
|
||||
<i className="fas fa-cloud-download-alt fa-2x" />
|
||||
</a>
|
||||
<div className={classes.link} onClick={() => console.log(plugin._links.install.href) /*TODO trigger plugin installation*/}>
|
||||
<i className="fas fa-cloud-download-alt fa-2x has-text-info" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,11 +29,13 @@ public class AvailablePluginResource {
|
||||
|
||||
private final PluginDtoCollectionMapper collectionMapper;
|
||||
private final PluginManager pluginManager;
|
||||
private final PluginDtoMapper mapper;
|
||||
|
||||
@Inject
|
||||
public AvailablePluginResource(PluginDtoCollectionMapper collectionMapper, PluginManager pluginManager) {
|
||||
public AvailablePluginResource(PluginDtoCollectionMapper collectionMapper, PluginManager pluginManager, PluginDtoMapper mapper) {
|
||||
this.collectionMapper = collectionMapper;
|
||||
this.pluginManager = pluginManager;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +81,7 @@ public class AvailablePluginResource {
|
||||
.filter(p -> p.getId().equals(name + ":" + version))
|
||||
.findFirst();
|
||||
if (plugin.isPresent()) {
|
||||
return Response.ok(plugin.get()).build();
|
||||
return Response.ok(mapper.map(plugin.get())).build();
|
||||
} else {
|
||||
throw notFound(entity(Plugin.class, name));
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ class AvailablePluginResourceTest {
|
||||
@Mock
|
||||
private PluginManager pluginManager;
|
||||
|
||||
@Mock
|
||||
private PluginDtoMapper mapper;
|
||||
|
||||
@InjectMocks
|
||||
AvailablePluginResource availablePluginResource;
|
||||
|
||||
@@ -107,6 +110,10 @@ class AvailablePluginResourceTest {
|
||||
pluginInformation.setVersion("2.0.0");
|
||||
when(pluginManager.getAvailable()).thenReturn(Collections.singletonList(pluginInformation));
|
||||
|
||||
PluginDto pluginDto = new PluginDto();
|
||||
pluginDto.setName("pluginName");
|
||||
when(mapper.map(pluginInformation)).thenReturn(pluginDto);
|
||||
|
||||
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/available/pluginName/2.0.0");
|
||||
request.accept(VndMediaType.PLUGIN);
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
|
||||
Reference in New Issue
Block a user