Merge with 2.0.0-m3

This commit is contained in:
René Pfeuffer
2018-12-20 10:44:44 +01:00
28 changed files with 313 additions and 146 deletions

View File

@@ -32,9 +32,8 @@ export function fetchConfig(link: string) {
.then(data => {
dispatch(fetchConfigSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch config: ${cause.message}`);
dispatch(fetchConfigFailure(error));
.catch(err => {
dispatch(fetchConfigFailure(err));
});
};
}
@@ -73,13 +72,8 @@ export function modifyConfig(config: Config, callback?: () => void) {
callback();
}
})
.catch(cause => {
dispatch(
modifyConfigFailure(
config,
new Error(`could not modify config: ${cause.message}`)
)
);
.catch(err => {
dispatch(modifyConfigFailure(config, err));
});
};
}

View File

@@ -54,9 +54,8 @@ export function fetchGroupsByLink(link: string) {
.then(data => {
dispatch(fetchGroupsSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch groups: ${cause.message}`);
dispatch(fetchGroupsFailure(link, error));
.catch(err => {
dispatch(fetchGroupsFailure(link, err));
});
};
}
@@ -105,9 +104,8 @@ function fetchGroup(link: string, name: string) {
.then(data => {
dispatch(fetchGroupSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch group: ${cause.message}`);
dispatch(fetchGroupFailure(name, error));
.catch(err => {
dispatch(fetchGroupFailure(name, err));
});
};
}
@@ -151,10 +149,10 @@ export function createGroup(link: string, group: Group, callback?: () => void) {
callback();
}
})
.catch(error => {
.catch(err => {
dispatch(
createGroupFailure(
new Error(`Failed to create group ${group.name}: ${error.message}`)
err
)
);
});
@@ -201,11 +199,11 @@ export function modifyGroup(group: Group, callback?: () => void) {
.then(() => {
dispatch(fetchGroupByLink(group));
})
.catch(cause => {
.catch(err => {
dispatch(
modifyGroupFailure(
group,
new Error(`could not modify group ${group.name}: ${cause.message}`)
err
)
);
});
@@ -259,11 +257,8 @@ export function deleteGroup(group: Group, callback?: () => void) {
callback();
}
})
.catch(cause => {
const error = new Error(
`could not delete group ${group.name}: ${cause.message}`
);
dispatch(deleteGroupFailure(group, error));
.catch(err => {
dispatch(deleteGroupFailure(group, err));
});
};
}

View File

@@ -101,7 +101,7 @@ class RepositoryRoot extends React.Component<Props> {
return (
<Page title={repository.namespace + "/" + repository.name}>
<div className="columns">
<div className="column is-three-quarters">
<div className="column is-three-quarters is-clipped">
<Switch>
<Route
path={url}

View File

@@ -224,9 +224,8 @@ export function modifyRepo(repository: Repository, callback?: () => void) {
.then(() => {
dispatch(fetchRepoByLink(repository));
})
.catch(cause => {
const error = new Error(`failed to modify repo: ${cause.message}`);
dispatch(modifyRepoFailure(repository, error));
.catch(err => {
dispatch(modifyRepoFailure(repository, err));
});
};
}

View File

@@ -1,12 +1,16 @@
// @flow
import type {Action} from "@scm-manager/ui-components";
import {apiClient} from "@scm-manager/ui-components";
import type { Action } from "@scm-manager/ui-components";
import { apiClient } from "@scm-manager/ui-components";
import * as types from "../../../modules/types";
import type {Permission, PermissionCollection, PermissionCreateEntry} from "@scm-manager/ui-types";
import {isPending} from "../../../modules/pending";
import {getFailure} from "../../../modules/failure";
import {Dispatch} from "redux";
import type {
Permission,
PermissionCollection,
PermissionCreateEntry
} from "@scm-manager/ui-types";
import { isPending } from "../../../modules/pending";
import { getFailure } from "../../../modules/failure";
import { Dispatch } from "redux";
export const FETCH_PERMISSIONS = "scm/permissions/FETCH_PERMISSIONS";
export const FETCH_PERMISSIONS_PENDING = `${FETCH_PERMISSIONS}_${
@@ -141,13 +145,8 @@ export function modifyPermission(
callback();
}
})
.catch(cause => {
const error = new Error(
`failed to modify permission: ${cause.message}`
);
dispatch(
modifyPermissionFailure(permission, error, namespace, repoName)
);
.catch(err => {
dispatch(modifyPermissionFailure(permission, err, namespace, repoName));
});
};
}
@@ -241,15 +240,7 @@ export function createPermission(
}
})
.catch(err =>
dispatch(
createPermissionFailure(
new Error(
`failed to add permission ${permission.name}: ${err.message}`
),
namespace,
repoName
)
)
dispatch(createPermissionFailure(err, namespace, repoName))
);
};
}
@@ -318,13 +309,8 @@ export function deletePermission(
callback();
}
})
.catch(cause => {
const error = new Error(
`could not delete permission ${permission.name}: ${cause.message}`
);
dispatch(
deletePermissionFailure(permission, namespace, repoName, error)
);
.catch(err => {
dispatch(deletePermissionFailure(permission, namespace, repoName, err));
});
};
}

