diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/entities/vulnerability/VulnerabilityDateType.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/entities/vulnerability/VulnerabilityDateType.kt index 133b5892cb..eaadd21699 100644 --- a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/entities/vulnerability/VulnerabilityDateType.kt +++ b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/entities/vulnerability/VulnerabilityDateType.kt @@ -41,14 +41,14 @@ enum class VulnerabilityDateType(val value: String) { PUBLISHED("Published"), /** - * Date from [com.saveourtool.osv4k.OsvSchema.withdrawn] in COSV schema + * Date when the vuln was submitted to our archive, our platform specific */ - WITHDRAWN("Withdrawn"), + SUBMITTED("Submitted"), /** - * Date when the vuln was submitted to our archive, our platform specific + * Date from [com.saveourtool.osv4k.OsvSchema.withdrawn] in COSV schema */ - SUBMITTED("Submitted") + WITHDRAWN("Withdrawn"), ; override fun toString(): String = value diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/HasErrorModal.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/HasErrorModal.kt index ef4c35a078..d7f9f7c8c5 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/HasErrorModal.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/HasErrorModal.kt @@ -10,7 +10,6 @@ import com.saveourtool.save.frontend.externals.animations.ringLoader import com.saveourtool.save.info.UserInfo import js.core.jso -import kotlinx.browser.window import org.w3c.fetch.Response import react.* import react.dom.html.ReactHTML.button @@ -21,6 +20,8 @@ import react.router.useNavigate import web.cssom.ClassName import web.html.ButtonType +import kotlinx.browser.window + /** * Loader animation */ diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TimelineComponent.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TimelineComponent.kt index 5a39ac85bf..55a27e7020 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TimelineComponent.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TimelineComponent.kt @@ -14,8 +14,6 @@ import kotlinx.datetime.LocalDateTime const val HOVERABLE_CONST = "hoverable" val timelineComponent: FC = FC { props -> - console.log(props.dates) - if (props.dates != undefined) { val hoverable = props.onNodeClick?.let { HOVERABLE_CONST }.orEmpty() div { @@ -55,7 +53,7 @@ val timelineComponent: FC = FC { props -> .forEach { (label, dateTime) -> div { className = - ClassName(if (!label.isSubmittedType()) "step $hoverable" else "step-non-editable") + ClassName(if (!label.isSubmittedType()) "step $hoverable" else "step-non-editable") if (!label.isSubmittedType()) { props.onNodeClick?.let { onClickCallback -> onClick = { onClickCallback(dateTime, label) } @@ -80,13 +78,8 @@ val timelineComponent: FC = FC { props -> } } } - } else { - - } } -private fun String.isSubmittedType() = this == VulnerabilityDateType.SUBMITTED.value - /** * [Props] of [timelineComponent] */ @@ -117,3 +110,5 @@ external interface TimelineComponentProps : Props { */ var vulnerability: VulnerabilityDto } + +private fun String.isSubmittedType() = this == VulnerabilityDateType.SUBMITTED.value diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/usersettings/SettingsView.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/usersettings/SettingsView.kt index 68081f0973..c783f7c9ee 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/usersettings/SettingsView.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/usersettings/SettingsView.kt @@ -16,7 +16,6 @@ import com.saveourtool.save.info.UserInfo import com.saveourtool.save.validation.FrontendRoutes import js.core.jso -import kotlinx.browser.window import react.* import react.dom.html.ReactHTML.button import react.dom.html.ReactHTML.div @@ -28,6 +27,7 @@ import web.cssom.* import web.html.ButtonType import web.html.InputType +import kotlinx.browser.window import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfo.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfo.kt index b84c0756a3..666d30e4cd 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfo.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfo.kt @@ -9,24 +9,23 @@ import com.saveourtool.save.frontend.externals.fontawesome.* import com.saveourtool.save.frontend.utils.* import com.saveourtool.save.info.UserInfo import com.saveourtool.save.utils.toUnixCalendarFormat -import js.core.jso +import js.core.jso import react.* import react.dom.html.ReactHTML.div import react.dom.html.ReactHTML.h6 import react.dom.html.ReactHTML.hr import react.dom.html.ReactHTML.label +import react.dom.html.ReactHTML.p import react.dom.html.ReactHTML.textarea import react.router.dom.Link import web.cssom.ClassName +import web.cssom.TextDecoration.Companion.underline import web.cssom.rem import kotlinx.datetime.TimeZone import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import react.dom.html.ReactHTML.p -import web.cssom.Color -import web.cssom.TextDecoration.Companion.underline /** * [FC] that is used to display some general vulnerability information @@ -60,13 +59,13 @@ val vulnerabilityGeneralInfo: FC = FC { props -> if (props.isEditDisabled) { // only Super Users and owners of unapproved vuln. can edit it if (props.userInfo?.isSuperAdmin() == true || - (props.userInfo?.name == userInfo.name && props.vulnerability.status != VulnerabilityStatus.APPROVED)) { + (props.userInfo?.name == userInfo.name && props.vulnerability.status != VulnerabilityStatus.APPROVED)) { buttonBuilder( labelBuilder = { p { className = ClassName("mb-0") style = jso { - textDecoration = underline; + textDecoration = underline } +"Edit " fontAwesomeIcon(icon = faEdit) @@ -221,7 +220,7 @@ external interface VulnerabilityGeneralInfo : Props { var vulnerability: VulnerabilityDto /** - * + * Vulnerabilities setter */ var setVulnerability: StateSetter diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityHeader.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityHeader.kt index a433541970..2556a6e01b 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityHeader.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityHeader.kt @@ -30,14 +30,11 @@ import react.dom.html.ReactHTML.h6 import react.dom.html.ReactHTML.textarea import react.router.useNavigate import react.useState +import web.cssom.* import kotlinx.browser.window import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import react.dom.html.ReactHTML.h4 -import react.dom.html.ReactHTML.img -import web.cssom.* -import web.cssom.HtmlAttributes.Companion.src internal val headerMenu: FC = FC { props -> val rejectVulnerabilityWindowOpenness = useWindowOpenness() @@ -183,7 +180,6 @@ internal val headerMenu: FC = FC { props -> style = jso { height = "7rem".unsafeCast() } - } } @@ -213,7 +209,7 @@ internal val headerMenu: FC = FC { props -> } if (props.permissions.isSuperAdmin || - (props.permissions.isOwner && props.vulnerability.status != VulnerabilityStatus.APPROVED) + (props.permissions.isOwner && props.vulnerability.status != VulnerabilityStatus.APPROVED) ) { buttonBuilder( faTrash, @@ -241,7 +237,6 @@ internal val headerMenu: FC = FC { props -> div { className = ClassName("col-3") } - } } } diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityInfoTab.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityInfoTab.kt index a86db7e937..df34f43928 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityInfoTab.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityInfoTab.kt @@ -18,7 +18,6 @@ import com.saveourtool.save.frontend.externals.fontawesome.* import com.saveourtool.save.frontend.utils.* import com.saveourtool.save.info.UserInfo -import js.core.jso import react.* import react.dom.html.ReactHTML.div import react.dom.html.ReactHTML.h4 diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityView.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityView.kt index 669f4b3022..50559b1935 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityView.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityView.kt @@ -22,15 +22,6 @@ import web.cssom.* const val HEADER_HEIGHT = "9rem" -fun borderEditStyle(pointerCursor: Boolean = false): CSSProperties = jso { - borderColor = "#5711d9".unsafeCast() - borderStyle = "dashed".unsafeCast() - borderWidth = "thin".unsafeCast() - if (pointerCursor) { - cursor = "pointer".unsafeCast() - } -} - @Suppress( "MAGIC_NUMBER", "TOO_LONG_FUNCTION", @@ -188,6 +179,19 @@ private fun ChildrenBuilder.languageSpan(language: VulnerabilityLanguage) { } } +/** + * @param pointerCursor + * @return returns the css for editable text form + */ +fun borderEditStyle(pointerCursor: Boolean = false): CSSProperties = jso { + borderColor = "#5711d9".unsafeCast() + borderStyle = "dashed".unsafeCast() + borderWidth = "thin".unsafeCast() + if (pointerCursor) { + cursor = "pointer".unsafeCast() + } +} + /** * @param currentUserInfo * @param vulnerability