use / as development context path and use ui-bundler instead of react-scripts

This commit is contained in:
Sebastian Sdorra
2018-08-24 08:35:50 +02:00
parent ee8efe9cf5
commit 8224327ed3
22 changed files with 2708 additions and 3550 deletions

6
scm-ui/.babelrc Normal file
View File

@@ -0,0 +1,6 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-flow"],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}

View File

@@ -1,3 +1,29 @@
{
"extends": "react-app"
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:flowtype/recommended"
],
"plugins": [
"flowtype",
"react",
"jsx-a11y",
"import"
],
"rules": {
"quotes": ["error", "double"]
},
"env": {
"browser": true
},
"overrides": [
{
"files": [ "*.test.js" ],
"env": {
"jest": true,
"browser": true
}
}
]
}

View File

@@ -3,7 +3,9 @@
"name": "scm-ui",
"version": "0.1.0",
"private": true,
"main": "src/index.js",
"dependencies": {
"@scm-manager/ui-extensions": "^0.0.3",
"bulma": "^0.7.1",
"classnames": "^2.2.5",
"font-awesome": "^4.7.0",
@@ -12,14 +14,13 @@
"i18next-browser-languagedetector": "^2.2.2",
"i18next-fetch-backend": "^0.1.0",
"moment": "^2.22.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-i18next": "^7.9.0",
"react-jss": "^8.6.0",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.1.4",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
"redux-logger": "^3.0.6",
@@ -28,51 +29,34 @@
"scripts": {
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build-js": "react-scripts build",
"build": "npm-run-all build-css build-js",
"test": "jest",
"test-coverage": "jest --coverage",
"test-ci": "jest --ci --coverage",
"eject": "react-scripts eject",
"start-js": "ui-bundler serve",
"start": "npm-run-all -p watch-css build-vendor start-js",
"build-js": "ui-bundler bundle target/scm-ui.bundle.js",
"build-vendor": "ui-bundler vendor target/vendor.bundle.js",
"build": "npm-run-all build-css build-vendor build-js",
"test": "ui-bundler test",
"test-ci": "ui-bundler test --ci",
"flow": "flow",
"pre-commit": "jest && flow && eslint src"
},
"proxy": {
"/scm/api": {
"target": "http://localhost:8081"
}
},
"devDependencies": {
"@scm-manager/ui-bundler": "^0.0.3",
"babel-eslint": "^8.2.6",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^5.3.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"fetch-mock": "^6.5.0",
"flow-bin": "^0.77.0",
"flow-typed": "^2.5.1",
"jest-junit": "^5.1.0",
"jest": "^23.5.0",
"node-sass-chokidar": "^1.3.0",
"npm-run-all": "^4.1.3",
"prettier": "^1.13.7",
"react-test-renderer": "^16.4.1",
"redux-mock-store": "^1.5.3"
},
"babel": {
"presets": [
"react-app"
]
},
"jest": {
"coverageDirectory": "target/jest-reports/coverage",
"coveragePathIgnorePatterns": [
"src/tests/.*"
],
"reporters": [
"default",
"jest-junit"
]
},
"jest-junit": {
"output": "./target/jest-reports/TEST-all.xml"
}
}

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -8,8 +8,8 @@
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="manifest" href="/manifest.json">
<link rel="shortcut icon" href="/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@@ -19,6 +19,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<base href="/">
<title>SCM-Manager</title>
</head>
<body>
@@ -36,5 +37,8 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="vendor.bundle.js"></script>
<script src="scm-ui.bundle.js"></script>
<!--script src="scm-git-plugin.bundle.js"></script-->
</body>
</html>

View File

@@ -1,7 +1,7 @@
// @flow
// get api base url from environment
const apiUrl = process.env.API_URL || process.env.PUBLIC_URL || "/scm";
const apiUrl = process.env.API_URL || process.env.PUBLIC_URL || "";
export const NOT_FOUND_ERROR = Error("not found");
export const UNAUTHORIZED_ERROR = Error("unauthorized");

