mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
(refs #32)Display plugin's status
This commit is contained in:
@@ -128,10 +128,12 @@ trait SystemSettingsControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
// TODO Move to PluginSystem or Service?
|
// TODO Move to PluginSystem or Service?
|
||||||
private def getAvailablePlugins(): List[SystemSettingsControllerBase.AvailablePlugin] = {
|
private def getAvailablePlugins(): List[SystemSettingsControllerBase.AvailablePlugin] = {
|
||||||
val dir = getPluginCacheDir()
|
val installedPlugins = plugin.PluginSystem.plugins
|
||||||
if(dir.exists && dir.isDirectory){
|
val repositoryRoot = getPluginCacheDir()
|
||||||
|
|
||||||
|
if(repositoryRoot.exists && repositoryRoot.isDirectory){
|
||||||
PluginSystem.repositories.flatMap { repo =>
|
PluginSystem.repositories.flatMap { repo =>
|
||||||
val repoDir = new java.io.File(dir, repo.id)
|
val repoDir = new java.io.File(repositoryRoot, repo.id)
|
||||||
if(repoDir.exists && repoDir.isDirectory){
|
if(repoDir.exists && repoDir.isDirectory){
|
||||||
repoDir.listFiles.filter(d => d.isDirectory && !d.getName.startsWith(".")).map { plugin =>
|
repoDir.listFiles.filter(d => d.isDirectory && !d.getName.startsWith(".")).map { plugin =>
|
||||||
val propertyFile = new java.io.File(plugin, "plugin.properties")
|
val propertyFile = new java.io.File(plugin, "plugin.properties")
|
||||||
@@ -147,7 +149,8 @@ trait SystemSettingsControllerBase extends ControllerBase {
|
|||||||
properties.getProperty("version"),
|
properties.getProperty("version"),
|
||||||
properties.getProperty("author"),
|
properties.getProperty("author"),
|
||||||
properties.getProperty("url"),
|
properties.getProperty("url"),
|
||||||
properties.getProperty("description"))
|
properties.getProperty("description"),
|
||||||
|
if(installedPlugins.exists(_.id == properties.getProperty("id"))) "installed" else "available")
|
||||||
}
|
}
|
||||||
} else Nil
|
} else Nil
|
||||||
}
|
}
|
||||||
@@ -156,6 +159,6 @@ trait SystemSettingsControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object SystemSettingsControllerBase {
|
object SystemSettingsControllerBase {
|
||||||
case class AvailablePlugin(
|
case class AvailablePlugin(repository: String, id: String, version: String,
|
||||||
repository: String, id: String, version: String, author: String, url: String, description: String)
|
author: String, url: String, description: String, status: String)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,13 @@
|
|||||||
@plugins.zipWithIndex.map { case (plugin, i) =>
|
@plugins.zipWithIndex.map { case (plugin, i) =>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@*
|
||||||
<input type="checkbox" name="pluginId[@i]" value="@plugin.id"/>
|
<input type="checkbox" name="pluginId[@i]" value="@plugin.id"/>
|
||||||
|
*@
|
||||||
@plugin.id
|
@plugin.id
|
||||||
|
@if(plugin.status == "installed"){
|
||||||
|
[Installed]
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@plugin.version</td>
|
<td>@plugin.version</td>
|
||||||
<td><a href="@plugin.url">@plugin.author</a></td>
|
<td><a href="@plugin.url">@plugin.author</a></td>
|
||||||
@@ -24,7 +29,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
@*
|
||||||
<input type="submit" id="install-plugins" class="btn btn-primary" value="Install selected plugins"/>
|
<input type="submit" id="install-plugins" class="btn btn-primary" value="Install selected plugins"/>
|
||||||
|
*@
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user