make secondary navigation collapsable // save collapse status in local storage

This commit is contained in:
Eduard Heimbuch
2020-02-25 09:49:23 +01:00
parent 1c681ea588
commit 7fe8b58e7d
5 changed files with 122 additions and 39 deletions

View File

@@ -155,7 +155,12 @@ export function fetchRepoFailure(namespace: string, name: string, error: Error):
// create repo
export function createRepo(link: string, repository: Repository, initRepository: boolean, callback?: (repo: Repository) => void) {
export function createRepo(
link: string,
repository: Repository,
initRepository: boolean,
callback?: (repo: Repository) => void
) {
return function(dispatch: any) {
dispatch(createRepoPending());
const repoLink = initRepository ? link + "?initialize=true" : link;
@@ -436,3 +441,12 @@ export function getPermissionsLink(state: object, namespace: string, name: strin
const repo = getRepository(state, namespace, name);
return repo && repo._links ? repo._links.permissions.href : undefined;
}
const REPOSITORY_NAVIGATION_COLLAPSED = "repository-menu-collapsed";
export function isRepositoryMenuCollapsed() {
return localStorage.getItem(REPOSITORY_NAVIGATION_COLLAPSED) === "true";
}
export function switchRepositoryMenuCollapsed(newStatus: boolean) {
localStorage.setItem(REPOSITORY_NAVIGATION_COLLAPSED, String(newStatus));
}