View File

@@ -9,7 +9,7 @@ describe("create url", () => {
});
it("should add prefix for api", () => {
expect(createUrl("/users")).toBe("/scm/api/rest/v2/users");
expect(createUrl("users")).toBe("/scm/api/rest/v2/users");
expect(createUrl("/users")).toBe("/api/rest/v2/users");
expect(createUrl("users")).toBe("/api/rest/v2/users");
});
});

View File

@@ -2,7 +2,6 @@
import React from "react";
import { translate } from "react-i18next";
import injectSheet from "react-jss";
import Image from "../images/loading.svg";
const styles = {
wrapper: {
@@ -35,7 +34,11 @@ class Loading extends React.Component<Props> {
return (
<div className={classes.wrapper}>
<div className={classes.loading}>
<img className={classes.image} src={Image} alt={t("loading.alt")} />
<img
className={classes.image}
src="/images/loading.svg"
alt={t("loading.alt")}
/>
</div>
</div>
);

View File

@@ -1,7 +1,6 @@
//@flow
import React from "react";
import { translate } from "react-i18next";
import Image from "../images/logo.png";
type Props = {
t: string => string
@@ -10,7 +9,7 @@ type Props = {
class Logo extends React.Component<Props> {
render() {
const { t } = this.props;
return <img src={Image} alt={t("logo.alt")} />;
return <img src="images/logo.png" alt={t("logo.alt")} />;
}
}

View File

@@ -12,7 +12,8 @@ import {
} from "../modules/auth";
import "./App.css";
import "font-awesome/css/font-awesome.css";
// TODO ???
// import "font-awesome/css/font-awesome.css";
import "../components/modals/ConfirmAlert.css";
import { PrimaryNavigation } from "../components/navigation";
import Loading from "../components/Loading";

View File

@@ -15,7 +15,6 @@ import { InputField } from "../components/forms";
import { SubmitButton } from "../components/buttons";
import classNames from "classnames";
import Avatar from "../images/blib.jpg";
import ErrorNotification from "../components/ErrorNotification";
const styles = {
@@ -108,7 +107,7 @@ class Login extends React.Component<Props, State> {
<figure className={classes.avatar}>
<img
className={classes.avatarImage}
src={Avatar}
src="/images/blib.jpg"
alt={t("login.logo-alt")}
/>
</figure>

View File

@@ -44,7 +44,7 @@ import reducer, {
MODIFY_GROUP_SUCCESS,
MODIFY_GROUP_FAILURE
} from "./groups";
const GROUPS_URL = "/scm/api/rest/v2/groups";
const GROUPS_URL = "/api/rest/v2/groups";
const error = new Error("You have an error!");
@@ -57,13 +57,13 @@ const humanGroup = {
members: ["userZaphod"],
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/groups/humanGroup"
href: "http://localhost:8081/api/rest/v2/groups/humanGroup"
},
delete: {
href: "http://localhost:8081/scm/api/rest/v2/groups/humanGroup"
href: "http://localhost:8081/api/rest/v2/groups/humanGroup"
},
update: {
href:"http://localhost:8081/scm/api/rest/v2/groups/humanGroup"
href:"http://localhost:8081/api/rest/v2/groups/humanGroup"
}
},
_embedded: {
@@ -72,7 +72,7 @@ const humanGroup = {
name: "userZaphod",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/users/userZaphod"
href: "http://localhost:8081/api/rest/v2/users/userZaphod"
}
}
}
@@ -89,13 +89,13 @@ const emptyGroup = {
members: [],
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/groups/emptyGroup"
href: "http://localhost:8081/api/rest/v2/groups/emptyGroup"
},
delete: {
href: "http://localhost:8081/scm/api/rest/v2/groups/emptyGroup"
href: "http://localhost:8081/api/rest/v2/groups/emptyGroup"
},
update: {
href:"http://localhost:8081/scm/api/rest/v2/groups/emptyGroup"
href:"http://localhost:8081/api/rest/v2/groups/emptyGroup"
}
},
_embedded: {
@@ -108,16 +108,16 @@ const responseBody = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:3000/scm/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
},
first: {
href: "http://localhost:3000/scm/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
},
last: {
href: "http://localhost:3000/scm/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
},
create: {
href: "http://localhost:3000/scm/api/rest/v2/groups/"
href: "http://localhost:3000/api/rest/v2/groups/"
}
},
_embedded: {
@@ -244,7 +244,7 @@ describe("groups fetch()", () => {
});
it("should successfully modify group", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 204
});
@@ -259,7 +259,7 @@ describe("groups fetch()", () => {
})
it("should call the callback after modifying group", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 204
});
@@ -278,7 +278,7 @@ describe("groups fetch()", () => {
})
it("should fail modifying group on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 500
});
@@ -293,7 +293,7 @@ describe("groups fetch()", () => {
})
it("should delete successfully group humanGroup", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 204
});
@@ -308,7 +308,7 @@ describe("groups fetch()", () => {
});
it("should call the callback, after successful delete", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 204
});
@@ -324,7 +324,7 @@ describe("groups fetch()", () => {
});
it("should fail to delete group humanGroup", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
status: 500
});

