mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
add selectors
This commit is contained in:
@@ -3,6 +3,8 @@ import * as types from "./types";
|
||||
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import type { Action, IndexResources } from "@scm-manager/ui-types";
|
||||
import { isPending } from "./pending";
|
||||
import { getFailure } from "./failure";
|
||||
|
||||
// Action
|
||||
|
||||
@@ -73,3 +75,77 @@ export default function reducer(
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
// selectors
|
||||
|
||||
export function isFetchIndexResourcesPending(state: Object) {
|
||||
return isPending(state, FETCH_INDEXRESOURCES);
|
||||
}
|
||||
|
||||
export function getFetchIndexResourcesFailure(state: Object) {
|
||||
return getFailure(state, FETCH_INDEXRESOURCES);
|
||||
}
|
||||
|
||||
export function getUiPluginsLink(state: Object) {
|
||||
return state.indexResources.links["uiPlugins"].href;
|
||||
}
|
||||
|
||||
export function getMeLink(state: Object) {
|
||||
if (state.indexResources.links["me"])
|
||||
return state.indexResources.links["me"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getLogoutLink(state: Object) {
|
||||
if (state.indexResources.links["logout"])
|
||||
return state.indexResources.links["logout"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getLoginLink(state: Object) {
|
||||
if (state.indexResources.links["login"])
|
||||
return state.indexResources.links["login"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getUsersLink(state: Object) {
|
||||
if (state.indexResources.links["users"])
|
||||
return state.indexResources.links["users"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getGroupsLink(state: Object) {
|
||||
if (state.indexResources.links["groups"])
|
||||
return state.indexResources.links["groups"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getConfigLink(state: Object) {
|
||||
if (state.indexResources.links["config"])
|
||||
return state.indexResources.links["config"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getRepositoriesLink(state: Object) {
|
||||
if (state.indexResources.links["repositories"])
|
||||
return state.indexResources.links["repositories"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getHgConfigLink(state: Object) {
|
||||
if (state.indexResources.links["hgConfig"])
|
||||
return state.indexResources.links["hgConfig"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getGitConfigLink(state: Object) {
|
||||
if (state.indexResources.links["gitConfig"])
|
||||
return state.indexResources.links["gitConfig"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getSvnConfigLink(state: Object) {
|
||||
if (state.indexResources.links["svnConfig"])
|
||||
return state.indexResources.links["svnConfig"].href;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user