-
Notifications
You must be signed in to change notification settings - Fork 0
allow all content nodes to be referenced #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,7 @@ object Components { | |
| // 4. crop via overflow ellipsis | ||
| cls := "oneline" | ||
| ) | ||
|
|
||
| } | ||
|
|
||
| def nodeCardAsOneLineText(node: Node, projectWithIcon: Boolean = true)(implicit ctx: Ctx.Owner): VNode = { | ||
|
|
@@ -652,7 +653,7 @@ object Components { | |
| def searchAndSelectNodeApplied[F[_] : Sink : Source](current: F[Option[NodeId]], filter: Node => Boolean)(implicit ctx: Ctx.Owner): VNode = searchAndSelectNode(current, filter) --> current | ||
| def searchAndSelectNode[F[_] : Source](observable: F[Option[NodeId]], filter: Node => Boolean)(implicit ctx: Ctx.Owner): EmitterBuilder[Option[NodeId], VNode] = | ||
| Components.searchInGraph(GlobalState.rawGraph, "Search", filter = { | ||
| case n: Node.Content => InlineList.contains[NodeRole](NodeRole.Message, NodeRole.Task, NodeRole.Project)(n.role) && filter(n) | ||
| case n: Node.Content => filter(n) | ||
| case _ => false | ||
| }, innerElementModifier = width := "100%", inputModifiers = width := "100%").mapResult[VNode] { search => | ||
| div( | ||
|
|
@@ -689,18 +690,47 @@ object Components { | |
| minCharacters = 0 | ||
| showNoResults = showNotFound | ||
|
|
||
| source = graph.now.nodes.collect { case node: Node if filter(node) => | ||
| val str = node match { | ||
| case user: Node.User => Components.displayUserName(user.data) | ||
| case _ => node.str | ||
| } | ||
| source = { | ||
| val g: Graph = graph.now | ||
| val res1 = (g.nodes.collect { case node: Node if filter(node) && node.role == NodeRole.Neutral => | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about other noderoles than neutral? |
||
|
|
||
| new SearchSourceEntry { | ||
| title = node.id.toCuidString | ||
| description = trimToMaxLength(str, 36) | ||
| data = node.asInstanceOf[js.Any] | ||
| } | ||
| }(breakOut): js.Array[SearchSourceEntry] | ||
| val probEdgesRev = g.propertiesEdgeReverseIdx(g.idToIdxOrThrow(node.id)) | ||
|
|
||
| val probData = probEdgesRev.map{ idx => | ||
| val keyString = g.edges(idx).as[Edge.LabeledProperty].data.key | ||
| val propertyValue = g.nodes(g.edgesIdx.b(idx)) | ||
| val propertySource = g.nodes(g.edgesIdx.a(idx)) | ||
| (keyString, propertyValue, propertySource) | ||
| } | ||
|
|
||
| probData.collect { | ||
| case p: (String, Node, Node) if p._2.data.isInstanceOf[NodeData.Placeholder] => | ||
| new SearchSourceEntry { | ||
| title = p._2.id.toCuidString | ||
| placeholder = true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to store this placeholder var separately? It is already encoded in the data property (that is the node itself). |
||
| text = s"${p._1} of ${p._3.str}" | ||
| description = trimToMaxLength(s"missing ${p._1} of ${p._3.str}", 36) | ||
| data = node.asInstanceOf[js.Any] | ||
| } | ||
| }(breakOut): js.Array[SearchSourceEntry] | ||
| }(breakOut): js.Array[js.Array[SearchSourceEntry]]).flatten | ||
|
|
||
| val res2 = g.nodes.collect { case node: Node if filter(node) && node.role != NodeRole.Neutral => | ||
| val str = node match { | ||
| case user: Node.User => Components.displayUserName(user.data) | ||
| case n: Node.Content => node.str | ||
| } | ||
|
|
||
| new SearchSourceEntry { | ||
| title = node.id.toCuidString | ||
| placeholder = false | ||
| description = trimToMaxLength(str, 36) | ||
| data = node.asInstanceOf[js.Any] | ||
| } | ||
| }(breakOut): js.Array[SearchSourceEntry] | ||
|
|
||
| res2 ++ res1 | ||
| } | ||
|
|
||
| searchFields = js.Array("description") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,9 @@ trait SearchSourceEntry extends js.Object { | |
| var description: js.UndefOr[String] = js.undefined | ||
| var category: js.UndefOr[String] = js.undefined | ||
|
|
||
| var placeholder: js.UndefOr[Boolean] = js.undefined | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not really belong into the fomantic ui facade, as it is our state, right? |
||
| var text: js.UndefOr[String] = js.undefined | ||
|
|
||
| var data: js.UndefOr[js.Any] = js.undefined | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you check whether other usages depends on this?