mirror of
https://github.com/philippemerle/KubeDiagrams.git
synced 2026-05-06 09:06:33 +00:00
35 lines
848 B
JavaScript
35 lines
848 B
JavaScript
const itemOpenClose = {
|
|
id: 'co',
|
|
content: 'close/open',
|
|
tooltipText: 'close/open',
|
|
selector: 'node[group = "cluster"]',
|
|
onClickFunction: function (event) {
|
|
const cluster = event.target;
|
|
if (cluster.data('isClose')) {
|
|
openCluster(cluster);
|
|
}
|
|
else {
|
|
closeCluster(cluster);
|
|
}
|
|
},
|
|
}
|
|
|
|
/**
|
|
* Open a cluster
|
|
* @param {*} cluster
|
|
*/
|
|
function openCluster(cluster) {
|
|
cluster.children().style('display', 'element');
|
|
cluster.data('isClose', false);
|
|
cluster.style(clusterOpenStyle);
|
|
}
|
|
|
|
/**
|
|
* Close a cluster
|
|
* @param {*} cluster
|
|
*/
|
|
function closeCluster(cluster) {
|
|
cluster.children().style('display', 'none');
|
|
cluster.data('isClose', true);
|
|
cluster.style(clusterClosedStyle);
|
|
} |