-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-1289 Mobile APP app grid (#1347)
- Loading branch information
1 parent
c11d72b
commit e4cdb07
Showing
8 changed files
with
216 additions
and
24 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
docs/modules/ROOT/pages/tmail-backend/configure/ecosystem-discovery.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
= Ecosystem Discovery | ||
:navtitle: Ecosystem Discovery | ||
|
||
|
||
Allows clients to discover Linagora ecosystem services. | ||
An example case for the Mobile APP grid in the application. | ||
|
||
== How to use it | ||
|
||
Clients can access the ecosystem discovery endpoint using the following URL: | ||
|
||
``` | ||
http://${jmapBaseServerUrl}/.well-known/linagora-ecosystem | ||
``` | ||
|
||
The JSON object response sample: | ||
```json | ||
{ | ||
"linShareApiUrl": "https://linshare.linagora.com/linshare/webservice", | ||
"linToApiUrl": "https://linto.ai/demo", | ||
"linToApiKey": "apiKey", | ||
"twakeApiUrl": "https://api.twake.app", | ||
"mobileApps": { | ||
"Twake Chat": { | ||
"logoURL": "https://twake-chat.xyz/tild3837-6430-4761-b135-303536323633__twake-chat_1.svg", | ||
"appId": "twake-chat" | ||
}, | ||
"Twake Drive": { | ||
"logoURL": "https://twake-drive.xyz/tild6334-3137-4635-b331-636632306164__drive_1.svg", | ||
"webLink": "https://tdrive.linagora.com" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
== How to configure the response JSON | ||
|
||
Provide the key-value in the `linagora-ecosystem.properties` file in the configure path. | ||
Use `.` for nested keys, representing hierarchical configuration. | ||
Example: `service.database.url` translates to a JSON structure: | ||
```json | ||
{ | ||
"service": { | ||
"database": { | ||
"url": "..." | ||
} | ||
} | ||
} | ||
``` | ||
Use `_` as a substitute for spaces in keys for better readability. | ||
Example: `key_with_space` can be interpreted as `key with space` in json key. | ||
When `app.key_with_space.apikey=1234` is set in the properties file, it will be translated to: | ||
```json | ||
{ | ||
"app": { | ||
"key with space": { | ||
"apikey": "1234" | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...tests/jmap/memory-jmap-integration-tests/src/test/resources/linagora-ecosystem.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
linShareApiUrl=https://linshare.linagora.com/linshare/webservice | ||
linToApiUrl=https://linto.ai/demo | ||
linToApiKey=apiKey | ||
twakeApiUrl=https://api.twake.app | ||
twakeApiUrl=https://api.twake.app | ||
mobileApps.Twake_Chat.logoURL=https://twake-chat.xyz/tild3837-6430-4761-b135-303536323633__twake-chat_1.svg | ||
mobileApps.Twake_Chat.appId=twake-chat | ||
mobileApps.Twake_Drive.logoURL=https://twake-drive.xyz/tild6334-3137-4635-b331-636632306164__drive_1.svg | ||
mobileApps.Twake_Drive.webLink=https://tdrive.linagora.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
.../linagora/tmail/james/jmap/json/LinagoraServicesDiscoveryConfigurationSerializeTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.linagora.tmail.james.jmap.json | ||
|
||
import com.linagora.tmail.james.jmap.service.discovery.{LinagoraServicesDiscoveryConfiguration, LinagoraServicesDiscoveryItem, ServicesDiscoveryConfigurationSerializers => testee} | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import play.api.libs.json.Json | ||
|
||
class LinagoraServicesDiscoveryConfigurationSerializeTest { | ||
|
||
@Test | ||
def serializeShouldHandleFlatPropertiesCorrectly(): Unit = { | ||
val input = LinagoraServicesDiscoveryConfiguration(services = List( | ||
LinagoraServicesDiscoveryItem("linShareApiUrl", "https://linshare.linagora.com/linshare/webservice"), | ||
LinagoraServicesDiscoveryItem("linToApiUrl", "https://linto.ai/demo"), | ||
LinagoraServicesDiscoveryItem("linToApiKey", "apiKey"))) | ||
|
||
assertThat(Json.parse(testee.serialize(input))) | ||
.isEqualTo(Json.parse( | ||
"""{ | ||
| "linShareApiUrl" : "https://linshare.linagora.com/linshare/webservice", | ||
| "linToApiUrl" : "https://linto.ai/demo", | ||
| "linToApiKey" : "apiKey" | ||
| }""".stripMargin)) | ||
} | ||
|
||
@Test | ||
def serializeShouldHandleNestedPropertiesCorrectly(): Unit = { | ||
val input = LinagoraServicesDiscoveryConfiguration(services = List( | ||
LinagoraServicesDiscoveryItem("mobileApps.Lin1.url1", "url1"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Lin1.url2", "url2"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Lin2.url3", "url3"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Lin4", "url4"))) | ||
|
||
assertThat(Json.parse(testee.serialize(input))) | ||
.isEqualTo(Json.parse( | ||
"""{ | ||
| "mobileApps": { | ||
| "Lin1": { | ||
| "url1": "url1", | ||
| "url2": "url2" | ||
| }, | ||
| "Lin2": { | ||
| "url3": "url3" | ||
| }, | ||
| "Lin4": "url4" | ||
| } | ||
|}""".stripMargin)) | ||
} | ||
|
||
@Test | ||
def serializeShouldTransformUnderscoreToSpaceInNestedKeys(): Unit = { | ||
val input = LinagoraServicesDiscoveryConfiguration(services = List( | ||
LinagoraServicesDiscoveryItem("linToApiKey", "apiKey"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Twake_Chat.logoURL", "https://xyz"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Twake_Chat.appId", "abc"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Twake_Drive.logoURL", "https://xyz"), | ||
LinagoraServicesDiscoveryItem("mobileApps.Twake_Drive.webLink", "https://tdrive.linagora.com"), | ||
LinagoraServicesDiscoveryItem("mobileApps.TwakeXyz.Logo_URL", "https://xyz") | ||
)) | ||
|
||
assertThat(Json.parse(testee.serialize(input))) | ||
.isEqualTo(Json.parse( | ||
"""{ | ||
| "mobileApps": { | ||
| "TwakeXyz": { | ||
| "Logo URL": "https://xyz" | ||
| }, | ||
| "Twake Chat": { | ||
| "logoURL": "https://xyz", | ||
| "appId": "abc" | ||
| }, | ||
| "Twake Drive": { | ||
| "logoURL": "https://xyz", | ||
| "webLink": "https://tdrive.linagora.com" | ||
| } | ||
| }, | ||
| "linToApiKey": "apiKey" | ||
|}""".stripMargin)) | ||
} | ||
|
||
@Test | ||
def serilizeShouldSuccessWhenEmptyConfiguration(): Unit = { | ||
val input = LinagoraServicesDiscoveryConfiguration(services = List()) | ||
|
||
assertThat(Json.parse(testee.serialize(input))) | ||
.isEqualTo(Json.parse("{}")) | ||
} | ||
} |