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