Skip to content

Commit 2cb3573

Browse files
committed
refactor(model-server): move HTML handlers explorer to own package
To avoid confusing API handlers with HTML request handlers in the future, move the content explorer HTML handlers to their own package.
1 parent 961561d commit 2cb3573

File tree

7 files changed

+48
-10
lines changed

7 files changed

+48
-10
lines changed

model-server/src/main/kotlin/org/modelix/model/server/Main.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ import org.modelix.authorization.NoPermissionException
6060
import org.modelix.authorization.NotLoggedInException
6161
import org.modelix.authorization.installAuthentication
6262
import org.modelix.model.InMemoryModels
63-
import org.modelix.model.server.handlers.ContentExplorer
6463
import org.modelix.model.server.handlers.DeprecatedLightModelServer
6564
import org.modelix.model.server.handlers.HealthApiImpl
66-
import org.modelix.model.server.handlers.HistoryHandler
6765
import org.modelix.model.server.handlers.HttpException
6866
import org.modelix.model.server.handlers.IdsApiImpl
6967
import org.modelix.model.server.handlers.KeyValueLikeModelServer
7068
import org.modelix.model.server.handlers.MetricsApiImpl
7169
import org.modelix.model.server.handlers.ModelReplicationServer
7270
import org.modelix.model.server.handlers.RepositoriesManager
73-
import org.modelix.model.server.handlers.RepositoryOverview
71+
import org.modelix.model.server.handlers.ui.ContentExplorer
72+
import org.modelix.model.server.handlers.ui.HistoryHandler
73+
import org.modelix.model.server.handlers.ui.RepositoryOverview
7474
import org.modelix.model.server.store.IgniteStoreClient
7575
import org.modelix.model.server.store.InMemoryStoreClient
7676
import org.modelix.model.server.store.IsolatingStore

model-server/src/main/kotlin/org/modelix/model/server/handlers/ContentExplorer.kt renamed to model-server/src/main/kotlin/org/modelix/model/server/handlers/ui/ContentExplorer.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
package org.modelix.model.server.handlers
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.modelix.model.server.handlers.ui
218

319
import io.ktor.http.HttpStatusCode
420
import io.ktor.server.application.Application
@@ -46,6 +62,7 @@ import org.modelix.model.client.IModelClient
4662
import org.modelix.model.lazy.BranchReference
4763
import org.modelix.model.lazy.CLVersion
4864
import org.modelix.model.lazy.RepositoryId
65+
import org.modelix.model.server.handlers.IRepositoriesManager
4966
import org.modelix.model.server.templates.PageWithMenuBar
5067
import kotlin.collections.set
5168

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.modelix.model.server.handlers
17+
package org.modelix.model.server.handlers.ui
1818

1919
import kotlinx.serialization.Serializable
2020

model-server/src/main/kotlin/org/modelix/model/server/handlers/HistoryHandler.kt renamed to model-server/src/main/kotlin/org/modelix/model/server/handlers/ui/HistoryHandler.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
package org.modelix.model.server.handlers
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.modelix.model.server.handlers.ui
218

319
import io.ktor.server.application.Application
420
import io.ktor.server.application.call
@@ -51,6 +67,7 @@ import org.modelix.model.operations.OTBranch
5167
import org.modelix.model.operations.RevertToOp
5268
import org.modelix.model.operations.applyOperation
5369
import org.modelix.model.persistent.CPVersion.Companion.DESERIALIZER
70+
import org.modelix.model.server.handlers.IRepositoriesManager
5471
import org.modelix.model.server.templates.PageWithMenuBar
5572
import java.time.LocalDateTime
5673
import java.time.format.DateTimeFormatter

model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoryOverview.kt renamed to model-server/src/main/kotlin/org/modelix/model/server/handlers/ui/RepositoryOverview.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.modelix.model.server.handlers
1+
package org.modelix.model.server.handlers.ui
22

33
import io.ktor.http.encodeURLPathPart
44
import io.ktor.server.application.Application
@@ -22,6 +22,7 @@ import kotlinx.html.th
2222
import kotlinx.html.thead
2323
import kotlinx.html.title
2424
import kotlinx.html.tr
25+
import org.modelix.model.server.handlers.IRepositoriesManager
2526
import org.modelix.model.server.templates.PageWithMenuBar
2627

2728
class RepositoryOverview(private val repoManager: IRepositoriesManager) {

model-server/src/test/kotlin/org/modelix/model/server/handlers/ContentExplorerTest.kt renamed to model-server/src/test/kotlin/org/modelix/model/server/handlers/ui/ContentExplorerTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.modelix.model.server.handlers
17+
package org.modelix.model.server.handlers.ui
1818

1919
import io.ktor.client.call.body
2020
import io.ktor.client.request.get
@@ -38,6 +38,9 @@ import org.modelix.model.lazy.CLVersion
3838
import org.modelix.model.lazy.RepositoryId
3939
import org.modelix.model.server.api.v2.VersionDelta
4040
import org.modelix.model.server.createModelClient
41+
import org.modelix.model.server.handlers.IdsApiImpl
42+
import org.modelix.model.server.handlers.ModelReplicationServer
43+
import org.modelix.model.server.handlers.RepositoriesManager
4144
import org.modelix.model.server.installDefaultServerPlugins
4245
import org.modelix.model.server.store.InMemoryStoreClient
4346
import org.modelix.model.server.store.LocalModelClient

model-server/src/test/kotlin/org/modelix/model/server/handlers/RepositoryOverviewTest.kt renamed to model-server/src/test/kotlin/org/modelix/model/server/handlers/ui/RepositoryOverviewTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023.
2+
* Copyright (c) 2023-2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.modelix.model.server.handlers
17+
package org.modelix.model.server.handlers.ui
1818

1919
import kotlinx.html.span
2020
import kotlinx.html.stream.createHTML

0 commit comments

Comments
 (0)