View File

@@ -119,7 +119,9 @@ class FileTree extends React.Component<Props> {
<th className="is-hidden-mobile">
{t("sources.file-tree.lastModified")}
</th>
<th>{t("sources.file-tree.description")}</th>
<th className="is-hidden-mobile">
{t("sources.file-tree.description")}
</th>
</tr>
</thead>
<tbody>

View File

@@ -6,10 +6,14 @@ import FileSize from "./FileSize";
import FileIcon from "./FileIcon";
import { Link } from "react-router-dom";
import type { File } from "@scm-manager/ui-types";
import classNames from "classnames";
const styles = {
iconColumn: {
width: "16px"
},
wordBreakMinWidth: {
minWidth: "10em"
}
};
@@ -71,12 +75,14 @@ class FileTreeLeaf extends React.Component<Props> {
return (
<tr>
<td className={classes.iconColumn}>{this.createFileIcon(file)}</td>
<td>{this.createFileName(file)}</td>
<td className={classNames(classes.wordBreakMinWidth, "is-word-break")}>{this.createFileName(file)}</td>
<td className="is-hidden-mobile">{fileSize}</td>
<td className="is-hidden-mobile">
<DateFromNow date={file.lastModified} />
</td>
<td>{file.description}</td>
<td className={classNames(classes.wordBreakMinWidth, "is-word-break", "is-hidden-mobile")}>
{file.description}
</td>
</tr>
);
}

View File

@@ -93,7 +93,7 @@ class Content extends React.Component<Props, State> {
classes.marginInHeader
)}
/>
<span>{file.name}</span>
<span className="is-word-break">{file.name}</span>
</div>
<div className="media-right">{selector}</div>
</article>
@@ -125,11 +125,11 @@ class Content extends React.Component<Props, State> {
<tbody>
<tr>
<td>{t("sources.content.path")}</td>
<td>{file.path}</td>
<td className="is-word-break">{file.path}</td>
</tr>
<tr>
<td>{t("sources.content.branch")}</td>
<td>{revision}</td>
<td className="is-word-break">{revision}</td>
</tr>
<tr>
<td>{t("sources.content.size")}</td>
@@ -141,7 +141,7 @@ class Content extends React.Component<Props, State> {
</tr>
<tr>
<td>{t("sources.content.description")}</td>
<td>{description}</td>
<td className="is-word-break">{description}</td>
</tr>
</tbody>
</table>

View File

@@ -25,8 +25,7 @@ export function fetchSources(
dispatch(fetchSourcesSuccess(repository, revision, path, sources));
})
.catch(err => {
const error = new Error(`failed to fetch sources: ${err.message}`);
dispatch(fetchSourcesFailure(repository, revision, path, error));
dispatch(fetchSourcesFailure(repository, revision, path, err));
});
};
}

View File

@@ -35,8 +35,6 @@ export const DELETE_USER_FAILURE = `${DELETE_USER}_${types.FAILURE_SUFFIX}`;
const CONTENT_TYPE_USER = "application/vnd.scmm-user+json;v=2";
// TODO i18n for error messages
// fetch users
export function fetchUsers(link: string) {
@@ -57,9 +55,8 @@ export function fetchUsersByLink(link: string) {
.then(data => {
dispatch(fetchUsersSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch users: ${cause.message}`);
dispatch(fetchUsersFailure(link, error));
.catch(err => {
dispatch(fetchUsersFailure(link, err));
});
};
}
@@ -108,9 +105,8 @@ function fetchUser(link: string, name: string) {
.then(data => {
dispatch(fetchUserSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch user: ${cause.message}`);
dispatch(fetchUserFailure(name, error));
.catch(err => {
dispatch(fetchUserFailure(name, err));
});
};
}
@@ -155,13 +151,7 @@ export function createUser(link: string, user: User, callback?: () => void) {
callback();
}
})
.catch(err =>
dispatch(
createUserFailure(
new Error(`failed to add user ${user.name}: ${err.message}`)
)
)
);
.catch(err => dispatch(createUserFailure(err)));
};
}
@@ -260,11 +250,8 @@ export function deleteUser(user: User, callback?: () => void) {
callback();
}
})
.catch(cause => {
const error = new Error(
`could not delete user ${user.name}: ${cause.message}`
);
dispatch(deleteUserFailure(user, error));
.catch(err => {
dispatch(deleteUserFailure(user, err));
});
};
}