Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/maven/org.apache.maven.plugins-…
Browse files Browse the repository at this point in the history
…maven-release-plugin-3.0.1
  • Loading branch information
philipsens authored Mar 7, 2024
2 parents a247cce + 5294c27 commit 66fc3fa
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
volumes:
- ./frank-flow/src/frontend/cypress/Frank/src/main/:/opt/frank/
- ./context.xml:/usr/local/tomcat/conf/context.xml
- ./frank-flow-webapp/target/frank-flow-webapp-0.0.0-SNAPSHOT:/usr/local/tomcat/webapps/frank-flow
- ./frank-flow/target/frank-flow-0.0.0-SNAPSHOT:/usr/local/tomcat/webapps/frank-flow
- ./frank-flow/target/frontend:/frank-flow/frontend
ports:
- "8080:8080"
Expand Down
12 changes: 9 additions & 3 deletions frank-flow/src/frontend/src/app/flow/palette/palette.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@ export class PaletteService {
}

getElementsForTypes(types: ElementType, data: any): Element[] {
return types.map((type: ElementType): Element => {
const elements: Element[] = [];
for (const type of types) {
const element = data.elements.find(
(element: any) => element.fullName === type.name
);
return element.elementNames.map((elementName: string) => ({
if (element.deprecated) {
continue;
}
const elementNames = element.elementNames.map((elementName: string) => ({
name: elementName,
type,
}));
});
elements.push(elementNames);
}
return elements;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*/
package org.ibissource.frankflow;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import javax.servlet.ServletContext;
Expand Down Expand Up @@ -96,10 +98,20 @@ private URL findResource(String path) {
normalizedPath = normalizedPath.substring(1);
}

if(!StringUtils.hasLength(frontendPath)) {
return this.getClass().getResource("/frontend/"+normalizedPath);
URL url = null;
if(StringUtils.hasLength(frontendPath)) {
try {
url = new File(frontendPath + "/" + normalizedPath).toURI().toURL();
log.debug("looking up resource from frontendPath [{}/{}] to url [{}]", frontendPath, normalizedPath, url);
} catch (MalformedURLException e) {
log.error(e);
}
} else {
return this.getClass().getResource(frontendPath+normalizedPath);
url = this.getClass().getResource("/frontend/"+normalizedPath);
log.debug("looking up resource from path [/frontend/{}] to url [{}]", normalizedPath, url);
}
}

log.debug("{} resource from path [{}]", url == null ? "did not find" : "found", normalizedPath);
return url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ public String getBasePath() {
servletContext.setAttribute("basepath", basePath);
}

String frontendLocation = FileUtils.getAbsPath(frontendPath);
if(StringUtils.hasLength(frontendLocation)) {
servletContext.setAttribute("frontend-location", frontendLocation);
if(StringUtils.hasLength(frontendPath)) {
servletContext.setAttribute("frontend-location", frontendPath);
}

return basePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
package org.ibissource.frankflow.util;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.util.StringUtils;
Expand Down Expand Up @@ -59,18 +62,6 @@ private static File getDir(File baseDir, String directory) {
return dir;
}

public static String getAbsPath(String path) {

if(StringUtils.isEmpty(path)) {
return null;
}

String absPath = getDir((File)null, path).toURI().toString();
log.info("found local frontend path ["+absPath+"]");

return absPath;
}

public static boolean createDir(File file) {
if(!file.exists()) {
return file.mkdirs();
Expand Down

0 comments on commit 66fc3fa

Please sign in to comment.