feat(repository): adaptations so that the branch system works@@ -1,5 +1,5 @@
{
- "_generatedAtUnix": 1663972400490,
+ "_generatedAtUnix": 1664028999133,
"_hashAlgorithm": "sha1",
"_version": 2,
"islands": {
@@ -28,13 +28,13 @@
"pathSourceMap": "./public/.islands/RepositoryFilesDiffsList.bundle.js.map"
},
"RepositoryInitialSetup": {
- "hash": "ade4c6a8e8d2b5abef10d1e4281cf6888d128b5c",
+ "hash": "89f47f8f4c4c5781a425d3a8c9f81b2a3e6ec6da",
"pathSource": "./app/islands/RepositoryInitialSetup.tsx",
"pathBundle": "./public/.islands/RepositoryInitialSetup.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryInitialSetup.bundle.js.map"
},
"RepositoryTreeView": {
- "hash": "a1c06f6183e3dd7ecbfed20ec55bf59f78afc27a",
+ "hash": "ee5b76a50148c328f479d60cf5f4ac3178ebc72b",
"pathSource": "./app/islands/RepositoryTreeView.tsx",
"pathBundle": "./public/.islands/RepositoryTreeView.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryTreeView.bundle.js.map"
@@ -62,7 +62,7 @@
"pathSource": "./app/views/organization/OrganizationDetailsView.tsx"
},
"RepositoryBrowserView": {
- "hash": "1a24dc89e650e755291fedb59b121467c1c8e6ab",
+ "hash": "0d530206f5c3ae6a5122c0b29a1a0123934ce122",
"pathSource": "./app/views/repository/RepositoryBrowserView.tsx"
},
"RepositoryCommitsLogView": {
@@ -78,7 +78,7 @@
"pathSource": "./app/views/repository/RepositoryCreateView.tsx"
},
"RepositoryDetailsView": {
- "hash": "2abf6abfa4d4d2b306a3e3e5ceb8e3fbc2f254cc",
+ "hash": "b15fff7aad6bc1d2636ed58be26492552d7d9946",
"pathSource": "./app/views/repository/RepositoryDetailsView.tsx"
},
"RepositoryExploreView": {
@@ -20,7 +20,7 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
const params =
request.params as AppRoutesParams[AppRoute.REPOSITORY_BROWSER]["params"];
const { orgSlug, repoSlug, ref } = params;
- const path = params["*"] || "/";
+ const path = params["*"];
const orgService = makeOrganizationService({ request });
const repoService = makeRepositoryService({ request });
@@ -51,7 +51,7 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
const reqHandler = reply.makeRequestHandler(request, reply);
- if (path.endsWith("/")) {
+ if (path === "" || path.endsWith("/")) {
const readmeFiles = await repoService.isFileInRepositoryPath(
repo,
path,
@@ -82,6 +82,7 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
return reqHandler<RepositoryDetailsViewProps>(RepositoryDetailsView.name, {
branches,
+ currentRef: ref,
currentUser,
cloneUrl: {
http: await repoService.getRepositoryHTTPCloneUrl(repo),
@@ -91,7 +92,6 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
parentOrg,
path,
readmeFileContent,
- ref,
repo,
repoHead: await repoService.getRepositoryHead(repo, ref),
repoFiles: await repoService.getRepositoryFiles(repo, path, ref),
@@ -118,12 +118,12 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
);
return reqHandler<RepositoryBrowserViewProps>(RepositoryBrowserView.name, {
+ currentRef: ref,
currentUser,
fileContent,
linguistInfos,
parentOrg,
path,
- ref,
repo,
});
};
@@ -83,6 +83,7 @@ const getRepositoryDetailsView: ReqHandler = async (request, reply) => {
try {
return reqHandler<RepositoryDetailsViewProps>(RepositoryDetailsView.name, {
branches,
+ currentRef: ref,
currentUser,
cloneUrl: {
http: await repoService.getRepositoryHTTPCloneUrl(repo),
@@ -92,7 +93,6 @@ const getRepositoryDetailsView: ReqHandler = async (request, reply) => {
parentOrg,
path,
readmeFileContent,
- ref,
repo,
repoHead: await repoService.getRepositoryHead(repo, ref),
repoFiles: await repoService.getRepositoryFiles(repo, "", ref),
@@ -105,6 +105,7 @@ const getRepositoryDetailsView: ReqHandler = async (request, reply) => {
RepositoryDetailsView.name,
{
branches,
+ currentRef: ref,
currentUser,
cloneUrl: {
http: await repoService.getRepositoryHTTPCloneUrl(repo),
@@ -113,7 +114,6 @@ const getRepositoryDetailsView: ReqHandler = async (request, reply) => {
parentOrg,
path,
readmeFileContent,
- ref,
repo,
repoHead: null,
repoFiles: [],
@@ -29,13 +29,7 @@ const getRepositoryCreateView: ReqHandler = async (request, reply) => {
const { body, validationError } = request;
if (validationError != null) {
- const {
- message: errorMessage,
- validation,
- validationContext,
- } = validationError;
- console.log("validation:", validation);
- console.log("validationContext:", validationContext);
+ const { message: errorMessage } = validationError;
return reqHandler<RepositoryCreateViewProps>(RepositoryCreateView.name, {
errorMessage,
availableParentOrgs: await usersService.getUserOrganizations(
@@ -12,12 +12,13 @@ export interface RepositoryInitialSetupProps {
http: string;
ssh: string;
};
- ref: string;
+ currentRef: string;
repo: Repository;
}
const RepositoryInitialSetup: ReactIsland<RepositoryInitialSetupProps> = ({
cloneUrl,
+ currentRef,
currentUser,
repo,
}) => {
@@ -37,10 +38,10 @@ ${
? `
# Setup committer identity for this project
$ git config user.name "${currentUser.displayName || currentUser.username}"
-$ git config user.email "${currentUser.email}"`
- : ""
+$ git config user.email "${currentUser.email}"
+`
+ : "\n"
}
-
# Create some base files
$ echo "# ${repo.displayName || repo.slug}" > README.md
$ echo "The MIT License" > LICENSE
@@ -48,7 +49,7 @@ $ echo "The MIT License" > LICENSE
# Track files, commit and send to GitFOSS remote repository
$ git add .
$ git commit -am 'feat: initial commit'
-$ git push
+$ git push -u origin ${currentRef}
`}</pre>
</code>
</StyledRepositoryInitialSetupContainer>
@@ -8,7 +8,8 @@ import type { RepositoryFile, RepositoryLog } from "../types";
import { Grid } from "../components";
export interface RepositoryTreeViewProps {
- currPath: string;
+ currentPath: string;
+ currentRef: string;
lastCommit: RepositoryLog;
orgSlug: string;
repoFiles: RepositoryFile[];
@@ -16,7 +17,8 @@ export interface RepositoryTreeViewProps {
}
const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
- currPath,
+ currentPath,
+ currentRef,
lastCommit,
orgSlug,
repoFiles,
@@ -28,17 +30,19 @@ const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
return {
text: fileName,
href:
- currPath === "/"
- ? `/${orgSlug}/${repoSlug}/main/tree/${fileName}`
- : `/${orgSlug}/${repoSlug}/main/tree/${
- currPath.endsWith("/") ? currPath : `${currPath}/`
+ currentPath === "/"
+ ? `/${orgSlug}/${repoSlug}/${currentRef}/tree/${fileName}`
+ : `/${orgSlug}/${repoSlug}/${currentRef}/tree/${
+ currentPath.endsWith("/") || currentPath === ""
+ ? currentPath
+ : `${currentPath}/`
}${fileName}`,
};
},
- [orgSlug, repoSlug, currPath]
+ [orgSlug, repoSlug, currentPath]
);
- const currPathParts = currPath.split("/");
+ const currPathParts = currentPath.split("/");
let prevPath: string | null = currPathParts
.slice(0, currPathParts.length - 2)
@@ -49,10 +53,10 @@ const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
const prevPathLink =
prevPath === "/"
? `/${orgSlug}/${repoSlug}`
- : `/${orgSlug}/${repoSlug}/main/tree/${
+ : `/${orgSlug}/${repoSlug}/${currentRef}/tree/${
prevPath.endsWith("/") ? prevPath : `${prevPath}/`
}`;
- const shouldShowPrevPath = currPath !== "/";
+ const shouldShowPrevPath = currentPath !== "/";
return (
<StyledRepositoryTreeViewContainer>
@@ -18,12 +18,12 @@ import {
} from "../../components";
export interface RepositoryBrowserViewProps extends CommonProps {
+ currentRef: string;
currentUser: null | User;
fileContent: RepositoryFileContent;
linguistInfos: LinguistFileInfos;
parentOrg: Organization;
path: string;
- ref: string;
repo: Repository;
}
@@ -25,6 +25,7 @@ import RepositoryTreeView from "../../islands/RepositoryTreeView";
export interface RepositoryDetailsViewProps extends CommonProps {
branches: string[];
+ currentRef: string;
currentUser: null | User;
cloneUrl: {
http: string;
@@ -34,7 +35,6 @@ export interface RepositoryDetailsViewProps extends CommonProps {
parentOrg: Organization;
path: string;
readmeFileContent: null | RepositoryFileContent;
- ref: string;
repo: Repository;
repoHead: null | RepositoryHead;
repoFiles: RepositoryFile[];
@@ -43,6 +43,7 @@ export interface RepositoryDetailsViewProps extends CommonProps {
const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
branches,
+ currentRef,
currentUser,
commonProps,
cloneUrl,
@@ -50,7 +51,6 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
parentOrg,
path,
readmeFileContent,
- ref,
repo,
repoHead,
repoFiles,
@@ -86,7 +86,7 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
<RepositoryInitialSetup
cloneUrl={cloneUrl}
currentUser={currentUser}
- ref={ref}
+ currentRef={currentRef}
repo={repo}
/>
</Card>
@@ -97,7 +97,8 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
themeScheme={commonProps.themeScheme}
>
<RepositoryTreeView
- currPath={path}
+ currentRef={currentRef}
+ currentPath={path}
lastCommit={lastCommit}
orgSlug={parentOrg.slug}
repoFiles={repoFiles}
@@ -165,7 +166,11 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
(branch, idx, self) =>
branch.trim() != "" && (
<React.Fragment key={branch}>
- <span>{branch}</span>
+ <a
+ href={`/${parentOrg.slug}/${repo.slug}/${branch}/tree/`}
+ >
+ {branch}
+ </a>
{idx < self.length - 2 ? ", " : "."}
</React.Fragment>
)