Skip to content

Commit ed53af8

Browse files
committed
INTLV-23: Add a label to the max number of pages to display element
1 parent ac4eef9 commit ed53af8

File tree

3 files changed

+240
-247
lines changed

3 files changed

+240
-247
lines changed

PROGRESS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@
101101
- [X] Kill and clear the previous graph instance to release memory ([INTLV-20 commit](https://github.com/xwiki-contrib/application-interactive-link-visualizer/commit/96a6f8267d0ef1f59c5387b37b3e154d8ca2e001))
102102
- [X] Move the application to `XWiki` space & encapsulate code ([commit](https://github.com/xwiki-contrib/application-interactive-link-visualizer/commit/faeb004ac22afb6161525711e3903bbcbf05f06a))
103103
- [X] Fixed: JSX Editor gets console error of document returned as null & object not loading properly ([INTLV-21 commit](https://github.com/xwiki-contrib/application-interactive-link-visualizer/commit/1e355b465492c230b2ac64a5ddfe189f9355579f))
104-
- [X] Fixed: Visualisation is initialised twice when there in another DOM updated event ([INTLV-22 commit]())
104+
- [X] Fixed: Visualisation is initialised twice when there in another DOM updated event ([INTLV-22 commit](https://github.com/xwiki-contrib/application-interactive-link-visualizer/commit/eddf9c12f7744e040d99330b1c1039b01f002121))
105105

106106
## Week 10 (07 August - 13 August 2023)
107107

108-
- [ ] ...
108+
- [X] Fixed: Add a label to the max number of pages to display element
109109

110110
## What is left
111111

112-
- [ ] Translations: implement the `Localization Module` in order to generate key-value pairs that will allow the possibility of translation of the application pages
112+
- [ ] Translations: transalte the app pages (`Localisation Module`)
113113

114114
<!--
115115
## Week 11 (14 August - 20 August 2023)

application-interactive-link-visualizer-ui/src/main/resources/XWiki/InteractiveLinkVisualizer/Code/MainVisualisation.xml

Lines changed: 196 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,192 @@
3737
<syntaxId>xwiki/2.1</syntaxId>
3838
<hidden>true</hidden>
3939
<content/>
40+
<object>
41+
<name>XWiki.InteractiveLinkVisualizer.Code.MainVisualisation</name>
42+
<number>0</number>
43+
<className>XWiki.JavaScriptExtension</className>
44+
<guid>0ceb04ea-1d89-4992-a593-c623abf70f7a</guid>
45+
<class>
46+
<name>XWiki.JavaScriptExtension</name>
47+
<customClass/>
48+
<customMapping/>
49+
<defaultViewSheet/>
50+
<defaultEditSheet/>
51+
<defaultWeb/>
52+
<nameField/>
53+
<validationScript/>
54+
<cache>
55+
<cache>0</cache>
56+
<defaultValue>long</defaultValue>
57+
<disabled>0</disabled>
58+
<displayType>select</displayType>
59+
<freeText>forbidden</freeText>
60+
<largeStorage>0</largeStorage>
61+
<multiSelect>0</multiSelect>
62+
<name>cache</name>
63+
<number>5</number>
64+
<prettyName>Caching policy</prettyName>
65+
<relationalStorage>0</relationalStorage>
66+
<separator> </separator>
67+
<separators>|, </separators>
68+
<size>1</size>
69+
<unmodifiable>0</unmodifiable>
70+
<values>long|short|default|forbid</values>
71+
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
72+
</cache>
73+
<code>
74+
<contenttype>PureText</contenttype>
75+
<disabled>0</disabled>
76+
<editor>PureText</editor>
77+
<name>code</name>
78+
<number>2</number>
79+
<prettyName>Code</prettyName>
80+
<restricted>0</restricted>
81+
<rows>20</rows>
82+
<size>50</size>
83+
<unmodifiable>0</unmodifiable>
84+
<classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
85+
</code>
86+
<name>
87+
<disabled>0</disabled>
88+
<name>name</name>
89+
<number>1</number>
90+
<prettyName>Name</prettyName>
91+
<size>30</size>
92+
<unmodifiable>0</unmodifiable>
93+
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
94+
</name>
95+
<parse>
96+
<disabled>0</disabled>
97+
<displayFormType>select</displayFormType>
98+
<displayType>yesno</displayType>
99+
<name>parse</name>
100+
<number>4</number>
101+
<prettyName>Parse content</prettyName>
102+
<unmodifiable>0</unmodifiable>
103+
<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
104+
</parse>
105+
<use>
106+
<cache>0</cache>
107+
<disabled>0</disabled>
108+
<displayType>select</displayType>
109+
<freeText>forbidden</freeText>
110+
<largeStorage>0</largeStorage>
111+
<multiSelect>0</multiSelect>
112+
<name>use</name>
113+
<number>3</number>
114+
<prettyName>Use this extension</prettyName>
115+
<relationalStorage>0</relationalStorage>
116+
<separator> </separator>
117+
<separators>|, </separators>
118+
<size>1</size>
119+
<unmodifiable>0</unmodifiable>
120+
<values>currentPage|onDemand|always</values>
121+
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
122+
</use>
123+
</class>
124+
<property>
125+
<cache>default</cache>
126+
</property>
127+
<property>
128+
<code>require(['jquery', 'visualisationAPI'], function($, visualisationAPI) {
129+
var tempData = null,
130+
edgeKeyCounter = 1;
131+
132+
#template('colorThemeInit.vm')
133+
var themeColors = $jsontool.serialize({
134+
'nodeColor': $theme.linkColor,
135+
'labelColor': $theme.textColor,
136+
'fadeColor': $theme.highlightColor,
137+
'labelContainerColor': $theme.pageContentBackgroundColor
138+
});
139+
140+
var init = function() {
141+
if ($('#sigma-container').attr('data-init-done') !== 'true') {
142+
$("kill-graph-button").click();
143+
tempData = JSON.parse(document.getElementById('sigma-container').dataset.results);
144+
const nodes = tempData.map(function(obj) {
145+
return {
146+
key: obj.reference,
147+
attributes: {
148+
label: obj.title_,
149+
color: themeColors.nodeColor,
150+
size: 4,
151+
pageURL: new XWiki.Document(XWiki.Model.resolve(obj.reference)).getURL()
152+
}
153+
};
154+
});
155+
const edges = [];
156+
tempData.forEach(function(obj) {
157+
if (obj.links &amp;&amp; obj.links.length &gt; 0) {
158+
obj.links.forEach(function(link) {
159+
var target = link.replace(/^entity:/, '');
160+
var isValid = tempData.some(function(item) {
161+
return item.reference === target;
162+
});
163+
if (isValid) {
164+
edges.push({
165+
key: edgeKeyCounter.toString(),
166+
target: target,
167+
source: obj.reference
168+
});
169+
edgeKeyCounter++;
170+
}
171+
});
172+
}
173+
});
174+
var graphData = {
175+
nodes: nodes,
176+
edges: edges
177+
};
178+
let nb = nodes.length;
179+
$('#node-count').text('Displaying ' + nb + ' documents &amp; ');
180+
$('#edge-count').text(edges.length + ' links');
181+
visualisationAPI.visualize(graphData, "sigma-container", themeColors, isPanel = false, nb);
182+
183+
const sigmaContainer = document.querySelector("#sigma-container");
184+
$('#view-fullscreen').click(function() {
185+
if (document.fullscreenElement) {
186+
if (document.exitFullscreen) {
187+
document.exitFullscreen();
188+
} else if (document.mozCancelFullScreen) {
189+
document.mozCancelFullScreen();
190+
} else if (document.webkitCancelFullScreen) {
191+
document.webkitCancelFullScreen();
192+
} else if (document.msExitFullscreen) {
193+
document.msExitFullscreen();
194+
}
195+
} else {
196+
if (!document.mozFullScreen &amp;&amp; !document.webkitFullScreen) {
197+
if (sigmaContainer.requestFullscreen) {
198+
sigmaContainer.requestFullscreen();
199+
} else if (sigmaContainer.mozRequestFullScreen) {
200+
sigmaContainer.mozRequestFullScreen();
201+
} else if (sigmaContainer.webkitRequestFullScreen) {
202+
sigmaContainer.webkitRequestFullScreen();
203+
} else if (sigmaContainer.msRequestFullscreen) {
204+
sigmaContainer.msRequestFullscreen();
205+
}
206+
}
207+
}
208+
});
209+
$('#sigma-container').attr('data-init-done', 'true');
210+
}};
211+
if ($('#sigma-container') &amp;&amp; $('#sigma-container').data('results')) {
212+
$(init).on('xwiki:dom:updated', init);
213+
}
214+
});</code>
215+
</property>
216+
<property>
217+
<name>Visualisation API</name>
218+
</property>
219+
<property>
220+
<parse>1</parse>
221+
</property>
222+
<property>
223+
<use>currentPage</use>
224+
</property>
225+
</object>
40226
<object>
41227
<name>XWiki.InteractiveLinkVisualizer.Code.MainVisualisation</name>
42228
<number>0</number>
@@ -145,7 +331,7 @@
145331
<property>
146332
<code>#sigma-container {
147333
width: 100%;
148-
height: 500px;
334+
height: 100vh;
149335
border: 1px solid @breadcrumb-bg;
150336
border-radius: 5px;
151337
box-shadow: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.2) 0px 2px 6px;
@@ -156,7 +342,7 @@
156342
}
157343
#top-bar {
158344
position: absolute;
159-
top: 0;
345+
top: 8%;
160346
left: 50%;
161347
transform: translateX(-50%);
162348
width: 97%;
@@ -196,32 +382,18 @@ i {
196382
.search-facets {
197383
background-color: @panel-bg;
198384
}
199-
200-
.input-group {
201-
left: 145%;
202-
width: 60%;
203-
}
204-
.form-control {
205-
text-align: left;
206-
}
207-
#nb-results {
208-
position: absolute;
209-
bottom: 0;
210-
left: 100%;
211-
}
212-
213-
.search-options {
214-
position: absolute;
215-
bottom: 105%;
216-
}
217-
.search-results-sort {
218-
position: absolute;
219-
bottom: 102%;
220-
}
221385
a.options-item.active, a.options-item.active:hover {
222386
color: @link-color;
223387
text-decoration: underline;
224388
}
389+
.input-group {
390+
width: 95%;
391+
position: absolute;
392+
left: 100%
393+
}
394+
#refresh-button {
395+
margin-top: -0.5%;
396+
}
225397
#graph-buttons {
226398
position: absolute;
227399
right: 0;

0 commit comments

Comments
 (0)