Skip to content

Commit 6185d25

Browse files
Added frontend. Solved few problems.
1 parent 8fff1f3 commit 6185d25

26 files changed

Lines changed: 271834 additions & 20 deletions

Demos/Ktor/comparison-ktor/src/main/kotlin/com/groupdocs/ui/Module.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ fun Application.module() {
2626
level = Level.DEBUG
2727
filter { call -> call.request.path().startsWith("/comparison") }
2828
}
29-
install(ContentNegotiation) { gson { } }
29+
install(ContentNegotiation) { gson {
30+
serializeNulls()
31+
}}
3032
install(DefaultHeaders) {
3133
header("X-Engine", "Ktor") // will send this header with each response
3234
}

Demos/Ktor/comparison-ktor/src/main/kotlin/com/groupdocs/ui/model/CompareResponse.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ data class CompareResponse(
77
val changes: List<DocumentChange>,
88

99
/**
10-
* List of images of pages with marked changes
10+
* Extension of compared files, for saving total results
1111
*/
12-
val pages: List<ComparePage>,
12+
val extension: String? = null,
1313

1414
/**
1515
* Unique key of results
1616
*/
1717
val guid: String,
1818

1919
/**
20-
* Extension of compared files, for saving total results
20+
* List of images of pages with marked changes
2121
*/
22-
val extension: String? = null
22+
val pages: List<ComparePage>,
2323
)
2424

2525
/**
@@ -28,42 +28,42 @@ data class CompareResponse(
2828
* @author Aspose Pty Ltd
2929
*/
3030
data class ComparePage(
31-
val data: String? = null,
3231
val angle: Int = 0,
33-
val width: Int = 0,
32+
val data: String? = null,
3433
val height: Int = 0,
3534
val number: Int = 0,
35+
val width: Int = 0,
3636
)
3737

3838
data class DocumentChange(
39-
val id: Int,
40-
val type: Int,
39+
val authors: List<String>,
40+
val box: ChangeBox,
4141
val comparisonAction: Int,
42-
val sourceText: String,
43-
val targetText: String,
44-
val text: String,
4542
val componentType: String,
46-
val box: ChangeBox,
47-
val authors: List<String>,
43+
val id: Int,
4844
val pageInfo: PageInfo,
45+
val sourceText: String?,
4946
val styleChanges: List<StyleChange>,
47+
val targetText: String?,
48+
val text: String,
49+
val type: Int,
5050
)
5151

5252
data class ChangeBox(
53-
val y: Double,
5453
val x: Double,
54+
val y: Double,
5555
val height: Double,
5656
val width: Double
5757
)
5858

5959
data class PageInfo(
6060
val height: Int,
61-
val width: Int,
62-
val pageNumber: Int
61+
val pageNumber: Int,
62+
val width: Int
6363
)
6464

6565
data class StyleChange(
66-
val oldValue: Any,
6766
val newValue: Any,
67+
val oldValue: Any,
6868
val propertyName: String
6969
)

Demos/Ktor/comparison-ktor/src/main/kotlin/com/groupdocs/ui/modules/compare/CompareController.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class CompareControllerImpl(
125125
return CompareResponse(
126126
guid = guid.toString(),
127127
changes = changes,
128-
pages = pages
128+
pages = pages,
129+
extension = resultExtension
129130
)
130131
}
131132

Demos/Ktor/comparison-ktor/src/main/kotlin/com/groupdocs/ui/modules/home/HomeTemplate.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class HomeTemplate : Template<HTML> {
2323
name = "viewport"
2424
content = "width=device-width, initial-scale=1"
2525
}
26+
link(rel = "icon", type = "image/x-icon", href = "static/favicon.ico")
2627
}
2728
body {
2829
HTMLTag(

Demos/Ktor/comparison-ktor/src/main/kotlin/com/groupdocs/ui/usecase/CompareDocumentsUseCase.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.groupdocs.ui.usecase
22

33
import com.groupdocs.comparison.Comparer
4+
import com.groupdocs.comparison.options.CompareOptions
45
import com.groupdocs.comparison.options.load.LoadOptions
56
import com.groupdocs.comparison.result.ChangeInfo
67
import com.groupdocs.ui.status.InternalServerException
@@ -20,7 +21,11 @@ class CompareDocumentsUseCase : KoinComponent {
2021
Comparer(sourcePath, LoadOptions(sourcePassword)).use { comparer ->
2122
comparer.apply {
2223
add(targetPath, LoadOptions(targetPassword))
23-
compare(outputStream)
24+
compare(outputStream, CompareOptions().apply {
25+
showDeletedContent = true
26+
detectStyleChanges = true
27+
calculateCoordinates = true
28+
})
2429
return changes.toList()
2530
}
2631
}
14.7 KB
Binary file not shown.

Demos/Ktor/comparison-ktor/src/main/resources/static/main-es2015.js

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demos/Ktor/comparison-ktor/src/main/resources/static/main-es2015.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)