Sat, 22 Jul 2023 13:04:12 +0200
remove vcs connectors in favor of externally fed logs
relates to #276
/* * Copyright 2021 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package de.uapcore.lightpit.viewmodel import de.uapcore.lightpit.entities.Component import de.uapcore.lightpit.entities.Project import de.uapcore.lightpit.entities.Version import de.uapcore.lightpit.types.VersionStatus class NavMenuEntry( val level: Int, val caption: String, val href: String, val title: String = "", val active: Boolean = false, val resolveCaption: Boolean = false, val iconColor: String? = null ) { val iconUseCssClass = iconColor != null && !iconColor.startsWith("#") } class NavMenu(val entries: List<NavMenuEntry>) fun projectNavMenu( projects: List<Project>, versions: List<Version> = emptyList(), components: List<Component> = emptyList(), selectedProject: Project? = null, selectedVersion: Version? = null, selectedComponent: Component? = null ) = NavMenu( sequence { val cnode = selectedComponent?.node ?: "-" val vnode = selectedVersion?.node ?: "-" for (project in projects) { val active = project == selectedProject yield( NavMenuEntry( level = 0, caption = project.name, href = "projects/${project.node}", active = active ) ) if (active) { yield( NavMenuEntry( level = 1, caption = "navmenu.versions", resolveCaption = true, href = "projects/${project.node}/versions/" ) ) yield( NavMenuEntry( level = 2, caption = "navmenu.all", resolveCaption = true, href = "projects/${project.node}/issues/-/${cnode}/", iconColor = "#000000" ) ) for (version in versions.filter { it.status != VersionStatus.Deprecated }) { yield( NavMenuEntry( level = 2, caption = version.name, title = "version.status.${version.status}", href = "projects/${project.node}/issues/${version.node}/${cnode}/", iconColor = "version-${version.status}", active = version == selectedVersion ) ) } yield( NavMenuEntry( level = 1, caption = "navmenu.components", resolveCaption = true, href = "projects/${project.node}/components/" ) ) yield( NavMenuEntry( level = 2, caption = "navmenu.all", resolveCaption = true, href = "projects/${project.node}/issues/${vnode}/-/", iconColor = "#000000" ) ) for (component in components) { if (!component.active && component != selectedComponent) continue yield( NavMenuEntry( level = 2, caption = component.name, href = "projects/${project.node}/issues/${vnode}/${component.node}/", iconColor = "${component.color}", active = component == selectedComponent ) ) } } } }.toList() )