View File

@@ -3,7 +3,8 @@ import Backend from "i18next-fetch-backend";
import LanguageDetector from "i18next-browser-languagedetector";
import { reactI18nextModule } from "react-i18next";
const loadPath = process.env.PUBLIC_URL + "/locales/{{lng}}/{{ns}}.json";
const loadPath =
(process.env.PUBLIC_URL || "") + "/locales/{{lng}}/{{ns}}.json";
// TODO load locales for moment

View File

@@ -78,7 +78,7 @@ describe("auth actions", () => {
});
it("should dispatch login success and dispatch fetch me", () => {
fetchMock.postOnce("/scm/api/rest/v2/auth/access_token", {
fetchMock.postOnce("/api/rest/v2/auth/access_token", {
body: {
cookie: true,
grant_type: "password",
@@ -88,7 +88,7 @@ describe("auth actions", () => {
headers: { "content-type": "application/json" }
});
fetchMock.getOnce("/scm/api/rest/v2/me", {
fetchMock.getOnce("/api/rest/v2/me", {
body: me,
headers: { "content-type": "application/json" }
});
@@ -106,7 +106,7 @@ describe("auth actions", () => {
});
it("should dispatch login failure", () => {
fetchMock.postOnce("/scm/api/rest/v2/auth/access_token", {
fetchMock.postOnce("/api/rest/v2/auth/access_token", {
status: 400
});
@@ -120,7 +120,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me success", () => {
fetchMock.getOnce("/scm/api/rest/v2/me", {
fetchMock.getOnce("/api/rest/v2/me", {
body: me,
headers: { "content-type": "application/json" }
});
@@ -141,7 +141,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me failure", () => {
fetchMock.getOnce("/scm/api/rest/v2/me", {
fetchMock.getOnce("/api/rest/v2/me", {
status: 500
});
@@ -155,7 +155,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me unauthorized", () => {
fetchMock.getOnce("/scm/api/rest/v2/me", {
fetchMock.getOnce("/api/rest/v2/me", {
status: 401
});
@@ -173,11 +173,11 @@ describe("auth actions", () => {
});
it("should dispatch logout success", () => {
fetchMock.deleteOnce("/scm/api/rest/v2/auth/access_token", {
fetchMock.deleteOnce("/api/rest/v2/auth/access_token", {
status: 204
});
fetchMock.getOnce("/scm/api/rest/v2/me", {
fetchMock.getOnce("/api/rest/v2/me", {
status: 401
});
@@ -194,7 +194,7 @@ describe("auth actions", () => {
});
it("should dispatch logout failure", () => {
fetchMock.deleteOnce("/scm/api/rest/v2/auth/access_token", {
fetchMock.deleteOnce("/api/rest/v2/auth/access_token", {
status: 500
});

View File

@@ -7,8 +7,6 @@ import DateFromNow from "../../../components/DateFromNow";
import RepositoryEntryLink from "./RepositoryEntryLink";
import classNames from "classnames";
import icon from "../../../images/blib.jpg";
const styles = {
outer: {
position: "relative"
@@ -86,7 +84,7 @@ class RepositoryEntry extends React.Component<Props> {
<article className={classNames("media", classes.inner)}>
<figure className="media-left">
<p className="image is-64x64">
<img src={icon} alt="Logo" />
<img src="/images/blib.jpg" alt="Logo" />
</p>
</figure>
<div className="media-content">

View File

@@ -58,36 +58,33 @@ const hitchhikerPuzzle42: Repository = {
type: "svn",
_links: {
self: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
},
delete: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
},
update: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
},
permissions: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42/permissions/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/permissions/"
},
tags: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42/tags/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/tags/"
},
branches: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42/branches/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/branches/"
},
changesets: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42/changesets/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/changesets/"
},
sources: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/puzzle42/sources/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/sources/"
}
}
};
@@ -103,35 +100,35 @@ const hitchhikerRestatend: Repository = {
_links: {
self: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
},
delete: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
},
update: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
},
permissions: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend/permissions/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/permissions/"
},
tags: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend/tags/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/tags/"
},
branches: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend/branches/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/branches/"
},
changesets: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend/changesets/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/changesets/"
},
sources: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/hitchhiker/restatend/sources/"
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/sources/"
}
}
};
@@ -145,33 +142,32 @@ const slartiFjords: Repository = {
creationDate: "2018-07-31T08:59:05.653Z",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
},
delete: {
href: "http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
},
update: {
href: "http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
},
permissions: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords/permissions/"
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/permissions/"
},
tags: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords/tags/"
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords/tags/"
},
branches: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords/branches/"
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/branches/"
},
changesets: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords/changesets/"
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/changesets/"
},
sources: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords/sources/"
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/sources/"
}
}
};
@@ -181,19 +177,16 @@ const repositoryCollection: RepositoryCollection = {
pageTotal: 1,
_links: {
self: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
first: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
last: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
create: {
href: "http://localhost:8081/scm/api/rest/v2/repositories/"
href: "http://localhost:8081/api/rest/v2/repositories/"
}
},
_embedded: {
@@ -206,19 +199,16 @@ const repositoryCollectionWithNames: RepositoryCollection = {
pageTotal: 1,
_links: {
self: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
first: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
last: {
href:
"http://localhost:8081/scm/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
},
create: {
href: "http://localhost:8081/scm/api/rest/v2/repositories/"
href: "http://localhost:8081/api/rest/v2/repositories/"
}
},
_embedded: {
@@ -231,7 +221,7 @@ const repositoryCollectionWithNames: RepositoryCollection = {
};
describe("repos fetch", () => {
const REPOS_URL = "/scm/api/rest/v2/repositories";
const REPOS_URL = "/api/rest/v2/repositories";
const SORT = "sortBy=namespaceAndName";
const REPOS_URL_WITH_SORT = REPOS_URL + "?" + SORT;
const mockStore = configureMockStore([thunk]);
@@ -303,7 +293,7 @@ describe("repos fetch", () => {
it("should append sortby parameter and successfully fetch repos from link", () => {
fetchMock.getOnce(
"/scm/api/rest/v2/repositories?one=1&sortBy=namespaceAndName",
"/api/rest/v2/repositories?one=1&sortBy=namespaceAndName",
repositoryCollection
);
@@ -431,7 +421,7 @@ describe("repos fetch", () => {
it("should successfully delete repo slarti/fjords", () => {
fetchMock.delete(
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
{
status: 204
}
@@ -458,7 +448,7 @@ describe("repos fetch", () => {
it("should successfully delete repo slarti/fjords and call the callback", () => {
fetchMock.delete(
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
{
status: 204
}
@@ -478,7 +468,7 @@ describe("repos fetch", () => {
it("should disapatch failure on delete, if server returns status code 500", () => {
fetchMock.delete(
"http://localhost:8081/scm/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
{
status: 500
}

View File

@@ -22,7 +22,7 @@ const git = {
displayName: "Git",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/git"
href: "http://localhost:8081/api/rest/v2/repositoryTypes/git"
}
}
};
@@ -32,7 +32,7 @@ const hg = {
displayName: "Mercurial",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/hg"
href: "http://localhost:8081/api/rest/v2/repositoryTypes/hg"
}
}
};
@@ -42,7 +42,7 @@ const svn = {
displayName: "Subversion",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/svn"
href: "http://localhost:8081/api/rest/v2/repositoryTypes/svn"
}
}
};
@@ -53,7 +53,7 @@ const collection = {
},
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes"
href: "http://localhost:8081/api/rest/v2/repositoryTypes"
}
}
};
@@ -97,7 +97,7 @@ describe("repository types caching", () => {
});
describe("repository types fetch", () => {
const URL = "/scm/api/rest/v2/repositoryTypes";
const URL = "/api/rest/v2/repositoryTypes";
const mockStore = configureMockStore([thunk]);
afterEach(() => {

View File

@@ -61,13 +61,13 @@ const userZaphod = {
properties: {},
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/rest/v2/users/zaphod"
},
delete: {
href: "http://localhost:8081/scm/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/rest/v2/users/zaphod"
},
update: {
href: "http://localhost:8081/scm/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/rest/v2/users/zaphod"
}
}
};
@@ -84,13 +84,13 @@ const userFord = {
properties: {},
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/users/ford"
href: "http://localhost:8081/api/rest/v2/users/ford"
},
delete: {
href: "http://localhost:8081/scm/api/rest/v2/users/ford"
href: "http://localhost:8081/api/rest/v2/users/ford"
},
update: {
href: "http://localhost:8081/scm/api/rest/v2/users/ford"
href: "http://localhost:8081/api/rest/v2/users/ford"
}
}
};
@@ -100,16 +100,16 @@ const responseBody = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:3000/scm/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
},
first: {
href: "http://localhost:3000/scm/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
},
last: {
href: "http://localhost:3000/scm/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
},
create: {
href: "http://localhost:3000/scm/api/rest/v2/users/"
href: "http://localhost:3000/api/rest/v2/users/"
}
},
_embedded: {
@@ -122,7 +122,7 @@ const response = {
responseBody
};
const USERS_URL = "/scm/api/rest/v2/users";
const USERS_URL = "/api/rest/v2/users";
const error = new Error("KAPUTT");
@@ -241,7 +241,7 @@ describe("users fetch()", () => {
});
it("successfully update user", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 204
});
@@ -255,7 +255,7 @@ describe("users fetch()", () => {
});
it("should call callback, after successful modified user", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 204
});
@@ -271,7 +271,7 @@ describe("users fetch()", () => {
});
it("should fail updating user on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 500
});
@@ -285,7 +285,7 @@ describe("users fetch()", () => {
});
it("should delete successfully user zaphod", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 204
});
@@ -300,7 +300,7 @@ describe("users fetch()", () => {
});
it("should call the callback, after successful delete", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 204
});
@@ -316,7 +316,7 @@ describe("users fetch()", () => {
});
it("should fail to delete user zaphod", () => {
fetchMock.deleteOnce("http://localhost:8081/scm/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
status: 500
});

File diff suppressed because it is too large Load Diff

View File

@@ -503,9 +503,13 @@
<name>java.awt.headless</name>
<value>true</value>
</systemProperty>
<systemProperty>
<name>sonia.scm.ui.proxy</name>
<value>http://localhost:9966</value>
</systemProperty>
</systemProperties>
<webApp>
<contextPath>/scm</contextPath>
<contextPath>/</contextPath>
</webApp>
<jettyXml>${project.basedir}/src/main/conf/jetty.xml</jettyXml>
<scanIntervalSeconds>0</scanIntervalSeconds>