Skip to content

Commit 61a3894

Browse files
authored
Merge pull request #270 from modelix/fix/model-server-content-readability
MODELIX-562 Improve model-server content explorer readability
2 parents 794159f + d429850 commit 61a3894

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

model-server/src/main/kotlin/org/modelix/model/server/handlers/ContentExplorer.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ import kotlinx.html.tr
3434
import kotlinx.html.ul
3535
import kotlinx.html.unsafe
3636
import org.modelix.model.ModelFacade
37+
import org.modelix.model.api.BuiltinLanguages
38+
import org.modelix.model.api.INodeResolutionScope
3739
import org.modelix.model.api.ITree
3840
import org.modelix.model.api.PNodeAdapter
3941
import org.modelix.model.api.TreePointer
4042
import org.modelix.model.client.IModelClient
4143
import org.modelix.model.lazy.CLVersion
4244
import org.modelix.model.server.templates.PageWithMenuBar
43-
import kotlin.collections.List
44-
import kotlin.collections.isNotEmpty
45-
import kotlin.collections.mutableListOf
4645
import kotlin.collections.set
47-
import kotlin.collections.toList
4846

4947
class ContentExplorer(private val client: IModelClient, private val repoManager: RepositoriesManager) {
5048

@@ -138,7 +136,11 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
138136
div("nameField") {
139137
attributes["data-nodeid"] = node.nodeId.toString()
140138
b {
141-
if (node.getPropertyRoles().contains("name")) {
139+
val namePropertyUID = BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name.getUID()
140+
val namedConceptName = node.getPropertyValue(namePropertyUID)
141+
if (namedConceptName != null) {
142+
+namedConceptName
143+
} else if (node.getPropertyRoles().contains("name")) {
142144
+"${node.getPropertyValue("name")}"
143145
} else {
144146
+"Unnamed Node"
@@ -187,7 +189,7 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
187189
for (propertyRole in node.getPropertyRoles()) {
188190
tr {
189191
td { +propertyRole }
190-
td { +(node.getPropertyValue(propertyRole) ?: "null") }
192+
td { +"${node.getPropertyValue(propertyRole)}" }
191193
}
192194
}
193195
}
@@ -202,12 +204,13 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
202204
th { +"Value" }
203205
}
204206
}
205-
for (referenceRole in node.getReferenceRoles()) {
206-
tr {
207-
td { +referenceRole }
208-
td {
209-
// TODO MODELIX-387
210-
// +"${node.getReferenceTarget(referenceRole)}"
207+
INodeResolutionScope.runWithAdditionalScope(node.getArea()) {
208+
for (referenceRole in node.getReferenceRoles()) {
209+
tr {
210+
td { +referenceRole }
211+
td {
212+
+"${node.getReferenceTarget(referenceRole)}"
213+
}
211214
}
212215
}
213216
}

0 commit comments

Comments
 (0)