Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
refactor(editor, frontend path): move editor to /app/editor, frontend…
Browse files Browse the repository at this point in the history
… to /app
  • Loading branch information
Alex Eng committed Jul 22, 2016
1 parent 5b13adf commit 2c5c7f3
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 16 deletions.
46 changes: 40 additions & 6 deletions zanata-editor/pom.xml
Expand Up @@ -28,8 +28,8 @@

<!-- Path within the jar to put the built artifacts.
Note: META-INF/resources/* is served as static content, so this puts
the editor at http://<server>/app -->
<bundle.destination>${project.build.outputDirectory}/META-INF/resources/app</bundle.destination>
the editor at http://<server>/app/editor -->
<bundle.destination>${project.build.outputDirectory}/META-INF/resources/app/editor</bundle.destination>
</properties>

<dependencies>
Expand Down Expand Up @@ -63,10 +63,27 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Will execute npm install before any other process. See exec-maven-plugin in server.pom -->
<!-- Inject a spritesheet into index.html based on all the icon sprite files. -->
<!-- editor: Run npm install -->
<execution>
<id>npm run processhtml (${project.artifactId})</id>
<id>execute npm install for: editor</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${build.directory}</workingDirectory>
<arguments>
<argument>${npm.executable}</argument>
<argument>install</argument>
<argument>--cache-min</argument>
<argument>${npm.cache.min}</argument>
</arguments>
</configuration>
</execution>

<!-- editor: copy index.html to build directory. -->
<execution>
<id>npm run processhtml: editor</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
Expand All @@ -81,7 +98,7 @@
</configuration>
</execution>

<!-- Transpile and bundle all the javascript and css. -->
<!-- editor: Transpile and bundle all the javascript and css. -->
<execution>
<id>npm run build (${project.artifactId})</id>
<phase>compile</phase>
Expand All @@ -97,6 +114,23 @@
</arguments>
</configuration>
</execution>

<!-- editor: Run npm test in test phase -->
<execution>
<id>execute npm test for: editor</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<workingDirectory>${build.directory}</workingDirectory>
<arguments>
<argument>${npm.executable}</argument>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

Expand Down
@@ -1,10 +1,10 @@
## This is a module to build zanata frontend javascript projects
## This is a module to build Zanata frontend javascript projects

This module contains: User profile page, Glossary page, and Zanata side menu bar.

## To run/setup in nodeJS

Navigate to `frontend/src`, run `npm install`
Navigate to `frontend/main`, run `npm install`

### To run in dev mode http://localhost:8000 (a HTTP server to serve index.html with webpack produced bundle.js)

Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 11 additions & 5 deletions zanata-frontend/src/frontend/main/components/Nav/index.jsx
Expand Up @@ -6,6 +6,12 @@ const dswid = window.dswh && window.dswh.windowId
? '?dswid=' + window.dswh.windowId
: ''

/**
* URL path for frontend
* e.g. http://localhost:8080/app/#explore
*/
const prefixPath = '/app/'

const items = [
{
icon: 'zanata',
Expand All @@ -17,7 +23,7 @@ const items = [
},
{
icon: 'search',
link: '/a/' + dswid + '#explore',
link: prefixPath + dswid + '#explore',
internalLink: '/explore',
title: 'Explore',
auth: 'public',
Expand Down Expand Up @@ -50,15 +56,15 @@ const items = [
{
small: true,
icon: 'user',
link: '/a/' + dswid + '#profile',
link: prefixPath + dswid + '#profile',
internalLink: '/profile',
title: 'Profile',
auth: 'loggedin',
id: 'nav_profile'
},
{
icon: 'glossary',
link: '/a/' + dswid + '#glossary',
link: prefixPath + dswid + '#glossary',
internalLink: '/glossary',
title: 'Glossary',
auth: 'loggedin',
Expand Down Expand Up @@ -95,7 +101,7 @@ const items = [
{
small: true,
icon: 'ellipsis',
link: '/a/more',
link: prefixPath + 'more',
title: 'More',
auth: 'public',
id: 'nav_more'
Expand Down Expand Up @@ -148,7 +154,7 @@ const Nav = ({
? (links.context + links[item.link])
: (links.context + item.link)
} else {
// react pages, /a/index.xhtml
// react pages, /app/index.xhtml
link = item.internalLink
? item.internalLink
: (links[item.link]
Expand Down
Expand Up @@ -52,8 +52,8 @@ public Configuration getConfiguration(final ServletContext context) {


.addRule(Join.path("/").to("/home.xhtml"))
.addRule(Join.path("/a/").to("/a/index.xhtml"))
.addRule(Join.path("/a/more").to("/a/more.xhtml"))
.addRule(Join.path("/app/").to("/app/index.xhtml"))
.addRule(Join.path("/app/more").to("/app/more.xhtml"))
.addRule(Join.path("/account/activate/{key}").to("/account/activate.xhtml"))
.addRule(Join.path("/account/google_password_reset_request").to("/account/google_password_reset_request.xhtml"))
.addRule(Join.path("/account/password_reset/{key}").to("/account/password_reset.xhtml"))
Expand Down
Expand Up @@ -264,7 +264,7 @@ public static String getVersionFilesURL(WorkspaceId workspaceId) {
}

public static String getNewEditorLink(WorkspaceId workspaceId, String docId) {
return getModuleParentBaseUrl() + "app/#/"
return getModuleParentBaseUrl() + "app/editor/#/"
+ workspaceId.getProjectIterationId().getProjectSlug() + "/"
+ workspaceId.getProjectIterationId().getIterationSlug()
+ "/translate/" + docId + "/"
Expand Down

0 comments on commit 2c5c7f3

Please sign in to comment.