removed unused function

This commit is contained in:
Florian Scholdei
2019-07-09 16:22:04 +02:00
parent e4e49a033d
commit d7d601a82f
2 changed files with 10 additions and 27 deletions

View File

@@ -144,8 +144,7 @@ export default function reducer(
switch (action.type) { switch (action.type) {
case FETCH_PLUGINS_SUCCESS: case FETCH_PLUGINS_SUCCESS:
const t = normalizeByName(action.payload); return normalizeByName(action.payload);
return t;
case FETCH_PLUGIN_SUCCESS: case FETCH_PLUGIN_SUCCESS:
return reducerByNames(state, action.payload); return reducerByNames(state, action.payload);
default: default:
@@ -190,8 +189,3 @@ export function isFetchPluginPending(state: Object, name: string) {
export function getFetchPluginFailure(state: Object, name: string) { export function getFetchPluginFailure(state: Object, name: string) {
return getFailure(state, FETCH_PLUGIN, name); return getFailure(state, FETCH_PLUGIN, name);
} }
export function getPermissionsLink(state: Object, name: string) {
const plugin = getPlugin(state, name);
return plugin && plugin._links ? plugin._links.permissions.href : undefined;
}

View File

@@ -23,10 +23,7 @@ import reducer, {
isFetchPluginPending, isFetchPluginPending,
getFetchPluginFailure getFetchPluginFailure
} from "./plugins"; } from "./plugins";
import type { import type { Plugin, PluginCollection } from "@scm-manager/ui-types";
Plugin,
PluginCollection
} from "@scm-manager/ui-types";
const groupManagerPlugin: Plugin = { const groupManagerPlugin: Plugin = {
name: "scm-groupmanager-plugin", name: "scm-groupmanager-plugin",
@@ -37,8 +34,7 @@ const groupManagerPlugin: Plugin = {
description: "Notify a remote webserver whenever a plugin is pushed to.", description: "Notify a remote webserver whenever a plugin is pushed to.",
_links: { _links: {
self: { self: {
href: href: "http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin"
"http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin"
} }
} }
}; };
@@ -52,8 +48,7 @@ const scriptPlugin: Plugin = {
description: "Script support for scm-manager.", description: "Script support for scm-manager.",
_links: { _links: {
self: { self: {
href: href: "http://localhost:8081/api/v2/ui/plugins/scm-script-plugin"
"http://localhost:8081/api/v2/ui/plugins/scm-script-plugin"
} }
} }
}; };
@@ -67,8 +62,7 @@ const branchwpPlugin: Plugin = {
description: "This plugin adds branch write protection for plugins.", description: "This plugin adds branch write protection for plugins.",
_links: { _links: {
self: { self: {
href: href: "http://localhost:8081/api/v2/ui/plugins/scm-branchwp-plugin"
"http://localhost:8081/api/v2/ui/plugins/scm-branchwp-plugin"
} }
} }
}; };
@@ -166,12 +160,9 @@ describe("plugins fetch", () => {
}); });
it("should dispatch FETCH_PLUGIN_FAILURE, if the request for scm-groupmanager-plugin by name fails", () => { it("should dispatch FETCH_PLUGIN_FAILURE, if the request for scm-groupmanager-plugin by name fails", () => {
fetchMock.getOnce( fetchMock.getOnce(PLUGINS_URL + "/scm-groupmanager-plugin", {
PLUGINS_URL + "/scm-groupmanager-plugin", status: 500
{ });
status: 500
}
);
const store = mockStore({}); const store = mockStore({});
return store return store
@@ -331,8 +322,7 @@ describe("plugins selectors", () => {
it("should return true, when fetch plugin is pending", () => { it("should return true, when fetch plugin is pending", () => {
const state = { const state = {
pending: { pending: {
[FETCH_PLUGIN + [FETCH_PLUGIN + "/scm-groupmanager-plugin"]: true
"/scm-groupmanager-plugin"]: true
} }
}; };
expect(isFetchPluginPending(state, "scm-groupmanager-plugin")).toEqual( expect(isFetchPluginPending(state, "scm-groupmanager-plugin")).toEqual(
@@ -347,8 +337,7 @@ describe("plugins selectors", () => {
it("should return error when fetch plugin did fail", () => { it("should return error when fetch plugin did fail", () => {
const state = { const state = {
failure: { failure: {
[FETCH_PLUGIN + [FETCH_PLUGIN + "/scm-groupmanager-plugin"]: error
"/scm-groupmanager-plugin"]: error
} }
}; };
expect(getFetchPluginFailure(state, "scm-groupmanager-plugin")).toEqual( expect(getFetchPluginFailure(state, "scm-groupmanager-plugin")).toEqual(