Adding the widget names set to the default layout for a page
This commit is contained in:
parent
a2a4cbb2d7
commit
a4132d5845
|
|
@ -25,6 +25,7 @@ public class FieldName {
|
||||||
public static String CATEGORY = "category";
|
public static String CATEGORY = "category";
|
||||||
public static String PAGE = "page";
|
public static String PAGE = "page";
|
||||||
public static String SIZE = "size";
|
public static String SIZE = "size";
|
||||||
|
public static String DEFAULT_WIDGET_NAME = "MainContainer";
|
||||||
public static String DEFAULT_PAGE_LAYOUT = "{\n" +
|
public static String DEFAULT_PAGE_LAYOUT = "{\n" +
|
||||||
" \"widgetName\": \"MainContainer\",\n" +
|
" \"widgetName\": \"MainContainer\",\n" +
|
||||||
" \"backgroundColor\": \"none\",\n" +
|
" \"backgroundColor\": \"none\",\n" +
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import reactor.core.scheduler.Scheduler;
|
||||||
|
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -81,6 +82,7 @@ public class PageServiceImpl extends BaseService<PageRepository, Page, String> i
|
||||||
layout.setId(id);
|
layout.setId(id);
|
||||||
try {
|
try {
|
||||||
layout.setDsl((JSONObject) new JSONParser(JSONParser.MODE_PERMISSIVE).parse(FieldName.DEFAULT_PAGE_LAYOUT));
|
layout.setDsl((JSONObject) new JSONParser(JSONParser.MODE_PERMISSIVE).parse(FieldName.DEFAULT_PAGE_LAYOUT));
|
||||||
|
layout.setWidgetNames(Set.of(FieldName.DEFAULT_WIDGET_NAME));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
log.error("Unable to set the default page layout for id: {}", id);
|
log.error("Unable to set the default page layout for id: {}", id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class PageServiceTest {
|
||||||
assertThat("PageServiceTest TestApp".equals(page.getName()));
|
assertThat("PageServiceTest TestApp".equals(page.getName()));
|
||||||
assertThat(page.getLayouts()).isNotEmpty();
|
assertThat(page.getLayouts()).isNotEmpty();
|
||||||
assertThat(page.getLayouts().get(0).getDsl()).isEqualTo(parsedJson);
|
assertThat(page.getLayouts().get(0).getDsl()).isEqualTo(parsedJson);
|
||||||
|
assertThat(page.getLayouts().get(0).getWidgetNames()).isNotEmpty();
|
||||||
})
|
})
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user