Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React editor #143

Merged
merged 130 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
24f9b8e
Fix stuff related to changes in dc-model
morpheus-87 Jul 15, 2019
6f6fdd9
Move json version to main dependency management
morpheus-87 Jul 16, 2019
4fb8eaa
Add database migration for LocalizedStructuredContent
morpheus-87 Jul 16, 2019
8feff2f
Disable checkstyle for database migrations
morpheus-87 Jul 16, 2019
07e7ad5
Remove commented line
morpheus-87 Jul 16, 2019
7ca3fac
Remove commented code
morpheus-87 Jul 17, 2019
6a6084f
Add database migration for LocalizedText
morpheus-87 Jul 17, 2019
3576eb4
Fix stuff related to changes in dc-model
morpheus-87 Jul 17, 2019
850cc38
Fix html rendering
morpheus-87 Jul 17, 2019
3dda0ba
Refactor V1 controller
morpheus-87 Jul 17, 2019
9419347
Fix checkstyle issues another way
morpheus-87 Jul 17, 2019
0d18b58
Migrate to dc-commons-file 5
datazuul Jul 19, 2019
9a2ffea
Remove dependency to dc-commons-file and split filresource binary and…
datazuul Jul 22, 2019
b9a3f82
No longer needed
datazuul Jul 22, 2019
69a44ea
Add getParent to node entity parts
datazuul Jul 22, 2019
44fd295
fix typos in SQL command
christian-bsb Jul 23, 2019
0bd4cee
Fix stuff related to changes in dc-model
morpheus-87 Jul 15, 2019
4bbf962
Move json version to main dependency management
morpheus-87 Jul 16, 2019
3646426
Add database migration for LocalizedStructuredContent
morpheus-87 Jul 16, 2019
faf451d
Disable checkstyle for database migrations
morpheus-87 Jul 16, 2019
8fa3309
Remove commented line
morpheus-87 Jul 16, 2019
c8d0bb3
Remove commented code
morpheus-87 Jul 17, 2019
57767dd
Add database migration for LocalizedText
morpheus-87 Jul 17, 2019
1342f07
Fix stuff related to changes in dc-model
morpheus-87 Jul 17, 2019
549d774
Fix html rendering
morpheus-87 Jul 17, 2019
cf990a8
Refactor V1 controller
morpheus-87 Jul 17, 2019
6b043e9
Fix checkstyle issues another way
morpheus-87 Jul 17, 2019
e32fd20
Add first prototype of cudami editor in react
morpheus-87 Jul 8, 2019
df57bea
Add node_modules folder to gitignore
morpheus-87 Jul 8, 2019
c898823
Refactor structure
morpheus-87 Jul 15, 2019
f17a0d4
Refactor editor to handle new json structure
morpheus-87 Jul 18, 2019
95ee45f
Remove unused stuff
morpheus-87 Jul 18, 2019
78189ec
Add sorted package.json
morpheus-87 Jul 18, 2019
56373b5
Fix public stuff
morpheus-87 Jul 18, 2019
f7fbd85
Add prototype of a build configuration
morpheus-87 Jul 18, 2019
fb12bef
Refactor to a library and remove thereby unused stuff
morpheus-87 Jul 19, 2019
42d1e25
Add debug prop to display json on if set
morpheus-87 Jul 19, 2019
460da27
Add some styling
morpheus-87 Jul 19, 2019
4adfe86
Restore possibility of local development
morpheus-87 Jul 22, 2019
04a80f7
Add directory with build artifacts to gitignore
morpheus-87 Jul 22, 2019
415135e
Add editor configuration from https://github.com/hubgit/react-prosemi…
morpheus-87 Jul 22, 2019
f1fd672
Fix icon for horizontal rule
morpheus-87 Jul 22, 2019
49a18c2
Add functionality to add new locales
morpheus-87 Jul 23, 2019
e01202b
Remove unused variable
morpheus-87 Jul 23, 2019
439f80b
Fix key prop of select options
morpheus-87 Jul 23, 2019
2b70983
Add possibility to add iframes in the editor
morpheus-87 Jul 23, 2019
3cca60d
Add internationalisation of the whole editor
morpheus-87 Jul 24, 2019
47e03e2
Add missing files for internationalisation
morpheus-87 Jul 24, 2019
0e88ee4
Add translation of language names
morpheus-87 Jul 24, 2019
719cdbd
Remove bootstrap css as not needed here
morpheus-87 Jul 26, 2019
fccb8b7
Remove mock data and replace with real api calls
morpheus-87 Jul 26, 2019
f5c79b0
Add splitting of country specific locale
morpheus-87 Jul 26, 2019
931c052
Add updating of an identifiable
morpheus-87 Jul 26, 2019
e2d428d
Remove unused property and sort dependencies
datazuul Jul 29, 2019
7550eec
Merge branch 'master' into simplify-localized-content
datazuul Jul 29, 2019
dd8ebaf
Rename param to reflect class name
datazuul Jul 29, 2019
ab77760
Fix missing version
datazuul Jul 29, 2019
7deffb4
Resolved conflicts
datazuul Jul 29, 2019
f28b3fd
Fix NPE in migration
datazuul Jul 30, 2019
9bef18e
Merge remote-tracking branch 'origin/master' into react-editor
datazuul Jul 30, 2019
e8f43b2
Add linked data file resource
datazuul Jul 31, 2019
53d98a3
Rename helper files
morpheus-87 Aug 5, 2019
82752a4
Add api mock
morpheus-87 Aug 6, 2019
d0fd05d
Add label to json debug output
morpheus-87 Aug 6, 2019
3ec3fbe
Add form for webpages
morpheus-87 Aug 6, 2019
e2af529
Add build directory to gitignore
morpheus-87 Aug 6, 2019
e4b6dc1
Fix handling of languages
morpheus-87 Aug 6, 2019
ea0b636
Add check if more languages can be added
morpheus-87 Aug 6, 2019
dfcb90a
Add call of webpack to pom
morpheus-87 Aug 6, 2019
b36cbd5
Disable csrf for api endpoints
morpheus-87 Aug 6, 2019
3c51ee1
Refactor from promises to async-await
morpheus-87 Aug 6, 2019
dec42a4
Fix mock data
morpheus-87 Aug 6, 2019
377b6aa
Add form for content trees
morpheus-87 Aug 6, 2019
f6422c7
Add default language and supported languages as service
datazuul Aug 6, 2019
b53740f
Fix locale endpoint
morpheus-87 Aug 6, 2019
9bb30c4
Add migration from locale to language
morpheus-87 Aug 6, 2019
71c2763
Rename function to submit the form
morpheus-87 Aug 6, 2019
3b01180
Add filtering of already existing languages
morpheus-87 Aug 6, 2019
807a21f
Remove useless modification of the language name
morpheus-87 Aug 6, 2019
72137fc
Add missing language translations
morpheus-87 Aug 6, 2019
8bc9c95
Add extended README for the prosemirror configuration
morpheus-87 Aug 6, 2019
93b95a7
Refactor locale to language
morpheus-87 Aug 7, 2019
8723520
Fix component name
morpheus-87 Aug 7, 2019
c106c11
Remove useless whitespace
morpheus-87 Aug 7, 2019
bf3b21a
Add form for content nodes
morpheus-87 Aug 7, 2019
1e68c9f
Add stuff for creation of a totally new identifiable
morpheus-87 Aug 7, 2019
fdab0cf
Remove useless brackets
morpheus-87 Aug 8, 2019
202b1a8
Change type to url
morpheus-87 Aug 8, 2019
bd01b3a
Add type for buttons
morpheus-87 Aug 8, 2019
c1a22a5
Change defaultValue to value
morpheus-87 Aug 8, 2019
ffd45db
Add check if uuid exists
morpheus-87 Aug 8, 2019
1dccb35
Add translations for creation of new identifiables
morpheus-87 Aug 8, 2019
105f10b
Update dependencies
morpheus-87 Aug 8, 2019
642aca0
Fix form submit
morpheus-87 Aug 8, 2019
40b86ce
Remove useless name attribute
morpheus-87 Aug 8, 2019
fc34731
Add required to url input field
morpheus-87 Aug 8, 2019
667fb60
Change ui locale to english
morpheus-87 Aug 8, 2019
48220c3
Add forms for articles and file resources
morpheus-87 Aug 8, 2019
ffc87cc
Add thicker border to the editor field
morpheus-87 Aug 8, 2019
ca04cb2
Add first prototype of form validation
morpheus-87 Aug 12, 2019
31a48dc
Move selected language to internal state
morpheus-87 Aug 13, 2019
9237ac3
Add unique key prop
morpheus-87 Aug 13, 2019
19029a8
Remove some extra whitespace
morpheus-87 Aug 13, 2019
6466810
Add modals for inserting links and tables
morpheus-87 Aug 13, 2019
b291c63
Add new dependency classnames
morpheus-87 Aug 14, 2019
2594834
Add customized menubar with heading dropdown
morpheus-87 Aug 14, 2019
4aef602
Fix function sorting
morpheus-87 Aug 14, 2019
9228af2
Fix bug with disabling the button action
morpheus-87 Aug 14, 2019
b69327a
Fix active and disabled state for headings
morpheus-87 Aug 19, 2019
a404446
Add headings level 3 to 6
morpheus-87 Aug 19, 2019
4f0a652
Remove pointer cursor from disabled menu buttons
morpheus-87 Aug 19, 2019
7d37564
Fix styling of editor
morpheus-87 Aug 20, 2019
85f24a0
Fix issue with the identifiable type
morpheus-87 Aug 20, 2019
f46a7c7
Remove border-radius
morpheus-87 Aug 20, 2019
f7f19c0
Add new language controller
morpheus-87 Aug 20, 2019
eb05317
Refactor creating and editing of articles, content trees and websites…
morpheus-87 Aug 20, 2019
c08ec57
Refactor creating and editing of content nodes and webpages to new ed…
morpheus-87 Aug 21, 2019
0336a6a
Remove unused function parameter
morpheus-87 Aug 26, 2019
ee0d409
Fix distinction between save and update
morpheus-87 Aug 26, 2019
f63578b
Add extended mock data
morpheus-87 Aug 26, 2019
da69a42
Fix wrong redirect url
morpheus-87 Aug 27, 2019
806d804
Remove unused endpoints
morpheus-87 Aug 27, 2019
9a25020
Refactor file upload to be done in React
morpheus-87 Aug 27, 2019
024fb41
Refactor FileResourceForm to two separate components
morpheus-87 Aug 28, 2019
d786b4a
Refactor async function call with await
morpheus-87 Aug 28, 2019
e636641
Add simplified version of getFormComponent
morpheus-87 Aug 28, 2019
c93e982
Remove unused files and stuff
morpheus-87 Sep 13, 2019
6ef6f5d
Update dependency to fix vulnerability
morpheus-87 Sep 13, 2019
da5cc00
Add docstring for the whiteSpaceNormalizedDialect
morpheus-87 Sep 16, 2019
12fb2a7
Rename locale to language
morpheus-87 Sep 16, 2019
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
/dc-cudami-admin/dc-cudami-admin-business/nbproject/
/nb-configuration.xml
**/nbactions.xml
build
dist
node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
*/
public interface LocaleRepository {

public List<Locale> findAll();
List<String> findAllLanguages();

public Locale getDefault();
List<Locale> findAllLocales();

String getDefaultLanguage();

Locale getDefaultLocale();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import java.util.UUID;

public interface NodeRepository<N extends Node> extends IdentifiableRepository<N> {

N getParent(UUID nodeUuid);

List<N> getChildren(N node);

List<N> getChildren(UUID uuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

import feign.RequestLine;
import java.util.List;
import java.util.Locale;

public interface LocaleRepositoryEndpoint {

@RequestLine("GET /latest/languages")
List<String> findAllLanguages();

@RequestLine("GET /latest/languages/default")
Locale getDefaultLanguage();

@RequestLine("GET /latest/locales")
List<String> find();
List<String> findAllLocales();

@RequestLine("GET /latest/locales/default")
String getDefault();
String getDefaultLocale();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ public class LocaleRepositoryImpl implements LocaleRepository {
private LocaleRepositoryEndpoint endpoint;

@Override
public List<Locale> findAll() {
List<String> localeCodes = endpoint.find();
public List<String> findAllLanguages() {
return endpoint.findAllLanguages();
}

@Override
public List<Locale> findAllLocales() {
List<String> localeCodes = endpoint.findAllLocales();
List<Locale> result = new ArrayList<>();
for (String localeCode : localeCodes) {
try {
Expand All @@ -34,8 +39,13 @@ public List<Locale> findAll() {
}

@Override
public Locale getDefault() {
String defaultLocaleCode = endpoint.getDefault();
public String getDefaultLanguage() {
return endpoint.getDefaultLanguage().getLanguage();
}

@Override
public Locale getDefaultLocale() {
String defaultLocaleCode = endpoint.getDefaultLocale();
return LocaleUtils.toLocale(defaultLocaleCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ PageResponse<ContentNode> find(
@RequestLine("GET /latest/contentnodes/{uuid}/fileresources")
LinkedHashSet<FileResource> getFileResources(@Param("uuid") UUID uuid);

@RequestLine("GET /latest/contentnodes/{uuid}/parent")
ContentNode getParent(@Param("uuid") UUID uuid);

@RequestLine("POST /latest/contentnodes")
@Headers("Content-Type: application/json")
ContentNode save(ContentNode contentNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public LinkedHashSet<FileResource> getFileResources(UUID contentNodeUuid) {
return endpoint.getFileResources(contentNodeUuid);
}

@Override
public ContentNode getParent(UUID nodeUuid) {
return endpoint.getParent(nodeUuid);
}

@Override
public ContentNode save(ContentNode contentNode) {
return endpoint.save(contentNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public interface WebpageRepositoryEndpoint extends RepositoryEndpoint {

@RequestLine("GET /latest/webpages?pageNumber={pageNumber}&pageSize={pageSize}&sortField={sortField}&sortDirection={sortDirection}&nullHandling={nullHandling}")
PageResponse<Webpage> find(
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
@Param("sortField") String sortField, @Param("sortDirection") String sortDirection, @Param("nullHandling") String nullHandling
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
@Param("sortField") String sortField, @Param("sortDirection") String sortDirection, @Param("nullHandling") String nullHandling
);

@RequestLine("GET /latest/webpages/{uuid}")
Expand All @@ -37,6 +37,9 @@ PageResponse<Webpage> find(
@RequestLine("GET /latest/webpages/{uuid}/children")
List<Webpage> getChildren(@Param("uuid") UUID uuid);

@RequestLine("GET /latest/webpages/{uuid}/parent")
Webpage getParent(UUID uuid);

@RequestLine("POST /latest/websites/{parentWebsiteUuid}/webpage")
@Headers("Content-Type: application/json")
Webpage saveWithParentWebsite(Webpage webpage, @Param("parentWebsiteUuid") UUID parentWebsiteUuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public List<Webpage> getChildren(Webpage webpage) {
return getChildren(webpage.getUuid());
}

@Override
public Webpage getParent(UUID uuid) {
return endpoint.getParent(uuid);
}

@Override
public Webpage save(Webpage identifiable) {
return endpoint.save(identifiable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,27 @@
import java.util.Locale;

/**
* Service for Locales.
* Service for Locales and languages.
*/
public interface LocaleService {
jbaiter marked this conversation as resolved.
Show resolved Hide resolved

public List<Locale> findAll();
/**
* @return default language of content managed in cudami (ISO-2-code, e.g. "de", "en")
*/
String getDefaultLanguage();

public Locale getDefault();
/**
* @return default locale of content managed in cudami
*/
Locale getDefaultLocale();

/**
* @return list of all languages supported by cudami
*/
List<String> getSupportedLanguages();

/**
* @return list of all locales supported by cudami
*/
List<Locale> getSupportedLocales();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

public interface NodeService<N extends Node> extends IdentifiableService<N> {

N getParent(N node);

N getParent(UUID nodeUuid);

List<N> getChildren(N node);

List<N> getChildren(UUID uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ public class LocaleServiceImpl implements LocaleService {
private LocaleRepository repository;

@Override
public List<Locale> findAll() {
List<Locale> locales = repository.findAll();
return locales;
public String getDefaultLanguage() {
return repository.getDefaultLanguage();
}

@Override
public Locale getDefault() {
return repository.getDefault();
public Locale getDefaultLocale() {
return repository.getDefaultLocale();
}

@Override
public List<String> getSupportedLanguages() {
return repository.findAllLanguages();
}

@Override
public List<Locale> getSupportedLocales() {
return repository.findAllLocales();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ public LinkedHashSet<E> getEntities(UUID contentNodeUuid) {
return ((ContentNodeRepository) repository).getEntities(contentNodeUuid);
}

@Override
public ContentNode getParent(ContentNode node) {
return getParent(node.getUuid());
}

@Override
public ContentNode getParent(UUID nodeUuid) {
return (ContentNode) ((ContentNodeRepository) repository).getParent(nodeUuid);
}

@Override
public LinkedHashSet<E> saveEntities(ContentNode contentNode, LinkedHashSet<E> entities) {
return saveEntities(contentNode.getUuid(), entities);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public List<Webpage> getChildren(UUID uuid) {
return ((NodeRepository) repository).getChildren(uuid);
}

@Override
public Webpage getParent(Webpage webpage) {
return getParent(webpage.getUuid());
}

@Override
public Webpage getParent(UUID webpageUuid) {
return (Webpage) ((WebpageRepository) repository).getParent(webpageUuid);
}

@Override
// @Transactional(readOnly = false)
public Webpage saveWithParentWebsite(Webpage webpage, UUID parentWebsiteUuid) throws IdentifiableServiceException {
Expand Down
37 changes: 37 additions & 0 deletions dc-cudami-admin/dc-cudami-admin-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,43 @@
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<arguments>
<argument>install</argument>
</arguments>
<executable>npm</executable>
<workingDirectory>../../dc-cudami-editor</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
<id>exec-npm-install</id>
<phase>initialize</phase>
</execution>
<execution>
<configuration>
<arguments>
<argument>webpack</argument>
<argument>
--outputPath=${project.basedir}/target/classes/static/js
</argument>
</arguments>
<executable>npx</executable>
<workingDirectory>../../dc-cudami-editor</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
<id>exec-webpack</id>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
protected void configure(HttpSecurity http) throws Exception {
// Webapp:
http.authorizeRequests()
.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
jbaiter marked this conversation as resolved.
Show resolved Hide resolved
.antMatchers("/api/**", "/setup/**").permitAll();
.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.antMatchers("/api/**", "/setup/**").permitAll().and().csrf().disable();

// FIXME: replace with serverside token repository?
final InMemoryTokenRepositoryImpl inMemoryTokenRepositoryImpl = new InMemoryTokenRepositoryImpl();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.digitalcollections.cudami.admin.controller;

import de.digitalcollections.cudami.admin.business.api.service.LocaleService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LanguageController {

@Autowired
LocaleService localeService;

@GetMapping("/api/languages")
public List<String> getLanguages() {
return localeService.getSupportedLanguages();
}
}
Loading