@import controllers.workspace.routes.Assets
@import org.silkframework.runtime.plugin.PluginRegistry
@import org.silkframework.workbench.WorkbenchPlugin.{TaskActions, TaskType}
@import org.silkframework.workbench.WorkbenchPlugins
@import org.silkframework.workspace.activity.ProjectExecutor
@import org.silkframework.workspace.{Project, Workspace}
@import org.silkframework.runtime.activity.UserContext
@import org.silkframework.runtime.plugin.PluginContext
@(workspace: Workspace)(implicit userContext: UserContext)
Search
@* Either a link opening a new tab if linkUrl is set or a button executing the onClick JavaScript *@
@button(title: String, tooltip: String, icon: String, onClick: String, linkUrl: String = "") = {
@if(linkUrl.trim.isEmpty) {
} else {
}
}
@project(project: Project) = {
@project.config.metaData.formattedLabel(project.id, maxLength = 100)
@button("Prefixes", "Edit prefixes", "wrench-screwdriver.png", s"editPrefixes('${project.id}')")
@button("Resources", "Manage resources", "wrench.png", s"editResources('${project.id}')")
@button("Link Spec", "Import link specification", "document--plus.png", s"importLinkSpec('${project.id}')")
@button("Export", "Export project", "document-export.png", s"exportProject('${project.id}')")
@if(PluginRegistry.availablePlugins[ProjectExecutor].nonEmpty) {
@button("Execute", "Execute project", "document-export.png", s"executeProject('${project.id}')")
}
@button("Clone", "Clone project", "clone.png", s"cloneProject('${project.id}')")
@button("Remove", "Remove project", "cross.png", s"deleteProjectConfirm('${project.id}')")
@for((taskType, taskActions) <- WorkbenchPlugins.byType(project)) {
@taskTypeNode(project, taskType, taskActions)
}
}
@projectIcon(project: Project) = @{
if(project.loadingErrors.isEmpty)
"img/project.png"
else
"img/project-error.png"
}
@taskTypeNode(project: Project, taskType: TaskType, taskActions: Seq[TaskActions]) = {
@{taskType.typeName}s
@for(path <- taskType.createDialog(project.id)) {
@button("Add", "Add " + taskType.typeName, "plus.png", s"workspaceDialog('$path')")
}
@for(actions <- taskActions.sortBy(_.task.label()).reverse) {
@task(project, taskType, actions)
}
}
@task(project: Project, taskType: TaskType, actions: TaskActions) = {
@actions.task.label()
@for(path <- actions.propertiesDialog) {
@button("Properties", "Edit task properties", "wrench.png", s"workspaceDialog('$path')")
}
@for(path <- actions.openPath(None, None)) {
@button("Open", "Open task", "document--pencil.png", s"window.location = '${config.baseUrl}/$path'", config.baseUrl + "/" + path)
}
@button("Clone", "Clone task", "clone.png", s"cloneTask('${project.id}', '${actions.task.id}')")
@button("Remove", "Remove task", "cross.png", s"deleteTaskConfirm('${project.id}', '${actions.task.id}')")
@for((key, value) <- actions.task.metaDataFields() ++ actions.task.data.parameters(PluginContext.fromProject(project)).toStringMap(PluginContext.empty) if !value.isEmpty) {
@key: @value
}
}
@for(p <- workspace.projects) {
@project(p)
}