Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ public static WebModule getModule(App app) {

String defaultAction = app.getLaunchUrl();

String icon = hasIcon ? app.getBaseUrl() + "/" + app.getIcons().getIcon48() : null;

String description = subString(app.getDescription(), 0, 80);
String displayDescription = subString(app.getDisplayDescription(), 0, 80);

String key = app.isBundled() ? AppManager.BUNDLED_APP_PREFIX + app.getKey() : app.getKey();
String icon =
hasIcon
? app.getBaseUrl() + "/" + app.getIcons().getIcon48()
: app.getBaseUrl() + "/icons/" + key + ".png";

WebModule module = new WebModule(key, app.getBasePath(), defaultAction);
module.setIcon(icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
import org.hisp.dhis.http.HttpStatus;
import org.hisp.dhis.jsontree.JsonArray;
import org.hisp.dhis.jsontree.JsonMixed;
import org.hisp.dhis.jsontree.JsonObject;
import org.hisp.dhis.jsontree.JsonString;
import org.hisp.dhis.security.Authorities;
import org.hisp.dhis.test.config.TestDhisConfigurationProvider;
import org.hisp.dhis.test.webapi.H2ControllerIntegrationTestBase;
Expand Down Expand Up @@ -117,6 +119,25 @@ void cleanUp() {
DELETE("/userSettings/keyUiLocale/?userId=" + ADMIN_USER_UID);
}

@Test
void testGetAppMenuWhenInstalledAppWithoutIconInManifest() throws IOException {
appManager.installApp(new ClassPathResource("app/test-app-wihout-icon.zip").getFile());

HttpResponse response = GET("/apps/menu");
JsonArray apps = response.content(HttpStatus.OK);
String icon =
apps.asObject()
.get("modules")
.asList(JsonObject.class)
.get(0)
.get("icon")
.as(JsonString.class)
.string();
assertTrue(
icon.equals("http://localhost/api/apps/test/icons/test.png")
|| icon.equals("http://localhost/api/apps/myapp/dhis2-app-icon.png"));
}

@Test
void testGetInstalledAppIndexHtml() throws IOException {
appManager.installApp(new ClassPathResource("app/test-app-with-index-html.zip").getFile());
Expand Down
Binary file not shown.
Loading