Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
a0f7f808
Commit
a0f7f808
authored
2 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Patches
Plain Diff
Removed old filter overlay
parent
742eb2fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
Master into new editor
Pipeline
#56806
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/display/components/filteroverlay.tsx
+0
-140
0 additions, 140 deletions
src/display/components/filteroverlay.tsx
with
0 additions
and
140 deletions
src/display/components/filteroverlay.tsx
deleted
100644 → 0
+
0
−
140
View file @
742eb2fb
import
React
from
"
react
"
;
import
Graph
from
"
../graph
"
;
import
PropTypes
,
{
InferType
}
from
"
prop-types
"
;
export
{
FilterOverlay
};
class
Link
extends
React
.
Component
<
InferType
<
typeof
Link
.
propTypes
>
,
InferType
<
typeof
Link
.
stateTypes
>
>
{
static
propTypes
=
{
type
:
PropTypes
.
string
.
isRequired
,
color
:
PropTypes
.
string
.
isRequired
,
width
:
PropTypes
.
number
.
isRequired
,
toggledCallback
:
PropTypes
.
func
,
};
static
stateTypes
=
{
visible
:
PropTypes
.
bool
,
};
constructor
(
props
:
InferType
<
typeof
Link
.
propTypes
>
)
{
super
(
props
);
this
.
state
=
{
visible
:
true
};
this
.
handleClick
=
this
.
handleClick
.
bind
(
this
);
}
handleClick
()
{
const
callback
=
this
.
props
.
toggledCallback
||
null
;
if
(
callback
)
{
callback
(
this
.
props
.
type
);
}
this
.
setState
(
(
state
:
InferType
<
typeof
Link
.
stateTypes
>
,
props
:
InferType
<
typeof
Link
.
propTypes
>
)
=>
({
visible
:
!
state
.
visible
})
);
}
render
()
{
const
opacity
=
this
.
state
.
visible
?
1.0
:
0.4
;
return
(
<
div
className
=
{
"
relation
"
}
style
=
{
{
opacity
:
opacity
}
}
onClick
=
{
this
.
handleClick
}
>
<
p
>
{
this
.
props
.
type
}
</
p
>
<
div
className
=
{
"
rel-container
"
}
style
=
{
{
width
:
this
.
props
.
width
+
"
px
"
,
backgroundColor
:
this
.
props
.
color
,
}
}
/>
</
div
>
);
}
}
/**
* Represents an overlay showing the meaning of different link/node colors.
* Offers the ability to toggle certain types.
*/
class
FilterOverlay
extends
React
.
Component
<
InferType
<
typeof
FilterOverlay
.
propTypes
>
,
unknown
>
{
static
propTypes
=
{
graph
:
PropTypes
.
instanceOf
(
Graph
).
isRequired
,
type
:
PropTypes
.
string
.
isRequired
,
};
/**
* Callback which gets called when the visibility of a category has changed.
*/
filterChangedCallback
:
(
type
:
string
)
=>
void
;
constructor
(
props
:
InferType
<
typeof
FilterOverlay
.
propTypes
>
)
{
super
(
props
);
this
.
filterChangedCallback
=
(
type
)
=>
void
type
;
this
.
toggleVisibility
=
this
.
toggleVisibility
.
bind
(
this
);
}
/**
* Renders an element for each category, which enables the user to toggle
* the corresponding visibility of assigned nodes.
*/
renderLinks
()
{
const
classes
=
this
.
props
.
type
===
"
link
"
?
this
.
props
.
graph
.
getLinkClasses
()
:
this
.
props
.
graph
.
getNodeClasses
();
const
chars
=
Math
.
max
(
...
classes
.
map
(
function
(
c
:
string
)
{
return
c
.
length
;
})
);
const
links
=
[];
for
(
const
link
of
classes
)
{
links
.
push
(
<
Link
type
=
{
link
}
color
=
{
this
.
props
.
type
==
"
link
"
?
this
.
props
.
graph
.
edgeColors
[
link
]
:
this
.
props
.
graph
.
nodeColors
[
link
]
}
width
=
{
10
*
chars
}
toggledCallback
=
{
this
.
toggleVisibility
}
key
=
{
link
}
/>
);
}
return
links
;
}
render
()
{
return
<
div
className
=
{
"
link-overlay
"
}
>
{
this
.
renderLinks
()
}
</
div
>;
}
/**
* Event handler for the click event of the link type divs.
* Toggles the visibility of certain edge types.
*/
toggleVisibility
(
type
:
string
)
{
if
(
this
.
props
.
type
===
"
link
"
)
{
this
.
props
.
graph
.
toggleLinkVisibility
(
type
);
}
else
{
this
.
props
.
graph
.
toggleNodeVisibility
(
type
);
}
this
.
filterChangedCallback
(
type
);
// TODO: This is really ugly.
this
.
props
.
graph
.
infoOverlay
.
bottomMenu
.
toggleCategory
(
type
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment