apply prettier, removed flow related config and added tsconfig

This commit is contained in:
Sebastian Sdorra
2019-10-20 18:02:52 +02:00
parent 0e017dcadd
commit 490418d06e
231 changed files with 5771 additions and 30386 deletions

View File

@@ -1,16 +0,0 @@
[ignore]
[include]
<PROJECT_ROOT>/../../ui-types
<PROJECT_ROOT>/../../ui-components
[libs]
[lints]
[options]
module.system.node.resolve_dirname=../../node_modules
module.name_mapper='^@scm-manager\/ui-\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/../ui-\1'
[strict]

View File

@@ -1,49 +0,0 @@
// flow-typed signature: e87b860fca7047001bcde4b8780a8655
// flow-typed version: <<STUB>>/@scm-manager/ui-extensions_v0.1.2/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* '@scm-manager/ui-extensions'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@scm-manager/ui-extensions' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@scm-manager/ui-extensions/lib/binder' {
declare module.exports: any;
}
declare module '@scm-manager/ui-extensions/lib/ExtensionPoint' {
declare module.exports: any;
}
declare module '@scm-manager/ui-extensions/lib' {
declare module.exports: any;
}
// Filename aliases
declare module '@scm-manager/ui-extensions/lib/binder.js' {
declare module.exports: $Exports<'@scm-manager/ui-extensions/lib/binder'>;
}
declare module '@scm-manager/ui-extensions/lib/ExtensionPoint.js' {
declare module.exports: $Exports<'@scm-manager/ui-extensions/lib/ExtensionPoint'>;
}
declare module '@scm-manager/ui-extensions/lib/index' {
declare module.exports: $Exports<'@scm-manager/ui-extensions/lib'>;
}
declare module '@scm-manager/ui-extensions/lib/index.js' {
declare module.exports: $Exports<'@scm-manager/ui-extensions/lib'>;
}

View File

@@ -1,23 +0,0 @@
// flow-typed signature: cf86673cc32d185bdab1d2ea90578d37
// flow-typed version: 614bf49aa8/classnames_v2.x.x/flow_>=v0.25.x
type $npm$classnames$Classes =
| string
| { [className: string]: * }
| false
| void
| null;
declare module "classnames" {
declare module.exports: (
...classes: Array<$npm$classnames$Classes | $npm$classnames$Classes[]>
) => string;
}
declare module "classnames/bind" {
declare module.exports: $Exports<"classnames">;
}
declare module "classnames/dedupe" {
declare module.exports: $Exports<"classnames">;
}

View File

@@ -1,269 +0,0 @@
// flow-typed signature: 761f01d8db9f91fa67135cb2120c2b8e
// flow-typed version: <<STUB>>/enzyme_v3.10.0/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'enzyme'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'enzyme' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'enzyme/build/configuration' {
declare module.exports: any;
}
declare module 'enzyme/build/Debug' {
declare module.exports: any;
}
declare module 'enzyme/build/EnzymeAdapter' {
declare module.exports: any;
}
declare module 'enzyme/build/getAdapter' {
declare module.exports: any;
}
declare module 'enzyme/build' {
declare module.exports: any;
}
declare module 'enzyme/build/mount' {
declare module.exports: any;
}
declare module 'enzyme/build/ReactWrapper' {
declare module.exports: any;
}
declare module 'enzyme/build/render' {
declare module.exports: any;
}
declare module 'enzyme/build/RSTTraversal' {
declare module.exports: any;
}
declare module 'enzyme/build/selectors' {
declare module.exports: any;
}
declare module 'enzyme/build/shallow' {
declare module.exports: any;
}
declare module 'enzyme/build/ShallowWrapper' {
declare module.exports: any;
}
declare module 'enzyme/build/Utils' {
declare module.exports: any;
}
declare module 'enzyme/build/validateAdapter' {
declare module.exports: any;
}
declare module 'enzyme/mount' {
declare module.exports: any;
}
declare module 'enzyme/ReactWrapper' {
declare module.exports: any;
}
declare module 'enzyme/render' {
declare module.exports: any;
}
declare module 'enzyme/shallow' {
declare module.exports: any;
}
declare module 'enzyme/ShallowWrapper' {
declare module.exports: any;
}
declare module 'enzyme/src/configuration' {
declare module.exports: any;
}
declare module 'enzyme/src/Debug' {
declare module.exports: any;
}
declare module 'enzyme/src/EnzymeAdapter' {
declare module.exports: any;
}
declare module 'enzyme/src/getAdapter' {
declare module.exports: any;
}
declare module 'enzyme/src' {
declare module.exports: any;
}
declare module 'enzyme/src/mount' {
declare module.exports: any;
}
declare module 'enzyme/src/ReactWrapper' {
declare module.exports: any;
}
declare module 'enzyme/src/render' {
declare module.exports: any;
}
declare module 'enzyme/src/RSTTraversal' {
declare module.exports: any;
}
declare module 'enzyme/src/selectors' {
declare module.exports: any;
}
declare module 'enzyme/src/shallow' {
declare module.exports: any;
}
declare module 'enzyme/src/ShallowWrapper' {
declare module.exports: any;
}
declare module 'enzyme/src/Utils' {
declare module.exports: any;
}
declare module 'enzyme/src/validateAdapter' {
declare module.exports: any;
}
declare module 'enzyme/withDom' {
declare module.exports: any;
}
// Filename aliases
declare module 'enzyme/build/configuration.js' {
declare module.exports: $Exports<'enzyme/build/configuration'>;
}
declare module 'enzyme/build/Debug.js' {
declare module.exports: $Exports<'enzyme/build/Debug'>;
}
declare module 'enzyme/build/EnzymeAdapter.js' {
declare module.exports: $Exports<'enzyme/build/EnzymeAdapter'>;
}
declare module 'enzyme/build/getAdapter.js' {
declare module.exports: $Exports<'enzyme/build/getAdapter'>;
}
declare module 'enzyme/build/index' {
declare module.exports: $Exports<'enzyme/build'>;
}
declare module 'enzyme/build/index.js' {
declare module.exports: $Exports<'enzyme/build'>;
}
declare module 'enzyme/build/mount.js' {
declare module.exports: $Exports<'enzyme/build/mount'>;
}
declare module 'enzyme/build/ReactWrapper.js' {
declare module.exports: $Exports<'enzyme/build/ReactWrapper'>;
}
declare module 'enzyme/build/render.js' {
declare module.exports: $Exports<'enzyme/build/render'>;
}
declare module 'enzyme/build/RSTTraversal.js' {
declare module.exports: $Exports<'enzyme/build/RSTTraversal'>;
}
declare module 'enzyme/build/selectors.js' {
declare module.exports: $Exports<'enzyme/build/selectors'>;
}
declare module 'enzyme/build/shallow.js' {
declare module.exports: $Exports<'enzyme/build/shallow'>;
}
declare module 'enzyme/build/ShallowWrapper.js' {
declare module.exports: $Exports<'enzyme/build/ShallowWrapper'>;
}
declare module 'enzyme/build/Utils.js' {
declare module.exports: $Exports<'enzyme/build/Utils'>;
}
declare module 'enzyme/build/validateAdapter.js' {
declare module.exports: $Exports<'enzyme/build/validateAdapter'>;
}
declare module 'enzyme/mount.js' {
declare module.exports: $Exports<'enzyme/mount'>;
}
declare module 'enzyme/ReactWrapper.js' {
declare module.exports: $Exports<'enzyme/ReactWrapper'>;
}
declare module 'enzyme/render.js' {
declare module.exports: $Exports<'enzyme/render'>;
}
declare module 'enzyme/shallow.js' {
declare module.exports: $Exports<'enzyme/shallow'>;
}
declare module 'enzyme/ShallowWrapper.js' {
declare module.exports: $Exports<'enzyme/ShallowWrapper'>;
}
declare module 'enzyme/src/configuration.js' {
declare module.exports: $Exports<'enzyme/src/configuration'>;
}
declare module 'enzyme/src/Debug.js' {
declare module.exports: $Exports<'enzyme/src/Debug'>;
}
declare module 'enzyme/src/EnzymeAdapter.js' {
declare module.exports: $Exports<'enzyme/src/EnzymeAdapter'>;
}
declare module 'enzyme/src/getAdapter.js' {
declare module.exports: $Exports<'enzyme/src/getAdapter'>;
}
declare module 'enzyme/src/index' {
declare module.exports: $Exports<'enzyme/src'>;
}
declare module 'enzyme/src/index.js' {
declare module.exports: $Exports<'enzyme/src'>;
}
declare module 'enzyme/src/mount.js' {
declare module.exports: $Exports<'enzyme/src/mount'>;
}
declare module 'enzyme/src/ReactWrapper.js' {
declare module.exports: $Exports<'enzyme/src/ReactWrapper'>;
}
declare module 'enzyme/src/render.js' {
declare module.exports: $Exports<'enzyme/src/render'>;
}
declare module 'enzyme/src/RSTTraversal.js' {
declare module.exports: $Exports<'enzyme/src/RSTTraversal'>;
}
declare module 'enzyme/src/selectors.js' {
declare module.exports: $Exports<'enzyme/src/selectors'>;
}
declare module 'enzyme/src/shallow.js' {
declare module.exports: $Exports<'enzyme/src/shallow'>;
}
declare module 'enzyme/src/ShallowWrapper.js' {
declare module.exports: $Exports<'enzyme/src/ShallowWrapper'>;
}
declare module 'enzyme/src/Utils.js' {
declare module.exports: $Exports<'enzyme/src/Utils'>;
}
declare module 'enzyme/src/validateAdapter.js' {
declare module.exports: $Exports<'enzyme/src/validateAdapter'>;
}
declare module 'enzyme/withDom.js' {
declare module.exports: $Exports<'enzyme/withDom'>;
}

View File

@@ -1,171 +0,0 @@
// flow-typed signature: 97b9f493816b5bb72fbf5c9e229affd7
// flow-typed version: <<STUB>>/fetch-mock_v6.5.2/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'fetch-mock'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'fetch-mock' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'fetch-mock/dist/es5/client-bundle' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/client' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/compile-route' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/fetch-handler' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/inspecting' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/response-builder' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/set-up-and-tear-down' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/lib/status-text' {
declare module.exports: any;
}
declare module 'fetch-mock/es5/server' {
declare module.exports: any;
}
declare module 'fetch-mock/scripts/support-fetch-mock' {
declare module.exports: any;
}
declare module 'fetch-mock/src/client' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/compile-route' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/fetch-handler' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/inspecting' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/response-builder' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/set-up-and-tear-down' {
declare module.exports: any;
}
declare module 'fetch-mock/src/lib/status-text' {
declare module.exports: any;
}
declare module 'fetch-mock/src/server' {
declare module.exports: any;
}
// Filename aliases
declare module 'fetch-mock/dist/es5/client-bundle.js' {
declare module.exports: $Exports<'fetch-mock/dist/es5/client-bundle'>;
}
declare module 'fetch-mock/es5/client.js' {
declare module.exports: $Exports<'fetch-mock/es5/client'>;
}
declare module 'fetch-mock/es5/lib/compile-route.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/compile-route'>;
}
declare module 'fetch-mock/es5/lib/fetch-handler.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/fetch-handler'>;
}
declare module 'fetch-mock/es5/lib/index' {
declare module.exports: $Exports<'fetch-mock/es5/lib'>;
}
declare module 'fetch-mock/es5/lib/index.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib'>;
}
declare module 'fetch-mock/es5/lib/inspecting.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/inspecting'>;
}
declare module 'fetch-mock/es5/lib/response-builder.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/response-builder'>;
}
declare module 'fetch-mock/es5/lib/set-up-and-tear-down.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/set-up-and-tear-down'>;
}
declare module 'fetch-mock/es5/lib/status-text.js' {
declare module.exports: $Exports<'fetch-mock/es5/lib/status-text'>;
}
declare module 'fetch-mock/es5/server.js' {
declare module.exports: $Exports<'fetch-mock/es5/server'>;
}
declare module 'fetch-mock/scripts/support-fetch-mock.js' {
declare module.exports: $Exports<'fetch-mock/scripts/support-fetch-mock'>;
}
declare module 'fetch-mock/src/client.js' {
declare module.exports: $Exports<'fetch-mock/src/client'>;
}
declare module 'fetch-mock/src/lib/compile-route.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/compile-route'>;
}
declare module 'fetch-mock/src/lib/fetch-handler.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/fetch-handler'>;
}
declare module 'fetch-mock/src/lib/index' {
declare module.exports: $Exports<'fetch-mock/src/lib'>;
}
declare module 'fetch-mock/src/lib/index.js' {
declare module.exports: $Exports<'fetch-mock/src/lib'>;
}
declare module 'fetch-mock/src/lib/inspecting.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/inspecting'>;
}
declare module 'fetch-mock/src/lib/response-builder.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/response-builder'>;
}
declare module 'fetch-mock/src/lib/set-up-and-tear-down.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/set-up-and-tear-down'>;
}
declare module 'fetch-mock/src/lib/status-text.js' {
declare module.exports: $Exports<'fetch-mock/src/lib/status-text'>;
}
declare module 'fetch-mock/src/server.js' {
declare module.exports: $Exports<'fetch-mock/src/server'>;
}

View File

@@ -1,66 +0,0 @@
// flow-typed signature: 9be79ea52a669f6c266677d1d0bd3e9d
// flow-typed version: <<STUB>>/gitdiff-parser_v0.1.2/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'gitdiff-parser'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'gitdiff-parser' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'gitdiff-parser/test/git.test' {
declare module.exports: any;
}
declare module 'gitdiff-parser/test/hg' {
declare module.exports: any;
}
declare module 'gitdiff-parser/test/hg.test' {
declare module.exports: any;
}
declare module 'gitdiff-parser/test/perf-parse-diff' {
declare module.exports: any;
}
declare module 'gitdiff-parser/test/perf' {
declare module.exports: any;
}
// Filename aliases
declare module 'gitdiff-parser/index' {
declare module.exports: $Exports<'gitdiff-parser'>;
}
declare module 'gitdiff-parser/index.js' {
declare module.exports: $Exports<'gitdiff-parser'>;
}
declare module 'gitdiff-parser/test/git.test.js' {
declare module.exports: $Exports<'gitdiff-parser/test/git.test'>;
}
declare module 'gitdiff-parser/test/hg.js' {
declare module.exports: $Exports<'gitdiff-parser/test/hg'>;
}
declare module 'gitdiff-parser/test/hg.test.js' {
declare module.exports: $Exports<'gitdiff-parser/test/hg.test'>;
}
declare module 'gitdiff-parser/test/perf-parse-diff.js' {
declare module.exports: $Exports<'gitdiff-parser/test/perf-parse-diff'>;
}
declare module 'gitdiff-parser/test/perf.js' {
declare module.exports: $Exports<'gitdiff-parser/test/perf'>;
}

View File

@@ -1,109 +0,0 @@
// flow-typed signature: 90337b03d736e9bdaa68004c36c4d3ee
// flow-typed version: 51319746df/history_v4.10.x/flow_>=v0.104.x
declare module 'history' {
declare type Unregister = () => void;
declare export type Action = 'PUSH' | 'REPLACE' | 'POP';
declare export type Location = {|
pathname: string,
search: string,
hash: string,
state: { ... },
key: string,
|};
declare type History<HistoryLocation = Location> = {|
length: number,
location: HistoryLocation,
action: Action,
push: ((path: string, state?: { ... }) => void) &
((location: $Shape<HistoryLocation>) => void),
replace: ((path: string, state?: { ... }) => void) &
((location: $Shape<HistoryLocation>) => void),
go(n: number): void,
goBack(): void,
goForward(): void,
listen((location: HistoryLocation, action: Action) => void): Unregister,
block(
prompt:
| string
| boolean
| ((location: HistoryLocation, action: Action) => string | false | void)
): Unregister,
createHref(location: $Shape<HistoryLocation>): string,
|};
declare export type BrowserHistory = History<>;
declare type BrowserHistoryOpts = {|
basename?: string,
forceRefresh?: boolean,
getUserConfirmation?: (
message: string,
callback: (willContinue: boolean) => void
) => void,
keyLength?: number,
|};
declare function createBrowserHistory(
opts?: BrowserHistoryOpts
): BrowserHistory;
declare export type MemoryHistory = {|
...History<>,
index: number,
entries: Array<string | Location>,
canGo(n: number): boolean,
|};
declare type MemoryHistoryOpts = {|
initialEntries?: Array<string>,
initialIndex?: number,
keyLength?: number,
getUserConfirmation?: (
message: string,
callback: (willContinue: boolean) => void
) => void,
|};
declare function createMemoryHistory(opts?: MemoryHistoryOpts): MemoryHistory;
declare export type HashLocation = {|
...Location,
state: void,
key: void,
|};
declare export type HashHistory = History<HashLocation>;
declare type HashHistoryOpts = {|
basename?: string,
hashType: 'slash' | 'noslash' | 'hashbang',
getUserConfirmation?: (
message: string,
callback: (willContinue: boolean) => void
) => void,
|};
declare function createHashHistory(opts?: HashHistoryOpts): HashHistory;
// PathUtils
declare function parsePath(path: string): Location;
declare function createPath(location: $Shape<Location>): string;
// LocationUtils
declare function locationsAreEqual(
a: $Shape<Location>,
b: $Shape<Location>
): boolean;
declare function createLocation(
path: string | $Shape<Location>,
state?: { ... },
key?: string,
currentLocation?: Location
): Location;
}

View File

@@ -1,597 +0,0 @@
// flow-typed signature: 002f0912eb0f40f562c348561ea3d850
// flow-typed version: a5bbe16c29/jest_v20.x.x/flow_>=v0.39.x
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
*/
mock: {
/**
* An array that represents all calls that have been made into this mock
* function. Each call is represented by an array of arguments that were
* passed during the call.
*/
calls: Array<TArguments>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: Array<TReturn>
},
/**
* Resets all information stored in the mockFn.mock.calls and
* mockFn.mock.instances arrays. Often this is useful when you want to clean
* up a mock's usage data between two assertions.
*/
mockClear(): void,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): void,
/**
* Removes the mock and restores the initial implementation. This is useful
* when you want to mock functions in certain test cases and restore the
* original implementation in others. Beware that mockFn.mockRestore only
* works when mock was created with jest.spyOn. Thus you have to take care of
* restoration yourself when manually assigning jest.fn().
*/
mockRestore(): void,
/**
* Accepts a function that should be used as the implementation of the mock.
* The mock itself will still record all calls that go into and instances
* that come from itself -- the only difference is that the implementation
* will also be executed when the mock is called.
*/
mockImplementation(
fn: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a function that will be used as an implementation of the mock for
* one call to the mocked function. Can be chained so that multiple function
* calls produce different results.
*/
mockImplementationOnce(
fn: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Deprecated: use jest.fn(() => value) instead
*/
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean
};
type JestCallsType = {
allArgs(): mixed,
all(): mixed,
any(): boolean,
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean
};
type JestMatcher = (actual: any, expected: any) => JestMatcherResult;
type JestPromiseType = {
/**
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
resolves: JestExpectType
};
/**
* Plugin: jest-enzyme
*/
type EnzymeMatchersType = {
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBeEmptyRender(): void,
toBePresent(): void,
toContainReact(element: React$Element<any>): void,
toExist(): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp: ((propKey: string, propValue?: any) => void) & ((props: Object) => void),
toHaveRef(refName: string): void,
toHaveState: ((stateKey: string, stateValue?: any) => void) & ((state: Object) => void),
toHaveStyle: ((styleKey: string, styleValue?: any) => void) & ((style: Object) => void),
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toIncludeText(text: string): void,
toHaveValue(value: any): void,
toMatchElement(element: React$Element<any>): void,
toMatchSelector(selector: string): void
};
// DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers
type DomTestingLibraryType = {
toBeInTheDOM(): void,
toHaveTextContent(content: string): void,
toHaveAttribute(name: string, expectedValue?: string): void
};
type JestExpectType = {
not: JestExpectType & EnzymeMatchersType & DomTestingLibraryType,
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
*/
lastCalledWith(...args: Array<any>): void,
/**
* toBe just checks that a value is what you expect. It uses === to check
* strict equality.
*/
toBe(value: any): void,
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toBeCalled(): void,
/**
* Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toBeCalledWith(...args: Array<any>): void,
/**
* Using exact equality with floating point numbers is a bad idea. Rounding
* means that intuitive things fail.
*/
toBeCloseTo(num: number, delta: any): void,
/**
* Use .toBeDefined to check that a variable is not undefined.
*/
toBeDefined(): void,
/**
* Use .toBeFalsy when you don't care what a value is, you just want to
* ensure a value is false in a boolean context.
*/
toBeFalsy(): void,
/**
* To compare floating point numbers, you can use toBeGreaterThan.
*/
toBeGreaterThan(number: number): void,
/**
* To compare floating point numbers, you can use toBeGreaterThanOrEqual.
*/
toBeGreaterThanOrEqual(number: number): void,
/**
* To compare floating point numbers, you can use toBeLessThan.
*/
toBeLessThan(number: number): void,
/**
* To compare floating point numbers, you can use toBeLessThanOrEqual.
*/
toBeLessThanOrEqual(number: number): void,
/**
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
toBeInstanceOf(cls: Class<*>): void,
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
*/
toBeNull(): void,
/**
* Use .toBeTruthy when you don't care what a value is, you just want to
* ensure a value is true in a boolean context.
*/
toBeTruthy(): void,
/**
* Use .toBeUndefined to check that a variable is undefined.
*/
toBeUndefined(): void,
/**
* Use .toContain when you want to check that an item is in a list. For
* testing the items in the list, this uses ===, a strict equality check.
*/
toContain(item: any): void,
/**
* Use .toContainEqual when you want to check that an item is in a list. For
* testing the items in the list, this matcher recursively checks the
* equality of all fields, rather than checking for object identity.
*/
toContainEqual(item: any): void,
/**
* Use .toEqual when you want to check that two objects have the same value.
* This matcher recursively checks the equality of all fields, rather than
* checking for object identity.
*/
toEqual(value: any): void,
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toHaveBeenCalled(): void,
/**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times.
*/
toHaveBeenCalledTimes(number: number): void,
/**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toHaveBeenCalledWith(...args: Array<any>): void,
/**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toHaveBeenLastCalledWith(...args: Array<any>): void,
/**
* Check that an object has a .length property and it is set to a certain
* numeric value.
*/
toHaveLength(number: number): void,
/**
*
*/
toHaveProperty(propPath: string, value?: any): void,
/**
* Use .toMatch to check that a string matches a regular expression or string.
*/
toMatch(regexpOrString: RegExp | string): void,
/**
* Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
*/
toMatchObject(object: Object): void,
/**
* This ensures that a React component matches the most recent snapshot.
*/
toMatchSnapshot(name?: string): void,
/**
* Use .toThrow to test that a function throws when it is called.
* If you want to test that a specific error gets thrown, you can provide an
* argument to toThrow. The argument can be a string for the error message,
* a class for the error, or a regex that should match the error.
*
* Alias: .toThrowError
*/
toThrow(message?: string | Error | RegExp): void,
toThrowError(message?: string | Error | RegExp): void,
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void
};
type JestObjectType = {
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): JestObjectType,
/**
* An un-hoisted version of disableAutomock
*/
autoMockOff(): JestObjectType,
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): JestObjectType,
/**
* An un-hoisted version of enableAutomock
*/
autoMockOn(): JestObjectType,
/**
* Clears the mock.calls and mock.instances properties of all mocks.
* Equivalent to calling .mockClear() on every mocked function.
*/
clearAllMocks(): JestObjectType,
/**
* Resets the state of all mocks. Equivalent to calling .mockReset() on every
* mocked function.
*/
resetAllMocks(): JestObjectType,
/**
* Removes any pending timers from the timer system.
*/
clearAllTimers(): void,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
*/
doMock(moduleName: string, moduleFactory?: any): JestObjectType,
/**
* The same as `unmock` but not moved to the top of the expectation by
* babel-jest.
*/
dontMock(moduleName: string): JestObjectType,
/**
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
fn<TArguments: $ReadOnlyArray<*>, TReturn>(
implementation?: (...args: TArguments) => TReturn,
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
genMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
* The second argument can be used to specify an explicit module factory that
* is being run instead of using Jest's automocking feature.
*
* The third argument can be used to create virtual mocks -- mocks of modules
* that don't exist anywhere in the system.
*/
mock(
moduleName: string,
moduleFactory?: any,
options?: Object
): JestObjectType,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
*/
runAllTicks(): void,
/**
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
* setInterval(), and setImmediate()).
*/
runAllTimers(): void,
/**
* Exhausts all tasks queued by setImmediate().
*/
runAllImmediates(): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*/
runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
* point)
*/
runOnlyPendingTimers(): void,
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module. Note: It is recommended to use jest.mock()
* instead.
*/
setMock(moduleName: string, moduleExports: any): JestObjectType,
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): JestObjectType,
/**
* Instructs Jest to use fake versions of the standard timer functions
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
useFakeTimers(): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
useRealTimers(): JestObjectType,
/**
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(object: Object, methodName: string): JestMockFn<any, any>
};
type JestSpyType = {
calls: JestCallsType
};
/** Runs this function after every test inside this context */
declare function afterEach(fn: (done: () => void) => ?Promise<mixed>, timeout?: number): void;
/** Runs this function before every test inside this context */
declare function beforeEach(fn: (done: () => void) => ?Promise<mixed>, timeout?: number): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(fn: (done: () => void) => ?Promise<mixed>, timeout?: number): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(fn: (done: () => void) => ?Promise<mixed>, timeout?: number): void;
/** A context for grouping tests together */
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: string, fn: () => void): void,
/**
* Only run this describe block
*/
only(name: string, fn: () => void): void,
/**
* Skip running this describe block
*/
skip(name: string, fn: () => void): void,
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
(name: string, fn?: (done: () => void) => ?Promise<mixed>, timeout?: number): void,
/**
* Only run this test
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
only(name: string, fn?: (done: () => void) => ?Promise<mixed>, timeout?: number): void,
/**
* Skip running this test
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
skip(name: string, fn?: (done: () => void) => ?Promise<mixed>, timeout?: number): void,
/**
* Run the test concurrently
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
concurrent(name: string, fn?: (done: () => void) => ?Promise<mixed>, timeout?: number): void,
};
declare function fit(
name: string,
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number,
): void;
/** An individual test unit */
declare var test: typeof it;
/** A disabled group of tests */
declare var xdescribe: typeof describe;
/** A focused group of tests */
declare var fdescribe: typeof describe;
/** A disabled individual test */
declare var xit: typeof it;
/** A disabled individual test */
declare var xtest: typeof it;
type JestPrettyFormatColors = {
comment: { close: string, open: string },
content: { close: string, open: string },
prop: { close: string, open: string },
tag: { close: string, open: string },
value: { close: string, open: string },
};
type JestPrettyFormatIndent = string => string;
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = any => string;
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
callToJSON: boolean,
edgeSpacing: string,
escapeRegex: boolean,
highlight: boolean,
indent: number,
maxDepth: number,
min: boolean,
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
theme: {|
comment: string,
content: string,
prop: string,
tag: string,
value: string,
|},
|};
type JestPrettyFormatPlugin = {
print: (
val: any,
serialize: JestPrettyFormatPrint,
indent: JestPrettyFormatIndent,
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors,
) => string,
test: any => boolean,
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
/** The expect function is used every time you want to test a value */
declare var expect: {
/** The object that you want to make assertions against */
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType & DomTestingLibraryType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: { [name: string]: JestMatcher }): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): void,
arrayContaining(value: Array<mixed>): void,
objectContaining(value: Object): void,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): void,
stringMatching(value: string | RegExp): void
};
// TODO handle return type
// http://jasmine.github.io/2.4/introduction.html#section-Spies
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType;
/**
* The global Jasmine object, this is generally not exposed as the public API,
* using features inside here could break in later versions of Jest.
*/
declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType,
anything(): void,
arrayContaining(value: Array<mixed>): void,
clock(): JestClockType,
createSpy(name: string): JestSpyType,
createSpyObj(
baseName: string,
methodNames: Array<string>
): { [methodName: string]: JestSpyType },
objectContaining(value: Object): void,
stringMatching(value: string): void
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,331 +0,0 @@
// flow-typed signature: 23b805356f90ad9384dd88489654e380
// flow-typed version: e9374c5fe9/moment_v2.3.x/flow_>=v0.25.x
type moment$MomentOptions = {
y?: number | string,
year?: number | string,
years?: number | string,
M?: number | string,
month?: number | string,
months?: number | string,
d?: number | string,
day?: number | string,
days?: number | string,
date?: number | string,
h?: number | string,
hour?: number | string,
hours?: number | string,
m?: number | string,
minute?: number | string,
minutes?: number | string,
s?: number | string,
second?: number | string,
seconds?: number | string,
ms?: number | string,
millisecond?: number | string,
milliseconds?: number | string
};
type moment$MomentObject = {
years: number,
months: number,
date: number,
hours: number,
minutes: number,
seconds: number,
milliseconds: number
};
type moment$MomentCreationData = {
input: string,
format: string,
locale: Object,
isUTC: boolean,
strict: boolean
};
type moment$CalendarFormat = string | ((moment: moment$Moment) => string);
type moment$CalendarFormats = {
sameDay?: moment$CalendarFormat,
nextDay?: moment$CalendarFormat,
nextWeek?: moment$CalendarFormat,
lastDay?: moment$CalendarFormat,
lastWeek?: moment$CalendarFormat,
sameElse?: moment$CalendarFormat
};
declare class moment$LocaleData {
months(moment: moment$Moment): string,
monthsShort(moment: moment$Moment): string,
monthsParse(month: string): number,
weekdays(moment: moment$Moment): string,
weekdaysShort(moment: moment$Moment): string,
weekdaysMin(moment: moment$Moment): string,
weekdaysParse(weekDay: string): number,
longDateFormat(dateFormat: string): string,
isPM(date: string): boolean,
meridiem(hours: number, minutes: number, isLower: boolean): string,
calendar(
key:
| "sameDay"
| "nextDay"
| "lastDay"
| "nextWeek"
| "prevWeek"
| "sameElse",
moment: moment$Moment
): string,
relativeTime(
number: number,
withoutSuffix: boolean,
key: "s" | "m" | "mm" | "h" | "hh" | "d" | "dd" | "M" | "MM" | "y" | "yy",
isFuture: boolean
): string,
pastFuture(diff: any, relTime: string): string,
ordinal(number: number): string,
preparse(str: string): any,
postformat(str: string): any,
week(moment: moment$Moment): string,
invalidDate(): string,
firstDayOfWeek(): number,
firstDayOfYear(): number
}
declare class moment$MomentDuration {
humanize(suffix?: boolean): string,
milliseconds(): number,
asMilliseconds(): number,
seconds(): number,
asSeconds(): number,
minutes(): number,
asMinutes(): number,
hours(): number,
asHours(): number,
days(): number,
asDays(): number,
months(): number,
asWeeks(): number,
weeks(): number,
asMonths(): number,
years(): number,
asYears(): number,
add(value: number | moment$MomentDuration | Object, unit?: string): this,
subtract(value: number | moment$MomentDuration | Object, unit?: string): this,
as(unit: string): number,
get(unit: string): number,
toJSON(): string,
toISOString(): string,
isValid(): boolean
}
declare class moment$Moment {
static ISO_8601: string,
static (
string?: string,
format?: string | Array<string>,
strict?: boolean
): moment$Moment,
static (
string?: string,
format?: string | Array<string>,
locale?: string,
strict?: boolean
): moment$Moment,
static (
initDate: ?Object | number | Date | Array<number> | moment$Moment | string
): moment$Moment,
static unix(seconds: number): moment$Moment,
static utc(): moment$Moment,
static utc(number: number | Array<number>): moment$Moment,
static utc(
str: string,
str2?: string | Array<string>,
str3?: string
): moment$Moment,
static utc(moment: moment$Moment): moment$Moment,
static utc(date: Date): moment$Moment,
static parseZone(): moment$Moment,
static parseZone(rawDate: string): moment$Moment,
static parseZone(
rawDate: string,
format: string | Array<string>
): moment$Moment,
static parseZone(
rawDate: string,
format: string,
strict: boolean
): moment$Moment,
static parseZone(
rawDate: string,
format: string,
locale: string,
strict: boolean
): moment$Moment,
isValid(): boolean,
invalidAt(): 0 | 1 | 2 | 3 | 4 | 5 | 6,
creationData(): moment$MomentCreationData,
millisecond(number: number): this,
milliseconds(number: number): this,
millisecond(): number,
milliseconds(): number,
second(number: number): this,
seconds(number: number): this,
second(): number,
seconds(): number,
minute(number: number): this,
minutes(number: number): this,
minute(): number,
minutes(): number,
hour(number: number): this,
hours(number: number): this,
hour(): number,
hours(): number,
date(number: number): this,
dates(number: number): this,
date(): number,
dates(): number,
day(day: number | string): this,
days(day: number | string): this,
day(): number,
days(): number,
weekday(number: number): this,
weekday(): number,
isoWeekday(number: number): this,
isoWeekday(): number,
dayOfYear(number: number): this,
dayOfYear(): number,
week(number: number): this,
weeks(number: number): this,
week(): number,
weeks(): number,
isoWeek(number: number): this,
isoWeeks(number: number): this,
isoWeek(): number,
isoWeeks(): number,
month(number: number): this,
months(number: number): this,
month(): number,
months(): number,
quarter(number: number): this,
quarter(): number,
year(number: number): this,
years(number: number): this,
year(): number,
years(): number,
weekYear(number: number): this,
weekYear(): number,
isoWeekYear(number: number): this,
isoWeekYear(): number,
weeksInYear(): number,
isoWeeksInYear(): number,
get(string: string): number,
set(unit: string, value: number): this,
set(options: { [unit: string]: number }): this,
static max(...dates: Array<moment$Moment>): moment$Moment,
static max(dates: Array<moment$Moment>): moment$Moment,
static min(...dates: Array<moment$Moment>): moment$Moment,
static min(dates: Array<moment$Moment>): moment$Moment,
add(
value: number | moment$MomentDuration | moment$Moment | Object,
unit?: string
): this,
subtract(
value: number | moment$MomentDuration | moment$Moment | string | Object,
unit?: string
): this,
startOf(unit: string): this,
endOf(unit: string): this,
local(): this,
utc(): this,
utcOffset(
offset: number | string,
keepLocalTime?: boolean,
keepMinutes?: boolean
): this,
utcOffset(): number,
format(format?: string): string,
fromNow(removeSuffix?: boolean): string,
from(
value: moment$Moment | string | number | Date | Array<number>,
removePrefix?: boolean
): string,
toNow(removePrefix?: boolean): string,
to(
value: moment$Moment | string | number | Date | Array<number>,
removePrefix?: boolean
): string,
calendar(refTime?: any, formats?: moment$CalendarFormats): string,
diff(
date: moment$Moment | string | number | Date | Array<number>,
format?: string,
floating?: boolean
): number,
valueOf(): number,
unix(): number,
daysInMonth(): number,
toDate(): Date,
toArray(): Array<number>,
toJSON(): string,
toISOString(
keepOffset?: boolean
): string,
toObject(): moment$MomentObject,
isBefore(
date?: moment$Moment | string | number | Date | Array<number>,
units?: ?string
): boolean,
isSame(
date?: moment$Moment | string | number | Date | Array<number>,
units?: ?string
): boolean,
isAfter(
date?: moment$Moment | string | number | Date | Array<number>,
units?: ?string
): boolean,
isSameOrBefore(
date?: moment$Moment | string | number | Date | Array<number>,
units?: ?string
): boolean,
isSameOrAfter(
date?: moment$Moment | string | number | Date | Array<number>,
units?: ?string
): boolean,
isBetween(
fromDate: moment$Moment | string | number | Date | Array<number>,
toDate?: ?moment$Moment | string | number | Date | Array<number>,
granularity?: ?string,
inclusion?: ?string
): boolean,
isDST(): boolean,
isDSTShifted(): boolean,
isLeapYear(): boolean,
clone(): moment$Moment,
static isMoment(obj: any): boolean,
static isDate(obj: any): boolean,
static locale(locale: string, localeData?: Object): string,
static updateLocale(locale: string, localeData?: ?Object): void,
static locale(locales: Array<string>): string,
locale(locale: string, customization?: Object | null): moment$Moment,
locale(): string,
static months(): Array<string>,
static monthsShort(): Array<string>,
static weekdays(): Array<string>,
static weekdaysShort(): Array<string>,
static weekdaysMin(): Array<string>,
static months(): string,
static monthsShort(): string,
static weekdays(): string,
static weekdaysShort(): string,
static weekdaysMin(): string,
static localeData(key?: string): moment$LocaleData,
static duration(
value: number | Object | string,
unit?: string
): moment$MomentDuration,
static isDuration(obj: any): boolean,
static normalizeUnits(unit: string): string,
static invalid(object: any): moment$Moment
}
declare module "moment" {
declare module.exports: Class<moment$Moment>;
}

View File

@@ -1,22 +0,0 @@
// flow-typed signature: 45d44f189fa426ca21dee3f5149a4f99
// flow-typed version: c6154227d1/query-string_v5.x.x/flow_>=v0.104.x
declare module "query-string" {
declare type ArrayFormat = "none" | "bracket" | "index";
declare type ParseOptions = {|
arrayFormat?: ArrayFormat
|};
declare type StringifyOptions = {|
arrayFormat?: ArrayFormat,
encode?: boolean,
strict?: boolean
|};
declare module.exports: {
extract(str: string): string,
parse(str: string, opts?: ParseOptions): Object,
stringify(obj: Object, opts?: StringifyOptions): string,
...
};
}

View File

@@ -1,139 +0,0 @@
// flow-typed signature: 35264e970923e4f3cda147e7c17e2407
// flow-typed version: <<STUB>>/react-diff-view_v1.8.1/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-diff-view'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-diff-view' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-diff-view/parse' {
declare module.exports: any;
}
declare module 'react-diff-view/src/CodeCell' {
declare module.exports: any;
}
declare module 'react-diff-view/src/Diff' {
declare module.exports: any;
}
declare module 'react-diff-view/src/Hunk' {
declare module.exports: any;
}
declare module 'react-diff-view/src' {
declare module.exports: any;
}
declare module 'react-diff-view/src/parse' {
declare module.exports: any;
}
declare module 'react-diff-view/src/propTypes' {
declare module.exports: any;
}
declare module 'react-diff-view/src/selectors' {
declare module.exports: any;
}
declare module 'react-diff-view/src/SplitChange' {
declare module.exports: any;
}
declare module 'react-diff-view/src/SplitHunk' {
declare module.exports: any;
}
declare module 'react-diff-view/src/SplitWidget' {
declare module.exports: any;
}
declare module 'react-diff-view/src/UnifiedChange' {
declare module.exports: any;
}
declare module 'react-diff-view/src/UnifiedHunk' {
declare module.exports: any;
}
declare module 'react-diff-view/src/UnifiedWidget' {
declare module.exports: any;
}
declare module 'react-diff-view/src/utils' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-diff-view/index' {
declare module.exports: $Exports<'react-diff-view'>;
}
declare module 'react-diff-view/index.js' {
declare module.exports: $Exports<'react-diff-view'>;
}
declare module 'react-diff-view/parse.js' {
declare module.exports: $Exports<'react-diff-view/parse'>;
}
declare module 'react-diff-view/src/CodeCell.js' {
declare module.exports: $Exports<'react-diff-view/src/CodeCell'>;
}
declare module 'react-diff-view/src/Diff.js' {
declare module.exports: $Exports<'react-diff-view/src/Diff'>;
}
declare module 'react-diff-view/src/Hunk.js' {
declare module.exports: $Exports<'react-diff-view/src/Hunk'>;
}
declare module 'react-diff-view/src/index' {
declare module.exports: $Exports<'react-diff-view/src'>;
}
declare module 'react-diff-view/src/index.js' {
declare module.exports: $Exports<'react-diff-view/src'>;
}
declare module 'react-diff-view/src/parse.js' {
declare module.exports: $Exports<'react-diff-view/src/parse'>;
}
declare module 'react-diff-view/src/propTypes.js' {
declare module.exports: $Exports<'react-diff-view/src/propTypes'>;
}
declare module 'react-diff-view/src/selectors.js' {
declare module.exports: $Exports<'react-diff-view/src/selectors'>;
}
declare module 'react-diff-view/src/SplitChange.js' {
declare module.exports: $Exports<'react-diff-view/src/SplitChange'>;
}
declare module 'react-diff-view/src/SplitHunk.js' {
declare module.exports: $Exports<'react-diff-view/src/SplitHunk'>;
}
declare module 'react-diff-view/src/SplitWidget.js' {
declare module.exports: $Exports<'react-diff-view/src/SplitWidget'>;
}
declare module 'react-diff-view/src/UnifiedChange.js' {
declare module.exports: $Exports<'react-diff-view/src/UnifiedChange'>;
}
declare module 'react-diff-view/src/UnifiedHunk.js' {
declare module.exports: $Exports<'react-diff-view/src/UnifiedHunk'>;
}
declare module 'react-diff-view/src/UnifiedWidget.js' {
declare module.exports: $Exports<'react-diff-view/src/UnifiedWidget'>;
}
declare module 'react-diff-view/src/utils.js' {
declare module.exports: $Exports<'react-diff-view/src/utils'>;
}

View File

@@ -1,110 +0,0 @@
// flow-typed signature: e48526194d458ea4787ca56d830092da
// flow-typed version: c6154227d1/react-i18next_v7.x.x/flow_>=v0.104.x
declare module "react-i18next" {
declare type TFunction = (key?: ?string, data?: ?Object) => string;
declare type TranslatorProps = {|
t: TFunction,
i18nLoadedAt: Date,
i18n: Object
|};
declare type TranslatorPropsVoid = {
t: TFunction | void,
i18nLoadedAt: Date | void,
i18n: Object | void,
...
};
declare type Translator<P: {...}, Component: React$ComponentType<P>> = (
WrappedComponent: Component
) => React$ComponentType<
$Diff<React$ElementConfig<Component>, TranslatorPropsVoid>
>;
declare type TranslateOptions = $Shape<{
wait: boolean,
nsMode: "default" | "fallback",
bindi18n: false | string,
bindStore: false | string,
withRef: boolean,
translateFuncName: string,
i18n: Object,
usePureComponent: boolean,
...
}>;
declare function translate<P: {...}, Component: React$ComponentType<P>>(
namespaces?: | string
| Array<string>
| (($Diff<P, TranslatorPropsVoid>) => string | Array<string>),
options?: TranslateOptions
): Translator<P, Component>;
declare type I18nProps = {
i18n?: Object,
ns?: string | Array<string>,
children: (t: TFunction, {
i18n: Object,
t: TFunction,
...
}) => React$Node,
initialI18nStore?: Object,
initialLanguage?: string,
...
};
declare var I18n: React$ComponentType<I18nProps>;
declare type InterpolateProps = {
className?: string,
dangerouslySetInnerHTMLPartElement?: string,
i18n?: Object,
i18nKey?: string,
options?: Object,
parent?: string,
style?: Object,
t?: TFunction,
useDangerouslySetInnerHTML?: boolean,
...
};
declare var Interpolate: React$ComponentType<InterpolateProps>;
declare type TransProps = {
count?: number,
parent?: string,
i18n?: Object,
i18nKey?: string,
t?: TFunction,
...
};
declare var Trans: React$ComponentType<TransProps>;
declare type ProviderProps = {
i18n: Object,
children: React$Element<*>,
...
};
declare var I18nextProvider: React$ComponentType<ProviderProps>;
declare type NamespacesProps = {
components: Array<React$ComponentType<*>>,
i18n: { loadNamespaces: Function, ... },
...
};
declare function loadNamespaces(props: NamespacesProps): Promise<void>;
declare var reactI18nextModule: {
type: "3rdParty",
init: (instance: Object) => void,
...
};
declare function setDefaults(options: TranslateOptions): void;
declare function getDefaults(): TranslateOptions;
declare function getI18n(): Object;
declare function setI18n(instance: Object): void;
}

View File

@@ -1,137 +0,0 @@
// flow-typed signature: ba35d02d668b0d0a3e04a63a6847974e
// flow-typed version: <<STUB>>/react-jss_v8.6.1/flow_v0.79.1
/**
* This is an autogenerated libdef stub for:
*
* 'react-jss'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-jss' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-jss/dist/react-jss' {
declare module.exports: any;
}
declare module 'react-jss/dist/react-jss.min' {
declare module.exports: any;
}
declare module 'react-jss/lib/compose' {
declare module.exports: any;
}
declare module 'react-jss/lib/compose.test' {
declare module.exports: any;
}
declare module 'react-jss/lib/contextTypes' {
declare module.exports: any;
}
declare module 'react-jss/lib/createHoc' {
declare module.exports: any;
}
declare module 'react-jss/lib/getDisplayName' {
declare module.exports: any;
}
declare module 'react-jss/lib/index' {
declare module.exports: any;
}
declare module 'react-jss/lib/index.test' {
declare module.exports: any;
}
declare module 'react-jss/lib/injectSheet' {
declare module.exports: any;
}
declare module 'react-jss/lib/injectSheet.test' {
declare module.exports: any;
}
declare module 'react-jss/lib/jss' {
declare module.exports: any;
}
declare module 'react-jss/lib/JssProvider' {
declare module.exports: any;
}
declare module 'react-jss/lib/JssProvider.test' {
declare module.exports: any;
}
declare module 'react-jss/lib/ns' {
declare module.exports: any;
}
declare module 'react-jss/lib/propTypes' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-jss/dist/react-jss.js' {
declare module.exports: $Exports<'react-jss/dist/react-jss'>;
}
declare module 'react-jss/dist/react-jss.min.js' {
declare module.exports: $Exports<'react-jss/dist/react-jss.min'>;
}
declare module 'react-jss/lib/compose.js' {
declare module.exports: $Exports<'react-jss/lib/compose'>;
}
declare module 'react-jss/lib/compose.test.js' {
declare module.exports: $Exports<'react-jss/lib/compose.test'>;
}
declare module 'react-jss/lib/contextTypes.js' {
declare module.exports: $Exports<'react-jss/lib/contextTypes'>;
}
declare module 'react-jss/lib/createHoc.js' {
declare module.exports: $Exports<'react-jss/lib/createHoc'>;
}
declare module 'react-jss/lib/getDisplayName.js' {
declare module.exports: $Exports<'react-jss/lib/getDisplayName'>;
}
declare module 'react-jss/lib/index.js' {
declare module.exports: $Exports<'react-jss/lib/index'>;
}
declare module 'react-jss/lib/index.test.js' {
declare module.exports: $Exports<'react-jss/lib/index.test'>;
}
declare module 'react-jss/lib/injectSheet.js' {
declare module.exports: $Exports<'react-jss/lib/injectSheet'>;
}
declare module 'react-jss/lib/injectSheet.test.js' {
declare module.exports: $Exports<'react-jss/lib/injectSheet.test'>;
}
declare module 'react-jss/lib/jss.js' {
declare module.exports: $Exports<'react-jss/lib/jss'>;
}
declare module 'react-jss/lib/JssProvider.js' {
declare module.exports: $Exports<'react-jss/lib/JssProvider'>;
}
declare module 'react-jss/lib/JssProvider.test.js' {
declare module.exports: $Exports<'react-jss/lib/JssProvider.test'>;
}
declare module 'react-jss/lib/ns.js' {
declare module.exports: $Exports<'react-jss/lib/ns'>;
}
declare module 'react-jss/lib/propTypes.js' {
declare module.exports: $Exports<'react-jss/lib/propTypes'>;
}

View File

@@ -1,123 +0,0 @@
// flow-typed signature: 6bcbadac27a01caf160321668f1e53ce
// flow-typed version: <<STUB>>/react-markdown_v4.2.2/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-markdown'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-markdown' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-markdown/lib/ast-to-react' {
declare module.exports: any;
}
declare module 'react-markdown/lib/get-definitions' {
declare module.exports: any;
}
declare module 'react-markdown/lib/plugins/disallow-node' {
declare module.exports: any;
}
declare module 'react-markdown/lib/plugins/html-parser' {
declare module.exports: any;
}
declare module 'react-markdown/lib/plugins/naive-html' {
declare module.exports: any;
}
declare module 'react-markdown/lib/react-markdown' {
declare module.exports: any;
}
declare module 'react-markdown/lib/renderers' {
declare module.exports: any;
}
declare module 'react-markdown/lib/symbols' {
declare module.exports: any;
}
declare module 'react-markdown/lib/uri-transformer' {
declare module.exports: any;
}
declare module 'react-markdown/lib/with-html' {
declare module.exports: any;
}
declare module 'react-markdown/lib/wrap-table-rows' {
declare module.exports: any;
}
declare module 'react-markdown/plugins/html-parser' {
declare module.exports: any;
}
declare module 'react-markdown/umd/react-markdown' {
declare module.exports: any;
}
declare module 'react-markdown/with-html' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-markdown/lib/ast-to-react.js' {
declare module.exports: $Exports<'react-markdown/lib/ast-to-react'>;
}
declare module 'react-markdown/lib/get-definitions.js' {
declare module.exports: $Exports<'react-markdown/lib/get-definitions'>;
}
declare module 'react-markdown/lib/plugins/disallow-node.js' {
declare module.exports: $Exports<'react-markdown/lib/plugins/disallow-node'>;
}
declare module 'react-markdown/lib/plugins/html-parser.js' {
declare module.exports: $Exports<'react-markdown/lib/plugins/html-parser'>;
}
declare module 'react-markdown/lib/plugins/naive-html.js' {
declare module.exports: $Exports<'react-markdown/lib/plugins/naive-html'>;
}
declare module 'react-markdown/lib/react-markdown.js' {
declare module.exports: $Exports<'react-markdown/lib/react-markdown'>;
}
declare module 'react-markdown/lib/renderers.js' {
declare module.exports: $Exports<'react-markdown/lib/renderers'>;
}
declare module 'react-markdown/lib/symbols.js' {
declare module.exports: $Exports<'react-markdown/lib/symbols'>;
}
declare module 'react-markdown/lib/uri-transformer.js' {
declare module.exports: $Exports<'react-markdown/lib/uri-transformer'>;
}
declare module 'react-markdown/lib/with-html.js' {
declare module.exports: $Exports<'react-markdown/lib/with-html'>;
}
declare module 'react-markdown/lib/wrap-table-rows.js' {
declare module.exports: $Exports<'react-markdown/lib/wrap-table-rows'>;
}
declare module 'react-markdown/plugins/html-parser.js' {
declare module.exports: $Exports<'react-markdown/plugins/html-parser'>;
}
declare module 'react-markdown/umd/react-markdown.js' {
declare module.exports: $Exports<'react-markdown/umd/react-markdown'>;
}
declare module 'react-markdown/with-html.js' {
declare module.exports: $Exports<'react-markdown/with-html'>;
}

View File

@@ -1,280 +0,0 @@
// flow-typed signature: 17b48cc5220dae9fdc0e9614a532a47b
// flow-typed version: c6154227d1/react-redux_v5.x.x/flow_>=v0.104.x
/**
The order of type arguments for connect() is as follows:
connect<Props, OwnProps, StateProps, DispatchProps, State, Dispatch>(…)
In Flow v0.89 only the first two are mandatory to specify. Other 4 can be repaced with the new awesome type placeholder:
connect<Props, OwnProps, _, _, _, _>(…)
But beware, in case of weird type errors somewhere in random places
just type everything and get to a green field and only then try to
remove the definitions you see bogus.
Decrypting the abbreviations:
WC = Component being wrapped
S = State
D = Dispatch
OP = OwnProps
SP = StateProps
DP = DispatchProps
MP = Merge props
RSP = Returned state props
RDP = Returned dispatch props
RMP = Returned merge props
CP = Props for returned component
Com = React Component
ST = Static properties of Com
EFO = Extra factory options (used only in connectAdvanced)
*/
declare module "react-redux" {
// ------------------------------------------------------------
// Typings for connect()
// ------------------------------------------------------------
declare export type Options<S, OP, SP, MP> = {|
pure?: boolean,
withRef?: boolean,
areStatesEqual?: (next: S, prev: S) => boolean,
areOwnPropsEqual?: (next: OP, prev: OP) => boolean,
areStatePropsEqual?: (next: SP, prev: SP) => boolean,
areMergedPropsEqual?: (next: MP, prev: MP) => boolean,
storeKey?: string,
|};
declare type MapStateToProps<-S, -OP, +SP> =
| ((state: S, ownProps: OP) => SP)
// If you want to use the factory function but get a strange error
// like "function is not an object" then just type the factory function
// like this:
// const factory: (State, OwnProps) => (State, OwnProps) => StateProps
// and provide the StateProps type to the SP type parameter.
| ((state: S, ownProps: OP) => (state: S, ownProps: OP) => SP);
declare type Bind<D> = <A, R>((...A) => R) => (...A) => $Call<D, R>;
declare type MapDispatchToPropsFn<D, -OP, +DP> =
| ((dispatch: D, ownProps: OP) => DP)
// If you want to use the factory function but get a strange error
// like "function is not an object" then just type the factory function
// like this:
// const factory: (Dispatch, OwnProps) => (Dispatch, OwnProps) => DispatchProps
// and provide the DispatchProps type to the DP type parameter.
| ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP);
declare class ConnectedComponent<OP, +WC> extends React$Component<OP> {
static +WrappedComponent: WC;
getWrappedInstance(): React$ElementRef<WC>;
}
// The connection of the Wrapped Component and the Connected Component
// happens here in `MP: P`. It means that type wise MP belongs to P,
// so to say MP >= P.
declare type Connector<P, OP, MP: P> = <WC: React$ComponentType<P>>(
WC,
) => Class<ConnectedComponent<OP, WC>> & WC;
// No `mergeProps` argument
// Got error like inexact OwnProps is incompatible with exact object type?
// Just make the OP parameter for `connect()` an exact object.
declare type MergeOP<OP, D> = {| ...$Exact<OP>, dispatch: D |};
declare type MergeOPSP<OP, SP, D> = {| ...$Exact<OP>, ...SP, dispatch: D |};
declare type MergeOPDP<OP, DP> = {| ...$Exact<OP>, ...DP |};
declare type MergeOPSPDP<OP, SP, DP> = {| ...$Exact<OP>, ...SP, ...DP |};
declare export function connect<-P, -OP, -SP, -DP, -S, -D>(
mapStateToProps?: null | void,
mapDispatchToProps?: null | void,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOP<OP, D>>,
): Connector<P, OP, MergeOP<OP, D>>;
declare export function connect<-P, -OP, -SP, -DP, -S, -D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps?: null | void,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, MergeOPSP<OP, SP, D>>,
): Connector<P, OP, MergeOPSP<OP, SP, D>>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOPDP<OP, DP>>,
): Connector<P, OP, MergeOPDP<OP, DP>>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: DP,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOPDP<OP, DP>>,
): Connector<P, OP, MergeOPDP<OP, $ObjMap<DP, Bind<D>>>>;
declare export function connect<-P, -OP, -SP, -DP, S, D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, {| ...OP, ...SP, ...DP |}>,
): Connector<P, OP, {| ...OP, ...SP, ...DP |}>;
declare export function connect<-P, -OP, -SP, -DP, S, D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: DP,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, MergeOPSPDP<OP, SP, DP>>,
): Connector<P, OP, MergeOPSPDP<OP, SP, $ObjMap<DP, Bind<D>>>>;
// With `mergeProps` argument
declare type MergeProps<+P, -OP, -SP, -DP> = (
stateProps: SP,
dispatchProps: DP,
ownProps: OP,
) => P;
declare export function connect<-P, -OP, -SP: {||}, -DP: {||}, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: null | void,
// If you get error here try adding return type to you mapStateToProps function
mergeProps: MergeProps<P, OP, {||}, {| dispatch: D |}>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
declare export function connect<-P, -OP, -SP, -DP: {||}, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: null | void,
// If you get error here try adding return type to you mapStateToProps function
mergeProps: MergeProps<P, OP, SP, {| dispatch: D |}>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP: {||}, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps: MergeProps<P, OP, {||}, DP>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP: {||}, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: DP,
mergeProps: MergeProps<P, OP, {||}, $ObjMap<DP, Bind<D>>>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps: MergeProps<P, OP, SP, DP>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: DP,
mergeProps: MergeProps<P, OP, SP, $ObjMap<DP, Bind<D>>>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// ------------------------------------------------------------
// Typings for Provider
// ------------------------------------------------------------
declare export class Provider<Store> extends React$Component<{
store: Store,
children?: React$Node,
...
}> {}
declare export function createProvider(
storeKey?: string,
subKey?: string,
): Class<Provider<*>>;
// ------------------------------------------------------------
// Typings for connectAdvanced()
// ------------------------------------------------------------
declare type ConnectAdvancedOptions = {
getDisplayName?: (name: string) => string,
methodName?: string,
renderCountProp?: string,
shouldHandleStateChanges?: boolean,
storeKey?: string,
withRef?: boolean,
...
};
declare type SelectorFactoryOptions<Com> = {
getDisplayName: (name: string) => string,
methodName: string,
renderCountProp: ?string,
shouldHandleStateChanges: boolean,
storeKey: string,
withRef: boolean,
displayName: string,
wrappedComponentName: string,
WrappedComponent: Com,
...
};
declare type MapStateToPropsEx<S: Object, SP: Object, RSP: Object> = (
state: S,
props: SP,
) => RSP;
declare type SelectorFactory<
Com: React$ComponentType<*>,
Dispatch,
S: Object,
OP: Object,
EFO: Object,
CP: Object,
> = (
dispatch: Dispatch,
factoryOptions: SelectorFactoryOptions<Com> & EFO,
) => MapStateToPropsEx<S, OP, CP>;
declare export function connectAdvanced<
Com: React$ComponentType<*>,
D,
S: Object,
OP: Object,
CP: Object,
EFO: Object,
ST: { [_: $Keys<Com>]: any, ... },
>(
selectorFactory: SelectorFactory<Com, D, S, OP, EFO, CP>,
connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO),
): (component: Com) => React$ComponentType<OP> & $Shape<ST>;
declare export default {
Provider: typeof Provider,
createProvider: typeof createProvider,
connect: typeof connect,
connectAdvanced: typeof connectAdvanced,
...
};
}

View File

@@ -1,182 +0,0 @@
// flow-typed signature: 0bc486c8fc04d0bb37efa138223e4f67
// flow-typed version: c6154227d1/react-router-dom_v4.x.x/flow_>=v0.104.x
declare module "react-router-dom" {
declare export var BrowserRouter: React$ComponentType<{|
basename?: string,
forceRefresh?: boolean,
getUserConfirmation?: GetUserConfirmation,
keyLength?: number,
children?: React$Node
|}>
declare export var HashRouter: React$ComponentType<{|
basename?: string,
getUserConfirmation?: GetUserConfirmation,
hashType?: "slash" | "noslash" | "hashbang",
children?: React$Node
|}>
declare export var Link: React$ComponentType<{
className?: string,
to: string | LocationShape,
replace?: boolean,
children?: React$Node,
...
}>
declare export var NavLink: React$ComponentType<{
to: string | LocationShape,
activeClassName?: string,
className?: string,
activeStyle?: Object,
style?: Object,
isActive?: (match: Match, location: Location) => boolean,
children?: React$Node,
exact?: boolean,
strict?: boolean,
...
}>
// NOTE: Below are duplicated from react-router. If updating these, please
// update the react-router and react-router-native types as well.
declare export type Location = {
pathname: string,
search: string,
hash: string,
state?: any,
key?: string,
...
};
declare export type LocationShape = {
pathname?: string,
search?: string,
hash?: string,
state?: any,
...
};
declare export type HistoryAction = "PUSH" | "REPLACE" | "POP";
declare export type RouterHistory = {
length: number,
location: Location,
action: HistoryAction,
listen(
callback: (location: Location, action: HistoryAction) => void
): () => void,
push(path: string | LocationShape, state?: any): void,
replace(path: string | LocationShape, state?: any): void,
go(n: number): void,
goBack(): void,
goForward(): void,
canGo?: (n: number) => boolean,
block(
callback: string | (location: Location, action: HistoryAction) => ?string
): () => void,
// createMemoryHistory
index?: number,
entries?: Array<Location>,
...
};
declare export type Match = {
params: { [key: string]: ?string, ... },
isExact: boolean,
path: string,
url: string,
...
};
declare export type ContextRouter = {|
history: RouterHistory,
location: Location,
match: Match,
staticContext?: StaticRouterContext
|};
declare type ContextRouterVoid = {
history: RouterHistory | void,
location: Location | void,
match: Match | void,
staticContext?: StaticRouterContext | void,
...
};
declare export type GetUserConfirmation = (
message: string,
callback: (confirmed: boolean) => void
) => void;
declare export type StaticRouterContext = { url?: string, ... };
declare export var StaticRouter: React$ComponentType<{|
basename?: string,
location?: string | Location,
context: StaticRouterContext,
children?: React$Node
|}>
declare export var MemoryRouter: React$ComponentType<{|
initialEntries?: Array<LocationShape | string>,
initialIndex?: number,
getUserConfirmation?: GetUserConfirmation,
keyLength?: number,
children?: React$Node
|}>
declare export var Router: React$ComponentType<{|
history: RouterHistory,
children?: React$Node
|}>
declare export var Prompt: React$ComponentType<{|
message: string | ((location: Location) => string | boolean),
when?: boolean
|}>
declare export var Redirect: React$ComponentType<{|
to: string | LocationShape,
push?: boolean,
from?: string,
exact?: boolean,
strict?: boolean
|}>
declare export var Route: React$ComponentType<{|
component?: React$ComponentType<*>,
render?: (router: ContextRouter) => React$Node,
children?: React$ComponentType<ContextRouter> | React$Node,
path?: string | Array<string>,
exact?: boolean,
strict?: boolean,
location?: LocationShape,
sensitive?: boolean
|}>
declare export var Switch: React$ComponentType<{|
children?: React$Node,
location?: Location
|}>
declare export function withRouter<Props: {...}, Component: React$ComponentType<Props>>(
WrappedComponent: Component
): React$ComponentType<$Diff<React$ElementConfig<Component>, ContextRouterVoid>>;
declare type MatchPathOptions = {
path?: string,
exact?: boolean,
sensitive?: boolean,
strict?: boolean,
...
};
declare export function matchPath(
pathname: string,
options?: MatchPathOptions | string,
parent?: Match
): null | Match;
declare export function generatePath(pattern?: string, params?: Object): string;
}

View File

@@ -1,56 +0,0 @@
// flow-typed signature: 030a0d51d7da2db8716b0c796bcd8992
// flow-typed version: <<STUB>>/react-router-enzyme-context_v1.2.0/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-router-enzyme-context'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-router-enzyme-context' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-router-enzyme-context/dist/react-router-enzyme-context.cjs' {
declare module.exports: any;
}
declare module 'react-router-enzyme-context/dist/react-router-enzyme-context.esm' {
declare module.exports: any;
}
declare module 'react-router-enzyme-context/rollup.config' {
declare module.exports: any;
}
declare module 'react-router-enzyme-context/src' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-router-enzyme-context/dist/react-router-enzyme-context.cjs.js' {
declare module.exports: $Exports<'react-router-enzyme-context/dist/react-router-enzyme-context.cjs'>;
}
declare module 'react-router-enzyme-context/dist/react-router-enzyme-context.esm.js' {
declare module.exports: $Exports<'react-router-enzyme-context/dist/react-router-enzyme-context.esm'>;
}
declare module 'react-router-enzyme-context/rollup.config.js' {
declare module.exports: $Exports<'react-router-enzyme-context/rollup.config'>;
}
declare module 'react-router-enzyme-context/src/index' {
declare module.exports: $Exports<'react-router-enzyme-context/src'>;
}
declare module 'react-router-enzyme-context/src/index.js' {
declare module.exports: $Exports<'react-router-enzyme-context/src'>;
}

View File

@@ -1,726 +0,0 @@
// flow-typed signature: 0b6edc6705aa28ab46a24d08242af068
// flow-typed version: <<STUB>>/react-select_v2.4.4/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-select'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-select' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-select/dist/react-select.esm' {
declare module.exports: any;
}
declare module 'react-select/dist/react-select' {
declare module.exports: any;
}
declare module 'react-select/dist/react-select.min' {
declare module.exports: any;
}
declare module 'react-select/lib/accessibility' {
declare module.exports: any;
}
declare module 'react-select/lib/animated' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/Input' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/MultiValue' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/Placeholder' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/SingleValue' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/transitions' {
declare module.exports: any;
}
declare module 'react-select/lib/animated/ValueContainer' {
declare module.exports: any;
}
declare module 'react-select/lib/Async' {
declare module.exports: any;
}
declare module 'react-select/lib/AsyncCreatable' {
declare module.exports: any;
}
declare module 'react-select/lib/builtins' {
declare module.exports: any;
}
declare module 'react-select/lib/components/containers' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Control' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Group' {
declare module.exports: any;
}
declare module 'react-select/lib/components' {
declare module.exports: any;
}
declare module 'react-select/lib/components/indicators' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Input' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Menu' {
declare module.exports: any;
}
declare module 'react-select/lib/components/MultiValue' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Option' {
declare module.exports: any;
}
declare module 'react-select/lib/components/Placeholder' {
declare module.exports: any;
}
declare module 'react-select/lib/components/SingleValue' {
declare module.exports: any;
}
declare module 'react-select/lib/Creatable' {
declare module.exports: any;
}
declare module 'react-select/lib/diacritics' {
declare module.exports: any;
}
declare module 'react-select/lib/filters' {
declare module.exports: any;
}
declare module 'react-select/lib' {
declare module.exports: any;
}
declare module 'react-select/lib/index.umd' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/A11yText' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/DummyInput' {
declare module.exports: any;
}
declare module 'react-select/lib/internal' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/NodeResolver' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/react-fast-compare' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/ScrollBlock' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/ScrollCaptor' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/ScrollLock/constants' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/ScrollLock' {
declare module.exports: any;
}
declare module 'react-select/lib/internal/ScrollLock/utils' {
declare module.exports: any;
}
declare module 'react-select/lib/Select' {
declare module.exports: any;
}
declare module 'react-select/lib/stateManager' {
declare module.exports: any;
}
declare module 'react-select/lib/styles' {
declare module.exports: any;
}
declare module 'react-select/lib/theme' {
declare module.exports: any;
}
declare module 'react-select/lib/types' {
declare module.exports: any;
}
declare module 'react-select/lib/utils' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/Async.test' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/AsyncCreatable.test' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/constants' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/Creatable.test' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/Select.test' {
declare module.exports: any;
}
declare module 'react-select/src/__tests__/StateManaged.test' {
declare module.exports: any;
}
declare module 'react-select/src/accessibility' {
declare module.exports: any;
}
declare module 'react-select/src/animated' {
declare module.exports: any;
}
declare module 'react-select/src/animated/Input' {
declare module.exports: any;
}
declare module 'react-select/src/animated/MultiValue' {
declare module.exports: any;
}
declare module 'react-select/src/animated/Placeholder' {
declare module.exports: any;
}
declare module 'react-select/src/animated/SingleValue' {
declare module.exports: any;
}
declare module 'react-select/src/animated/transitions' {
declare module.exports: any;
}
declare module 'react-select/src/animated/ValueContainer' {
declare module.exports: any;
}
declare module 'react-select/src/Async' {
declare module.exports: any;
}
declare module 'react-select/src/AsyncCreatable' {
declare module.exports: any;
}
declare module 'react-select/src/builtins' {
declare module.exports: any;
}
declare module 'react-select/src/components/containers' {
declare module.exports: any;
}
declare module 'react-select/src/components/Control' {
declare module.exports: any;
}
declare module 'react-select/src/components/Group' {
declare module.exports: any;
}
declare module 'react-select/src/components' {
declare module.exports: any;
}
declare module 'react-select/src/components/indicators' {
declare module.exports: any;
}
declare module 'react-select/src/components/Input' {
declare module.exports: any;
}
declare module 'react-select/src/components/Menu' {
declare module.exports: any;
}
declare module 'react-select/src/components/MultiValue' {
declare module.exports: any;
}
declare module 'react-select/src/components/Option' {
declare module.exports: any;
}
declare module 'react-select/src/components/Placeholder' {
declare module.exports: any;
}
declare module 'react-select/src/components/SingleValue' {
declare module.exports: any;
}
declare module 'react-select/src/Creatable' {
declare module.exports: any;
}
declare module 'react-select/src/diacritics' {
declare module.exports: any;
}
declare module 'react-select/src/filters' {
declare module.exports: any;
}
declare module 'react-select/src' {
declare module.exports: any;
}
declare module 'react-select/src/index.umd' {
declare module.exports: any;
}
declare module 'react-select/src/internal/A11yText' {
declare module.exports: any;
}
declare module 'react-select/src/internal/DummyInput' {
declare module.exports: any;
}
declare module 'react-select/src/internal' {
declare module.exports: any;
}
declare module 'react-select/src/internal/NodeResolver' {
declare module.exports: any;
}
declare module 'react-select/src/internal/react-fast-compare' {
declare module.exports: any;
}
declare module 'react-select/src/internal/ScrollBlock' {
declare module.exports: any;
}
declare module 'react-select/src/internal/ScrollCaptor' {
declare module.exports: any;
}
declare module 'react-select/src/internal/ScrollLock/constants' {
declare module.exports: any;
}
declare module 'react-select/src/internal/ScrollLock' {
declare module.exports: any;
}
declare module 'react-select/src/internal/ScrollLock/utils' {
declare module.exports: any;
}
declare module 'react-select/src/Select' {
declare module.exports: any;
}
declare module 'react-select/src/stateManager' {
declare module.exports: any;
}
declare module 'react-select/src/styles' {
declare module.exports: any;
}
declare module 'react-select/src/theme' {
declare module.exports: any;
}
declare module 'react-select/src/types' {
declare module.exports: any;
}
declare module 'react-select/src/utils' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-select/dist/react-select.esm.js' {
declare module.exports: $Exports<'react-select/dist/react-select.esm'>;
}
declare module 'react-select/dist/react-select.js' {
declare module.exports: $Exports<'react-select/dist/react-select'>;
}
declare module 'react-select/dist/react-select.min.js' {
declare module.exports: $Exports<'react-select/dist/react-select.min'>;
}
declare module 'react-select/lib/accessibility/index' {
declare module.exports: $Exports<'react-select/lib/accessibility'>;
}
declare module 'react-select/lib/accessibility/index.js' {
declare module.exports: $Exports<'react-select/lib/accessibility'>;
}
declare module 'react-select/lib/animated/index' {
declare module.exports: $Exports<'react-select/lib/animated'>;
}
declare module 'react-select/lib/animated/index.js' {
declare module.exports: $Exports<'react-select/lib/animated'>;
}
declare module 'react-select/lib/animated/Input.js' {
declare module.exports: $Exports<'react-select/lib/animated/Input'>;
}
declare module 'react-select/lib/animated/MultiValue.js' {
declare module.exports: $Exports<'react-select/lib/animated/MultiValue'>;
}
declare module 'react-select/lib/animated/Placeholder.js' {
declare module.exports: $Exports<'react-select/lib/animated/Placeholder'>;
}
declare module 'react-select/lib/animated/SingleValue.js' {
declare module.exports: $Exports<'react-select/lib/animated/SingleValue'>;
}
declare module 'react-select/lib/animated/transitions.js' {
declare module.exports: $Exports<'react-select/lib/animated/transitions'>;
}
declare module 'react-select/lib/animated/ValueContainer.js' {
declare module.exports: $Exports<'react-select/lib/animated/ValueContainer'>;
}
declare module 'react-select/lib/Async.js' {
declare module.exports: $Exports<'react-select/lib/Async'>;
}
declare module 'react-select/lib/AsyncCreatable.js' {
declare module.exports: $Exports<'react-select/lib/AsyncCreatable'>;
}
declare module 'react-select/lib/builtins.js' {
declare module.exports: $Exports<'react-select/lib/builtins'>;
}
declare module 'react-select/lib/components/containers.js' {
declare module.exports: $Exports<'react-select/lib/components/containers'>;
}
declare module 'react-select/lib/components/Control.js' {
declare module.exports: $Exports<'react-select/lib/components/Control'>;
}
declare module 'react-select/lib/components/Group.js' {
declare module.exports: $Exports<'react-select/lib/components/Group'>;
}
declare module 'react-select/lib/components/index' {
declare module.exports: $Exports<'react-select/lib/components'>;
}
declare module 'react-select/lib/components/index.js' {
declare module.exports: $Exports<'react-select/lib/components'>;
}
declare module 'react-select/lib/components/indicators.js' {
declare module.exports: $Exports<'react-select/lib/components/indicators'>;
}
declare module 'react-select/lib/components/Input.js' {
declare module.exports: $Exports<'react-select/lib/components/Input'>;
}
declare module 'react-select/lib/components/Menu.js' {
declare module.exports: $Exports<'react-select/lib/components/Menu'>;
}
declare module 'react-select/lib/components/MultiValue.js' {
declare module.exports: $Exports<'react-select/lib/components/MultiValue'>;
}
declare module 'react-select/lib/components/Option.js' {
declare module.exports: $Exports<'react-select/lib/components/Option'>;
}
declare module 'react-select/lib/components/Placeholder.js' {
declare module.exports: $Exports<'react-select/lib/components/Placeholder'>;
}
declare module 'react-select/lib/components/SingleValue.js' {
declare module.exports: $Exports<'react-select/lib/components/SingleValue'>;
}
declare module 'react-select/lib/Creatable.js' {
declare module.exports: $Exports<'react-select/lib/Creatable'>;
}
declare module 'react-select/lib/diacritics.js' {
declare module.exports: $Exports<'react-select/lib/diacritics'>;
}
declare module 'react-select/lib/filters.js' {
declare module.exports: $Exports<'react-select/lib/filters'>;
}
declare module 'react-select/lib/index' {
declare module.exports: $Exports<'react-select/lib'>;
}
declare module 'react-select/lib/index.js' {
declare module.exports: $Exports<'react-select/lib'>;
}
declare module 'react-select/lib/index.umd.js' {
declare module.exports: $Exports<'react-select/lib/index.umd'>;
}
declare module 'react-select/lib/internal/A11yText.js' {
declare module.exports: $Exports<'react-select/lib/internal/A11yText'>;
}
declare module 'react-select/lib/internal/DummyInput.js' {
declare module.exports: $Exports<'react-select/lib/internal/DummyInput'>;
}
declare module 'react-select/lib/internal/index' {
declare module.exports: $Exports<'react-select/lib/internal'>;
}
declare module 'react-select/lib/internal/index.js' {
declare module.exports: $Exports<'react-select/lib/internal'>;
}
declare module 'react-select/lib/internal/NodeResolver.js' {
declare module.exports: $Exports<'react-select/lib/internal/NodeResolver'>;
}
declare module 'react-select/lib/internal/react-fast-compare.js' {
declare module.exports: $Exports<'react-select/lib/internal/react-fast-compare'>;
}
declare module 'react-select/lib/internal/ScrollBlock.js' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollBlock'>;
}
declare module 'react-select/lib/internal/ScrollCaptor.js' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollCaptor'>;
}
declare module 'react-select/lib/internal/ScrollLock/constants.js' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollLock/constants'>;
}
declare module 'react-select/lib/internal/ScrollLock/index' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollLock'>;
}
declare module 'react-select/lib/internal/ScrollLock/index.js' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollLock'>;
}
declare module 'react-select/lib/internal/ScrollLock/utils.js' {
declare module.exports: $Exports<'react-select/lib/internal/ScrollLock/utils'>;
}
declare module 'react-select/lib/Select.js' {
declare module.exports: $Exports<'react-select/lib/Select'>;
}
declare module 'react-select/lib/stateManager.js' {
declare module.exports: $Exports<'react-select/lib/stateManager'>;
}
declare module 'react-select/lib/styles.js' {
declare module.exports: $Exports<'react-select/lib/styles'>;
}
declare module 'react-select/lib/theme.js' {
declare module.exports: $Exports<'react-select/lib/theme'>;
}
declare module 'react-select/lib/types.js' {
declare module.exports: $Exports<'react-select/lib/types'>;
}
declare module 'react-select/lib/utils.js' {
declare module.exports: $Exports<'react-select/lib/utils'>;
}
declare module 'react-select/src/__tests__/Async.test.js' {
declare module.exports: $Exports<'react-select/src/__tests__/Async.test'>;
}
declare module 'react-select/src/__tests__/AsyncCreatable.test.js' {
declare module.exports: $Exports<'react-select/src/__tests__/AsyncCreatable.test'>;
}
declare module 'react-select/src/__tests__/constants.js' {
declare module.exports: $Exports<'react-select/src/__tests__/constants'>;
}
declare module 'react-select/src/__tests__/Creatable.test.js' {
declare module.exports: $Exports<'react-select/src/__tests__/Creatable.test'>;
}
declare module 'react-select/src/__tests__/Select.test.js' {
declare module.exports: $Exports<'react-select/src/__tests__/Select.test'>;
}
declare module 'react-select/src/__tests__/StateManaged.test.js' {
declare module.exports: $Exports<'react-select/src/__tests__/StateManaged.test'>;
}
declare module 'react-select/src/accessibility/index' {
declare module.exports: $Exports<'react-select/src/accessibility'>;
}
declare module 'react-select/src/accessibility/index.js' {
declare module.exports: $Exports<'react-select/src/accessibility'>;
}
declare module 'react-select/src/animated/index' {
declare module.exports: $Exports<'react-select/src/animated'>;
}
declare module 'react-select/src/animated/index.js' {
declare module.exports: $Exports<'react-select/src/animated'>;
}
declare module 'react-select/src/animated/Input.js' {
declare module.exports: $Exports<'react-select/src/animated/Input'>;
}
declare module 'react-select/src/animated/MultiValue.js' {
declare module.exports: $Exports<'react-select/src/animated/MultiValue'>;
}
declare module 'react-select/src/animated/Placeholder.js' {
declare module.exports: $Exports<'react-select/src/animated/Placeholder'>;
}
declare module 'react-select/src/animated/SingleValue.js' {
declare module.exports: $Exports<'react-select/src/animated/SingleValue'>;
}
declare module 'react-select/src/animated/transitions.js' {
declare module.exports: $Exports<'react-select/src/animated/transitions'>;
}
declare module 'react-select/src/animated/ValueContainer.js' {
declare module.exports: $Exports<'react-select/src/animated/ValueContainer'>;
}
declare module 'react-select/src/Async.js' {
declare module.exports: $Exports<'react-select/src/Async'>;
}
declare module 'react-select/src/AsyncCreatable.js' {
declare module.exports: $Exports<'react-select/src/AsyncCreatable'>;
}
declare module 'react-select/src/builtins.js' {
declare module.exports: $Exports<'react-select/src/builtins'>;
}
declare module 'react-select/src/components/containers.js' {
declare module.exports: $Exports<'react-select/src/components/containers'>;
}
declare module 'react-select/src/components/Control.js' {
declare module.exports: $Exports<'react-select/src/components/Control'>;
}
declare module 'react-select/src/components/Group.js' {
declare module.exports: $Exports<'react-select/src/components/Group'>;
}
declare module 'react-select/src/components/index' {
declare module.exports: $Exports<'react-select/src/components'>;
}
declare module 'react-select/src/components/index.js' {
declare module.exports: $Exports<'react-select/src/components'>;
}
declare module 'react-select/src/components/indicators.js' {
declare module.exports: $Exports<'react-select/src/components/indicators'>;
}
declare module 'react-select/src/components/Input.js' {
declare module.exports: $Exports<'react-select/src/components/Input'>;
}
declare module 'react-select/src/components/Menu.js' {
declare module.exports: $Exports<'react-select/src/components/Menu'>;
}
declare module 'react-select/src/components/MultiValue.js' {
declare module.exports: $Exports<'react-select/src/components/MultiValue'>;
}
declare module 'react-select/src/components/Option.js' {
declare module.exports: $Exports<'react-select/src/components/Option'>;
}
declare module 'react-select/src/components/Placeholder.js' {
declare module.exports: $Exports<'react-select/src/components/Placeholder'>;
}
declare module 'react-select/src/components/SingleValue.js' {
declare module.exports: $Exports<'react-select/src/components/SingleValue'>;
}
declare module 'react-select/src/Creatable.js' {
declare module.exports: $Exports<'react-select/src/Creatable'>;
}
declare module 'react-select/src/diacritics.js' {
declare module.exports: $Exports<'react-select/src/diacritics'>;
}
declare module 'react-select/src/filters.js' {
declare module.exports: $Exports<'react-select/src/filters'>;
}
declare module 'react-select/src/index' {
declare module.exports: $Exports<'react-select/src'>;
}
declare module 'react-select/src/index.js' {
declare module.exports: $Exports<'react-select/src'>;
}
declare module 'react-select/src/index.umd.js' {
declare module.exports: $Exports<'react-select/src/index.umd'>;
}
declare module 'react-select/src/internal/A11yText.js' {
declare module.exports: $Exports<'react-select/src/internal/A11yText'>;
}
declare module 'react-select/src/internal/DummyInput.js' {
declare module.exports: $Exports<'react-select/src/internal/DummyInput'>;
}
declare module 'react-select/src/internal/index' {
declare module.exports: $Exports<'react-select/src/internal'>;
}
declare module 'react-select/src/internal/index.js' {
declare module.exports: $Exports<'react-select/src/internal'>;
}
declare module 'react-select/src/internal/NodeResolver.js' {
declare module.exports: $Exports<'react-select/src/internal/NodeResolver'>;
}
declare module 'react-select/src/internal/react-fast-compare.js' {
declare module.exports: $Exports<'react-select/src/internal/react-fast-compare'>;
}
declare module 'react-select/src/internal/ScrollBlock.js' {
declare module.exports: $Exports<'react-select/src/internal/ScrollBlock'>;
}
declare module 'react-select/src/internal/ScrollCaptor.js' {
declare module.exports: $Exports<'react-select/src/internal/ScrollCaptor'>;
}
declare module 'react-select/src/internal/ScrollLock/constants.js' {
declare module.exports: $Exports<'react-select/src/internal/ScrollLock/constants'>;
}
declare module 'react-select/src/internal/ScrollLock/index' {
declare module.exports: $Exports<'react-select/src/internal/ScrollLock'>;
}
declare module 'react-select/src/internal/ScrollLock/index.js' {
declare module.exports: $Exports<'react-select/src/internal/ScrollLock'>;
}
declare module 'react-select/src/internal/ScrollLock/utils.js' {
declare module.exports: $Exports<'react-select/src/internal/ScrollLock/utils'>;
}
declare module 'react-select/src/Select.js' {
declare module.exports: $Exports<'react-select/src/Select'>;
}
declare module 'react-select/src/stateManager.js' {
declare module.exports: $Exports<'react-select/src/stateManager'>;
}
declare module 'react-select/src/styles.js' {
declare module.exports: $Exports<'react-select/src/styles'>;
}
declare module 'react-select/src/theme.js' {
declare module.exports: $Exports<'react-select/src/theme'>;
}
declare module 'react-select/src/types.js' {
declare module.exports: $Exports<'react-select/src/types'>;
}
declare module 'react-select/src/utils.js' {
declare module.exports: $Exports<'react-select/src/utils'>;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +0,0 @@
// flow-typed signature: bfde320a1fcb9c4e387bc5bee5186189
// flow-typed version: <<STUB>>/redux-mock-store_v1.5.3/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'redux-mock-store'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'redux-mock-store' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'redux-mock-store/lib' {
declare module.exports: any;
}
declare module 'redux-mock-store/test' {
declare module.exports: any;
}
declare module 'redux-mock-store/test/mock/middleware' {
declare module.exports: any;
}
// Filename aliases
declare module 'redux-mock-store/lib/index' {
declare module.exports: $Exports<'redux-mock-store/lib'>;
}
declare module 'redux-mock-store/lib/index.js' {
declare module.exports: $Exports<'redux-mock-store/lib'>;
}
declare module 'redux-mock-store/test/index' {
declare module.exports: $Exports<'redux-mock-store/test'>;
}
declare module 'redux-mock-store/test/index.js' {
declare module.exports: $Exports<'redux-mock-store/test'>;
}
declare module 'redux-mock-store/test/mock/middleware.js' {
declare module.exports: $Exports<'redux-mock-store/test/mock/middleware'>;
}

View File

@@ -1,69 +0,0 @@
// flow-typed signature: 2dd998b0c8ef2beb4cf28fc074992c98
// flow-typed version: <<STUB>>/redux-thunk_v2.3.0/flow_v0.109.0
/**
* This is an autogenerated libdef stub for:
*
* 'redux-thunk'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'redux-thunk' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'redux-thunk/dist/redux-thunk' {
declare module.exports: any;
}
declare module 'redux-thunk/dist/redux-thunk.min' {
declare module.exports: any;
}
declare module 'redux-thunk/es' {
declare module.exports: any;
}
declare module 'redux-thunk/lib' {
declare module.exports: any;
}
declare module 'redux-thunk/src' {
declare module.exports: any;
}
// Filename aliases
declare module 'redux-thunk/dist/redux-thunk.js' {
declare module.exports: $Exports<'redux-thunk/dist/redux-thunk'>;
}
declare module 'redux-thunk/dist/redux-thunk.min.js' {
declare module.exports: $Exports<'redux-thunk/dist/redux-thunk.min'>;
}
declare module 'redux-thunk/es/index' {
declare module.exports: $Exports<'redux-thunk/es'>;
}
declare module 'redux-thunk/es/index.js' {
declare module.exports: $Exports<'redux-thunk/es'>;
}
declare module 'redux-thunk/lib/index' {
declare module.exports: $Exports<'redux-thunk/lib'>;
}
declare module 'redux-thunk/lib/index.js' {
declare module.exports: $Exports<'redux-thunk/lib'>;
}
declare module 'redux-thunk/src/index' {
declare module.exports: $Exports<'redux-thunk/src'>;
}
declare module 'redux-thunk/src/index.js' {
declare module.exports: $Exports<'redux-thunk/src'>;
}

View File

@@ -1,99 +0,0 @@
// flow-typed signature: f62df6dbce399d55b0f2954c5ac1bd4e
// flow-typed version: c6154227d1/redux_v4.x.x/flow_>=v0.104.x
declare module 'redux' {
/*
S = State
A = Action
D = Dispatch
*/
declare export type Action<T> = { type: T, ... }
declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: { type: *, ... }> = DispatchAPI<A>;
declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {
dispatch: D,
getState(): S,
...
};
declare export type Store<S, A, D = Dispatch<A>> = {
// rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages)
dispatch: D,
getState(): S,
subscribe(listener: () => void): () => void,
replaceReducer(nextReducer: Reducer<S, A>): void,
...
};
declare export type Reducer<S, A> = (state: S | void, action: A) => S;
declare export type CombinedReducer<S, A> = (
state: ($Shape<S> & {...}) | void,
action: A
) => S;
declare export type Middleware<S, A, D = Dispatch<A>> = (
api: MiddlewareAPI<S, A, D>
) => (next: D) => D;
declare export type StoreCreator<S, A, D = Dispatch<A>> = {
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>,
(
reducer: Reducer<S, A>,
preloadedState: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>,
...
};
declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (
next: StoreCreator<S, A, D>
) => StoreCreator<S, A, D>;
declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;
declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
preloadedState?: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;
declare export function applyMiddleware<S, A, D>(
...middlewares: Array<Middleware<S, A, D>>
): StoreEnhancer<S, A, D>;
declare export type ActionCreator<A, B> = (...args: Array<B>) => A;
declare export type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any>, ... };
declare export function bindActionCreators<
A,
C: ActionCreator<A, any>,
D: DispatchAPI<A>
>(
actionCreator: C,
dispatch: D
): C;
declare export function bindActionCreators<
A,
K,
C: ActionCreators<K, A>,
D: DispatchAPI<A>
>(
actionCreators: C,
dispatch: D
): C;
declare export function combineReducers<O: {...}, A>(
reducers: O
): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
declare export var compose: $Compose;
}

View File

@@ -1,484 +0,0 @@
// flow-typed signature: a55c22479779e4f28ad4dd10c702882a
// flow-typed version: a29423bb31/styled-components_v4.x.x/flow_>=v0.104.x
// @flow
declare module 'styled-components' {
declare type BuiltinElementInstances = {
a: React$ElementRef<'a'>,
abbr: React$ElementRef<'abbr'>,
address: React$ElementRef<'address'>,
area: React$ElementRef<'area'>,
article: React$ElementRef<'article'>,
aside: React$ElementRef<'aside'>,
audio: React$ElementRef<'audio'>,
b: React$ElementRef<'b'>,
base: React$ElementRef<'base'>,
bdi: React$ElementRef<'bdi'>,
bdo: React$ElementRef<'bdo'>,
big: React$ElementRef<'big'>,
blockquote: React$ElementRef<'blockquote'>,
body: React$ElementRef<'body'>,
br: React$ElementRef<'br'>,
button: React$ElementRef<'button'>,
canvas: React$ElementRef<'canvas'>,
caption: React$ElementRef<'caption'>,
cite: React$ElementRef<'cite'>,
code: React$ElementRef<'code'>,
col: React$ElementRef<'col'>,
colgroup: React$ElementRef<'colgroup'>,
data: React$ElementRef<'data'>,
datalist: React$ElementRef<'datalist'>,
dd: React$ElementRef<'dd'>,
del: React$ElementRef<'del'>,
details: React$ElementRef<'details'>,
dfn: React$ElementRef<'dfn'>,
dialog: React$ElementRef<'dialog'>,
div: React$ElementRef<'div'>,
dl: React$ElementRef<'dl'>,
dt: React$ElementRef<'dt'>,
em: React$ElementRef<'em'>,
embed: React$ElementRef<'embed'>,
fieldset: React$ElementRef<'fieldset'>,
figcaption: React$ElementRef<'figcaption'>,
figure: React$ElementRef<'figure'>,
footer: React$ElementRef<'footer'>,
form: React$ElementRef<'form'>,
h1: React$ElementRef<'h1'>,
h2: React$ElementRef<'h2'>,
h3: React$ElementRef<'h3'>,
h4: React$ElementRef<'h4'>,
h5: React$ElementRef<'h5'>,
h6: React$ElementRef<'h6'>,
head: React$ElementRef<'head'>,
header: React$ElementRef<'header'>,
hgroup: React$ElementRef<'hgroup'>,
hr: React$ElementRef<'hr'>,
html: React$ElementRef<'html'>,
i: React$ElementRef<'i'>,
iframe: React$ElementRef<'iframe'>,
img: React$ElementRef<'img'>,
input: React$ElementRef<'input'>,
ins: React$ElementRef<'ins'>,
kbd: React$ElementRef<'kbd'>,
label: React$ElementRef<'label'>,
legend: React$ElementRef<'legend'>,
li: React$ElementRef<'li'>,
link: React$ElementRef<'link'>,
main: React$ElementRef<'main'>,
map: React$ElementRef<'map'>,
mark: React$ElementRef<'mark'>,
menu: React$ElementRef<'menu'>,
meta: React$ElementRef<'meta'>,
meter: React$ElementRef<'meter'>,
nav: React$ElementRef<'nav'>,
noscript: React$ElementRef<'noscript'>,
object: React$ElementRef<'object'>,
ol: React$ElementRef<'ol'>,
optgroup: React$ElementRef<'optgroup'>,
option: React$ElementRef<'option'>,
output: React$ElementRef<'output'>,
p: React$ElementRef<'p'>,
param: React$ElementRef<'param'>,
picture: React$ElementRef<'picture'>,
pre: React$ElementRef<'pre'>,
progress: React$ElementRef<'progress'>,
q: React$ElementRef<'q'>,
rp: React$ElementRef<'rp'>,
rt: React$ElementRef<'rt'>,
ruby: React$ElementRef<'ruby'>,
s: React$ElementRef<'s'>,
samp: React$ElementRef<'samp'>,
script: React$ElementRef<'script'>,
section: React$ElementRef<'section'>,
select: React$ElementRef<'select'>,
small: React$ElementRef<'small'>,
source: React$ElementRef<'source'>,
span: React$ElementRef<'span'>,
strong: React$ElementRef<'strong'>,
style: React$ElementRef<'style'>,
sub: React$ElementRef<'sub'>,
summary: React$ElementRef<'summary'>,
sup: React$ElementRef<'sup'>,
table: React$ElementRef<'table'>,
tbody: React$ElementRef<'tbody'>,
td: React$ElementRef<'td'>,
textarea: React$ElementRef<'textarea'>,
tfoot: React$ElementRef<'tfoot'>,
th: React$ElementRef<'th'>,
thead: React$ElementRef<'thead'>,
time: React$ElementRef<'time'>,
title: React$ElementRef<'title'>,
tr: React$ElementRef<'tr'>,
track: React$ElementRef<'track'>,
u: React$ElementRef<'u'>,
ul: React$ElementRef<'ul'>,
var: React$ElementRef<'var'>,
video: React$ElementRef<'video'>,
wbr: React$ElementRef<'wbr'>,
// SVG
circle: React$ElementRef<'circle'>,
clipPath: React$ElementRef<'clipPath'>,
defs: React$ElementRef<'defs'>,
ellipse: React$ElementRef<'ellipse'>,
g: React$ElementRef<'g'>,
image: React$ElementRef<'image'>,
line: React$ElementRef<'line'>,
linearGradient: React$ElementRef<'linearGradient'>,
mask: React$ElementRef<'mask'>,
path: React$ElementRef<'path'>,
pattern: React$ElementRef<'pattern'>,
polygon: React$ElementRef<'polygon'>,
polyline: React$ElementRef<'polyline'>,
radialGradient: React$ElementRef<'radialGradient'>,
rect: React$ElementRef<'rect'>,
stop: React$ElementRef<'stop'>,
svg: React$ElementRef<'svg'>,
text: React$ElementRef<'text'>,
tspan: React$ElementRef<'tspan'>,
// Deprecated, should be HTMLUnknownElement, but Flow doesn't support it
keygen: React$ElementRef<'keygen'>,
menuitem: React$ElementRef<'menuitem'>,
...
}
declare type BuiltinElementType<ElementName: string> = $ElementType<BuiltinElementInstances, ElementName>
declare class InterpolatableComponent<P> extends React$Component<P> {
static +styledComponentId: string;
}
declare export type Interpolation<P> =
| ((executionContext: P) =>
| ((executionContext: P) => InterpolationBase)
| InterpolationBase
)
| Class<InterpolatableComponent<mixed>>
| InterpolationBase
declare export type InterpolationBase =
| CSSRules
| KeyFrames
| string
| number
// Should this be `mixed` perhaps?
declare export type CSSRules = Interpolation<any>[] // eslint-disable-line flowtype/no-weak-types
// This is not exported on purpose, since it's an implementation detail
declare type TaggedTemplateLiteral<I, R> = (strings: string[], ...interpolations: Interpolation<I>[]) => R
declare export type CSSConstructor = TaggedTemplateLiteral<any, CSSRules> // eslint-disable-line flowtype/no-weak-types
declare export type KeyFramesConstructor = TaggedTemplateLiteral<any, KeyFrames> // eslint-disable-line flowtype/no-weak-types
declare export type CreateGlobalStyleConstructor = TaggedTemplateLiteral<any, React$ComponentType<*>> // eslint-disable-line flowtype/no-weak-types
declare interface Tag<T> {
styleTag: HTMLStyleElement | null;
getIds(): string[];
hasNameForId(id: string, name: string): boolean;
insertMarker(id: string): T;
insertRules(id: string, cssRules: string[], name: ?string): void;
removeRules(id: string): void;
css(): string;
toHTML(additionalAttrs: ?string): string;
toElement(): React$Element<*>;
clone(): Tag<T>;
sealed: boolean;
}
// The `any`/weak types in here all come from `styled-components` directly, since those definitions were just copied over
declare export class StyleSheet {
static get master() : StyleSheet;
static get instance() : StyleSheet;
static reset(forceServer? : boolean) : void;
id : number;
forceServer : boolean;
target : ?HTMLElement;
tagMap : { [string]: Tag<any>, ... }; // eslint-disable-line flowtype/no-weak-types
deferred: { [string]: string[] | void, ... };
rehydratedNames: { [string]: boolean, ... };
ignoreRehydratedNames: { [string]: boolean, ... };
tags: Tag<any>[]; // eslint-disable-line flowtype/no-weak-types
importRuleTag: Tag<any>; // eslint-disable-line flowtype/no-weak-types
capacity: number;
clones: StyleSheet[];
constructor(?HTMLElement) : this;
rehydrate() : this;
clone() : StyleSheet;
sealAllTags() : void;
makeTag(tag : ?Tag<any>) : Tag<any>; // eslint-disable-line flowtype/no-weak-types
getImportRuleTag() : Tag<any>; // eslint-disable-line flowtype/no-weak-types
getTagForId(id : string): Tag<any>; // eslint-disable-line flowtype/no-weak-types
hasId(id: string) : boolean;
hasNameForId(id: string, name: string) : boolean;
deferredInject(id : string, cssRules : string[]) : void;
inject(id: string, cssRules : string[], name? : string) : void;
remove(id : string) : void;
toHtml() : string;
toReactElements() : React$ElementType[];
}
declare export class KeyFrames {
id : string;
name : string;
rules : string[];
constructor(name : string, rules : string[]) : this;
inject(StyleSheet) : void;
toString() : string;
getName() : string;
}
// I think any is appropriate here?
// eslint-disable-next-line flowtype/no-weak-types
declare export var css : CSSConstructor;
declare export var keyframes : KeyFramesConstructor;
declare export var createGlobalStyle : CreateGlobalStyleConstructor
declare export var ThemeProvider: React$ComponentType<{
children?: ?React$Node,
theme: mixed | (mixed) => mixed,
...
}>
declare type ThemeProps<T> = {|
theme: T
|}
declare type PropsWithTheme<Props, T> = {|
...ThemeProps<T>,
...$Exact<Props>
|}
declare export function withTheme<Theme, Config: {...}, Instance>(Component: React$AbstractComponent<Config, Instance>): React$AbstractComponent<$Diff<Config, ThemeProps<Theme | void>>, Instance>
declare export type StyledComponent<Props, Theme, Instance> = React$AbstractComponent<Props, Instance> & Class<InterpolatableComponent<Props>>
declare type StyledFactory<StyleProps, Theme, Instance> = {|
[[call]]: TaggedTemplateLiteral<PropsWithTheme<StyleProps, Theme>, StyledComponent<StyleProps, Theme, Instance>>;
+attrs: <A: {...}>(((StyleProps) => A) | A) => TaggedTemplateLiteral<
PropsWithTheme<{|...$Exact<StyleProps>, ...$Exact<A>|}, Theme>,
StyledComponent<React$Config<{|...$Exact<StyleProps>, ...$Exact<A>|}, $Exact<A>>, Theme, Instance>
>;
|}
declare type StyledShorthandFactory<V> = {|
[[call]]: <StyleProps, Theme>(string[], ...Interpolation<PropsWithTheme<StyleProps, Theme>>[]) => StyledComponent<StyleProps, Theme, V>;
+attrs: <A: {...}, StyleProps = {||}, Theme = {||}>(((StyleProps) => A) | A) => TaggedTemplateLiteral<
PropsWithTheme<{|...$Exact<StyleProps>, ...$Exact<A>|}, Theme>,
StyledComponent<React$Config<{|...$Exact<StyleProps>, ...$Exact<A>|}, $Exact<A>>, Theme, V>
>;
|}
declare type ConvenientShorthands = $ObjMap<
BuiltinElementInstances,
<V>(V) => StyledShorthandFactory<V>
>
declare interface Styled {
<StyleProps, Theme, ElementName: $Keys<BuiltinElementInstances>>(ElementName): StyledFactory<StyleProps, Theme, BuiltinElementType<ElementName>>;
<Comp: React$ComponentType<any>, Theme, OwnProps = React$ElementConfig<Comp>>(Comp): StyledFactory<{|...$Exact<OwnProps>|}, Theme, Comp>;
}
declare export default Styled & ConvenientShorthands
}
declare module 'styled-components/native' {
declare class InterpolatableComponent<P> extends React$Component<P> {
static +styledComponentId: string;
}
declare export type Interpolation<P> =
| ((executionContext: P) =>
| ((executionContext: P) => InterpolationBase) // eslint-disable-line flowtype/no-weak-types
| InterpolationBase
)
| Class<InterpolatableComponent<mixed>>
| InterpolationBase
declare export type InterpolationBase =
| CSSRules
| KeyFrames
| string
| number
// Should this be `mixed` perhaps?
declare export type CSSRules = Interpolation<any>[] // eslint-disable-line flowtype/no-weak-types
// This is not exported on purpose, since it's an implementation detail
declare type TaggedTemplateLiteral<I, R> = (strings: string[], ...interpolations: Interpolation<I>[]) => R
declare export type CSSConstructor = TaggedTemplateLiteral<any, CSSRules> // eslint-disable-line flowtype/no-weak-types
declare export type KeyFramesConstructor = TaggedTemplateLiteral<any, KeyFrames> // eslint-disable-line flowtype/no-weak-types
declare export type CreateGlobalStyleConstructor = TaggedTemplateLiteral<any, React$ComponentType<*>> // eslint-disable-line flowtype/no-weak-types
declare interface Tag<T> {
styleTag: HTMLStyleElement | null;
getIds(): string[];
hasNameForId(id: string, name: string): boolean;
insertMarker(id: string): T;
insertRules(id: string, cssRules: string[], name: ?string): void;
removeRules(id: string): void;
css(): string;
toHTML(additionalAttrs: ?string): string;
toElement(): React$Element<*>;
clone(): Tag<T>;
sealed: boolean;
}
// The `any`/weak types in here all come from `styled-components` directly, since those definitions were just copied over
declare export class StyleSheet {
static get master() : StyleSheet;
static get instance() : StyleSheet;
static reset(forceServer? : boolean) : void;
id : number;
forceServer : boolean;
target : ?HTMLElement;
tagMap : { [string]: Tag<any>, ... }; // eslint-disable-line flowtype/no-weak-types
deferred: { [string]: string[] | void, ... };
rehydratedNames: { [string]: boolean, ... };
ignoreRehydratedNames: { [string]: boolean, ... };
tags: Tag<any>[]; // eslint-disable-line flowtype/no-weak-types
importRuleTag: Tag<any>; // eslint-disable-line flowtype/no-weak-types
capacity: number;
clones: StyleSheet[];
constructor(?HTMLElement) : this;
rehydrate() : this;
clone() : StyleSheet;
sealAllTags() : void;
makeTag(tag : ?Tag<any>) : Tag<any>; // eslint-disable-line flowtype/no-weak-types
getImportRuleTag() : Tag<any>; // eslint-disable-line flowtype/no-weak-types
getTagForId(id : string): Tag<any>; // eslint-disable-line flowtype/no-weak-types
hasId(id: string) : boolean;
hasNameForId(id: string, name: string) : boolean;
deferredInject(id : string, cssRules : string[]) : void;
inject(id: string, cssRules : string[], name? : string) : void;
remove(id : string) : void;
toHtml() : string;
toReactElements() : React$ElementType[];
}
declare export class KeyFrames {
id : string;
name : string;
rules : string[];
constructor(name : string, rules : string[]) : this;
inject(StyleSheet) : void;
toString() : string;
getName() : string;
}
// I think any is appropriate here?
// eslint-disable-next-line flowtype/no-weak-types
declare export var css : CSSConstructor;
declare export var keyframes : KeyFramesConstructor;
declare export var createGlobalStyle : CreateGlobalStyleConstructor
declare export var ThemeProvider: React$ComponentType<{
children?: ?React$Node,
theme: mixed | (mixed) => mixed,
...
}>
declare type ThemeProps<T> = {|
theme: T
|}
declare type PropsWithTheme<Props, T> = {|
...ThemeProps<T>,
...$Exact<Props>
|}
declare export function withTheme<Theme, Config: {...}, Instance>(Component: React$AbstractComponent<Config, Instance>): React$AbstractComponent<$Diff<Config, ThemeProps<Theme | void>>, Instance>
declare export type StyledComponent<Props, Theme, Instance> = React$AbstractComponent<Props, Instance> & Class<InterpolatableComponent<Props>>
declare type StyledFactory<StyleProps, Theme, Instance> = {|
[[call]]: TaggedTemplateLiteral<PropsWithTheme<StyleProps, Theme>, StyledComponent<StyleProps, Theme, Instance>>;
+attrs: <A: {...}>(((StyleProps) => A) | A) => TaggedTemplateLiteral<
PropsWithTheme<{|...$Exact<StyleProps>, ...$Exact<A>|}, Theme>,
StyledComponent<React$Config<{|...$Exact<StyleProps>, ...$Exact<A>|}, $Exact<A>>, Theme, Instance>
>;
|}
declare type StyledShorthandFactory<V> = {|
[[call]]: <StyleProps, Theme>(string[], ...Interpolation<PropsWithTheme<StyleProps, Theme>>[]) => StyledComponent<StyleProps, Theme, V>;
+attrs: <A: {...}, StyleProps = {||}, Theme = {||}>(((StyleProps) => A) | A) => TaggedTemplateLiteral<
PropsWithTheme<{|...$Exact<StyleProps>, ...$Exact<A>|}, Theme>,
StyledComponent<React$Config<{|...$Exact<StyleProps>, ...$Exact<A>|}, $Exact<A>>, Theme, V>
>;
|}
declare type BuiltinElementInstances = {
ActivityIndicator: React$ComponentType<{...}>,
ActivityIndicatorIOS: React$ComponentType<{...}>,
ART: React$ComponentType<{...}>,
Button: React$ComponentType<{...}>,
DatePickerIOS: React$ComponentType<{...}>,
DrawerLayoutAndroid: React$ComponentType<{...}>,
Image: React$ComponentType<{...}>,
ImageBackground: React$ComponentType<{...}>,
ImageEditor: React$ComponentType<{...}>,
ImageStore: React$ComponentType<{...}>,
KeyboardAvoidingView: React$ComponentType<{...}>,
ListView: React$ComponentType<{...}>,
MapView: React$ComponentType<{...}>,
Modal: React$ComponentType<{...}>,
NavigatorIOS: React$ComponentType<{...}>,
Picker: React$ComponentType<{...}>,
PickerIOS: React$ComponentType<{...}>,
ProgressBarAndroid: React$ComponentType<{...}>,
ProgressViewIOS: React$ComponentType<{...}>,
ScrollView: React$ComponentType<{...}>,
SegmentedControlIOS: React$ComponentType<{...}>,
Slider: React$ComponentType<{...}>,
SliderIOS: React$ComponentType<{...}>,
SnapshotViewIOS: React$ComponentType<{...}>,
Switch: React$ComponentType<{...}>,
RecyclerViewBackedScrollView: React$ComponentType<{...}>,
RefreshControl: React$ComponentType<{...}>,
SafeAreaView: React$ComponentType<{...}>,
StatusBar: React$ComponentType<{...}>,
SwipeableListView: React$ComponentType<{...}>,
SwitchAndroid: React$ComponentType<{...}>,
SwitchIOS: React$ComponentType<{...}>,
TabBarIOS: React$ComponentType<{...}>,
Text: React$ComponentType<{...}>,
TextInput: React$ComponentType<{...}>,
ToastAndroid: React$ComponentType<{...}>,
ToolbarAndroid: React$ComponentType<{...}>,
Touchable: React$ComponentType<{...}>,
TouchableHighlight: React$ComponentType<{...}>,
TouchableNativeFeedback: React$ComponentType<{...}>,
TouchableOpacity: React$ComponentType<{...}>,
TouchableWithoutFeedback: React$ComponentType<{...}>,
View: React$ComponentType<{...}>,
ViewPagerAndroid: React$ComponentType<{...}>,
WebView: React$ComponentType<{...}>,
FlatList: React$ComponentType<{...}>,
SectionList: React$ComponentType<{...}>,
VirtualizedList: React$ComponentType<{...}>,
...
}
declare type BuiltinElementType<ElementName: string> = $ElementType<BuiltinElementInstances, ElementName>
declare type ConvenientShorthands = $ObjMap<
BuiltinElementInstances,
<V>(V) => StyledShorthandFactory<V>
>
declare interface Styled {
<StyleProps, Theme, ElementName: $Keys<BuiltinElementInstances>>(ElementName): StyledFactory<StyleProps, Theme, BuiltinElementType<ElementName>>;
<Comp: React$ComponentType<any>, Theme, OwnProps = React$ElementConfig<Comp>>(Comp): StyledFactory<{|...$Exact<OwnProps>|}, Theme, Comp>;
}
declare export default Styled & ConvenientShorthands
}

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Checkbox, InputField, Subtitle } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { Checkbox, InputField, Subtitle } from "@scm-manager/ui-components";
type Props = {
baseUrl: string;
@@ -16,24 +16,24 @@ class BaseUrlSettings extends React.Component<Props> {
return (
<div>
<Subtitle subtitle={t('base-url-settings.name')} />
<Subtitle subtitle={t("base-url-settings.name")} />
<div className="columns">
<div className="column is-half">
<InputField
label={t('base-url-settings.base-url')}
label={t("base-url-settings.base-url")}
onChange={this.handleBaseUrlChange}
value={baseUrl}
disabled={!hasUpdatePermission}
helpText={t('help.baseUrlHelpText')}
helpText={t("help.baseUrlHelpText")}
/>
</div>
<div className="column is-half">
<Checkbox
checked={forceBaseUrl}
label={t('base-url-settings.force-base-url')}
label={t("base-url-settings.force-base-url")}
onChange={this.handleForceBaseUrlChange}
disabled={!hasUpdatePermission}
helpText={t('help.forceBaseUrlHelpText')}
helpText={t("help.forceBaseUrlHelpText")}
/>
</div>
</div>
@@ -42,11 +42,11 @@ class BaseUrlSettings extends React.Component<Props> {
}
handleBaseUrlChange = (value: string) => {
this.props.onChange(true, value, 'baseUrl');
this.props.onChange(true, value, "baseUrl");
};
handleForceBaseUrlChange = (value: boolean) => {
this.props.onChange(true, value, 'forceBaseUrl');
this.props.onChange(true, value, "forceBaseUrl");
};
}
export default translate('config')(BaseUrlSettings);
export default translate("config")(BaseUrlSettings);

View File

@@ -1,11 +1,11 @@
import React from 'react';
import { translate } from 'react-i18next';
import { SubmitButton, Notification } from '@scm-manager/ui-components';
import { NamespaceStrategies, Config } from '@scm-manager/ui-types';
import ProxySettings from './ProxySettings';
import GeneralSettings from './GeneralSettings';
import BaseUrlSettings from './BaseUrlSettings';
import LoginAttempt from './LoginAttempt';
import React from "react";
import { translate } from "react-i18next";
import { SubmitButton, Notification } from "@scm-manager/ui-components";
import { NamespaceStrategies, Config } from "@scm-manager/ui-types";
import ProxySettings from "./ProxySettings";
import GeneralSettings from "./GeneralSettings";
import BaseUrlSettings from "./BaseUrlSettings";
import LoginAttempt from "./LoginAttempt";
type Props = {
submitForm: (p: Config) => void;
@@ -36,31 +36,31 @@ class ConfigForm extends React.Component<Props, State> {
config: {
proxyPassword: null,
proxyPort: 0,
proxyServer: '',
proxyServer: "",
proxyUser: null,
enableProxy: false,
realmDescription: '',
realmDescription: "",
disableGroupingGrid: false,
dateFormat: '',
dateFormat: "",
anonymousAccessEnabled: false,
baseUrl: '',
baseUrl: "",
forceBaseUrl: false,
loginAttemptLimit: 0,
proxyExcludes: [],
skipFailedAuthenticators: false,
pluginUrl: '',
pluginUrl: "",
loginAttemptLimitTimeout: 0,
enabledXsrfProtection: true,
namespaceStrategy: '',
loginInfoUrl: '',
_links: {},
namespaceStrategy: "",
loginInfoUrl: "",
_links: {}
},
showNotification: false,
error: {
loginAttemptLimitTimeout: false,
loginAttemptLimit: false,
loginAttemptLimit: false
},
changed: false,
changed: false
};
}
@@ -70,14 +70,14 @@ class ConfigForm extends React.Component<Props, State> {
this.setState({
...this.state,
config: {
...config,
},
...config
}
});
}
if (!configUpdatePermission) {
this.setState({
...this.state,
showNotification: true,
showNotification: true
});
}
}
@@ -85,7 +85,7 @@ class ConfigForm extends React.Component<Props, State> {
submit = (event: Event) => {
event.preventDefault();
this.setState({
changed: false,
changed: false
});
this.props.submitForm(this.state.config);
};
@@ -96,7 +96,7 @@ class ConfigForm extends React.Component<Props, State> {
t,
namespaceStrategies,
configReadPermission,
configUpdatePermission,
configUpdatePermission
} = this.props;
const config = this.state.config;
@@ -105,8 +105,8 @@ class ConfigForm extends React.Component<Props, State> {
if (!configReadPermission) {
return (
<Notification
type={'danger'}
children={t('config.form.no-read-permission-notification')}
type={"danger"}
children={t("config.form.no-read-permission-notification")}
/>
);
}
@@ -114,8 +114,8 @@ class ConfigForm extends React.Component<Props, State> {
if (this.state.showNotification) {
noPermissionNotification = (
<Notification
type={'info'}
children={t('config.form.no-write-permission-notification')}
type={"info"}
children={t("config.form.no-write-permission-notification")}
onClose={() => this.onClose()}
/>
);
@@ -160,10 +160,10 @@ class ConfigForm extends React.Component<Props, State> {
/>
<hr />
<ProxySettings
proxyPassword={config.proxyPassword ? config.proxyPassword : ''}
proxyPassword={config.proxyPassword ? config.proxyPassword : ""}
proxyPort={config.proxyPort}
proxyServer={config.proxyServer ? config.proxyServer : ''}
proxyUser={config.proxyUser ? config.proxyUser : ''}
proxyServer={config.proxyServer ? config.proxyServer : ""}
proxyUser={config.proxyUser ? config.proxyUser : ""}
enableProxy={config.enableProxy}
proxyExcludes={config.proxyExcludes}
onChange={(isValid, changedValue, name) =>
@@ -174,7 +174,7 @@ class ConfigForm extends React.Component<Props, State> {
<hr />
<SubmitButton
loading={loading}
label={t('config.form.submit')}
label={t("config.form.submit")}
disabled={
!configUpdatePermission || this.hasError() || !this.state.changed
}
@@ -188,13 +188,13 @@ class ConfigForm extends React.Component<Props, State> {
...this.state,
config: {
...this.state.config,
[name]: changedValue,
[name]: changedValue
},
error: {
...this.state.error,
[name]: !isValid,
[name]: !isValid
},
changed: true,
changed: true
});
};
@@ -208,9 +208,9 @@ class ConfigForm extends React.Component<Props, State> {
onClose = () => {
this.setState({
...this.state,
showNotification: false,
showNotification: false
});
};
}
export default translate('config')(ConfigForm);
export default translate("config")(ConfigForm);

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Checkbox, InputField } from '@scm-manager/ui-components';
import { NamespaceStrategies } from '@scm-manager/ui-types';
import NamespaceStrategySelect from './NamespaceStrategySelect';
import React from "react";
import { translate } from "react-i18next";
import { Checkbox, InputField } from "@scm-manager/ui-components";
import { NamespaceStrategies } from "@scm-manager/ui-types";
import NamespaceStrategySelect from "./NamespaceStrategySelect";
type Props = {
realmDescription: string;
@@ -32,7 +32,7 @@ class GeneralSettings extends React.Component<Props> {
anonymousAccessEnabled,
namespaceStrategy,
hasUpdatePermission,
namespaceStrategies,
namespaceStrategies
} = this.props;
return (
@@ -40,61 +40,61 @@ class GeneralSettings extends React.Component<Props> {
<div className="columns">
<div className="column is-half">
<InputField
label={t('general-settings.realm-description')}
label={t("general-settings.realm-description")}
onChange={this.handleRealmDescriptionChange}
value={realmDescription}
disabled={!hasUpdatePermission}
helpText={t('help.realmDescriptionHelpText')}
helpText={t("help.realmDescriptionHelpText")}
/>
</div>
<div className="column is-half">
<NamespaceStrategySelect
label={t('general-settings.namespace-strategy')}
label={t("general-settings.namespace-strategy")}
onChange={this.handleNamespaceStrategyChange}
value={namespaceStrategy}
disabled={!hasUpdatePermission}
namespaceStrategies={namespaceStrategies}
helpText={t('help.nameSpaceStrategyHelpText')}
helpText={t("help.nameSpaceStrategyHelpText")}
/>
</div>
</div>
<div className="columns">
<div className="column is-half">
<InputField
label={t('general-settings.login-info-url')}
label={t("general-settings.login-info-url")}
onChange={this.handleLoginInfoUrlChange}
value={loginInfoUrl}
disabled={!hasUpdatePermission}
helpText={t('help.loginInfoUrlHelpText')}
helpText={t("help.loginInfoUrlHelpText")}
/>
</div>
<div className="column is-half">
<Checkbox
checked={enabledXsrfProtection}
label={t('general-settings.enabled-xsrf-protection')}
label={t("general-settings.enabled-xsrf-protection")}
onChange={this.handleEnabledXsrfProtectionChange}
disabled={!hasUpdatePermission}
helpText={t('help.enableXsrfProtectionHelpText')}
helpText={t("help.enableXsrfProtectionHelpText")}
/>
</div>
</div>
<div className="columns">
<div className="column is-half">
<InputField
label={t('general-settings.plugin-url')}
label={t("general-settings.plugin-url")}
onChange={this.handlePluginCenterUrlChange}
value={pluginUrl}
disabled={!hasUpdatePermission}
helpText={t('help.pluginUrlHelpText')}
helpText={t("help.pluginUrlHelpText")}
/>
</div>
<div className="column is-half">
<Checkbox
checked={anonymousAccessEnabled}
label={t('general-settings.anonymous-access-enabled')}
label={t("general-settings.anonymous-access-enabled")}
onChange={this.handleEnableAnonymousAccess}
disabled={!hasUpdatePermission}
helpText={t('help.allowAnonymousAccessHelpText')}
helpText={t("help.allowAnonymousAccessHelpText")}
/>
</div>
</div>
@@ -103,23 +103,23 @@ class GeneralSettings extends React.Component<Props> {
}
handleLoginInfoUrlChange = (value: string) => {
this.props.onChange(true, value, 'loginInfoUrl');
this.props.onChange(true, value, "loginInfoUrl");
};
handleRealmDescriptionChange = (value: string) => {
this.props.onChange(true, value, 'realmDescription');
this.props.onChange(true, value, "realmDescription");
};
handleEnabledXsrfProtectionChange = (value: boolean) => {
this.props.onChange(true, value, 'enabledXsrfProtection');
this.props.onChange(true, value, "enabledXsrfProtection");
};
handleEnableAnonymousAccess = (value: boolean) => {
this.props.onChange(true, value, 'anonymousAccessEnabled');
this.props.onChange(true, value, "anonymousAccessEnabled");
};
handleNamespaceStrategyChange = (value: string) => {
this.props.onChange(true, value, 'namespaceStrategy');
this.props.onChange(true, value, "namespaceStrategy");
};
handlePluginCenterUrlChange = (value: string) => {
this.props.onChange(true, value, 'pluginUrl');
this.props.onChange(true, value, "pluginUrl");
};
}
export default translate('config')(GeneralSettings);
export default translate("config")(GeneralSettings);

View File

@@ -1,10 +1,10 @@
import React from 'react';
import { translate } from 'react-i18next';
import React from "react";
import { translate } from "react-i18next";
import {
InputField,
Subtitle,
validation as validator,
} from '@scm-manager/ui-components';
validation as validator
} from "@scm-manager/ui-components";
type Props = {
loginAttemptLimit: number;
@@ -25,7 +25,7 @@ class LoginAttempt extends React.Component<Props, State> {
this.state = {
loginAttemptLimitError: false,
loginAttemptLimitTimeoutError: false,
loginAttemptLimitTimeoutError: false
};
}
render() {
@@ -33,33 +33,33 @@ class LoginAttempt extends React.Component<Props, State> {
t,
loginAttemptLimit,
loginAttemptLimitTimeout,
hasUpdatePermission,
hasUpdatePermission
} = this.props;
return (
<div>
<Subtitle subtitle={t('login-attempt.name')} />
<Subtitle subtitle={t("login-attempt.name")} />
<div className="columns">
<div className="column is-half">
<InputField
label={t('login-attempt.login-attempt-limit')}
label={t("login-attempt.login-attempt-limit")}
onChange={this.handleLoginAttemptLimitChange}
value={loginAttemptLimit}
disabled={!hasUpdatePermission}
validationError={this.state.loginAttemptLimitError}
errorMessage={t('validation.login-attempt-limit-invalid')}
helpText={t('help.loginAttemptLimitHelpText')}
errorMessage={t("validation.login-attempt-limit-invalid")}
helpText={t("help.loginAttemptLimitHelpText")}
/>
</div>
<div className="column is-half">
<InputField
label={t('login-attempt.login-attempt-limit-timeout')}
label={t("login-attempt.login-attempt-limit-timeout")}
onChange={this.handleLoginAttemptLimitTimeoutChange}
value={loginAttemptLimitTimeout}
disabled={!hasUpdatePermission}
validationError={this.state.loginAttemptLimitTimeoutError}
errorMessage={t('validation.login-attempt-limit-timeout-invalid')}
helpText={t('help.loginAttemptLimitTimeoutHelpText')}
errorMessage={t("validation.login-attempt-limit-timeout-invalid")}
helpText={t("help.loginAttemptLimitTimeoutHelpText")}
/>
</div>
</div>
@@ -71,26 +71,26 @@ class LoginAttempt extends React.Component<Props, State> {
handleLoginAttemptLimitChange = (value: string) => {
this.setState({
...this.state,
loginAttemptLimitError: !validator.isNumberValid(value),
loginAttemptLimitError: !validator.isNumberValid(value)
});
this.props.onChange(
validator.isNumberValid(value),
value,
'loginAttemptLimit',
"loginAttemptLimit"
);
};
handleLoginAttemptLimitTimeoutChange = (value: string) => {
this.setState({
...this.state,
loginAttemptLimitTimeoutError: !validator.isNumberValid(value),
loginAttemptLimitTimeoutError: !validator.isNumberValid(value)
});
this.props.onChange(
validator.isNumberValid(value),
value,
'loginAttemptLimitTimeout',
"loginAttemptLimitTimeout"
);
};
}
export default translate('config')(LoginAttempt);
export default translate("config")(LoginAttempt);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { translate, TFunction } from 'react-i18next';
import { Select } from '@scm-manager/ui-components';
import { NamespaceStrategies } from '@scm-manager/ui-types';
import React from "react";
import { translate, TFunction } from "react-i18next";
import { Select } from "@scm-manager/ui-components";
import { NamespaceStrategies } from "@scm-manager/ui-types";
type Props = {
namespaceStrategies: NamespaceStrategies;
@@ -23,14 +23,14 @@ class NamespaceStrategySelect extends React.Component<Props> {
}
return available.map(ns => {
const key = 'namespaceStrategies.' + ns;
const key = "namespaceStrategies." + ns;
let label = t(key);
if (label === key) {
label = ns;
}
return {
value: ns,
label: label,
label: label
};
});
};
@@ -63,4 +63,4 @@ class NamespaceStrategySelect extends React.Component<Props> {
}
}
export default translate('plugins')(NamespaceStrategySelect);
export default translate("plugins")(NamespaceStrategySelect);

View File

@@ -1,12 +1,12 @@
import React from 'react';
import { translate } from 'react-i18next';
import React from "react";
import { translate } from "react-i18next";
import {
Checkbox,
InputField,
Subtitle,
AddEntryToTableField,
} from '@scm-manager/ui-components';
import ProxyExcludesTable from '../table/ProxyExcludesTable';
AddEntryToTableField
} from "@scm-manager/ui-components";
import ProxyExcludesTable from "../table/ProxyExcludesTable";
type Props = {
proxyPassword: string;
@@ -30,61 +30,61 @@ class ProxySettings extends React.Component<Props> {
proxyUser,
enableProxy,
proxyExcludes,
hasUpdatePermission,
hasUpdatePermission
} = this.props;
return (
<div>
<Subtitle subtitle={t('proxy-settings.name')} />
<Subtitle subtitle={t("proxy-settings.name")} />
<div className="columns">
<div className="column is-full">
<Checkbox
checked={enableProxy}
label={t('proxy-settings.enable-proxy')}
label={t("proxy-settings.enable-proxy")}
onChange={this.handleEnableProxyChange}
disabled={!hasUpdatePermission}
helpText={t('help.enableProxyHelpText')}
helpText={t("help.enableProxyHelpText")}
/>
</div>
</div>
<div className="columns">
<div className="column is-half">
<InputField
label={t('proxy-settings.proxy-password')}
label={t("proxy-settings.proxy-password")}
onChange={this.handleProxyPasswordChange}
value={proxyPassword}
type="password"
disabled={!enableProxy || !hasUpdatePermission}
helpText={t('help.proxyPasswordHelpText')}
helpText={t("help.proxyPasswordHelpText")}
/>
</div>
<div className="column is-half">
<InputField
label={t('proxy-settings.proxy-port')}
label={t("proxy-settings.proxy-port")}
value={proxyPort}
onChange={this.handleProxyPortChange}
disabled={!enableProxy || !hasUpdatePermission}
helpText={t('help.proxyPortHelpText')}
helpText={t("help.proxyPortHelpText")}
/>
</div>
</div>
<div className="columns">
<div className="column is-half">
<InputField
label={t('proxy-settings.proxy-server')}
label={t("proxy-settings.proxy-server")}
value={proxyServer}
onChange={this.handleProxyServerChange}
disabled={!enableProxy || !hasUpdatePermission}
helpText={t('help.proxyServerHelpText')}
helpText={t("help.proxyServerHelpText")}
/>
</div>
<div className="column is-half">
<InputField
label={t('proxy-settings.proxy-user')}
label={t("proxy-settings.proxy-user")}
value={proxyUser}
onChange={this.handleProxyUserChange}
disabled={!enableProxy || !hasUpdatePermission}
helpText={t('help.proxyUserHelpText')}
helpText={t("help.proxyUserHelpText")}
/>
</div>
</div>
@@ -100,9 +100,9 @@ class ProxySettings extends React.Component<Props> {
<AddEntryToTableField
addEntry={this.addProxyExclude}
disabled={!enableProxy || !hasUpdatePermission}
buttonLabel={t('proxy-settings.add-proxy-exclude-button')}
fieldLabel={t('proxy-settings.add-proxy-exclude-textfield')}
errorMessage={t('proxy-settings.add-proxy-exclude-error')}
buttonLabel={t("proxy-settings.add-proxy-exclude-button")}
fieldLabel={t("proxy-settings.add-proxy-exclude-textfield")}
errorMessage={t("proxy-settings.add-proxy-exclude-error")}
/>
</div>
</div>
@@ -111,19 +111,19 @@ class ProxySettings extends React.Component<Props> {
}
handleProxyPasswordChange = (value: string) => {
this.props.onChange(true, value, 'proxyPassword');
this.props.onChange(true, value, "proxyPassword");
};
handleProxyPortChange = (value: string) => {
this.props.onChange(true, value, 'proxyPort');
this.props.onChange(true, value, "proxyPort");
};
handleProxyServerChange = (value: string) => {
this.props.onChange(true, value, 'proxyServer');
this.props.onChange(true, value, "proxyServer");
};
handleProxyUserChange = (value: string) => {
this.props.onChange(true, value, 'proxyUser');
this.props.onChange(true, value, "proxyUser");
};
handleEnableProxyChange = (value: string) => {
this.props.onChange(true, value, 'enableProxy');
this.props.onChange(true, value, "enableProxy");
};
addProxyExclude = (proxyExcludeName: string) => {
@@ -133,7 +133,7 @@ class ProxySettings extends React.Component<Props> {
this.props.onChange(
true,
[...this.props.proxyExcludes, proxyExcludeName],
'proxyExcludes',
"proxyExcludes"
);
};
@@ -142,4 +142,4 @@ class ProxySettings extends React.Component<Props> {
};
}
export default translate('config')(ProxySettings);
export default translate("config")(ProxySettings);

View File

@@ -1,8 +1,8 @@
import React from 'react';
import React from "react";
import {
RemoveEntryOfTableButton,
LabelWithHelpIcon,
} from '@scm-manager/ui-components';
LabelWithHelpIcon
} from "@scm-manager/ui-components";
type Props = {
items: string[];

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate } from 'react-i18next';
import ArrayConfigTable from './ArrayConfigTable';
import React from "react";
import { translate } from "react-i18next";
import ArrayConfigTable from "./ArrayConfigTable";
type Props = {
proxyExcludes: string[];
@@ -17,18 +17,18 @@ class ProxyExcludesTable extends React.Component<Props, State> {
return (
<ArrayConfigTable
items={proxyExcludes}
label={t('proxy-settings.proxy-excludes')}
removeLabel={t('proxy-settings.remove-proxy-exclude-button')}
label={t("proxy-settings.proxy-excludes")}
removeLabel={t("proxy-settings.remove-proxy-exclude-button")}
onRemove={this.removeEntry}
disabled={disabled}
helpText={t('help.proxyExcludesHelpText')}
helpText={t("help.proxyExcludesHelpText")}
/>
);
}
removeEntry = (newExcludes: string[]) => {
this.props.onChange(true, newExcludes, 'proxyExcludes');
this.props.onChange(true, newExcludes, "proxyExcludes");
};
}
export default translate('config')(ProxyExcludesTable);
export default translate("config")(ProxyExcludesTable);

View File

@@ -1,29 +1,29 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Redirect, Route, Switch } from 'react-router-dom';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
import { History } from 'history';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Links } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import { Redirect, Route, Switch } from "react-router-dom";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { History } from "history";
import { connect } from "react-redux";
import { compose } from "redux";
import { Links } from "@scm-manager/ui-types";
import {
Page,
Navigation,
NavLink,
Section,
SubNavigation,
} from '@scm-manager/ui-components';
SubNavigation
} from "@scm-manager/ui-components";
import {
getLinks,
getAvailablePluginsLink,
getInstalledPluginsLink,
} from '../../modules/indexResource';
import AdminDetails from './AdminDetails';
import PluginsOverview from '../plugins/containers/PluginsOverview';
import GlobalConfig from './GlobalConfig';
import RepositoryRoles from '../roles/containers/RepositoryRoles';
import SingleRepositoryRole from '../roles/containers/SingleRepositoryRole';
import CreateRepositoryRole from '../roles/containers/CreateRepositoryRole';
getInstalledPluginsLink
} from "../../modules/indexResource";
import AdminDetails from "./AdminDetails";
import PluginsOverview from "../plugins/containers/PluginsOverview";
import GlobalConfig from "./GlobalConfig";
import RepositoryRoles from "../roles/containers/RepositoryRoles";
import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole";
import CreateRepositoryRole from "../roles/containers/CreateRepositoryRole";
type Props = {
links: Links;
@@ -38,8 +38,8 @@ type Props = {
class Admin extends React.Component<Props> {
stripEndingSlash = (url: string) => {
if (url.endsWith('/')) {
if (url.includes('role')) {
if (url.endsWith("/")) {
if (url.includes("role")) {
return url.substring(0, url.length - 2);
}
return url.substring(0, url.length - 1);
@@ -63,7 +63,7 @@ class Admin extends React.Component<Props> {
const url = this.matchedUrl();
const extensionProps = {
links,
url,
url
};
return (
@@ -157,28 +157,28 @@ class Admin extends React.Component<Props> {
</div>
<div className="column is-one-quarter">
<Navigation>
<Section label={t('admin.menu.navigationLabel')}>
<Section label={t("admin.menu.navigationLabel")}>
<NavLink
to={`${url}/info`}
icon="fas fa-info-circle"
label={t('admin.menu.informationNavLink')}
label={t("admin.menu.informationNavLink")}
/>
{(availablePluginsLink || installedPluginsLink) && (
<SubNavigation
to={`${url}/plugins/`}
icon="fas fa-puzzle-piece"
label={t('plugins.menu.pluginsNavLink')}
label={t("plugins.menu.pluginsNavLink")}
>
{installedPluginsLink && (
<NavLink
to={`${url}/plugins/installed/`}
label={t('plugins.menu.installedNavLink')}
label={t("plugins.menu.installedNavLink")}
/>
)}
{availablePluginsLink && (
<NavLink
to={`${url}/plugins/available/`}
label={t('plugins.menu.availableNavLink')}
label={t("plugins.menu.availableNavLink")}
/>
)}
</SubNavigation>
@@ -186,7 +186,7 @@ class Admin extends React.Component<Props> {
<NavLink
to={`${url}/roles/`}
icon="fas fa-user-shield"
label={t('repositoryRole.navLink')}
label={t("repositoryRole.navLink")}
activeWhenMatch={this.matchesRoles}
activeOnlyWhenExact={false}
/>
@@ -197,11 +197,11 @@ class Admin extends React.Component<Props> {
/>
<SubNavigation
to={`${url}/settings/general`}
label={t('admin.menu.settingsNavLink')}
label={t("admin.menu.settingsNavLink")}
>
<NavLink
to={`${url}/settings/general`}
label={t('admin.menu.generalNavLink')}
label={t("admin.menu.generalNavLink")}
/>
<ExtensionPoint
name="admin.setting"
@@ -225,11 +225,11 @@ const mapStateToProps = (state: any) => {
return {
links,
availablePluginsLink,
installedPluginsLink,
installedPluginsLink
};
};
export default compose(
connect(mapStateToProps),
translate('admin'),
translate("admin")
)(Admin);

View File

@@ -1,9 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import styled from 'styled-components';
import { Image, Loading, Subtitle, Title } from '@scm-manager/ui-components';
import { getAppVersion } from '../../modules/indexResource';
import React from "react";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import styled from "styled-components";
import { Image, Loading, Subtitle, Title } from "@scm-manager/ui-components";
import { getAppVersion } from "../../modules/indexResource";
type Props = {
loading: boolean;
@@ -33,28 +33,28 @@ class AdminDetails extends React.Component<Props> {
return (
<>
<Title title={t('admin.info.currentAppVersion')} />
<Title title={t("admin.info.currentAppVersion")} />
<Subtitle subtitle={this.props.version} />
<BoxShadowBox className="box">
<article className="media">
<ImageWrapper className="media-left">
<Image
src="/images/iconCommunitySupport.png"
alt={t('admin.info.communityIconAlt')}
alt={t("admin.info.communityIconAlt")}
/>
</ImageWrapper>
<div className="media-content">
<div className="content">
<h3 className="has-text-weight-medium">
{t('admin.info.communityTitle')}
{t("admin.info.communityTitle")}
</h3>
<p>{t('admin.info.communityInfo')}</p>
<p>{t("admin.info.communityInfo")}</p>
<a
className="button is-info is-pulled-right"
target="_blank"
href="https://scm-manager.org/support/"
>
{t('admin.info.communityButton')}
{t("admin.info.communityButton")}
</a>
</div>
</div>
@@ -65,25 +65,25 @@ class AdminDetails extends React.Component<Props> {
<ImageWrapper className="media-left">
<Image
src="/images/iconEnterpriseSupport.png"
alt={t('admin.info.enterpriseIconAlt')}
alt={t("admin.info.enterpriseIconAlt")}
/>
</ImageWrapper>
<div className="media-content">
<div className="content">
<h3 className="has-text-weight-medium">
{t('admin.info.enterpriseTitle')}
{t("admin.info.enterpriseTitle")}
</h3>
<p>
{t('admin.info.enterpriseInfo')}
{t("admin.info.enterpriseInfo")}
<br />
<strong>{t('admin.info.enterprisePartner')}</strong>
<strong>{t("admin.info.enterprisePartner")}</strong>
</p>
<a
className="button is-info is-pulled-right is-normal"
target="_blank"
href={t('admin.info.enterpriseLink')}
href={t("admin.info.enterpriseLink")}
>
{t('admin.info.enterpriseButton')}
{t("admin.info.enterpriseButton")}
</a>
</div>
</div>
@@ -97,8 +97,8 @@ class AdminDetails extends React.Component<Props> {
const mapStateToProps = (state: any) => {
const version = getAppVersion(state);
return {
version,
version
};
};
export default connect(mapStateToProps)(translate('admin')(AdminDetails));
export default connect(mapStateToProps)(translate("admin")(AdminDetails));

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Title, Loading, ErrorNotification } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { Title, Loading, ErrorNotification } from "@scm-manager/ui-components";
import {
fetchConfig,
getFetchConfigFailure,
@@ -10,18 +10,18 @@ import {
isModifyConfigPending,
getConfigUpdatePermission,
getModifyConfigFailure,
modifyConfigReset,
} from '../modules/config';
import { connect } from 'react-redux';
import { Config, NamespaceStrategies } from '@scm-manager/ui-types';
import ConfigForm from '../components/form/ConfigForm';
import { getConfigLink } from '../../modules/indexResource';
modifyConfigReset
} from "../modules/config";
import { connect } from "react-redux";
import { Config, NamespaceStrategies } from "@scm-manager/ui-types";
import ConfigForm from "../components/form/ConfigForm";
import { getConfigLink } from "../../modules/indexResource";
import {
fetchNamespaceStrategiesIfNeeded,
getFetchNamespaceStrategiesFailure,
getNamespaceStrategies,
isFetchNamespaceStrategiesPending,
} from '../modules/namespaceStrategies';
isFetchNamespaceStrategiesPending
} from "../modules/namespaceStrategies";
type Props = {
loading: boolean;
@@ -52,7 +52,7 @@ class GlobalConfig extends React.Component<Props, State> {
this.state = {
configReadPermission: true,
configChanged: false,
configChanged: false
};
}
@@ -63,7 +63,7 @@ class GlobalConfig extends React.Component<Props, State> {
this.props.fetchConfig(this.props.configLink);
} else {
this.setState({
configReadPermission: false,
configReadPermission: false
});
}
}
@@ -71,7 +71,7 @@ class GlobalConfig extends React.Component<Props, State> {
modifyConfig = (config: Config) => {
this.props.modifyConfig(config);
this.setState({
configChanged: true,
configChanged: true
});
};
@@ -83,11 +83,11 @@ class GlobalConfig extends React.Component<Props, State> {
className="delete"
onClick={() =>
this.setState({
configChanged: false,
configChanged: false
})
}
/>
{this.props.t('config.form.submit-success-notification')}
{this.props.t("config.form.submit-success-notification")}
</div>
);
}
@@ -103,7 +103,7 @@ class GlobalConfig extends React.Component<Props, State> {
return (
<div>
<Title title={t('config.title')} />
<Title title={t("config.title")} />
{this.renderError()}
{this.renderContent()}
</div>
@@ -124,7 +124,7 @@ class GlobalConfig extends React.Component<Props, State> {
loading,
config,
configUpdatePermission,
namespaceStrategies,
namespaceStrategies
} = this.props;
const { configReadPermission } = this.state;
if (!error) {
@@ -159,7 +159,7 @@ const mapDispatchToProps = dispatch => {
},
fetchNamespaceStrategiesIfNeeded: () => {
dispatch(fetchNamespaceStrategiesIfNeeded());
},
}
};
};
@@ -184,11 +184,11 @@ const mapStateToProps = state => {
config,
configUpdatePermission,
configLink,
namespaceStrategies,
namespaceStrategies
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('config')(GlobalConfig));
mapDispatchToProps
)(translate("config")(GlobalConfig));

View File

@@ -1,6 +1,6 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'fetch-mock';
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import fetchMock from "fetch-mock";
import reducer, {
FETCH_CONFIG,
@@ -19,118 +19,118 @@ import reducer, {
isModifyConfigPending,
getModifyConfigFailure,
getConfig,
getConfigUpdatePermission,
} from './config';
getConfigUpdatePermission
} from "./config";
const CONFIG_URL = '/config';
const URL = '/api/v2' + CONFIG_URL;
const CONFIG_URL = "/config";
const URL = "/api/v2" + CONFIG_URL;
const error = new Error('You have an error!');
const error = new Error("You have an error!");
const config = {
proxyPassword: null,
proxyPort: 8080,
proxyServer: 'proxy.mydomain.com',
proxyServer: "proxy.mydomain.com",
proxyUser: null,
enableProxy: false,
realmDescription: 'SONIA :: SCM Manager',
realmDescription: "SONIA :: SCM Manager",
disableGroupingGrid: false,
dateFormat: 'YYYY-MM-DD HH:mm:ss',
dateFormat: "YYYY-MM-DD HH:mm:ss",
anonymousAccessEnabled: false,
adminGroups: [],
adminUsers: [],
baseUrl: 'http://localhost:8081',
baseUrl: "http://localhost:8081",
forceBaseUrl: false,
loginAttemptLimit: -1,
proxyExcludes: [],
skipFailedAuthenticators: false,
pluginUrl:
'http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false',
"http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false",
loginAttemptLimitTimeout: 300,
enabledXsrfProtection: true,
namespaceStrategy: 'UsernameNamespaceStrategy',
namespaceStrategy: "UsernameNamespaceStrategy",
_links: {
self: {
href: 'http://localhost:8081/api/v2/config',
href: "http://localhost:8081/api/v2/config"
},
update: {
href: 'http://localhost:8081/api/v2/config',
},
},
href: "http://localhost:8081/api/v2/config"
}
}
};
const configWithNullValues = {
proxyPassword: null,
proxyPort: 8080,
proxyServer: 'proxy.mydomain.com',
proxyServer: "proxy.mydomain.com",
proxyUser: null,
enableProxy: false,
realmDescription: 'SONIA :: SCM Manager',
realmDescription: "SONIA :: SCM Manager",
disableGroupingGrid: false,
dateFormat: 'YYYY-MM-DD HH:mm:ss',
dateFormat: "YYYY-MM-DD HH:mm:ss",
anonymousAccessEnabled: false,
adminGroups: null,
adminUsers: null,
baseUrl: 'http://localhost:8081',
baseUrl: "http://localhost:8081",
forceBaseUrl: false,
loginAttemptLimit: -1,
proxyExcludes: null,
skipFailedAuthenticators: false,
pluginUrl:
'http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false',
"http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false",
loginAttemptLimitTimeout: 300,
enabledXsrfProtection: true,
namespaceStrategy: 'UsernameNamespaceStrategy',
namespaceStrategy: "UsernameNamespaceStrategy",
_links: {
self: {
href: 'http://localhost:8081/api/v2/config',
href: "http://localhost:8081/api/v2/config"
},
update: {
href: 'http://localhost:8081/api/v2/config',
},
},
href: "http://localhost:8081/api/v2/config"
}
}
};
const responseBody = {
entries: config,
configUpdatePermission: false,
configUpdatePermission: false
};
const response = {
headers: {
'content-type': 'application/json',
"content-type": "application/json"
},
responseBody,
responseBody
};
describe('config fetch()', () => {
describe("config fetch()", () => {
const mockStore = configureMockStore([thunk]);
afterEach(() => {
fetchMock.reset();
fetchMock.restore();
});
it('should successfully fetch config', () => {
it("should successfully fetch config", () => {
fetchMock.getOnce(URL, response);
const expectedActions = [
{
type: FETCH_CONFIG_PENDING,
type: FETCH_CONFIG_PENDING
},
{
type: FETCH_CONFIG_SUCCESS,
payload: response,
},
payload: response
}
];
const store = mockStore({
indexResources: {
links: {
config: {
href: CONFIG_URL,
},
},
},
href: CONFIG_URL
}
}
}
});
return store.dispatch(fetchConfig(CONFIG_URL)).then(() => {
@@ -138,19 +138,19 @@ describe('config fetch()', () => {
});
});
it('should fail getting config on HTTP 500', () => {
it("should fail getting config on HTTP 500", () => {
fetchMock.getOnce(URL, {
status: 500,
status: 500
});
const store = mockStore({
indexResources: {
links: {
config: {
href: CONFIG_URL,
},
},
},
href: CONFIG_URL
}
}
}
});
return store.dispatch(fetchConfig(CONFIG_URL)).then(() => {
const actions = store.getActions();
@@ -160,9 +160,9 @@ describe('config fetch()', () => {
});
});
it('should successfully modify config', () => {
fetchMock.putOnce('http://localhost:8081/api/v2/config', {
status: 204,
it("should successfully modify config", () => {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 204
});
const store = mockStore({});
@@ -175,9 +175,9 @@ describe('config fetch()', () => {
});
});
it('should call the callback after modifying config', () => {
fetchMock.putOnce('http://localhost:8081/api/v2/config', {
status: 204,
it("should call the callback after modifying config", () => {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 204
});
let called = false;
@@ -194,9 +194,9 @@ describe('config fetch()', () => {
});
});
it('should fail modifying config on HTTP 500', () => {
fetchMock.putOnce('http://localhost:8081/api/v2/config', {
status: 500,
it("should fail modifying config on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 500
});
const store = mockStore({});
@@ -210,28 +210,28 @@ describe('config fetch()', () => {
});
});
describe('config reducer', () => {
it('should update state correctly according to FETCH_CONFIG_SUCCESS action', () => {
describe("config reducer", () => {
it("should update state correctly according to FETCH_CONFIG_SUCCESS action", () => {
const newState = reducer({}, fetchConfigSuccess(config));
expect(newState).toEqual({
entries: config,
configUpdatePermission: true,
configUpdatePermission: true
});
});
it('should set configUpdatePermission to true if update link is present', () => {
it("should set configUpdatePermission to true if update link is present", () => {
const newState = reducer({}, fetchConfigSuccess(config));
expect(newState.configUpdatePermission).toBeTruthy();
});
it('should update state according to FETCH_CONFIG_SUCCESS action', () => {
it("should update state according to FETCH_CONFIG_SUCCESS action", () => {
const newState = reducer({}, fetchConfigSuccess(config));
expect(newState.entries).toBe(config);
});
it('should return empty arrays for null values', () => {
it("should return empty arrays for null values", () => {
// $FlowFixMe
const config = reducer({}, fetchConfigSuccess(configWithNullValues))
.entries;
@@ -241,73 +241,73 @@ describe('config reducer', () => {
});
});
describe('selector tests', () => {
it('should return true, when fetch config is pending', () => {
describe("selector tests", () => {
it("should return true, when fetch config is pending", () => {
const state = {
pending: {
[FETCH_CONFIG]: true,
},
[FETCH_CONFIG]: true
}
};
expect(isFetchConfigPending(state)).toEqual(true);
});
it('should return false, when fetch config is not pending', () => {
it("should return false, when fetch config is not pending", () => {
expect(isFetchConfigPending({})).toEqual(false);
});
it('should return error when fetch config did fail', () => {
it("should return error when fetch config did fail", () => {
const state = {
failure: {
[FETCH_CONFIG]: error,
},
[FETCH_CONFIG]: error
}
};
expect(getFetchConfigFailure(state)).toEqual(error);
});
it('should return undefined when fetch config did not fail', () => {
it("should return undefined when fetch config did not fail", () => {
expect(getFetchConfigFailure({})).toBe(undefined);
});
it('should return true, when modify group is pending', () => {
it("should return true, when modify group is pending", () => {
const state = {
pending: {
[MODIFY_CONFIG]: true,
},
[MODIFY_CONFIG]: true
}
};
expect(isModifyConfigPending(state)).toEqual(true);
});
it('should return false, when modify config is not pending', () => {
it("should return false, when modify config is not pending", () => {
expect(isModifyConfigPending({})).toEqual(false);
});
it('should return error when modify config did fail', () => {
it("should return error when modify config did fail", () => {
const state = {
failure: {
[MODIFY_CONFIG]: error,
},
[MODIFY_CONFIG]: error
}
};
expect(getModifyConfigFailure(state)).toEqual(error);
});
it('should return undefined when modify config did not fail', () => {
it("should return undefined when modify config did not fail", () => {
expect(getModifyConfigFailure({})).toBe(undefined);
});
it('should return config', () => {
it("should return config", () => {
const state = {
config: {
entries: config,
},
entries: config
}
};
expect(getConfig(state)).toEqual(config);
});
it('should return configUpdatePermission', () => {
it("should return configUpdatePermission", () => {
const state = {
config: {
configUpdatePermission: true,
},
configUpdatePermission: true
}
};
expect(getConfigUpdatePermission(state)).toEqual(true);
});

View File

@@ -1,23 +1,23 @@
import { apiClient } from '@scm-manager/ui-components';
import * as types from '../../modules/types';
import { Action } from '@scm-manager/ui-types';
import { isPending } from '../../modules/pending';
import { getFailure } from '../../modules/failure';
import { Dispatch } from 'redux';
import { Config } from '@scm-manager/ui-types';
import { apiClient } from "@scm-manager/ui-components";
import * as types from "../../modules/types";
import { Action } from "@scm-manager/ui-types";
import { isPending } from "../../modules/pending";
import { getFailure } from "../../modules/failure";
import { Dispatch } from "redux";
import { Config } from "@scm-manager/ui-types";
export const FETCH_CONFIG = 'scm/config/FETCH_CONFIG';
export const FETCH_CONFIG = "scm/config/FETCH_CONFIG";
export const FETCH_CONFIG_PENDING = `${FETCH_CONFIG}_${types.PENDING_SUFFIX}`;
export const FETCH_CONFIG_SUCCESS = `${FETCH_CONFIG}_${types.SUCCESS_SUFFIX}`;
export const FETCH_CONFIG_FAILURE = `${FETCH_CONFIG}_${types.FAILURE_SUFFIX}`;
export const MODIFY_CONFIG = 'scm/config/MODIFY_CONFIG';
export const MODIFY_CONFIG = "scm/config/MODIFY_CONFIG";
export const MODIFY_CONFIG_PENDING = `${MODIFY_CONFIG}_${types.PENDING_SUFFIX}`;
export const MODIFY_CONFIG_SUCCESS = `${MODIFY_CONFIG}_${types.SUCCESS_SUFFIX}`;
export const MODIFY_CONFIG_FAILURE = `${MODIFY_CONFIG}_${types.FAILURE_SUFFIX}`;
export const MODIFY_CONFIG_RESET = `${MODIFY_CONFIG}_${types.RESET_SUFFIX}`;
const CONTENT_TYPE_CONFIG = 'application/vnd.scmm-config+json;v=2';
const CONTENT_TYPE_CONFIG = "application/vnd.scmm-config+json;v=2";
//fetch config
export function fetchConfig(link: string) {
@@ -39,14 +39,14 @@ export function fetchConfig(link: string) {
export function fetchConfigPending(): Action {
return {
type: FETCH_CONFIG_PENDING,
type: FETCH_CONFIG_PENDING
};
}
export function fetchConfigSuccess(config: Config): Action {
return {
type: FETCH_CONFIG_SUCCESS,
payload: config,
payload: config
};
}
@@ -54,8 +54,8 @@ export function fetchConfigFailure(error: Error): Action {
return {
type: FETCH_CONFIG_FAILURE,
payload: {
error,
},
error
}
};
}
@@ -80,14 +80,14 @@ export function modifyConfig(config: Config, callback?: () => void) {
export function modifyConfigPending(config: Config): Action {
return {
type: MODIFY_CONFIG_PENDING,
payload: config,
payload: config
};
}
export function modifyConfigSuccess(config: Config): Action {
return {
type: MODIFY_CONFIG_SUCCESS,
payload: config,
payload: config
};
}
@@ -96,14 +96,14 @@ export function modifyConfigFailure(config: Config, error: Error): Action {
type: MODIFY_CONFIG_FAILURE,
payload: {
error,
config,
},
config
}
};
}
export function modifyConfigReset() {
return {
type: MODIFY_CONFIG_RESET,
type: MODIFY_CONFIG_RESET
};
}
@@ -130,7 +130,7 @@ function reducer(state: any = {}, action: any = {}) {
return {
...state,
entries: config,
configUpdatePermission: action.payload._links.update ? true : false,
configUpdatePermission: action.payload._links.update ? true : false
};
default:
return state;

View File

@@ -1,6 +1,6 @@
import fetchMock from 'fetch-mock';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from "fetch-mock";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import {
FETCH_NAMESPACESTRATEGIES_TYPES,
FETCH_NAMESPACESTRATEGIES_TYPES_FAILURE,
@@ -12,67 +12,67 @@ import {
default as reducer,
getNamespaceStrategies,
isFetchNamespaceStrategiesPending,
getFetchNamespaceStrategiesFailure,
} from './namespaceStrategies';
import { MODIFY_CONFIG_SUCCESS } from './config';
getFetchNamespaceStrategiesFailure
} from "./namespaceStrategies";
import { MODIFY_CONFIG_SUCCESS } from "./config";
const strategies = {
current: 'UsernameNamespaceStrategy',
current: "UsernameNamespaceStrategy",
available: [
'UsernameNamespaceStrategy',
'CustomNamespaceStrategy',
'CurrentYearNamespaceStrategy',
'RepositoryTypeNamespaceStrategy',
"UsernameNamespaceStrategy",
"CustomNamespaceStrategy",
"CurrentYearNamespaceStrategy",
"RepositoryTypeNamespaceStrategy"
],
_links: {
self: {
href: 'http://localhost:8081/scm/api/v2/namespaceStrategies',
},
},
href: "http://localhost:8081/scm/api/v2/namespaceStrategies"
}
}
};
describe('namespace strategy caching', () => {
it('should fetch strategies, on empty state', () => {
describe("namespace strategy caching", () => {
it("should fetch strategies, on empty state", () => {
expect(shouldFetchNamespaceStrategies({})).toBe(true);
});
it('should fetch strategies, on empty namespaceStrategies node', () => {
it("should fetch strategies, on empty namespaceStrategies node", () => {
const state = {
namespaceStrategies: {},
namespaceStrategies: {}
};
expect(shouldFetchNamespaceStrategies(state)).toBe(true);
});
it('should not fetch strategies, on pending state', () => {
it("should not fetch strategies, on pending state", () => {
const state = {
pending: {
[FETCH_NAMESPACESTRATEGIES_TYPES]: true,
},
[FETCH_NAMESPACESTRATEGIES_TYPES]: true
}
};
expect(shouldFetchNamespaceStrategies(state)).toBe(false);
});
it('should not fetch strategies, on failure state', () => {
it("should not fetch strategies, on failure state", () => {
const state = {
failure: {
[FETCH_NAMESPACESTRATEGIES_TYPES]: new Error('no...'),
},
[FETCH_NAMESPACESTRATEGIES_TYPES]: new Error("no...")
}
};
expect(shouldFetchNamespaceStrategies(state)).toBe(false);
});
it('should not fetch strategies, if they are already fetched', () => {
it("should not fetch strategies, if they are already fetched", () => {
const state = {
namespaceStrategies: {
current: 'some',
},
current: "some"
}
};
expect(shouldFetchNamespaceStrategies(state)).toBe(false);
});
});
describe('namespace strategies fetch', () => {
const URL = 'http://scm.hitchhiker.com/api/v2/namespaceStrategies';
describe("namespace strategies fetch", () => {
const URL = "http://scm.hitchhiker.com/api/v2/namespaceStrategies";
const mockStore = configureMockStore([thunk]);
afterEach(() => {
@@ -86,24 +86,24 @@ describe('namespace strategies fetch', () => {
indexResources: {
links: {
namespaceStrategies: {
href: URL,
},
},
},
href: URL
}
}
}
});
};
it('should successfully fetch strategies', () => {
it("should successfully fetch strategies", () => {
fetchMock.getOnce(URL, strategies);
const expectedActions = [
{
type: FETCH_NAMESPACESTRATEGIES_TYPES_PENDING,
type: FETCH_NAMESPACESTRATEGIES_TYPES_PENDING
},
{
type: FETCH_NAMESPACESTRATEGIES_TYPES_SUCCESS,
payload: strategies,
},
payload: strategies
}
];
const store = createStore();
@@ -112,9 +112,9 @@ describe('namespace strategies fetch', () => {
});
});
it('should dispatch FETCH_NAMESPACESTRATEGIES_TYPES_FAILURE on server error', () => {
it("should dispatch FETCH_NAMESPACESTRATEGIES_TYPES_FAILURE on server error", () => {
fetchMock.getOnce(URL, {
status: 500,
status: 500
});
const store = createStore();
@@ -126,75 +126,75 @@ describe('namespace strategies fetch', () => {
});
});
it('should not dispatch any action, if the strategies are already fetched', () => {
it("should not dispatch any action, if the strategies are already fetched", () => {
const store = createStore({
namespaceStrategies: strategies,
namespaceStrategies: strategies
});
store.dispatch(fetchNamespaceStrategiesIfNeeded());
expect(store.getActions().length).toBe(0);
});
});
describe('namespace strategies reducer', () => {
it('should return unmodified state on unknown action', () => {
describe("namespace strategies reducer", () => {
it("should return unmodified state on unknown action", () => {
const state = {};
expect(reducer(state)).toBe(state);
});
it('should store the strategies on success', () => {
it("should store the strategies on success", () => {
const newState = reducer({}, fetchNamespaceStrategiesSuccess(strategies));
expect(newState).toBe(strategies);
});
it('should clear store if config was modified', () => {
it("should clear store if config was modified", () => {
const modifyConfigAction = {
type: MODIFY_CONFIG_SUCCESS,
payload: {
namespaceStrategy: 'CustomNamespaceStrategy',
},
namespaceStrategy: "CustomNamespaceStrategy"
}
};
const newState = reducer(strategies, modifyConfigAction);
expect(newState.current).toEqual('CustomNamespaceStrategy');
expect(newState.current).toEqual("CustomNamespaceStrategy");
});
});
describe('namespace strategy selectors', () => {
const error = new Error('The end of the universe');
describe("namespace strategy selectors", () => {
const error = new Error("The end of the universe");
it('should return an empty object', () => {
it("should return an empty object", () => {
expect(getNamespaceStrategies({})).toEqual({});
});
it('should return the namespace strategies', () => {
it("should return the namespace strategies", () => {
const state = {
namespaceStrategies: strategies,
namespaceStrategies: strategies
};
expect(getNamespaceStrategies(state)).toBe(strategies);
});
it('should return true, when fetch namespace strategies is pending', () => {
it("should return true, when fetch namespace strategies is pending", () => {
const state = {
pending: {
[FETCH_NAMESPACESTRATEGIES_TYPES]: true,
},
[FETCH_NAMESPACESTRATEGIES_TYPES]: true
}
};
expect(isFetchNamespaceStrategiesPending(state)).toEqual(true);
});
it('should return false, when fetch strategies is not pending', () => {
it("should return false, when fetch strategies is not pending", () => {
expect(isFetchNamespaceStrategiesPending({})).toEqual(false);
});
it('should return error when fetch namespace strategies did fail', () => {
it("should return error when fetch namespace strategies did fail", () => {
const state = {
failure: {
[FETCH_NAMESPACESTRATEGIES_TYPES]: error,
},
[FETCH_NAMESPACESTRATEGIES_TYPES]: error
}
};
expect(getFetchNamespaceStrategiesFailure(state)).toEqual(error);
});
it('should return undefined when fetch strategies did not fail', () => {
it("should return undefined when fetch strategies did not fail", () => {
expect(getFetchNamespaceStrategiesFailure({})).toBe(undefined);
});
});

View File

@@ -1,12 +1,12 @@
import * as types from '../../modules/types';
import { Action, NamespaceStrategies } from '@scm-manager/ui-types';
import { apiClient } from '@scm-manager/ui-components';
import { isPending } from '../../modules/pending';
import { getFailure } from '../../modules/failure';
import { MODIFY_CONFIG_SUCCESS } from './config';
import * as types from "../../modules/types";
import { Action, NamespaceStrategies } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components";
import { isPending } from "../../modules/pending";
import { getFailure } from "../../modules/failure";
import { MODIFY_CONFIG_SUCCESS } from "./config";
export const FETCH_NAMESPACESTRATEGIES_TYPES =
'scm/config/FETCH_NAMESPACESTRATEGIES_TYPES';
"scm/config/FETCH_NAMESPACESTRATEGIES_TYPES";
export const FETCH_NAMESPACESTRATEGIES_TYPES_PENDING = `${FETCH_NAMESPACESTRATEGIES_TYPES}_${types.PENDING_SUFFIX}`;
export const FETCH_NAMESPACESTRATEGIES_TYPES_SUCCESS = `${FETCH_NAMESPACESTRATEGIES_TYPES}_${types.SUCCESS_SUFFIX}`;
export const FETCH_NAMESPACESTRATEGIES_TYPES_FAILURE = `${FETCH_NAMESPACESTRATEGIES_TYPES}_${types.FAILURE_SUFFIX}`;
@@ -17,7 +17,7 @@ export function fetchNamespaceStrategiesIfNeeded() {
if (shouldFetchNamespaceStrategies(state)) {
return fetchNamespaceStrategies(
dispatch,
state.indexResources.links.namespaceStrategies.href,
state.indexResources.links.namespaceStrategies.href
);
}
};
@@ -48,23 +48,23 @@ export function shouldFetchNamespaceStrategies(state: object) {
export function fetchNamespaceStrategiesPending(): Action {
return {
type: FETCH_NAMESPACESTRATEGIES_TYPES_PENDING,
type: FETCH_NAMESPACESTRATEGIES_TYPES_PENDING
};
}
export function fetchNamespaceStrategiesSuccess(
namespaceStrategies: NamespaceStrategies,
namespaceStrategies: NamespaceStrategies
): Action {
return {
type: FETCH_NAMESPACESTRATEGIES_TYPES_SUCCESS,
payload: namespaceStrategies,
payload: namespaceStrategies
};
}
export function fetchNamespaceStrategiesFailure(error: Error): Action {
return {
type: FETCH_NAMESPACESTRATEGIES_TYPES_FAILURE,
payload: error,
payload: error
};
}
@@ -73,8 +73,8 @@ export function fetchNamespaceStrategiesFailure(error: Error): Action {
export default function reducer(
state: object = {},
action: Action = {
type: 'UNKNOWN',
},
type: "UNKNOWN"
}
): object {
if (
action.type === FETCH_NAMESPACESTRATEGIES_TYPES_SUCCESS &&
@@ -85,7 +85,7 @@ export default function reducer(
const config = action.payload;
return {
...state,
current: config.namespaceStrategy,
current: config.namespaceStrategy
};
}
return state;

View File

@@ -1,8 +1,8 @@
import React from 'react';
import PluginActionModal from './PluginActionModal';
import { PendingPlugins } from '@scm-manager/ui-types';
import { apiClient } from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import React from "react";
import PluginActionModal from "./PluginActionModal";
import { PendingPlugins } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = {
onClose: () => void;
@@ -19,8 +19,8 @@ class CancelPendingActionModal extends React.Component<Props> {
return (
<PluginActionModal
description={t('plugins.modal.cancelPending')}
label={t('plugins.cancelPending')}
description={t("plugins.modal.cancelPending")}
label={t("plugins.cancelPending")}
onClose={onClose}
pendingPlugins={pendingPlugins}
execute={this.cancelPending}
@@ -37,4 +37,4 @@ class CancelPendingActionModal extends React.Component<Props> {
};
}
export default translate('admin')(CancelPendingActionModal);
export default translate("admin")(CancelPendingActionModal);

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { Button } from '@scm-manager/ui-components';
import { PendingPlugins } from '@scm-manager/ui-types';
import { translate } from 'react-i18next';
import ExecutePendingModal from './ExecutePendingModal';
import React from "react";
import { Button } from "@scm-manager/ui-components";
import { PendingPlugins } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import ExecutePendingModal from "./ExecutePendingModal";
type Props = {
pendingPlugins: PendingPlugins;
@@ -19,19 +19,19 @@ class ExecutePendingAction extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
showModal: false,
showModal: false
};
}
openModal = () => {
this.setState({
showModal: true,
showModal: true
});
};
closeModal = () => {
this.setState({
showModal: false,
showModal: false
});
};
@@ -56,7 +56,7 @@ class ExecutePendingAction extends React.Component<Props, State> {
{this.renderModal()}
<Button
color="primary"
label={t('plugins.executePending')}
label={t("plugins.executePending")}
action={this.openModal}
/>
</>
@@ -64,4 +64,4 @@ class ExecutePendingAction extends React.Component<Props, State> {
}
}
export default translate('admin')(ExecutePendingAction);
export default translate("admin")(ExecutePendingAction);

View File

@@ -1,9 +1,9 @@
import React from 'react';
import PluginActionModal from './PluginActionModal';
import { PendingPlugins } from '@scm-manager/ui-types';
import waitForRestart from './waitForRestart';
import { apiClient, Notification } from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import React from "react";
import PluginActionModal from "./PluginActionModal";
import { PendingPlugins } from "@scm-manager/ui-types";
import waitForRestart from "./waitForRestart";
import { apiClient, Notification } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = {
onClose: () => void;
@@ -19,14 +19,14 @@ class ExecutePendingActionModal extends React.Component<Props> {
return (
<PluginActionModal
description={t('plugins.modal.executePending')}
label={t('plugins.modal.executeAndRestart')}
description={t("plugins.modal.executePending")}
label={t("plugins.modal.executeAndRestart")}
onClose={onClose}
pendingPlugins={pendingPlugins}
execute={this.executeAndRestart}
>
<Notification type="warning">
{t('plugins.modal.restartNotification')}
{t("plugins.modal.restartNotification")}
</Notification>
</PluginActionModal>
);
@@ -40,4 +40,4 @@ class ExecutePendingActionModal extends React.Component<Props> {
};
}
export default translate('admin')(ExecutePendingActionModal);
export default translate("admin")(ExecutePendingActionModal);

View File

@@ -1,16 +1,16 @@
import React from 'react';
import React from "react";
import {
apiClient,
Button,
ButtonGroup,
ErrorNotification,
Modal,
Notification,
} from '@scm-manager/ui-components';
import { PendingPlugins } from '@scm-manager/ui-types';
import { translate } from 'react-i18next';
import waitForRestart from './waitForRestart';
import SuccessNotification from './SuccessNotification';
Notification
} from "@scm-manager/ui-components";
import { PendingPlugins } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import waitForRestart from "./waitForRestart";
import SuccessNotification from "./SuccessNotification";
type Props = {
onClose: () => void;
@@ -31,7 +31,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
super(props);
this.state = {
loading: false,
success: false,
success: false
};
}
@@ -45,7 +45,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
} else {
return (
<Notification type="warning">
{t('plugins.modal.restartNotification')}
{t("plugins.modal.restartNotification")}
</Notification>
);
}
@@ -54,7 +54,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
executeAndRestart = () => {
const { pendingPlugins } = this.props;
this.setState({
loading: true,
loading: true
});
apiClient
@@ -64,14 +64,14 @@ class ExecutePendingModal extends React.Component<Props, State> {
this.setState({
success: true,
loading: false,
error: undefined,
error: undefined
});
})
.catch(error => {
this.setState({
success: false,
loading: false,
error: error,
error: error
});
});
};
@@ -82,7 +82,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
<>
{pendingPlugins._embedded && pendingPlugins._embedded.new.length > 0 && (
<>
<strong>{t('plugins.modal.installQueue')}</strong>
<strong>{t("plugins.modal.installQueue")}</strong>
<ul>
{pendingPlugins._embedded.new.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -101,7 +101,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
{pendingPlugins._embedded &&
pendingPlugins._embedded.update.length > 0 && (
<>
<strong>{t('plugins.modal.updateQueue')}</strong>
<strong>{t("plugins.modal.updateQueue")}</strong>
<ul>
{pendingPlugins._embedded.update.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -120,7 +120,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
{pendingPlugins._embedded &&
pendingPlugins._embedded.uninstall.length > 0 && (
<>
<strong>{t('plugins.modal.uninstallQueue')}</strong>
<strong>{t("plugins.modal.uninstallQueue")}</strong>
<ul>
{pendingPlugins._embedded.uninstall.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -138,7 +138,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
<>
<div className="media">
<div className="content">
<p>{t('plugins.modal.executePending')}</p>
<p>{t("plugins.modal.executePending")}</p>
{this.renderInstallQueue()}
{this.renderUpdateQueue()}
{this.renderUninstallQueue()}
@@ -156,12 +156,12 @@ class ExecutePendingModal extends React.Component<Props, State> {
<ButtonGroup>
<Button
color="warning"
label={t('plugins.modal.executeAndRestart')}
label={t("plugins.modal.executeAndRestart")}
loading={loading}
action={this.executeAndRestart}
disabled={error || success}
/>
<Button label={t('plugins.modal.abort')} action={onClose} />
<Button label={t("plugins.modal.abort")} action={onClose} />
</ButtonGroup>
);
};
@@ -170,7 +170,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
const { onClose, t } = this.props;
return (
<Modal
title={t('plugins.modal.executeAndRestart')}
title={t("plugins.modal.executeAndRestart")}
closeFunction={onClose}
body={this.renderBody()}
footer={this.renderFooter()}
@@ -180,4 +180,4 @@ class ExecutePendingModal extends React.Component<Props, State> {
}
}
export default translate('admin')(ExecutePendingModal);
export default translate("admin")(ExecutePendingModal);

View File

@@ -1,13 +1,13 @@
import * as React from 'react';
import * as React from "react";
import {
Button,
ButtonGroup,
ErrorNotification,
Modal,
} from '@scm-manager/ui-components';
import { PendingPlugins, PluginCollection } from '@scm-manager/ui-types';
import { translate } from 'react-i18next';
import SuccessNotification from './SuccessNotification';
Modal
} from "@scm-manager/ui-components";
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import SuccessNotification from "./SuccessNotification";
type Props = {
onClose: () => void;
@@ -36,7 +36,7 @@ class PluginActionModal extends React.Component<Props, State> {
super(props);
this.state = {
loading: false,
success: false,
success: false
};
}
@@ -54,7 +54,7 @@ class PluginActionModal extends React.Component<Props, State> {
executeAction = () => {
this.setState({
loading: true,
loading: true
});
this.props
@@ -62,14 +62,14 @@ class PluginActionModal extends React.Component<Props, State> {
.then(() => {
this.setState({
success: true,
loading: false,
loading: false
});
})
.catch(error => {
this.setState({
success: false,
loading: false,
error: error,
error: error
});
});
};
@@ -93,7 +93,7 @@ class PluginActionModal extends React.Component<Props, State> {
installedPlugins._embedded &&
installedPlugins._embedded.plugins && (
<>
<strong>{t('plugins.modal.updateQueue')}</strong>
<strong>{t("plugins.modal.updateQueue")}</strong>
<ul>
{installedPlugins._embedded.plugins
.filter(plugin => plugin._links && plugin._links.update)
@@ -115,7 +115,7 @@ class PluginActionModal extends React.Component<Props, State> {
pendingPlugins._embedded &&
pendingPlugins._embedded.new.length > 0 && (
<>
<strong>{t('plugins.modal.installQueue')}</strong>
<strong>{t("plugins.modal.installQueue")}</strong>
<ul>
{pendingPlugins._embedded.new.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -135,7 +135,7 @@ class PluginActionModal extends React.Component<Props, State> {
pendingPlugins._embedded &&
pendingPlugins._embedded.update.length > 0 && (
<>
<strong>{t('plugins.modal.updateQueue')}</strong>
<strong>{t("plugins.modal.updateQueue")}</strong>
<ul>
{pendingPlugins._embedded.update.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -155,7 +155,7 @@ class PluginActionModal extends React.Component<Props, State> {
pendingPlugins._embedded &&
pendingPlugins._embedded.uninstall.length > 0 && (
<>
<strong>{t('plugins.modal.uninstallQueue')}</strong>
<strong>{t("plugins.modal.uninstallQueue")}</strong>
<ul>
{pendingPlugins._embedded.uninstall.map(plugin => (
<li key={plugin.name}>{plugin.name}</li>
@@ -193,7 +193,7 @@ class PluginActionModal extends React.Component<Props, State> {
action={this.executeAction}
disabled={error || success}
/>
<Button label={t('plugins.modal.abort')} action={onClose} />
<Button label={t("plugins.modal.abort")} action={onClose} />
</ButtonGroup>
);
};
@@ -212,4 +212,4 @@ class PluginActionModal extends React.Component<Props, State> {
}
}
export default translate('admin')(PluginActionModal);
export default translate("admin")(PluginActionModal);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
import { Plugin } from '@scm-manager/ui-types';
import { Image } from '@scm-manager/ui-components';
import React from "react";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { Plugin } from "@scm-manager/ui-types";
import { Image } from "@scm-manager/ui-components";
type Props = {
plugin: Plugin;
@@ -15,11 +15,11 @@ export default class PluginAvatar extends React.Component<Props> {
<ExtensionPoint
name="plugins.plugin-avatar"
props={{
plugin,
plugin
}}
>
<Image
src={plugin.avatarUrl ? plugin.avatarUrl : '/images/blib.jpg'}
src={plugin.avatarUrl ? plugin.avatarUrl : "/images/blib.jpg"}
alt="Logo"
/>
</ExtensionPoint>

View File

@@ -1,5 +1,5 @@
import * as React from 'react';
import styled from 'styled-components';
import * as React from "react";
import styled from "styled-components";
type Props = {
children?: React.Node;

View File

@@ -1,16 +1,16 @@
import React from 'react';
import { translate } from 'react-i18next';
import classNames from 'classnames';
import styled from 'styled-components';
import { Plugin } from '@scm-manager/ui-types';
import { CardColumn, Icon } from '@scm-manager/ui-components';
import PluginAvatar from './PluginAvatar';
import PluginModal from './PluginModal';
import React from "react";
import { translate } from "react-i18next";
import classNames from "classnames";
import styled from "styled-components";
import { Plugin } from "@scm-manager/ui-types";
import { CardColumn, Icon } from "@scm-manager/ui-components";
import PluginAvatar from "./PluginAvatar";
import PluginModal from "./PluginModal";
export const PluginAction = {
INSTALL: 'install',
UPDATE: 'update',
UNINSTALL: 'uninstall',
INSTALL: "install",
UPDATE: "update",
UNINSTALL: "uninstall"
};
type Props = {
@@ -53,7 +53,7 @@ class PluginEntry extends React.Component<Props, State> {
this.state = {
showInstallModal: false,
showUpdateModal: false,
showUninstallModal: false,
showUninstallModal: false
};
}
@@ -64,7 +64,7 @@ class PluginEntry extends React.Component<Props, State> {
toggleModal = (showModal: string) => {
const oldValue = this.state[showModal];
this.setState({
[showModal]: !oldValue,
[showModal]: !oldValue
});
};
@@ -96,10 +96,10 @@ class PluginEntry extends React.Component<Props, State> {
{this.isInstallable() && (
<IconWrapper
className="level-item"
onClick={() => this.toggleModal('showInstallModal')}
onClick={() => this.toggleModal("showInstallModal")}
>
<Icon
title={t('plugins.modal.install')}
title={t("plugins.modal.install")}
name="download"
color="info"
/>
@@ -108,10 +108,10 @@ class PluginEntry extends React.Component<Props, State> {
{this.isUninstallable() && (
<IconWrapper
className="level-item"
onClick={() => this.toggleModal('showUninstallModal')}
onClick={() => this.toggleModal("showUninstallModal")}
>
<Icon
title={t('plugins.modal.uninstall')}
title={t("plugins.modal.uninstall")}
name="trash"
color="info"
/>
@@ -120,10 +120,10 @@ class PluginEntry extends React.Component<Props, State> {
{this.isUpdatable() && (
<IconWrapper
className="level-item"
onClick={() => this.toggleModal('showUpdateModal')}
onClick={() => this.toggleModal("showUpdateModal")}
>
<Icon
title={t('plugins.modal.update')}
title={t("plugins.modal.update")}
name="sync-alt"
color="info"
/>
@@ -141,7 +141,7 @@ class PluginEntry extends React.Component<Props, State> {
plugin={plugin}
pluginAction={PluginAction.INSTALL}
refresh={refresh}
onClose={() => this.toggleModal('showInstallModal')}
onClose={() => this.toggleModal("showInstallModal")}
/>
);
} else if (this.state.showUpdateModal && this.isUpdatable()) {
@@ -150,7 +150,7 @@ class PluginEntry extends React.Component<Props, State> {
plugin={plugin}
pluginAction={PluginAction.UPDATE}
refresh={refresh}
onClose={() => this.toggleModal('showUpdateModal')}
onClose={() => this.toggleModal("showUpdateModal")}
/>
);
} else if (this.state.showUninstallModal && this.isUninstallable()) {
@@ -159,7 +159,7 @@ class PluginEntry extends React.Component<Props, State> {
plugin={plugin}
pluginAction={PluginAction.UNINSTALL}
refresh={refresh}
onClose={() => this.toggleModal('showUninstallModal')}
onClose={() => this.toggleModal("showUninstallModal")}
/>
);
} else {
@@ -173,7 +173,7 @@ class PluginEntry extends React.Component<Props, State> {
<Icon
className="fa-spin fa-lg"
name="spinner"
color={plugin.markedForUninstall ? 'danger' : 'info'}
color={plugin.markedForUninstall ? "danger" : "info"}
/>
);
};
@@ -191,7 +191,7 @@ class PluginEntry extends React.Component<Props, State> {
<CardColumn
action={
this.isInstallable()
? () => this.toggleModal('showInstallModal')
? () => this.toggleModal("showInstallModal")
: null
}
avatar={avatar}
@@ -210,4 +210,4 @@ class PluginEntry extends React.Component<Props, State> {
}
}
export default translate('admin')(PluginEntry);
export default translate("admin")(PluginEntry);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { CardColumnGroup } from '@scm-manager/ui-components';
import { PluginGroup } from '@scm-manager/ui-types';
import PluginEntry from './PluginEntry';
import React from "react";
import { CardColumnGroup } from "@scm-manager/ui-components";
import { PluginGroup } from "@scm-manager/ui-types";
import PluginEntry from "./PluginEntry";
type Props = {
group: PluginGroup;

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Plugin } from '@scm-manager/ui-types';
import PluginGroupEntry from '../components/PluginGroupEntry';
import groupByCategory from './groupByCategory';
import React from "react";
import { Plugin } from "@scm-manager/ui-types";
import PluginGroupEntry from "../components/PluginGroupEntry";
import groupByCategory from "./groupByCategory";
type Props = {
plugins: Plugin[];

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { translate } from 'react-i18next';
import classNames from 'classnames';
import styled from 'styled-components';
import { Plugin } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import classNames from "classnames";
import styled from "styled-components";
import { Plugin } from "@scm-manager/ui-types";
import {
apiClient,
Button,
@@ -10,11 +10,11 @@ import {
Checkbox,
ErrorNotification,
Modal,
Notification,
} from '@scm-manager/ui-components';
import waitForRestart from './waitForRestart';
import SuccessNotification from './SuccessNotification';
import { PluginAction } from './PluginEntry';
Notification
} from "@scm-manager/ui-components";
import waitForRestart from "./waitForRestart";
import SuccessNotification from "./SuccessNotification";
import { PluginAction } from "./PluginEntry";
type Props = {
plugin: Plugin;
@@ -36,7 +36,7 @@ type State = {
const ListParent = styled.div`
margin-right: 0;
min-width: ${props =>
props.pluginAction === PluginAction.INSTALL ? '5.5em' : '10em'};
props.pluginAction === PluginAction.INSTALL ? "5.5em" : "10em"};
text-align: left;
`;
@@ -50,7 +50,7 @@ class PluginModal extends React.Component<Props, State> {
this.state = {
loading: false,
restart: false,
success: false,
success: false
};
}
@@ -60,7 +60,7 @@ class PluginModal extends React.Component<Props, State> {
const newState = {
loading: false,
error: undefined,
error: undefined
};
if (restart) {
@@ -68,14 +68,14 @@ class PluginModal extends React.Component<Props, State> {
.then(() => {
this.setState({
...newState,
success: true,
success: true
});
})
.catch(error => {
this.setState({
loading: false,
success: false,
error,
error
});
});
} else {
@@ -90,7 +90,7 @@ class PluginModal extends React.Component<Props, State> {
const { plugin, pluginAction } = this.props;
const { restart } = this.state;
let pluginActionLink = '';
let pluginActionLink = "";
if (pluginAction === PluginAction.INSTALL) {
pluginActionLink = plugin._links.install.href;
@@ -99,12 +99,12 @@ class PluginModal extends React.Component<Props, State> {
} else if (pluginAction === PluginAction.UNINSTALL) {
pluginActionLink = plugin._links.uninstall.href;
}
return pluginActionLink + '?restart=' + restart.toString();
return pluginActionLink + "?restart=" + restart.toString();
};
handlePluginAction = (e: Event) => {
this.setState({
loading: true,
loading: true
});
e.preventDefault();
apiClient
@@ -114,7 +114,7 @@ class PluginModal extends React.Component<Props, State> {
this.setState({
loading: false,
success: false,
error: error,
error: error
});
});
};
@@ -123,10 +123,10 @@ class PluginModal extends React.Component<Props, State> {
const { pluginAction, onClose, t } = this.props;
const { loading, error, restart, success } = this.state;
let color = pluginAction === PluginAction.UNINSTALL ? 'warning' : 'primary';
let color = pluginAction === PluginAction.UNINSTALL ? "warning" : "primary";
let label = `plugins.modal.${pluginAction}`;
if (restart) {
color = 'warning';
color = "warning";
label = `plugins.modal.${pluginAction}AndRestart`;
}
return (
@@ -138,7 +138,7 @@ class PluginModal extends React.Component<Props, State> {
loading={loading}
disabled={!!error || success}
/>
<Button label={t('plugins.modal.abort')} action={onClose} />
<Button label={t("plugins.modal.abort")} action={onClose} />
</ButtonGroup>
);
};
@@ -151,7 +151,7 @@ class PluginModal extends React.Component<Props, State> {
dependencies = (
<div className="media">
<Notification type="warning">
<strong>{t('plugins.modal.dependencyNotification')}</strong>
<strong>{t("plugins.modal.dependencyNotification")}</strong>
<ul>
{plugin.dependencies.map((dependency, index) => {
return <li key={index}>{dependency}</li>;
@@ -183,7 +183,7 @@ class PluginModal extends React.Component<Props, State> {
return (
<div className="media">
<Notification type="warning">
{t('plugins.modal.restartNotification')}
{t("plugins.modal.restartNotification")}
</Notification>
</div>
);
@@ -193,7 +193,7 @@ class PluginModal extends React.Component<Props, State> {
handleRestartChange = (value: boolean) => {
this.setState({
restart: value,
restart: value
});
};
@@ -212,25 +212,25 @@ class PluginModal extends React.Component<Props, State> {
<div className="media-content">
<div className="field is-horizontal">
<ListParent
className={classNames('field-label', 'is-inline-flex')}
className={classNames("field-label", "is-inline-flex")}
pluginAction={pluginAction}
>
{t('plugins.modal.author')}:
{t("plugins.modal.author")}:
</ListParent>
<ListChild className={classNames('field-body', 'is-inline-flex')}>
<ListChild className={classNames("field-body", "is-inline-flex")}>
{plugin.author}
</ListChild>
</div>
{pluginAction === PluginAction.INSTALL && (
<div className="field is-horizontal">
<ListParent
className={classNames('field-label', 'is-inline-flex')}
className={classNames("field-label", "is-inline-flex")}
pluginAction={pluginAction}
>
{t('plugins.modal.version')}:
{t("plugins.modal.version")}:
</ListParent>
<ListChild
className={classNames('field-body', 'is-inline-flex')}
className={classNames("field-body", "is-inline-flex")}
>
{plugin.version}
</ListChild>
@@ -240,12 +240,12 @@ class PluginModal extends React.Component<Props, State> {
pluginAction === PluginAction.UNINSTALL) && (
<div className="field is-horizontal">
<ListParent
className={classNames('field-label', 'is-inline-flex')}
className={classNames("field-label", "is-inline-flex")}
>
{t('plugins.modal.currentVersion')}:
{t("plugins.modal.currentVersion")}:
</ListParent>
<ListChild
className={classNames('field-body', 'is-inline-flex')}
className={classNames("field-body", "is-inline-flex")}
>
{plugin.version}
</ListChild>
@@ -254,12 +254,12 @@ class PluginModal extends React.Component<Props, State> {
{pluginAction === PluginAction.UPDATE && (
<div className="field is-horizontal">
<ListParent
className={classNames('field-label', 'is-inline-flex')}
className={classNames("field-label", "is-inline-flex")}
>
{t('plugins.modal.newVersion')}:
{t("plugins.modal.newVersion")}:
</ListParent>
<ListChild
className={classNames('field-body', 'is-inline-flex')}
className={classNames("field-body", "is-inline-flex")}
>
{plugin.newVersion}
</ListChild>
@@ -272,7 +272,7 @@ class PluginModal extends React.Component<Props, State> {
<div className="media-content">
<Checkbox
checked={restart}
label={t('plugins.modal.restart')}
label={t("plugins.modal.restart")}
onChange={this.handleRestartChange}
disabled={false}
/>
@@ -285,7 +285,7 @@ class PluginModal extends React.Component<Props, State> {
return (
<Modal
title={t(`plugins.modal.title.${pluginAction}`, {
name: plugin.displayName ? plugin.displayName : plugin.name,
name: plugin.displayName ? plugin.displayName : plugin.name
})}
closeFunction={() => onClose()}
body={body}
@@ -296,4 +296,4 @@ class PluginModal extends React.Component<Props, State> {
}
}
export default translate('admin')(PluginModal);
export default translate("admin")(PluginModal);

View File

@@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import styled from 'styled-components';
import * as React from "react";
import classNames from "classnames";
import styled from "styled-components";
type Props = {
children?: React.Node;
@@ -17,10 +17,10 @@ export default class PluginTopActions extends React.Component<Props> {
return (
<ChildWrapper
className={classNames(
'column',
'is-flex',
'is-one-fifths',
'is-mobile-action-spacing',
"column",
"is-flex",
"is-one-fifths",
"is-mobile-action-spacing"
)}
>
{children}

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Notification } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { Notification } from "@scm-manager/ui-components";
type Props = {
// context props
@@ -12,13 +12,13 @@ class InstallSuccessNotification extends React.Component<Props> {
const { t } = this.props;
return (
<Notification type="success">
{t('plugins.modal.successNotification')}{' '}
{t("plugins.modal.successNotification")}{" "}
<a onClick={e => window.location.reload(true)}>
{t('plugins.modal.reload')}
{t("plugins.modal.reload")}
</a>
</Notification>
);
}
}
export default translate('admin')(InstallSuccessNotification);
export default translate("admin")(InstallSuccessNotification);

View File

@@ -1,8 +1,8 @@
import React from 'react';
import PluginActionModal from './PluginActionModal';
import { PluginCollection } from '@scm-manager/ui-types';
import { apiClient } from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import React from "react";
import PluginActionModal from "./PluginActionModal";
import { PluginCollection } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = {
onClose: () => void;
@@ -19,8 +19,8 @@ class UpdateAllActionModal extends React.Component<Props> {
return (
<PluginActionModal
description={t('plugins.modal.updateAll')}
label={t('plugins.updateAll')}
description={t("plugins.modal.updateAll")}
label={t("plugins.updateAll")}
onClose={onClose}
installedPlugins={installedPlugins}
execute={this.updateAll}
@@ -37,4 +37,4 @@ class UpdateAllActionModal extends React.Component<Props> {
};
}
export default translate('admin')(UpdateAllActionModal);
export default translate("admin")(UpdateAllActionModal);

View File

@@ -1,4 +1,4 @@
import { Plugin, PluginGroup } from '@scm-manager/ui-types';
import { Plugin, PluginGroup } from "@scm-manager/ui-types";
export default function groupByCategory(plugins: Plugin[]): PluginGroup[] {
let groups = {};
@@ -9,7 +9,7 @@ export default function groupByCategory(plugins: Plugin[]): PluginGroup[] {
if (!group) {
group = {
name: groupName,
plugins: [],
plugins: []
};
groups[groupName] = group;
}

View File

@@ -1,4 +1,4 @@
import { apiClient } from '@scm-manager/ui-components';
import { apiClient } from "@scm-manager/ui-components";
const waitForRestart = () => {
const endTime = Number(new Date()) + 10000;
@@ -11,13 +11,13 @@ const waitForRestart = () => {
setTimeout(executor, 1000, resolve, reject);
} else {
apiClient
.get('')
.get("")
.then(resolve)
.catch(() => {
if (Number(new Date()) < endTime) {
setTimeout(executor, 500, resolve, reject);
} else {
reject(new Error('timeout reached'));
reject(new Error("timeout reached"));
}
});
}

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { compose } from 'redux';
import { PendingPlugins, PluginCollection } from '@scm-manager/ui-types';
import * as React from "react";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { compose } from "redux";
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
import {
ButtonGroup,
ErrorNotification,
@@ -10,27 +10,27 @@ import {
Notification,
Subtitle,
Title,
Button,
} from '@scm-manager/ui-components';
Button
} from "@scm-manager/ui-components";
import {
fetchPendingPlugins,
fetchPluginsByLink,
getFetchPluginsFailure,
getPendingPlugins,
getPluginCollection,
isFetchPluginsPending,
} from '../modules/plugins';
import PluginsList from '../components/PluginList';
isFetchPluginsPending
} from "../modules/plugins";
import PluginsList from "../components/PluginList";
import {
getAvailablePluginsLink,
getInstalledPluginsLink,
getPendingPluginsLink,
} from '../../../modules/indexResource';
import PluginTopActions from '../components/PluginTopActions';
import PluginBottomActions from '../components/PluginBottomActions';
import ExecutePendingActionModal from '../components/ExecutePendingActionModal';
import CancelPendingActionModal from '../components/CancelPendingActionModal';
import UpdateAllActionModal from '../components/UpdateAllActionModal';
getPendingPluginsLink
} from "../../../modules/indexResource";
import PluginTopActions from "../components/PluginTopActions";
import PluginBottomActions from "../components/PluginBottomActions";
import ExecutePendingActionModal from "../components/ExecutePendingActionModal";
import CancelPendingActionModal from "../components/CancelPendingActionModal";
import UpdateAllActionModal from "../components/UpdateAllActionModal";
type Props = {
loading: boolean;
@@ -63,7 +63,7 @@ class PluginsOverview extends React.Component<Props, State> {
this.state = {
showPendingModal: false,
showUpdateAllModal: false,
showCancelModal: false,
showCancelModal: false
};
}
@@ -85,7 +85,7 @@ class PluginsOverview extends React.Component<Props, State> {
availablePluginsLink,
installedPluginsLink,
pendingPluginsLink,
fetchPendingPlugins,
fetchPendingPlugins
} = this.props;
fetchPluginsByLink(installed ? installedPluginsLink : availablePluginsLink);
if (pendingPluginsLink) {
@@ -98,12 +98,12 @@ class PluginsOverview extends React.Component<Props, State> {
return (
<div className="columns">
<div className="column">
<Title title={t('plugins.title')} />
<Title title={t("plugins.title")} />
<Subtitle
subtitle={
installed
? t('plugins.installedSubtitle')
: t('plugins.availableSubtitle')
? t("plugins.installedSubtitle")
: t("plugins.availableSubtitle")
}
/>
</div>
@@ -132,15 +132,15 @@ class PluginsOverview extends React.Component<Props, State> {
<Button
color="primary"
reducedMobile={true}
key={'executePending'}
icon={'arrow-circle-right'}
label={t('plugins.executePending')}
key={"executePending"}
icon={"arrow-circle-right"}
label={t("plugins.executePending")}
action={() =>
this.setState({
showPendingModal: true,
showPendingModal: true
})
}
/>,
/>
);
}
@@ -153,15 +153,15 @@ class PluginsOverview extends React.Component<Props, State> {
<Button
color="primary"
reducedMobile={true}
key={'cancelPending'}
icon={'times'}
label={t('plugins.cancelPending')}
key={"cancelPending"}
icon={"times"}
label={t("plugins.cancelPending")}
action={() =>
this.setState({
showCancelModal: true,
showCancelModal: true
})
}
/>,
/>
);
}
@@ -170,15 +170,15 @@ class PluginsOverview extends React.Component<Props, State> {
<Button
color="primary"
reducedMobile={true}
key={'updateAll'}
icon={'sync-alt'}
key={"updateAll"}
icon={"sync-alt"}
label={this.computeUpdateAllSize()}
action={() =>
this.setState({
showUpdateAllModal: true,
showUpdateAllModal: true
})
}
/>,
/>
);
}
@@ -191,10 +191,10 @@ class PluginsOverview extends React.Component<Props, State> {
computeUpdateAllSize = () => {
const { collection, t } = this.props;
const outdatedPlugins = collection._embedded.plugins.filter(
p => p._links.update,
p => p._links.update
).length;
return t('plugins.outdatedPlugins', {
count: outdatedPlugins,
return t("plugins.outdatedPlugins", {
count: outdatedPlugins
});
};
@@ -226,7 +226,7 @@ class PluginsOverview extends React.Component<Props, State> {
const {
showPendingModal,
showCancelModal,
showUpdateAllModal,
showUpdateAllModal
} = this.state;
if (showPendingModal) {
@@ -234,7 +234,7 @@ class PluginsOverview extends React.Component<Props, State> {
<ExecutePendingActionModal
onClose={() =>
this.setState({
showPendingModal: false,
showPendingModal: false
})
}
pendingPlugins={pendingPlugins}
@@ -246,7 +246,7 @@ class PluginsOverview extends React.Component<Props, State> {
<CancelPendingActionModal
onClose={() =>
this.setState({
showCancelModal: false,
showCancelModal: false
})
}
refresh={this.fetchPlugins}
@@ -259,7 +259,7 @@ class PluginsOverview extends React.Component<Props, State> {
<UpdateAllActionModal
onClose={() =>
this.setState({
showUpdateAllModal: false,
showUpdateAllModal: false
})
}
refresh={this.fetchPlugins}
@@ -280,7 +280,7 @@ class PluginsOverview extends React.Component<Props, State> {
/>
);
}
return <Notification type="info">{t('plugins.noPlugins')}</Notification>;
return <Notification type="info">{t("plugins.noPlugins")}</Notification>;
}
}
@@ -300,7 +300,7 @@ const mapStateToProps = state => {
availablePluginsLink,
installedPluginsLink,
pendingPluginsLink,
pendingPlugins,
pendingPlugins
};
};
@@ -311,14 +311,14 @@ const mapDispatchToProps = dispatch => {
},
fetchPendingPlugins: (link: string) => {
dispatch(fetchPendingPlugins(link));
},
}
};
};
export default compose(
translate('admin'),
translate("admin"),
connect(
mapStateToProps,
mapDispatchToProps,
),
mapDispatchToProps
)
)(PluginsOverview);

View File

@@ -1,6 +1,6 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'fetch-mock';
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import fetchMock from "fetch-mock";
import reducer, {
FETCH_PLUGINS,
FETCH_PLUGINS_PENDING,
@@ -20,77 +20,77 @@ import reducer, {
fetchPluginSuccess,
getPlugin,
isFetchPluginPending,
getFetchPluginFailure,
} from './plugins';
import { Plugin, PluginCollection } from '@scm-manager/ui-types';
getFetchPluginFailure
} from "./plugins";
import { Plugin, PluginCollection } from "@scm-manager/ui-types";
const groupManagerPlugin: Plugin = {
name: 'scm-groupmanager-plugin',
bundles: ['/scm/groupmanager-plugin.bundle.js'],
type: 'Administration',
version: '2.0.0-SNAPSHOT',
author: 'Sebastian Sdorra',
description: 'Notify a remote webserver whenever a plugin is pushed to.',
name: "scm-groupmanager-plugin",
bundles: ["/scm/groupmanager-plugin.bundle.js"],
type: "Administration",
version: "2.0.0-SNAPSHOT",
author: "Sebastian Sdorra",
description: "Notify a remote webserver whenever a plugin is pushed to.",
_links: {
self: {
href: 'http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin',
},
},
href: "http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin"
}
}
};
const scriptPlugin: Plugin = {
name: 'scm-script-plugin',
bundles: ['/scm/script-plugin.bundle.js'],
type: 'Miscellaneous',
version: '2.0.0-SNAPSHOT',
author: 'Sebastian Sdorra',
description: 'Script support for scm-manager.',
name: "scm-script-plugin",
bundles: ["/scm/script-plugin.bundle.js"],
type: "Miscellaneous",
version: "2.0.0-SNAPSHOT",
author: "Sebastian Sdorra",
description: "Script support for scm-manager.",
_links: {
self: {
href: 'http://localhost:8081/api/v2/ui/plugins/scm-script-plugin',
},
},
href: "http://localhost:8081/api/v2/ui/plugins/scm-script-plugin"
}
}
};
const branchwpPlugin: Plugin = {
name: 'scm-branchwp-plugin',
bundles: ['/scm/branchwp-plugin.bundle.js'],
type: 'Miscellaneous',
version: '2.0.0-SNAPSHOT',
author: 'Sebastian Sdorra',
description: 'This plugin adds branch write protection for plugins.',
name: "scm-branchwp-plugin",
bundles: ["/scm/branchwp-plugin.bundle.js"],
type: "Miscellaneous",
version: "2.0.0-SNAPSHOT",
author: "Sebastian Sdorra",
description: "This plugin adds branch write protection for plugins.",
_links: {
self: {
href: 'http://localhost:8081/api/v2/ui/plugins/scm-branchwp-plugin',
},
},
href: "http://localhost:8081/api/v2/ui/plugins/scm-branchwp-plugin"
}
}
};
const pluginCollectionWithNames: PluginCollection = {
_links: {
self: {
href: 'http://localhost:8081/api/v2/ui/plugins',
},
href: "http://localhost:8081/api/v2/ui/plugins"
}
},
_embedded: {
plugins: [groupManagerPlugin.name, scriptPlugin.name, branchwpPlugin.name],
},
plugins: [groupManagerPlugin.name, scriptPlugin.name, branchwpPlugin.name]
}
};
const pluginCollection: PluginCollection = {
_links: {
self: {
href: 'http://localhost:8081/api/v2/ui/plugins',
},
href: "http://localhost:8081/api/v2/ui/plugins"
}
},
_embedded: {
plugins: [groupManagerPlugin, scriptPlugin, branchwpPlugin],
},
plugins: [groupManagerPlugin, scriptPlugin, branchwpPlugin]
}
};
describe('plugins fetch', () => {
const URL = 'ui/plugins';
const PLUGINS_URL = '/api/v2/ui/plugins';
describe("plugins fetch", () => {
const URL = "ui/plugins";
const PLUGINS_URL = "/api/v2/ui/plugins";
const mockStore = configureMockStore([thunk]);
afterEach(() => {
@@ -98,17 +98,17 @@ describe('plugins fetch', () => {
fetchMock.restore();
});
it('should successfully fetch plugins from link', () => {
it("should successfully fetch plugins from link", () => {
fetchMock.getOnce(PLUGINS_URL, pluginCollection);
const expectedActions = [
{
type: FETCH_PLUGINS_PENDING,
type: FETCH_PLUGINS_PENDING
},
{
type: FETCH_PLUGINS_SUCCESS,
payload: pluginCollection,
},
payload: pluginCollection
}
];
const store = mockStore({});
@@ -117,9 +117,9 @@ describe('plugins fetch', () => {
});
});
it('should dispatch FETCH_PLUGINS_FAILURE if request fails', () => {
it("should dispatch FETCH_PLUGINS_FAILURE if request fails", () => {
fetchMock.getOnce(PLUGINS_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -131,72 +131,72 @@ describe('plugins fetch', () => {
});
});
it('should successfully fetch scm-groupmanager-plugin by name', () => {
it("should successfully fetch scm-groupmanager-plugin by name", () => {
fetchMock.getOnce(
PLUGINS_URL + '/scm-groupmanager-plugin',
groupManagerPlugin,
PLUGINS_URL + "/scm-groupmanager-plugin",
groupManagerPlugin
);
const expectedActions = [
{
type: FETCH_PLUGIN_PENDING,
payload: {
name: 'scm-groupmanager-plugin',
name: "scm-groupmanager-plugin"
},
itemId: 'scm-groupmanager-plugin',
itemId: "scm-groupmanager-plugin"
},
{
type: FETCH_PLUGIN_SUCCESS,
payload: groupManagerPlugin,
itemId: 'scm-groupmanager-plugin',
},
itemId: "scm-groupmanager-plugin"
}
];
const store = mockStore({});
return store
.dispatch(fetchPluginByName(URL, 'scm-groupmanager-plugin'))
.dispatch(fetchPluginByName(URL, "scm-groupmanager-plugin"))
.then(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
it('should dispatch FETCH_PLUGIN_FAILURE, if the request for scm-groupmanager-plugin by name fails', () => {
fetchMock.getOnce(PLUGINS_URL + '/scm-groupmanager-plugin', {
status: 500,
it("should dispatch FETCH_PLUGIN_FAILURE, if the request for scm-groupmanager-plugin by name fails", () => {
fetchMock.getOnce(PLUGINS_URL + "/scm-groupmanager-plugin", {
status: 500
});
const store = mockStore({});
return store
.dispatch(fetchPluginByName(URL, 'scm-groupmanager-plugin'))
.dispatch(fetchPluginByName(URL, "scm-groupmanager-plugin"))
.then(() => {
const actions = store.getActions();
expect(actions[0].type).toEqual(FETCH_PLUGIN_PENDING);
expect(actions[1].type).toEqual(FETCH_PLUGIN_FAILURE);
expect(actions[1].payload.name).toBe('scm-groupmanager-plugin');
expect(actions[1].payload.name).toBe("scm-groupmanager-plugin");
expect(actions[1].payload.error).toBeDefined();
expect(actions[1].itemId).toBe('scm-groupmanager-plugin');
expect(actions[1].itemId).toBe("scm-groupmanager-plugin");
});
});
it('should successfully fetch scm-groupmanager-plugin', () => {
it("should successfully fetch scm-groupmanager-plugin", () => {
fetchMock.getOnce(
'http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin',
groupManagerPlugin,
"http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin",
groupManagerPlugin
);
const expectedActions = [
{
type: FETCH_PLUGIN_PENDING,
payload: {
name: 'scm-groupmanager-plugin',
name: "scm-groupmanager-plugin"
},
itemId: 'scm-groupmanager-plugin',
itemId: "scm-groupmanager-plugin"
},
{
type: FETCH_PLUGIN_SUCCESS,
payload: groupManagerPlugin,
itemId: 'scm-groupmanager-plugin',
},
itemId: "scm-groupmanager-plugin"
}
];
const store = mockStore({});
@@ -205,12 +205,12 @@ describe('plugins fetch', () => {
});
});
it('should dispatch FETCH_PLUGIN_FAILURE, it the request for scm-groupmanager-plugin fails', () => {
it("should dispatch FETCH_PLUGIN_FAILURE, it the request for scm-groupmanager-plugin fails", () => {
fetchMock.getOnce(
'http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin',
"http://localhost:8081/api/v2/ui/plugins/scm-groupmanager-plugin",
{
status: 500,
},
status: 500
}
);
const store = mockStore({});
@@ -218,145 +218,145 @@ describe('plugins fetch', () => {
const actions = store.getActions();
expect(actions[0].type).toEqual(FETCH_PLUGIN_PENDING);
expect(actions[1].type).toEqual(FETCH_PLUGIN_FAILURE);
expect(actions[1].payload.name).toBe('scm-groupmanager-plugin');
expect(actions[1].payload.name).toBe("scm-groupmanager-plugin");
expect(actions[1].payload.error).toBeDefined();
expect(actions[1].itemId).toBe('scm-groupmanager-plugin');
expect(actions[1].itemId).toBe("scm-groupmanager-plugin");
});
});
});
describe('plugins reducer', () => {
it('should return empty object, if state and action is undefined', () => {
describe("plugins reducer", () => {
it("should return empty object, if state and action is undefined", () => {
expect(reducer()).toEqual({});
});
it('should return the same state, if the action is undefined', () => {
it("should return the same state, if the action is undefined", () => {
const state = {
x: true,
x: true
};
expect(reducer(state)).toBe(state);
});
it('should return the same state, if the action is unknown to the reducer', () => {
it("should return the same state, if the action is unknown to the reducer", () => {
const state = {
x: true,
x: true
};
expect(
reducer(state, {
type: 'EL_SPECIALE',
}),
type: "EL_SPECIALE"
})
).toBe(state);
});
it("should store the plugins by it's type and name on FETCH_PLUGINS_SUCCESS", () => {
const newState = reducer({}, fetchPluginsSuccess(pluginCollection));
expect(newState.list._embedded.plugins).toEqual([
'scm-groupmanager-plugin',
'scm-script-plugin',
'scm-branchwp-plugin',
"scm-groupmanager-plugin",
"scm-script-plugin",
"scm-branchwp-plugin"
]);
expect(newState.byNames['scm-groupmanager-plugin']).toBe(
groupManagerPlugin,
expect(newState.byNames["scm-groupmanager-plugin"]).toBe(
groupManagerPlugin
);
expect(newState.byNames['scm-script-plugin']).toBe(scriptPlugin);
expect(newState.byNames['scm-branchwp-plugin']).toBe(branchwpPlugin);
expect(newState.byNames["scm-script-plugin"]).toBe(scriptPlugin);
expect(newState.byNames["scm-branchwp-plugin"]).toBe(branchwpPlugin);
});
it('should store the plugin at byNames', () => {
it("should store the plugin at byNames", () => {
const newState = reducer({}, fetchPluginSuccess(groupManagerPlugin));
expect(newState.byNames['scm-groupmanager-plugin']).toBe(
groupManagerPlugin,
expect(newState.byNames["scm-groupmanager-plugin"]).toBe(
groupManagerPlugin
);
});
});
describe('plugins selectors', () => {
const error = new Error('something went wrong');
describe("plugins selectors", () => {
const error = new Error("something went wrong");
it('should return the plugins collection', () => {
it("should return the plugins collection", () => {
const state = {
plugins: {
list: pluginCollectionWithNames,
byNames: {
'scm-groupmanager-plugin': groupManagerPlugin,
'scm-script-plugin': scriptPlugin,
'scm-branchwp-plugin': branchwpPlugin,
},
},
"scm-groupmanager-plugin": groupManagerPlugin,
"scm-script-plugin": scriptPlugin,
"scm-branchwp-plugin": branchwpPlugin
}
}
};
const collection = getPluginCollection(state);
expect(collection).toEqual(pluginCollection);
});
it('should return true, when fetch plugins is pending', () => {
it("should return true, when fetch plugins is pending", () => {
const state = {
pending: {
[FETCH_PLUGINS]: true,
},
[FETCH_PLUGINS]: true
}
};
expect(isFetchPluginsPending(state)).toEqual(true);
});
it('should return false, when fetch plugins is not pending', () => {
it("should return false, when fetch plugins is not pending", () => {
expect(isFetchPluginsPending({})).toEqual(false);
});
it('should return error when fetch plugins did fail', () => {
it("should return error when fetch plugins did fail", () => {
const state = {
failure: {
[FETCH_PLUGINS]: error,
},
[FETCH_PLUGINS]: error
}
};
expect(getFetchPluginsFailure(state)).toEqual(error);
});
it('should return undefined when fetch plugins did not fail', () => {
it("should return undefined when fetch plugins did not fail", () => {
expect(getFetchPluginsFailure({})).toBe(undefined);
});
it('should return the plugin collection', () => {
it("should return the plugin collection", () => {
const state = {
plugins: {
byNames: {
'scm-groupmanager-plugin': groupManagerPlugin,
},
},
"scm-groupmanager-plugin": groupManagerPlugin
}
}
};
const plugin = getPlugin(state, 'scm-groupmanager-plugin');
const plugin = getPlugin(state, "scm-groupmanager-plugin");
expect(plugin).toEqual(groupManagerPlugin);
});
it('should return true, when fetch plugin is pending', () => {
it("should return true, when fetch plugin is pending", () => {
const state = {
pending: {
[FETCH_PLUGIN + '/scm-groupmanager-plugin']: true,
},
[FETCH_PLUGIN + "/scm-groupmanager-plugin"]: true
}
};
expect(isFetchPluginPending(state, 'scm-groupmanager-plugin')).toEqual(
true,
expect(isFetchPluginPending(state, "scm-groupmanager-plugin")).toEqual(
true
);
});
it('should return false, when fetch plugin is not pending', () => {
expect(isFetchPluginPending({}, 'scm-groupmanager-plugin')).toEqual(false);
it("should return false, when fetch plugin is not pending", () => {
expect(isFetchPluginPending({}, "scm-groupmanager-plugin")).toEqual(false);
});
it('should return error when fetch plugin did fail', () => {
it("should return error when fetch plugin did fail", () => {
const state = {
failure: {
[FETCH_PLUGIN + '/scm-groupmanager-plugin']: error,
},
[FETCH_PLUGIN + "/scm-groupmanager-plugin"]: error
}
};
expect(getFetchPluginFailure(state, 'scm-groupmanager-plugin')).toEqual(
error,
expect(getFetchPluginFailure(state, "scm-groupmanager-plugin")).toEqual(
error
);
});
it('should return undefined when fetch plugin did not fail', () => {
expect(getFetchPluginFailure({}, 'scm-groupmanager-plugin')).toBe(
undefined,
it("should return undefined when fetch plugin did not fail", () => {
expect(getFetchPluginFailure({}, "scm-groupmanager-plugin")).toBe(
undefined
);
});
});

View File

@@ -1,20 +1,20 @@
import * as types from '../../../modules/types';
import { isPending } from '../../../modules/pending';
import { getFailure } from '../../../modules/failure';
import { Action, Plugin, PluginCollection } from '@scm-manager/ui-types';
import { apiClient } from '@scm-manager/ui-components';
import * as types from "../../../modules/types";
import { isPending } from "../../../modules/pending";
import { getFailure } from "../../../modules/failure";
import { Action, Plugin, PluginCollection } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components";
export const FETCH_PLUGINS = 'scm/plugins/FETCH_PLUGINS';
export const FETCH_PLUGINS = "scm/plugins/FETCH_PLUGINS";
export const FETCH_PLUGINS_PENDING = `${FETCH_PLUGINS}_${types.PENDING_SUFFIX}`;
export const FETCH_PLUGINS_SUCCESS = `${FETCH_PLUGINS}_${types.SUCCESS_SUFFIX}`;
export const FETCH_PLUGINS_FAILURE = `${FETCH_PLUGINS}_${types.FAILURE_SUFFIX}`;
export const FETCH_PLUGIN = 'scm/plugins/FETCH_PLUGIN';
export const FETCH_PLUGIN = "scm/plugins/FETCH_PLUGIN";
export const FETCH_PLUGIN_PENDING = `${FETCH_PLUGIN}_${types.PENDING_SUFFIX}`;
export const FETCH_PLUGIN_SUCCESS = `${FETCH_PLUGIN}_${types.SUCCESS_SUFFIX}`;
export const FETCH_PLUGIN_FAILURE = `${FETCH_PLUGIN}_${types.FAILURE_SUFFIX}`;
export const FETCH_PENDING_PLUGINS = 'scm/plugins/FETCH_PENDING_PLUGINS';
export const FETCH_PENDING_PLUGINS = "scm/plugins/FETCH_PENDING_PLUGINS";
export const FETCH_PENDING_PLUGINS_PENDING = `${FETCH_PENDING_PLUGINS}_${types.PENDING_SUFFIX}`;
export const FETCH_PENDING_PLUGINS_SUCCESS = `${FETCH_PENDING_PLUGINS}_${types.SUCCESS_SUFFIX}`;
export const FETCH_PENDING_PLUGINS_FAILURE = `${FETCH_PENDING_PLUGINS}_${types.FAILURE_SUFFIX}`;
@@ -37,21 +37,21 @@ export function fetchPluginsByLink(link: string) {
export function fetchPluginsPending(): Action {
return {
type: FETCH_PLUGINS_PENDING,
type: FETCH_PLUGINS_PENDING
};
}
export function fetchPluginsSuccess(plugins: PluginCollection): Action {
return {
type: FETCH_PLUGINS_SUCCESS,
payload: plugins,
payload: plugins
};
}
export function fetchPluginsFailure(err: Error): Action {
return {
type: FETCH_PLUGINS_FAILURE,
payload: err,
payload: err
};
}
@@ -61,7 +61,7 @@ export function fetchPluginByLink(plugin: Plugin) {
}
export function fetchPluginByName(link: string, name: string) {
const pluginUrl = link.endsWith('/') ? link : link + '/';
const pluginUrl = link.endsWith("/") ? link : link + "/";
return fetchPlugin(pluginUrl + name, name);
}
@@ -84,9 +84,9 @@ export function fetchPluginPending(name: string): Action {
return {
type: FETCH_PLUGIN_PENDING,
payload: {
name,
name
},
itemId: name,
itemId: name
};
}
@@ -94,7 +94,7 @@ export function fetchPluginSuccess(plugin: Plugin): Action {
return {
type: FETCH_PLUGIN_SUCCESS,
payload: plugin,
itemId: plugin.name,
itemId: plugin.name
};
}
@@ -103,9 +103,9 @@ export function fetchPluginFailure(name: string, error: Error): Action {
type: FETCH_PLUGIN_FAILURE,
payload: {
name,
error,
error
},
itemId: name,
itemId: name
};
}
@@ -127,21 +127,21 @@ export function fetchPendingPlugins(link: string) {
export function fetchPendingPluginsPending(): Action {
return {
type: FETCH_PENDING_PLUGINS_PENDING,
type: FETCH_PENDING_PLUGINS_PENDING
};
}
export function fetchPendingPluginsSuccess(PendingPlugins: {}): Action {
return {
type: FETCH_PENDING_PLUGINS_SUCCESS,
payload: PendingPlugins,
payload: PendingPlugins
};
}
export function fetchPendingPluginsFailure(err: Error): Action {
return {
type: FETCH_PENDING_PLUGINS_FAILURE,
payload: err,
payload: err
};
}
@@ -158,10 +158,10 @@ function normalizeByName(state: object, pluginCollection: PluginCollection) {
list: {
...pluginCollection,
_embedded: {
plugins: names,
plugins: names
}
},
},
byNames: byNames,
byNames: byNames
};
}
@@ -170,16 +170,16 @@ const reducerByNames = (state: object, plugin: Plugin) => {
...state,
byNames: {
...state.byNames,
[plugin.name]: plugin,
},
[plugin.name]: plugin
}
};
};
export default function reducer(
state: object = {},
action: Action = {
type: 'UNKNOWN',
},
type: "UNKNOWN"
}
): object {
if (!action.payload) {
return state;
@@ -193,7 +193,7 @@ export default function reducer(
case FETCH_PENDING_PLUGINS_SUCCESS:
return {
...state,
pending: action.payload,
pending: action.payload
};
default:
return state;
@@ -210,8 +210,8 @@ export function getPluginCollection(state: object) {
return {
...state.plugins.list,
_embedded: {
plugins,
},
plugins
}
};
}
}

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
type Props = {
role: RepositoryRole;
@@ -21,7 +21,7 @@ class AvailableVerbs extends React.Component<Props> {
<ul>
{role.verbs.map(verb => {
return (
<li>{t('verbs.repository.' + verb + '.displayName')}</li>
<li>{t("verbs.repository." + verb + ".displayName")}</li>
);
})}
</ul>
@@ -33,4 +33,4 @@ class AvailableVerbs extends React.Component<Props> {
}
}
export default translate('plugins')(AvailableVerbs);
export default translate("plugins")(AvailableVerbs);

View File

@@ -1,9 +1,9 @@
import React from 'react';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
import PermissionRoleDetailsTable from './PermissionRoleDetailsTable';
import { Button } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import PermissionRoleDetailsTable from "./PermissionRoleDetailsTable";
import { Button } from "@scm-manager/ui-components";
type Props = {
role: RepositoryRole;
@@ -19,7 +19,7 @@ class PermissionRoleDetails extends React.Component<Props> {
if (!!this.props.role._links.update) {
return (
<Button
label={t('repositoryRole.editButton')}
label={t("repositoryRole.editButton")}
link={`${url}/edit`}
color="primary"
/>
@@ -40,7 +40,7 @@ class PermissionRoleDetails extends React.Component<Props> {
name="repositoryRole.role-details.information"
renderAll={true}
props={{
role,
role
}}
/>
</>
@@ -48,4 +48,4 @@ class PermissionRoleDetails extends React.Component<Props> {
}
}
export default translate('admin')(PermissionRoleDetails);
export default translate("admin")(PermissionRoleDetails);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { RepositoryRole } from '@scm-manager/ui-types';
import { translate } from 'react-i18next';
import AvailableVerbs from './AvailableVerbs';
import React from "react";
import { RepositoryRole } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import AvailableVerbs from "./AvailableVerbs";
type Props = {
role: RepositoryRole;
@@ -17,15 +17,15 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
<table className="table content">
<tbody>
<tr>
<th>{t('repositoryRole.name')}</th>
<th>{t("repositoryRole.name")}</th>
<td>{role.name}</td>
</tr>
<tr>
<th>{t('repositoryRole.type')}</th>
<th>{t("repositoryRole.type")}</th>
<td>{role.type}</td>
</tr>
<tr>
<th>{t('repositoryRole.verbs')}</th>
<th>{t("repositoryRole.verbs")}</th>
<AvailableVerbs role={role} />
</tr>
</tbody>
@@ -34,4 +34,4 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
}
}
export default translate('admin')(PermissionRoleDetailsTable);
export default translate("admin")(PermissionRoleDetailsTable);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { RepositoryRole } from '@scm-manager/ui-types';
import SystemRoleTag from './SystemRoleTag';
import React from "react";
import { Link } from "react-router-dom";
import { RepositoryRole } from "@scm-manager/ui-types";
import SystemRoleTag from "./SystemRoleTag";
type Props = {
baseUrl: string;

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import PermissionRoleRow from './PermissionRoleRow';
import React from "react";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import PermissionRoleRow from "./PermissionRoleRow";
type Props = {
baseUrl: string;
@@ -18,7 +18,7 @@ class PermissionRoleTable extends React.Component<Props> {
<table className="card-table table is-hoverable is-fullwidth">
<thead>
<tr>
<th>{t('repositoryRole.name')}</th>
<th>{t("repositoryRole.name")}</th>
</tr>
</thead>
<tbody>
@@ -33,4 +33,4 @@ class PermissionRoleTable extends React.Component<Props> {
}
}
export default translate('admin')(PermissionRoleTable);
export default translate("admin")(PermissionRoleTable);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { translate } from 'react-i18next';
import styled from 'styled-components';
import { Tag } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import styled from "styled-components";
import { Tag } from "@scm-manager/ui-components";
type Props = {
system?: boolean;
@@ -20,10 +20,10 @@ class SystemRoleTag extends React.Component<Props> {
const { system, t } = this.props;
if (system) {
return <LeftMarginTag color="dark" label={t('repositoryRole.system')} />;
return <LeftMarginTag color="dark" label={t("repositoryRole.system")} />;
}
return null;
}
}
export default translate('admin')(SystemRoleTag);
export default translate("admin")(SystemRoleTag);

View File

@@ -1,20 +1,20 @@
import React from 'react';
import RepositoryRoleForm from './RepositoryRoleForm';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { ErrorNotification, Subtitle, Title } from '@scm-manager/ui-components';
import React from "react";
import RepositoryRoleForm from "./RepositoryRoleForm";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { ErrorNotification, Subtitle, Title } from "@scm-manager/ui-components";
import {
createRole,
getCreateRoleFailure,
getFetchVerbsFailure,
isFetchVerbsPending,
} from '../modules/roles';
import { RepositoryRole } from '@scm-manager/ui-types';
isFetchVerbsPending
} from "../modules/roles";
import { RepositoryRole } from "@scm-manager/ui-types";
import {
getRepositoryRolesLink,
getRepositoryVerbsLink,
} from '../../../modules/indexResource';
import { History } from 'history';
getRepositoryVerbsLink
} from "../../../modules/indexResource";
import { History } from "history";
type Props = {
repositoryRolesLink: string;
@@ -31,12 +31,12 @@ type Props = {
class CreateRepositoryRole extends React.Component<Props> {
repositoryRoleCreated = (role: RepositoryRole) => {
const { history } = this.props;
history.push('/admin/role/' + role.name + '/info');
history.push("/admin/role/" + role.name + "/info");
};
createRepositoryRole = (role: RepositoryRole) => {
this.props.addRole(this.props.repositoryRolesLink, role, () =>
this.repositoryRoleCreated(role),
this.repositoryRoleCreated(role)
);
};
@@ -49,8 +49,8 @@ class CreateRepositoryRole extends React.Component<Props> {
return (
<>
<Title title={t('repositoryRole.title')} />
<Subtitle subtitle={t('repositoryRole.createSubtitle')} />
<Title title={t("repositoryRole.title")} />
<Subtitle subtitle={t("repositoryRole.createSubtitle")} />
<RepositoryRoleForm
submitForm={role => this.createRepositoryRole(role)}
/>
@@ -69,7 +69,7 @@ const mapStateToProps = (state, ownProps) => {
loading,
error,
verbsLink,
repositoryRolesLink,
repositoryRolesLink
};
};
@@ -77,11 +77,11 @@ const mapDispatchToProps = dispatch => {
return {
addRole: (link: string, role: RepositoryRole, callback?: () => void) => {
dispatch(createRole(link, role, callback));
},
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('admin')(CreateRepositoryRole));
mapDispatchToProps
)(translate("admin")(CreateRepositoryRole));

View File

@@ -1,20 +1,20 @@
import React from 'react';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import {
Subtitle,
DeleteButton,
confirmAlert,
ErrorNotification,
} from '@scm-manager/ui-components';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { History } from 'history';
ErrorNotification
} from "@scm-manager/ui-components";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { History } from "history";
import {
deleteRole,
getDeleteRoleFailure,
isDeleteRolePending,
} from '../modules/roles';
isDeleteRolePending
} from "../modules/roles";
type Props = {
loading: boolean;
@@ -30,11 +30,11 @@ type Props = {
class DeleteRepositoryRole extends React.Component<Props> {
static defaultProps = {
confirmDialog: true,
confirmDialog: true
};
roleDeleted = () => {
this.props.history.push('/admin/roles/');
this.props.history.push("/admin/roles/");
};
deleteRole = () => {
@@ -44,18 +44,18 @@ class DeleteRepositoryRole extends React.Component<Props> {
confirmDelete = () => {
const { t } = this.props;
confirmAlert({
title: t('repositoryRole.delete.confirmAlert.title'),
message: t('repositoryRole.delete.confirmAlert.message'),
title: t("repositoryRole.delete.confirmAlert.title"),
message: t("repositoryRole.delete.confirmAlert.message"),
buttons: [
{
label: t('repositoryRole.delete.confirmAlert.submit'),
onClick: () => this.deleteRole(),
label: t("repositoryRole.delete.confirmAlert.submit"),
onClick: () => this.deleteRole()
},
{
label: t('repositoryRole.delete.confirmAlert.cancel'),
onClick: () => null,
},
],
label: t("repositoryRole.delete.confirmAlert.cancel"),
onClick: () => null
}
]
});
};
@@ -73,12 +73,12 @@ class DeleteRepositoryRole extends React.Component<Props> {
return (
<>
<Subtitle subtitle={t('repositoryRole.delete.subtitle')} />
<Subtitle subtitle={t("repositoryRole.delete.subtitle")} />
<div className="columns">
<div className="column">
<ErrorNotification error={error} />
<DeleteButton
label={t('repositoryRole.delete.button')}
label={t("repositoryRole.delete.button")}
action={action}
loading={loading}
/>
@@ -94,7 +94,7 @@ const mapStateToProps = (state, ownProps) => {
const error = getDeleteRoleFailure(state, ownProps.role.name);
return {
loading,
error,
error
};
};
@@ -102,11 +102,11 @@ const mapDispatchToProps = dispatch => {
return {
deleteRole: (role: RepositoryRole, callback?: () => void) => {
dispatch(deleteRole(role, callback));
},
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withRouter(translate('admin')(DeleteRepositoryRole)));
mapDispatchToProps
)(withRouter(translate("admin")(DeleteRepositoryRole)));

View File

@@ -1,16 +1,16 @@
import React from 'react';
import RepositoryRoleForm from './RepositoryRoleForm';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import React from "react";
import RepositoryRoleForm from "./RepositoryRoleForm";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import {
getModifyRoleFailure,
isModifyRolePending,
modifyRole,
} from '../modules/roles';
import { ErrorNotification, Subtitle } from '@scm-manager/ui-components';
import { RepositoryRole } from '@scm-manager/ui-types';
import { History } from 'history';
import DeleteRepositoryRole from './DeleteRepositoryRole';
modifyRole
} from "../modules/roles";
import { ErrorNotification, Subtitle } from "@scm-manager/ui-components";
import { RepositoryRole } from "@scm-manager/ui-types";
import { History } from "history";
import DeleteRepositoryRole from "./DeleteRepositoryRole";
type Props = {
disabled: boolean;
@@ -28,7 +28,7 @@ type Props = {
class EditRepositoryRole extends React.Component<Props> {
repositoryRoleUpdated = () => {
this.props.history.push('/admin/roles/');
this.props.history.push("/admin/roles/");
};
updateRepositoryRole = (role: RepositoryRole) => {
@@ -44,7 +44,7 @@ class EditRepositoryRole extends React.Component<Props> {
return (
<>
<Subtitle subtitle={t('repositoryRole.editSubtitle')} />
<Subtitle subtitle={t("repositoryRole.editSubtitle")} />
<RepositoryRoleForm
role={this.props.role}
submitForm={role => this.updateRepositoryRole(role)}
@@ -62,7 +62,7 @@ const mapStateToProps = (state, ownProps) => {
return {
loading,
error,
error
};
};
@@ -70,11 +70,11 @@ const mapDispatchToProps = dispatch => {
return {
updateRole: (role: RepositoryRole, callback?: () => void) => {
dispatch(modifyRole(role, callback));
},
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('admin')(EditRepositoryRole));
mapDispatchToProps
)(translate("admin")(EditRepositoryRole));

View File

@@ -1,19 +1,19 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import { InputField, SubmitButton } from '@scm-manager/ui-components';
import PermissionCheckbox from '../../../repos/permissions/components/PermissionCheckbox';
import React from "react";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { InputField, SubmitButton } from "@scm-manager/ui-components";
import PermissionCheckbox from "../../../repos/permissions/components/PermissionCheckbox";
import {
fetchAvailableVerbs,
getFetchVerbsFailure,
getVerbsFromState,
isFetchVerbsPending,
} from '../modules/roles';
isFetchVerbsPending
} from "../modules/roles";
import {
getRepositoryRolesLink,
getRepositoryVerbsLink,
} from '../../../modules/indexResource';
getRepositoryVerbsLink
} from "../../../modules/indexResource";
type Props = {
role?: RepositoryRole;
@@ -39,11 +39,11 @@ class RepositoryRoleForm extends React.Component<Props, State> {
this.state = {
role: {
name: '',
name: "",
verbs: [],
system: false,
_links: {},
},
_links: {}
}
};
}
@@ -52,7 +52,7 @@ class RepositoryRoleForm extends React.Component<Props, State> {
fetchAvailableVerbs(verbsLink);
if (this.props.role) {
this.setState({
role: this.props.role,
role: this.props.role
});
}
}
@@ -74,8 +74,8 @@ class RepositoryRoleForm extends React.Component<Props, State> {
this.setState({
role: {
...this.state.role,
name,
},
name
}
});
};
@@ -90,8 +90,8 @@ class RepositoryRoleForm extends React.Component<Props, State> {
...this.state,
role: {
...role,
verbs: newVerbs,
},
verbs: newVerbs
}
});
};
@@ -121,21 +121,21 @@ class RepositoryRoleForm extends React.Component<Props, State> {
<form onSubmit={this.submit}>
<InputField
name="name"
label={t('repositoryRole.form.name')}
label={t("repositoryRole.form.name")}
onChange={this.handleNameChange}
value={role.name ? role.name : ''}
value={role.name ? role.name : ""}
disabled={!!this.props.role}
/>
<div className="field">
<label className="label">
{t('repositoryRole.form.permissions')}
{t("repositoryRole.form.permissions")}
</label>
{verbSelectBoxes}
</div>
<hr />
<SubmitButton
loading={loading}
label={t('repositoryRole.form.submit')}
label={t("repositoryRole.form.submit")}
disabled={!this.isValid()}
/>
</form>
@@ -155,7 +155,7 @@ const mapStateToProps = (state, ownProps) => {
error,
verbsLink,
availableVerbs,
repositoryRolesLink,
repositoryRolesLink
};
};
@@ -163,11 +163,11 @@ const mapDispatchToProps = dispatch => {
return {
fetchAvailableVerbs: (link: string) => {
dispatch(fetchAvailableVerbs(link));
},
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('admin')(RepositoryRoleForm));
mapDispatchToProps
)(translate("admin")(RepositoryRoleForm));

View File

@@ -1,9 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { translate } from 'react-i18next';
import { History } from 'history';
import { RepositoryRole, PagedCollection } from '@scm-manager/ui-types';
import React from "react";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { translate } from "react-i18next";
import { History } from "history";
import { RepositoryRole, PagedCollection } from "@scm-manager/ui-types";
import {
Title,
Subtitle,
@@ -11,18 +11,18 @@ import {
Notification,
LinkPaginator,
urls,
CreateButton,
} from '@scm-manager/ui-components';
CreateButton
} from "@scm-manager/ui-components";
import {
fetchRolesByPage,
getRolesFromState,
selectListAsCollection,
isPermittedToCreateRoles,
isFetchRolesPending,
getFetchRolesFailure,
} from '../modules/roles';
import PermissionRoleTable from '../components/PermissionRoleTable';
import { getRepositoryRolesLink } from '../../../modules/indexResource';
getFetchRolesFailure
} from "../modules/roles";
import PermissionRoleTable from "../components/PermissionRoleTable";
import { getRepositoryRolesLink } from "../../../modules/indexResource";
type Props = {
baseUrl: string;
@@ -56,7 +56,7 @@ class RepositoryRoles extends React.Component<Props> {
page,
rolesLink,
location,
fetchRolesByPage,
fetchRolesByPage
} = this.props;
if (list && page && !loading) {
const statePage: number = list.page + 1;
@@ -75,8 +75,8 @@ class RepositoryRoles extends React.Component<Props> {
return (
<>
<Title title={t('repositoryRole.title')} />
<Subtitle subtitle={t('repositoryRole.overview.title')} />
<Title title={t("repositoryRole.title")} />
<Subtitle subtitle={t("repositoryRole.overview.title")} />
{this.renderPermissionsTable()}
{this.renderCreateButton()}
</>
@@ -95,7 +95,7 @@ class RepositoryRoles extends React.Component<Props> {
}
return (
<Notification type="info">
{t('repositoryRole.overview.noPermissionRoles')}
{t("repositoryRole.overview.noPermissionRoles")}
</Notification>
);
}
@@ -105,7 +105,7 @@ class RepositoryRoles extends React.Component<Props> {
if (canAddRoles) {
return (
<CreateButton
label={t('repositoryRole.overview.createButton')}
label={t("repositoryRole.overview.createButton")}
link={`${baseUrl}/create`}
/>
);
@@ -131,7 +131,7 @@ const mapStateToProps = (state, ownProps) => {
canAddRoles,
list,
page,
rolesLink,
rolesLink
};
};
@@ -139,13 +139,13 @@ const mapDispatchToProps = dispatch => {
return {
fetchRolesByPage: (link: string, page: number) => {
dispatch(fetchRolesByPage(link, page));
},
}
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('admin')(RepositoryRoles)),
mapDispatchToProps
)(translate("admin")(RepositoryRoles))
);

View File

@@ -1,21 +1,21 @@
import React from 'react';
import { connect } from 'react-redux';
import { Loading, ErrorPage, Title } from '@scm-manager/ui-components';
import { Route } from 'react-router-dom';
import { History } from 'history';
import { translate } from 'react-i18next';
import { RepositoryRole } from '@scm-manager/ui-types';
import { getRepositoryRolesLink } from '../../../modules/indexResource';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
import React from "react";
import { connect } from "react-redux";
import { Loading, ErrorPage, Title } from "@scm-manager/ui-components";
import { Route } from "react-router-dom";
import { History } from "history";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { getRepositoryRolesLink } from "../../../modules/indexResource";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import {
fetchRoleByName,
getFetchRoleFailure,
getRoleByName,
isFetchRolePending,
} from '../modules/roles';
import { withRouter } from 'react-router-dom';
import PermissionRoleDetail from '../components/PermissionRoleDetails';
import EditRepositoryRole from './EditRepositoryRole';
isFetchRolePending
} from "../modules/roles";
import { withRouter } from "react-router-dom";
import PermissionRoleDetail from "../components/PermissionRoleDetails";
import EditRepositoryRole from "./EditRepositoryRole";
type Props = {
roleName: string;
@@ -38,12 +38,12 @@ class SingleRepositoryRole extends React.Component<Props> {
componentDidMount() {
this.props.fetchRoleByName(
this.props.repositoryRolesLink,
this.props.roleName,
this.props.roleName
);
}
stripEndingSlash = (url: string) => {
if (url.endsWith('/')) {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
}
return url;
@@ -59,8 +59,8 @@ class SingleRepositoryRole extends React.Component<Props> {
if (error) {
return (
<ErrorPage
title={t('repositoryRole.errorTitle')}
subtitle={t('repositoryRole.errorSubtitle')}
title={t("repositoryRole.errorTitle")}
subtitle={t("repositoryRole.errorSubtitle")}
error={error}
/>
);
@@ -74,12 +74,12 @@ class SingleRepositoryRole extends React.Component<Props> {
const extensionProps = {
role,
url,
url
};
return (
<>
<Title title={t('repositoryRole.title')} />
<Title title={t("repositoryRole.title")} />
<Route
path={`${url}/info`}
component={() => <PermissionRoleDetail role={role} url={url} />}
@@ -112,7 +112,7 @@ const mapStateToProps = (state, ownProps) => {
roleName,
role,
loading,
error,
error
};
};
@@ -120,13 +120,13 @@ const mapDispatchToProps = dispatch => {
return {
fetchRoleByName: (link: string, name: string) => {
dispatch(fetchRoleByName(link, name));
},
}
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('admin')(SingleRepositoryRole)),
mapDispatchToProps
)(translate("admin")(SingleRepositoryRole))
);

View File

@@ -1,6 +1,6 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'fetch-mock';
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import fetchMock from "fetch-mock";
import reducer, {
FETCH_ROLES,
@@ -45,42 +45,42 @@ import reducer, {
deleteRoleSuccess,
getDeleteRoleFailure,
selectListAsCollection,
isPermittedToCreateRoles,
} from './roles';
isPermittedToCreateRoles
} from "./roles";
const role1 = {
name: 'specialrole',
verbs: ['read', 'pull', 'push', 'readPullRequest'],
name: "specialrole",
verbs: ["read", "pull", "push", "readPullRequest"],
system: false,
_links: {
self: {
href: 'http://localhost:8081/scm/api/v2/repositoryRoles/specialrole',
href: "http://localhost:8081/scm/api/v2/repositoryRoles/specialrole"
},
delete: {
href: 'http://localhost:8081/scm/api/v2/repositoryRoles/specialrole',
href: "http://localhost:8081/scm/api/v2/repositoryRoles/specialrole"
},
update: {
href: 'http://localhost:8081/scm/api/v2/repositoryRoles/specialrole',
},
},
href: "http://localhost:8081/scm/api/v2/repositoryRoles/specialrole"
}
}
};
const role2 = {
name: 'WRITE',
name: "WRITE",
verbs: [
'read',
'pull',
'push',
'createPullRequest',
'readPullRequest',
'commentPullRequest',
'mergePullRequest',
"read",
"pull",
"push",
"createPullRequest",
"readPullRequest",
"commentPullRequest",
"mergePullRequest"
],
system: true,
_links: {
self: {
href: 'http://localhost:8081/scm/api/v2/repositoryRoles/WRITE',
},
},
href: "http://localhost:8081/scm/api/v2/repositoryRoles/WRITE"
}
}
};
const responseBody = {
@@ -89,57 +89,57 @@ const responseBody = {
_links: {
self: {
href:
'http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10',
"http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10"
},
first: {
href:
'http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10',
"http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10"
},
last: {
href:
'http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10',
"http://localhost:8081/scm/api/v2/repositoryRoles/?page=0&pageSize=10"
},
create: {
href: 'http://localhost:8081/scm/api/v2/repositoryRoles/',
},
href: "http://localhost:8081/scm/api/v2/repositoryRoles/"
}
},
_embedded: {
repositoryRoles: [role1, role2],
},
repositoryRoles: [role1, role2]
}
};
const response = {
headers: {
'content-type': 'application/json',
"content-type": "application/json"
},
responseBody,
responseBody
};
const URL = 'repositoryRoles';
const ROLES_URL = '/api/v2/repositoryRoles';
const URL = "repositoryRoles";
const ROLES_URL = "/api/v2/repositoryRoles";
const ROLE1_URL =
'http://localhost:8081/scm/api/v2/repositoryRoles/specialrole';
"http://localhost:8081/scm/api/v2/repositoryRoles/specialrole";
const error = new Error('FEHLER!');
const error = new Error("FEHLER!");
describe('repository roles fetch', () => {
describe("repository roles fetch", () => {
const mockStore = configureMockStore([thunk]);
afterEach(() => {
fetchMock.reset();
fetchMock.restore();
});
it('should successfully fetch repository roles', () => {
it("should successfully fetch repository roles", () => {
fetchMock.getOnce(ROLES_URL, response);
const expectedActions = [
{
type: FETCH_ROLES_PENDING,
type: FETCH_ROLES_PENDING
},
{
type: FETCH_ROLES_SUCCESS,
payload: response,
},
payload: response
}
];
const store = mockStore({});
@@ -149,9 +149,9 @@ describe('repository roles fetch', () => {
});
});
it('should fail getting repository roles on HTTP 500', () => {
it("should fail getting repository roles on HTTP 500", () => {
fetchMock.getOnce(ROLES_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -164,11 +164,11 @@ describe('repository roles fetch', () => {
});
});
it('should sucessfully fetch single role by name', () => {
fetchMock.getOnce(ROLES_URL + '/specialrole', role1);
it("should sucessfully fetch single role by name", () => {
fetchMock.getOnce(ROLES_URL + "/specialrole", role1);
const store = mockStore({});
return store.dispatch(fetchRoleByName(URL, 'specialrole')).then(() => {
return store.dispatch(fetchRoleByName(URL, "specialrole")).then(() => {
const actions = store.getActions();
expect(actions[0].type).toEqual(FETCH_ROLE_PENDING);
expect(actions[1].type).toEqual(FETCH_ROLE_SUCCESS);
@@ -176,13 +176,13 @@ describe('repository roles fetch', () => {
});
});
it('should fail fetching single role by name on HTTP 500', () => {
fetchMock.getOnce(ROLES_URL + '/specialrole', {
status: 500,
it("should fail fetching single role by name on HTTP 500", () => {
fetchMock.getOnce(ROLES_URL + "/specialrole", {
status: 500
});
const store = mockStore({});
return store.dispatch(fetchRoleByName(URL, 'specialrole')).then(() => {
return store.dispatch(fetchRoleByName(URL, "specialrole")).then(() => {
const actions = store.getActions();
expect(actions[0].type).toEqual(FETCH_ROLE_PENDING);
expect(actions[1].type).toEqual(FETCH_ROLE_FAILURE);
@@ -190,7 +190,7 @@ describe('repository roles fetch', () => {
});
});
it('should sucessfully fetch single role', () => {
it("should sucessfully fetch single role", () => {
fetchMock.getOnce(ROLE1_URL, role1);
const store = mockStore({});
@@ -202,9 +202,9 @@ describe('repository roles fetch', () => {
});
});
it('should fail fetching single role on HTTP 500', () => {
it("should fail fetching single role on HTTP 500", () => {
fetchMock.getOnce(ROLE1_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -216,10 +216,10 @@ describe('repository roles fetch', () => {
});
});
it('should add a role successfully', () => {
it("should add a role successfully", () => {
// unmatched
fetchMock.postOnce(ROLES_URL, {
status: 204,
status: 204
});
// after create, the roles are fetched again
@@ -234,9 +234,9 @@ describe('repository roles fetch', () => {
});
});
it('should fail adding a role on HTTP 500', () => {
it("should fail adding a role on HTTP 500", () => {
fetchMock.postOnce(ROLES_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -249,27 +249,27 @@ describe('repository roles fetch', () => {
});
});
it('should call the callback after role successfully created', () => {
it("should call the callback after role successfully created", () => {
// unmatched
fetchMock.postOnce(ROLES_URL, {
status: 204,
status: 204
});
let callMe = 'not yet';
let callMe = "not yet";
const callback = () => {
callMe = 'yeah';
callMe = "yeah";
};
const store = mockStore({});
return store.dispatch(createRole(URL, role1, callback)).then(() => {
expect(callMe).toBe('yeah');
expect(callMe).toBe("yeah");
});
});
it('successfully update role', () => {
it("successfully update role", () => {
fetchMock.putOnce(ROLE1_URL, {
status: 204,
status: 204
});
fetchMock.getOnce(ROLE1_URL, role1);
@@ -283,9 +283,9 @@ describe('repository roles fetch', () => {
});
});
it('should call callback, after successful modified role', () => {
it("should call callback, after successful modified role", () => {
fetchMock.putOnce(ROLE1_URL, {
status: 204,
status: 204
});
fetchMock.getOnce(ROLE1_URL, role1);
@@ -300,9 +300,9 @@ describe('repository roles fetch', () => {
});
});
it('should fail updating role on HTTP 500', () => {
it("should fail updating role on HTTP 500", () => {
fetchMock.putOnce(ROLE1_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -314,9 +314,9 @@ describe('repository roles fetch', () => {
});
});
it('should delete successfully role1', () => {
it("should delete successfully role1", () => {
fetchMock.deleteOnce(ROLE1_URL, {
status: 204,
status: 204
});
const store = mockStore({});
@@ -329,9 +329,9 @@ describe('repository roles fetch', () => {
});
});
it('should call the callback after successful delete', () => {
it("should call the callback after successful delete", () => {
fetchMock.deleteOnce(ROLE1_URL, {
status: 204,
status: 204
});
let called = false;
@@ -345,9 +345,9 @@ describe('repository roles fetch', () => {
});
});
it('should fail to delete role1', () => {
it("should fail to delete role1", () => {
fetchMock.deleteOnce(ROLE1_URL, {
status: 500,
status: 500
});
const store = mockStore({});
@@ -361,325 +361,325 @@ describe('repository roles fetch', () => {
});
});
describe('repository roles reducer', () => {
it('should update state correctly according to FETCH_ROLES_SUCCESS action', () => {
describe("repository roles reducer", () => {
it("should update state correctly according to FETCH_ROLES_SUCCESS action", () => {
const newState = reducer({}, fetchRolesSuccess(responseBody));
expect(newState.list).toEqual({
entries: ['specialrole', 'WRITE'],
entries: ["specialrole", "WRITE"],
entry: {
roleCreatePermission: true,
page: 0,
pageTotal: 1,
_links: responseBody._links,
},
_links: responseBody._links
}
});
expect(newState.byNames).toEqual({
specialrole: role1,
WRITE: role2,
WRITE: role2
});
expect(newState.list.entry.roleCreatePermission).toBeTruthy();
});
it('should set roleCreatePermission to true if update link is present', () => {
it("should set roleCreatePermission to true if update link is present", () => {
const newState = reducer({}, fetchRolesSuccess(responseBody));
expect(newState.list.entry.roleCreatePermission).toBeTruthy();
});
it('should not replace whole byNames map when fetching roles', () => {
it("should not replace whole byNames map when fetching roles", () => {
const oldState = {
byNames: {
WRITE: role2,
},
WRITE: role2
}
};
const newState = reducer(oldState, fetchRolesSuccess(responseBody));
expect(newState.byNames['specialrole']).toBeDefined();
expect(newState.byNames['WRITE']).toBeDefined();
expect(newState.byNames["specialrole"]).toBeDefined();
expect(newState.byNames["WRITE"]).toBeDefined();
});
it('should remove role from state when delete succeeds', () => {
it("should remove role from state when delete succeeds", () => {
const state = {
list: {
entries: ['WRITE', 'specialrole'],
entries: ["WRITE", "specialrole"]
},
byNames: {
specialrole: role1,
WRITE: role2,
},
WRITE: role2
}
};
const newState = reducer(state, deleteRoleSuccess(role2));
expect(newState.byNames['specialrole']).toBeDefined();
expect(newState.byNames['WRITE']).toBeFalsy();
expect(newState.list.entries).toEqual(['specialrole']);
expect(newState.byNames["specialrole"]).toBeDefined();
expect(newState.byNames["WRITE"]).toBeFalsy();
expect(newState.list.entries).toEqual(["specialrole"]);
});
it('should set roleCreatePermission to true if create link is present', () => {
it("should set roleCreatePermission to true if create link is present", () => {
const newState = reducer({}, fetchRolesSuccess(responseBody));
expect(newState.list.entry.roleCreatePermission).toBeTruthy();
expect(newState.list.entries).toEqual(['specialrole', 'WRITE']);
expect(newState.byNames['WRITE']).toBeTruthy();
expect(newState.byNames['specialrole']).toBeTruthy();
expect(newState.list.entries).toEqual(["specialrole", "WRITE"]);
expect(newState.byNames["WRITE"]).toBeTruthy();
expect(newState.byNames["specialrole"]).toBeTruthy();
});
it('should update state according to FETCH_ROLE_SUCCESS action', () => {
it("should update state according to FETCH_ROLE_SUCCESS action", () => {
const newState = reducer({}, fetchRoleSuccess(role2));
expect(newState.byNames['WRITE']).toBe(role2);
expect(newState.byNames["WRITE"]).toBe(role2);
});
it('should affect roles state nor the state of other roles', () => {
it("should affect roles state nor the state of other roles", () => {
const newState = reducer(
{
list: {
entries: ['specialrole'],
entries: ["specialrole"]
}
},
},
fetchRoleSuccess(role2),
fetchRoleSuccess(role2)
);
expect(newState.byNames['WRITE']).toBe(role2);
expect(newState.list.entries).toEqual(['specialrole']);
expect(newState.byNames["WRITE"]).toBe(role2);
expect(newState.list.entries).toEqual(["specialrole"]);
});
});
describe('repository roles selector', () => {
it('should return an empty object', () => {
describe("repository roles selector", () => {
it("should return an empty object", () => {
expect(selectListAsCollection({})).toEqual({});
expect(
selectListAsCollection({
roles: {
a: 'a',
},
}),
a: "a"
}
})
).toEqual({});
});
it('should return a state slice collection', () => {
it("should return a state slice collection", () => {
const collection = {
page: 3,
totalPages: 42,
totalPages: 42
};
const state = {
roles: {
list: {
entry: collection,
},
},
entry: collection
}
}
};
expect(selectListAsCollection(state)).toBe(collection);
});
it('should return false', () => {
it("should return false", () => {
expect(isPermittedToCreateRoles({})).toBe(false);
expect(
isPermittedToCreateRoles({
roles: {
list: {
entry: {},
},
},
}),
entry: {}
}
}
})
).toBe(false);
expect(
isPermittedToCreateRoles({
roles: {
list: {
entry: {
roleCreatePermission: false,
},
},
},
}),
roleCreatePermission: false
}
}
}
})
).toBe(false);
});
it('should return true', () => {
it("should return true", () => {
const state = {
roles: {
list: {
entry: {
roleCreatePermission: true,
},
},
},
roleCreatePermission: true
}
}
}
};
expect(isPermittedToCreateRoles(state)).toBe(true);
});
it('should get repositoryRoles from state', () => {
it("should get repositoryRoles from state", () => {
const state = {
roles: {
list: {
entries: ['a', 'b'],
entries: ["a", "b"]
},
byNames: {
a: {
name: 'a',
name: "a"
},
b: {
name: 'b',
},
},
},
name: "b"
}
}
}
};
expect(getRolesFromState(state)).toEqual([
{
name: 'a',
name: "a"
},
{
name: 'b',
},
name: "b"
}
]);
});
it('should return true, when fetch repositoryRoles is pending', () => {
it("should return true, when fetch repositoryRoles is pending", () => {
const state = {
pending: {
[FETCH_ROLES]: true,
},
[FETCH_ROLES]: true
}
};
expect(isFetchRolesPending(state)).toEqual(true);
});
it('should return false, when fetch repositoryRoles is not pending', () => {
it("should return false, when fetch repositoryRoles is not pending", () => {
expect(isFetchRolesPending({})).toEqual(false);
});
it('should return error when fetch repositoryRoles did fail', () => {
it("should return error when fetch repositoryRoles did fail", () => {
const state = {
failure: {
[FETCH_ROLES]: error,
},
[FETCH_ROLES]: error
}
};
expect(getFetchRolesFailure(state)).toEqual(error);
});
it('should return undefined when fetch repositoryRoles did not fail', () => {
it("should return undefined when fetch repositoryRoles did not fail", () => {
expect(getFetchRolesFailure({})).toBe(undefined);
});
it('should return true if create role is pending', () => {
it("should return true if create role is pending", () => {
const state = {
pending: {
[CREATE_ROLE]: true,
},
[CREATE_ROLE]: true
}
};
expect(isCreateRolePending(state)).toBe(true);
});
it('should return false if create role is not pending', () => {
it("should return false if create role is not pending", () => {
const state = {
pending: {
[CREATE_ROLE]: false,
},
[CREATE_ROLE]: false
}
};
expect(isCreateRolePending(state)).toBe(false);
});
it('should return error when create role did fail', () => {
it("should return error when create role did fail", () => {
const state = {
failure: {
[CREATE_ROLE]: error,
},
[CREATE_ROLE]: error
}
};
expect(getCreateRoleFailure(state)).toEqual(error);
});
it('should return undefined when create role did not fail', () => {
it("should return undefined when create role did not fail", () => {
expect(getCreateRoleFailure({})).toBe(undefined);
});
it('should return role1', () => {
it("should return role1", () => {
const state = {
roles: {
byNames: {
role1: role1,
},
},
role1: role1
}
}
};
expect(getRoleByName(state, 'role1')).toEqual(role1);
expect(getRoleByName(state, "role1")).toEqual(role1);
});
it('should return true, when fetch role2 is pending', () => {
it("should return true, when fetch role2 is pending", () => {
const state = {
pending: {
[FETCH_ROLE + '/role2']: true,
},
[FETCH_ROLE + "/role2"]: true
}
};
expect(isFetchRolePending(state, 'role2')).toEqual(true);
expect(isFetchRolePending(state, "role2")).toEqual(true);
});
it('should return false, when fetch role2 is not pending', () => {
expect(isFetchRolePending({}, 'role2')).toEqual(false);
it("should return false, when fetch role2 is not pending", () => {
expect(isFetchRolePending({}, "role2")).toEqual(false);
});
it('should return error when fetch role2 did fail', () => {
it("should return error when fetch role2 did fail", () => {
const state = {
failure: {
[FETCH_ROLE + '/role2']: error,
},
[FETCH_ROLE + "/role2"]: error
}
};
expect(getFetchRoleFailure(state, 'role2')).toEqual(error);
expect(getFetchRoleFailure(state, "role2")).toEqual(error);
});
it('should return undefined when fetch role2 did not fail', () => {
expect(getFetchRoleFailure({}, 'role2')).toBe(undefined);
it("should return undefined when fetch role2 did not fail", () => {
expect(getFetchRoleFailure({}, "role2")).toBe(undefined);
});
it('should return true, when modify role1 is pending', () => {
it("should return true, when modify role1 is pending", () => {
const state = {
pending: {
[MODIFY_ROLE + '/role1']: true,
},
[MODIFY_ROLE + "/role1"]: true
}
};
expect(isModifyRolePending(state, 'role1')).toEqual(true);
expect(isModifyRolePending(state, "role1")).toEqual(true);
});
it('should return false, when modify role1 is not pending', () => {
expect(isModifyRolePending({}, 'role1')).toEqual(false);
it("should return false, when modify role1 is not pending", () => {
expect(isModifyRolePending({}, "role1")).toEqual(false);
});
it('should return error when modify role1 did fail', () => {
it("should return error when modify role1 did fail", () => {
const state = {
failure: {
[MODIFY_ROLE + '/role1']: error,
},
[MODIFY_ROLE + "/role1"]: error
}
};
expect(getModifyRoleFailure(state, 'role1')).toEqual(error);
expect(getModifyRoleFailure(state, "role1")).toEqual(error);
});
it('should return undefined when modify role1 did not fail', () => {
expect(getModifyRoleFailure({}, 'role1')).toBe(undefined);
it("should return undefined when modify role1 did not fail", () => {
expect(getModifyRoleFailure({}, "role1")).toBe(undefined);
});
it('should return true, when delete role2 is pending', () => {
it("should return true, when delete role2 is pending", () => {
const state = {
pending: {
[DELETE_ROLE + '/role2']: true,
},
[DELETE_ROLE + "/role2"]: true
}
};
expect(isDeleteRolePending(state, 'role2')).toEqual(true);
expect(isDeleteRolePending(state, "role2")).toEqual(true);
});
it('should return false, when delete role2 is not pending', () => {
expect(isDeleteRolePending({}, 'role2')).toEqual(false);
it("should return false, when delete role2 is not pending", () => {
expect(isDeleteRolePending({}, "role2")).toEqual(false);
});
it('should return error when delete role2 did fail', () => {
it("should return error when delete role2 did fail", () => {
const state = {
failure: {
[DELETE_ROLE + '/role2']: error,
},
[DELETE_ROLE + "/role2"]: error
}
};
expect(getDeleteRoleFailure(state, 'role2')).toEqual(error);
expect(getDeleteRoleFailure(state, "role2")).toEqual(error);
});
it('should return undefined when delete role2 did not fail', () => {
expect(getDeleteRoleFailure({}, 'role2')).toBe(undefined);
it("should return undefined when delete role2 did not fail", () => {
expect(getDeleteRoleFailure({}, "role2")).toBe(undefined);
});
});

View File

@@ -1,55 +1,55 @@
import { apiClient } from '@scm-manager/ui-components';
import { isPending } from '../../../modules/pending';
import { getFailure } from '../../../modules/failure';
import * as types from '../../../modules/types';
import { combineReducers, Dispatch } from 'redux';
import { Action, PagedCollection, RepositoryRole } from '@scm-manager/ui-types';
import { apiClient } from "@scm-manager/ui-components";
import { isPending } from "../../../modules/pending";
import { getFailure } from "../../../modules/failure";
import * as types from "../../../modules/types";
import { combineReducers, Dispatch } from "redux";
import { Action, PagedCollection, RepositoryRole } from "@scm-manager/ui-types";
export const FETCH_ROLES = 'scm/roles/FETCH_ROLES';
export const FETCH_ROLES = "scm/roles/FETCH_ROLES";
export const FETCH_ROLES_PENDING = `${FETCH_ROLES}_${types.PENDING_SUFFIX}`;
export const FETCH_ROLES_SUCCESS = `${FETCH_ROLES}_${types.SUCCESS_SUFFIX}`;
export const FETCH_ROLES_FAILURE = `${FETCH_ROLES}_${types.FAILURE_SUFFIX}`;
export const FETCH_ROLE = 'scm/roles/FETCH_ROLE';
export const FETCH_ROLE = "scm/roles/FETCH_ROLE";
export const FETCH_ROLE_PENDING = `${FETCH_ROLE}_${types.PENDING_SUFFIX}`;
export const FETCH_ROLE_SUCCESS = `${FETCH_ROLE}_${types.SUCCESS_SUFFIX}`;
export const FETCH_ROLE_FAILURE = `${FETCH_ROLE}_${types.FAILURE_SUFFIX}`;
export const CREATE_ROLE = 'scm/roles/CREATE_ROLE';
export const CREATE_ROLE = "scm/roles/CREATE_ROLE";
export const CREATE_ROLE_PENDING = `${CREATE_ROLE}_${types.PENDING_SUFFIX}`;
export const CREATE_ROLE_SUCCESS = `${CREATE_ROLE}_${types.SUCCESS_SUFFIX}`;
export const CREATE_ROLE_FAILURE = `${CREATE_ROLE}_${types.FAILURE_SUFFIX}`;
export const CREATE_ROLE_RESET = `${CREATE_ROLE}_${types.RESET_SUFFIX}`;
export const MODIFY_ROLE = 'scm/roles/MODIFY_ROLE';
export const MODIFY_ROLE = "scm/roles/MODIFY_ROLE";
export const MODIFY_ROLE_PENDING = `${MODIFY_ROLE}_${types.PENDING_SUFFIX}`;
export const MODIFY_ROLE_SUCCESS = `${MODIFY_ROLE}_${types.SUCCESS_SUFFIX}`;
export const MODIFY_ROLE_FAILURE = `${MODIFY_ROLE}_${types.FAILURE_SUFFIX}`;
export const MODIFY_ROLE_RESET = `${MODIFY_ROLE}_${types.RESET_SUFFIX}`;
export const DELETE_ROLE = 'scm/roles/DELETE_ROLE';
export const DELETE_ROLE = "scm/roles/DELETE_ROLE";
export const DELETE_ROLE_PENDING = `${DELETE_ROLE}_${types.PENDING_SUFFIX}`;
export const DELETE_ROLE_SUCCESS = `${DELETE_ROLE}_${types.SUCCESS_SUFFIX}`;
export const DELETE_ROLE_FAILURE = `${DELETE_ROLE}_${types.FAILURE_SUFFIX}`;
export const FETCH_VERBS = 'scm/roles/FETCH_VERBS';
export const FETCH_VERBS = "scm/roles/FETCH_VERBS";
export const FETCH_VERBS_PENDING = `${FETCH_VERBS}_${types.PENDING_SUFFIX}`;
export const FETCH_VERBS_SUCCESS = `${FETCH_VERBS}_${types.SUCCESS_SUFFIX}`;
export const FETCH_VERBS_FAILURE = `${FETCH_VERBS}_${types.FAILURE_SUFFIX}`;
const CONTENT_TYPE_ROLE = 'application/vnd.scmm-repositoryRole+json;v=2';
const CONTENT_TYPE_ROLE = "application/vnd.scmm-repositoryRole+json;v=2";
// fetch roles
export function fetchRolesPending(): Action {
return {
type: FETCH_ROLES_PENDING,
type: FETCH_ROLES_PENDING
};
}
export function fetchRolesSuccess(roles: any): Action {
return {
type: FETCH_ROLES_SUCCESS,
payload: roles,
payload: roles
};
}
@@ -58,8 +58,8 @@ export function fetchRolesFailure(url: string, error: Error): Action {
type: FETCH_ROLES_FAILURE,
payload: {
error,
url,
},
url
}
};
}
@@ -92,7 +92,7 @@ export function fetchRolePending(name: string): Action {
return {
type: FETCH_ROLE_PENDING,
payload: name,
itemId: name,
itemId: name
};
}
@@ -100,7 +100,7 @@ export function fetchRoleSuccess(role: any): Action {
return {
type: FETCH_ROLE_SUCCESS,
payload: role,
itemId: role.name,
itemId: role.name
};
}
@@ -109,9 +109,9 @@ export function fetchRoleFailure(name: string, error: Error): Action {
type: FETCH_ROLE_FAILURE,
payload: {
name,
error,
error
},
itemId: name,
itemId: name
};
}
@@ -133,7 +133,7 @@ function fetchRole(link: string, name: string) {
}
export function fetchRoleByName(link: string, name: string) {
const roleUrl = link.endsWith('/') ? link + name : link + '/' + name;
const roleUrl = link.endsWith("/") ? link + name : link + "/" + name;
return fetchRole(roleUrl, name);
}
@@ -145,33 +145,33 @@ export function fetchRoleByLink(role: RepositoryRole) {
export function createRolePending(role: RepositoryRole): Action {
return {
type: CREATE_ROLE_PENDING,
role,
role
};
}
export function createRoleSuccess(): Action {
return {
type: CREATE_ROLE_SUCCESS,
type: CREATE_ROLE_SUCCESS
};
}
export function createRoleFailure(error: Error): Action {
return {
type: CREATE_ROLE_FAILURE,
payload: error,
payload: error
};
}
export function createRoleReset() {
return {
type: CREATE_ROLE_RESET,
type: CREATE_ROLE_RESET
};
}
export function createRole(
link: string,
role: RepositoryRole,
callback?: () => void,
callback?: () => void
) {
return function(dispatch: Dispatch) {
dispatch(createRolePending(role));
@@ -190,21 +190,21 @@ export function createRole(
//fetch verbs
export function fetchVerbsPending(): Action {
return {
type: FETCH_VERBS_PENDING,
type: FETCH_VERBS_PENDING
};
}
export function fetchVerbsSuccess(verbs: any): Action {
return {
type: FETCH_VERBS_SUCCESS,
payload: verbs,
payload: verbs
};
}
export function fetchVerbsFailure(error: Error): Action {
return {
type: FETCH_VERBS_FAILURE,
payload: error,
payload: error
};
}
@@ -231,7 +231,7 @@ function verbReducer(state: any = {}, action: any = {}) {
const verbs = action.payload.verbs;
return {
...state,
verbs,
verbs
};
default:
return state;
@@ -243,7 +243,7 @@ export function modifyRolePending(role: RepositoryRole): Action {
return {
type: MODIFY_ROLE_PENDING,
payload: role,
itemId: role.name,
itemId: role.name
};
}
@@ -251,7 +251,7 @@ export function modifyRoleSuccess(role: RepositoryRole): Action {
return {
type: MODIFY_ROLE_SUCCESS,
payload: role,
itemId: role.name,
itemId: role.name
};
}
@@ -260,16 +260,16 @@ export function modifyRoleFailure(role: RepositoryRole, error: Error): Action {
type: MODIFY_ROLE_FAILURE,
payload: {
error,
role,
role
},
itemId: role.name,
itemId: role.name
};
}
export function modifyRoleReset(role: RepositoryRole): Action {
return {
type: MODIFY_ROLE_RESET,
itemId: role.name,
itemId: role.name
};
}
@@ -298,7 +298,7 @@ export function deleteRolePending(role: RepositoryRole): Action {
return {
type: DELETE_ROLE_PENDING,
payload: role,
itemId: role.name,
itemId: role.name
};
}
@@ -306,7 +306,7 @@ export function deleteRoleSuccess(role: RepositoryRole): Action {
return {
type: DELETE_ROLE_SUCCESS,
payload: role,
itemId: role.name,
itemId: role.name
};
}
@@ -315,9 +315,9 @@ export function deleteRoleFailure(role: RepositoryRole, error: Error): Action {
type: DELETE_ROLE_FAILURE,
payload: {
error,
role,
role
},
itemId: role.name,
itemId: role.name
};
}
@@ -341,7 +341,7 @@ export function deleteRole(role: RepositoryRole, callback?: () => void) {
function extractRolesByNames(
roles: RepositoryRole[],
roleNames: string[],
oldRolesByNames: object,
oldRolesByNames: object
) {
const rolesByNames = {};
@@ -374,7 +374,7 @@ function deleteRoleInEntries(roles: [], roleName: string) {
const reducerByName = (state: any, rolename: string, newRoleState: any) => {
return {
...state,
[rolename]: newRoleState,
[rolename]: newRoleState
};
};
@@ -390,19 +390,19 @@ function listReducer(state: any = {}, action: any = {}) {
roleCreatePermission: !!action.payload._links.create,
page: action.payload.page,
pageTotal: action.payload.pageTotal,
_links: action.payload._links,
},
_links: action.payload._links
}
};
// Delete single role actions
case DELETE_ROLE_SUCCESS:
const newRoleEntries = deleteRoleInEntries(
state.entries,
action.payload.name,
action.payload.name
);
return {
...state,
entries: newRoleEntries,
entries: newRoleEntries
};
default:
return state;
@@ -417,7 +417,7 @@ function byNamesReducer(state: any = {}, action: any = {}) {
const roleNames = roles.map(role => role.name);
const byNames = extractRolesByNames(roles, roleNames, state.byNames);
return {
...byNames,
...byNames
};
// Fetch single role actions
@@ -435,7 +435,7 @@ function byNamesReducer(state: any = {}, action: any = {}) {
export default combineReducers({
list: listReducer,
byNames: byNamesReducer,
verbs: verbReducer,
verbs: verbReducer
});
// selectors

View File

@@ -1,12 +1,12 @@
import * as React from 'react';
import { translate } from 'react-i18next';
import classNames from 'classnames';
import styled from 'styled-components';
import { InfoItem } from './InfoItem';
import { Icon } from '@scm-manager/ui-components';
import * as React from "react";
import { translate } from "react-i18next";
import classNames from "classnames";
import styled from "styled-components";
import { InfoItem } from "./InfoItem";
import { Icon } from "@scm-manager/ui-components";
type Props = {
type: 'plugin' | 'feature';
type: "plugin" | "feature";
item: InfoItem;
// context props
@@ -40,11 +40,11 @@ const ContentWrapper = styled.div`
class InfoBox extends React.Component<Props> {
renderBody = () => {
const { item, t } = this.props;
const title = item ? item.title : t('login.loading');
const summary = item ? item.summary : t('login.loading');
const title = item ? item.title : t("login.loading");
const summary = item ? item.summary : t("login.loading");
return (
<ContentWrapper className={classNames('media-content', 'content')}>
<ContentWrapper className={classNames("media-content", "content")}>
<h4 className="has-text-link">{title}</h4>
<p>{summary}</p>
</ContentWrapper>
@@ -53,23 +53,23 @@ class InfoBox extends React.Component<Props> {
render() {
const { item, type, t } = this.props;
const icon = type === 'plugin' ? 'puzzle-piece' : 'star';
const icon = type === "plugin" ? "puzzle-piece" : "star";
return (
<BottomMarginA href={item._links.self.href}>
<div className="box media">
<figure className="media-left">
<FixedSizedIconWrapper
className={classNames(
'image',
'box',
'has-text-weight-bold',
'has-text-white',
'has-background-info',
"image",
"box",
"has-text-weight-bold",
"has-text-white",
"has-background-info"
)}
>
<LightBlueIcon className="fa-2x" name={icon} color="inherit" />
<div className="is-size-4">{t('login.' + type)}</div>
<div className="is-size-4">{t('login.tip')}</div>
<div className="is-size-4">{t("login." + type)}</div>
<div className="is-size-4">{t("login.tip")}</div>
</FixedSizedIconWrapper>
</figure>
{this.renderBody()}
@@ -79,4 +79,4 @@ class InfoBox extends React.Component<Props> {
}
}
export default translate('commons')(InfoBox);
export default translate("commons")(InfoBox);

View File

@@ -1,4 +1,4 @@
import { Link } from '@scm-manager/ui-types';
import { Link } from "@scm-manager/ui-types";
export type InfoItem = {
title: string;

View File

@@ -1,13 +1,13 @@
import React from 'react';
import { translate } from 'react-i18next';
import styled from 'styled-components';
import React from "react";
import { translate } from "react-i18next";
import styled from "styled-components";
import {
Image,
ErrorNotification,
InputField,
SubmitButton,
UnauthorizedError,
} from '@scm-manager/ui-components';
UnauthorizedError
} from "@scm-manager/ui-components";
type Props = {
error?: Error;
@@ -45,8 +45,8 @@ class LoginForm extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
username: '',
password: '',
username: "",
password: ""
};
}
@@ -59,13 +59,13 @@ class LoginForm extends React.Component<Props, State> {
handleUsernameChange = (value: string) => {
this.setState({
username: value,
username: value
});
};
handlePasswordChange = (value: string) => {
this.setState({
password: value,
password: value
});
};
@@ -76,7 +76,7 @@ class LoginForm extends React.Component<Props, State> {
areCredentialsInvalid() {
const { t, error } = this.props;
if (error instanceof UnauthorizedError) {
return new Error(t('errorNotification.wrongLoginCredentials'));
return new Error(t("errorNotification.wrongLoginCredentials"));
} else {
return error;
}
@@ -86,26 +86,26 @@ class LoginForm extends React.Component<Props, State> {
const { loading, t } = this.props;
return (
<div className="column is-4 box has-text-centered has-background-white-ter">
<h3 className="title">{t('login.title')}</h3>
<p className="subtitle">{t('login.subtitle')}</p>
<h3 className="title">{t("login.title")}</h3>
<p className="subtitle">{t("login.subtitle")}</p>
<TopMarginBox className="box">
<AvatarWrapper>
<AvatarImage src="/images/blib.jpg" alt={t('login.logo-alt')} />
<AvatarImage src="/images/blib.jpg" alt={t("login.logo-alt")} />
</AvatarWrapper>
<ErrorNotification error={this.areCredentialsInvalid()} />
<form onSubmit={this.handleSubmit}>
<InputField
placeholder={t('login.username-placeholder')}
placeholder={t("login.username-placeholder")}
autofocus={true}
onChange={this.handleUsernameChange}
/>
<InputField
placeholder={t('login.password-placeholder')}
placeholder={t("login.password-placeholder")}
type="password"
onChange={this.handlePasswordChange}
/>
<SubmitButton
label={t('login.submit')}
label={t("login.submit")}
fullWidth={true}
loading={loading}
/>
@@ -116,4 +116,4 @@ class LoginForm extends React.Component<Props, State> {
}
}
export default translate('commons')(LoginForm);
export default translate("commons")(LoginForm);

View File

@@ -1,8 +1,8 @@
import React from 'react';
import InfoBox from './InfoBox';
import { InfoItem } from './InfoItem';
import LoginForm from './LoginForm';
import { Loading } from '@scm-manager/ui-components';
import React from "react";
import InfoBox from "./InfoBox";
import { InfoItem } from "./InfoItem";
import LoginForm from "./LoginForm";
import { Loading } from "@scm-manager/ui-components";
type Props = {
loginInfoLink?: string;
@@ -25,7 +25,7 @@ class LoginInfo extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
loading: !!props.loginInfoLink,
loading: !!props.loginInfoLink
};
}
@@ -35,7 +35,7 @@ class LoginInfo extends React.Component<Props, State> {
.then(info => {
this.setState({
info,
loading: false,
loading: false
});
});
};
@@ -43,7 +43,7 @@ class LoginInfo extends React.Component<Props, State> {
timeout = (ms: number, promise: Promise<any>) => {
return new Promise<LoginInfoResponse>((resolve, reject) => {
setTimeout(() => {
reject(new Error('timeout during fetch of login info'));
reject(new Error("timeout during fetch of login info"));
}, ms);
promise.then(resolve, reject);
});
@@ -56,7 +56,7 @@ class LoginInfo extends React.Component<Props, State> {
}
this.timeout(1000, this.fetchLoginInfo(loginInfoLink)).catch(() => {
this.setState({
loading: false,
loading: false
});
});
}

View File

@@ -1,30 +1,30 @@
import React, { Component } from 'react';
import Main from './Main';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router-dom';
import React, { Component } from "react";
import Main from "./Main";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import {
fetchMe,
getFetchMeFailure,
getMe,
isAuthenticated,
isFetchMePending,
} from '../modules/auth';
isFetchMePending
} from "../modules/auth";
import {
ErrorPage,
Footer,
Header,
Loading,
PrimaryNavigation,
} from '@scm-manager/ui-components';
import { Links, Me } from '@scm-manager/ui-types';
PrimaryNavigation
} from "@scm-manager/ui-components";
import { Links, Me } from "@scm-manager/ui-types";
import {
getFetchIndexResourcesFailure,
getLinks,
getMeLink,
isFetchIndexResourcesPending,
} from '../modules/indexResource';
isFetchIndexResourcesPending
} from "../modules/indexResource";
type Props = {
me: Me;
@@ -52,15 +52,15 @@ class App extends Component<Props> {
const { me, loading, error, authenticated, links, t } = this.props;
let content;
const navigation = authenticated ? <PrimaryNavigation links={links} /> : '';
const navigation = authenticated ? <PrimaryNavigation links={links} /> : "";
if (loading) {
content = <Loading />;
} else if (error) {
content = (
<ErrorPage
title={t('app.error.title')}
subtitle={t('app.error.subtitle')}
title={t("app.error.title")}
subtitle={t("app.error.subtitle")}
error={error}
/>
);
@@ -79,7 +79,7 @@ class App extends Component<Props> {
const mapDispatchToProps = (dispatch: any) => {
return {
fetchMe: (link: string) => dispatch(fetchMe(link)),
fetchMe: (link: string) => dispatch(fetchMe(link))
};
};
@@ -98,13 +98,13 @@ const mapStateToProps = state => {
loading,
error,
links,
meLink,
meLink
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(App)),
mapDispatchToProps
)(translate("commons")(App))
);

View File

@@ -1,14 +1,14 @@
import React from 'react';
import React from "react";
import {
ErrorNotification,
InputField,
Notification,
PasswordConfirmation,
SubmitButton,
} from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import { changePassword } from '../modules/changePassword';
SubmitButton
} from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import { changePassword } from "../modules/changePassword";
type Props = {
me: Me;
@@ -29,21 +29,21 @@ class ChangeUserPassword extends React.Component<Props, State> {
super(props);
this.state = {
oldPassword: '',
password: '',
oldPassword: "",
password: "",
loading: false,
passwordConfirmationError: false,
validatePasswordError: false,
validatePassword: '',
validatePassword: "",
passwordChanged: false,
passwordValid: false,
passwordValid: false
};
}
setLoadingState = () => {
this.setState({
...this.state,
loading: true,
loading: true
});
};
@@ -51,7 +51,7 @@ class ChangeUserPassword extends React.Component<Props, State> {
this.setState({
...this.state,
error: error,
loading: false,
loading: false
});
};
@@ -60,8 +60,8 @@ class ChangeUserPassword extends React.Component<Props, State> {
...this.state,
loading: false,
passwordChanged: true,
oldPassword: '',
password: '',
oldPassword: "",
password: ""
});
};
@@ -97,8 +97,8 @@ class ChangeUserPassword extends React.Component<Props, State> {
if (passwordChanged) {
message = (
<Notification
type={'success'}
children={t('password.changedSuccessfully')}
type={"success"}
children={t("password.changedSuccessfully")}
onClose={() => this.onClose()}
/>
);
@@ -112,29 +112,29 @@ class ChangeUserPassword extends React.Component<Props, State> {
<div className="columns">
<div className="column">
<InputField
label={t('password.currentPassword')}
label={t("password.currentPassword")}
type="password"
onChange={oldPassword =>
this.setState({
...this.state,
oldPassword,
oldPassword
})
}
value={this.state.oldPassword ? this.state.oldPassword : ''}
helpText={t('password.currentPasswordHelpText')}
value={this.state.oldPassword ? this.state.oldPassword : ""}
helpText={t("password.currentPasswordHelpText")}
/>
</div>
</div>
<PasswordConfirmation
passwordChanged={this.passwordChanged}
key={this.state.passwordChanged ? 'changed' : 'unchanged'}
key={this.state.passwordChanged ? "changed" : "unchanged"}
/>
<div className="columns">
<div className="column">
<SubmitButton
disabled={!this.isValid()}
loading={loading}
label={t('password.submit')}
label={t("password.submit")}
/>
</div>
</div>
@@ -146,16 +146,16 @@ class ChangeUserPassword extends React.Component<Props, State> {
this.setState({
...this.state,
password,
passwordValid: !!password && passwordValid,
passwordValid: !!password && passwordValid
});
};
onClose = () => {
this.setState({
...this.state,
passwordChanged: false,
passwordChanged: false
});
};
}
export default translate('commons')(ChangeUserPassword);
export default translate("commons")(ChangeUserPassword);

View File

@@ -1,20 +1,20 @@
import React, { Component } from 'react';
import App from './App';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router-dom';
import React, { Component } from "react";
import App from "./App";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import { Loading, ErrorBoundary } from '@scm-manager/ui-components';
import { Loading, ErrorBoundary } from "@scm-manager/ui-components";
import {
fetchIndexResources,
getFetchIndexResourcesFailure,
getLinks,
isFetchIndexResourcesPending,
} from '../modules/indexResource';
import PluginLoader from './PluginLoader';
import { IndexResources } from '@scm-manager/ui-types';
import ScrollToTop from './ScrollToTop';
import IndexErrorPage from './IndexErrorPage';
isFetchIndexResourcesPending
} from "../modules/indexResource";
import PluginLoader from "./PluginLoader";
import { IndexResources } from "@scm-manager/ui-types";
import ScrollToTop from "./ScrollToTop";
import IndexErrorPage from "./IndexErrorPage";
type Props = {
error: Error;
@@ -36,7 +36,7 @@ class Index extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
pluginsLoaded: false,
pluginsLoaded: false
};
}
@@ -46,7 +46,7 @@ class Index extends Component<Props, State> {
pluginLoaderCallback = () => {
this.setState({
pluginsLoaded: true,
pluginsLoaded: true
});
};
@@ -77,7 +77,7 @@ class Index extends Component<Props, State> {
const mapDispatchToProps = (dispatch: any) => {
return {
fetchIndexResources: () => dispatch(fetchIndexResources()),
fetchIndexResources: () => dispatch(fetchIndexResources())
};
};
@@ -88,13 +88,13 @@ const mapStateToProps = state => {
return {
loading,
error,
indexResources,
indexResources
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(Index)),
mapDispatchToProps
)(translate("commons")(Index))
);

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate, TFunction } from 'react-i18next';
import { ErrorPage } from '@scm-manager/ui-components';
import React from "react";
import { translate, TFunction } from "react-i18next";
import { ErrorPage } from "@scm-manager/ui-components";
type Props = {
error: Error;
@@ -12,12 +12,12 @@ class IndexErrorPage extends React.Component<Props> {
const { error, t } = this.props;
return (
<ErrorPage
title={t('app.error.title')}
subtitle={t('app.error.subtitle')}
title={t("app.error.title")}
subtitle={t("app.error.subtitle")}
error={error}
/>
);
}
}
export default translate('commons')(IndexErrorPage);
export default translate("commons")(IndexErrorPage);

View File

@@ -1,17 +1,17 @@
import React from 'react';
import { connect } from 'react-redux';
import { Redirect, withRouter } from 'react-router-dom';
import { compose } from 'redux';
import { translate } from 'react-i18next';
import styled from 'styled-components';
import React from "react";
import { connect } from "react-redux";
import { Redirect, withRouter } from "react-router-dom";
import { compose } from "redux";
import { translate } from "react-i18next";
import styled from "styled-components";
import {
getLoginFailure,
isAuthenticated,
isLoginPending,
login,
} from '../modules/auth';
import { getLoginInfoLink, getLoginLink } from '../modules/indexResource';
import LoginInfo from '../components/LoginInfo';
login
} from "../modules/auth";
import { getLoginInfoLink, getLoginLink } from "../modules/indexResource";
import LoginInfo from "../components/LoginInfo";
type Props = {
authenticated: boolean;
@@ -42,8 +42,8 @@ class Login extends React.Component<Props> {
renderRedirect = () => {
const { from } = this.props.location.state || {
from: {
pathname: '/',
},
pathname: "/"
}
};
return <Redirect to={from} />;
};
@@ -80,14 +80,14 @@ const mapStateToProps = state => {
loading,
error,
link,
loginInfoLink,
loginInfoLink
};
};
const mapDispatchToProps = dispatch => {
return {
login: (loginLink: string, username: string, password: string) =>
dispatch(login(loginLink, username, password)),
dispatch(login(loginLink, username, password))
};
};
@@ -95,6 +95,6 @@ export default compose(
withRouter,
connect(
mapStateToProps,
mapDispatchToProps,
),
mapDispatchToProps
)
)(Login);

View File

@@ -1,17 +1,17 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { Redirect } from 'react-router-dom';
import React from "react";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { Redirect } from "react-router-dom";
import {
logout,
isAuthenticated,
isLogoutPending,
getLogoutFailure,
isRedirecting,
} from '../modules/auth';
import { Loading, ErrorPage } from '@scm-manager/ui-components';
import { getLogoutLink } from '../modules/indexResource';
isRedirecting
} from "../modules/auth";
import { Loading, ErrorPage } from "@scm-manager/ui-components";
import { getLogoutLink } from "../modules/indexResource";
type Props = {
authenticated: boolean;
@@ -37,8 +37,8 @@ class Logout extends React.Component<Props> {
if (error) {
return (
<ErrorPage
title={t('logout.error.title')}
subtitle={t('logout.error.subtitle')}
title={t("logout.error.title")}
subtitle={t("logout.error.subtitle")}
error={error}
/>
);
@@ -61,17 +61,17 @@ const mapStateToProps = state => {
loading,
redirecting,
error,
logoutLink,
logoutLink
};
};
const mapDispatchToProps = dispatch => {
return {
logout: (link: string) => dispatch(logout(link)),
logout: (link: string) => dispatch(logout(link))
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(Logout));
mapDispatchToProps
)(translate("commons")(Logout));

View File

@@ -1,28 +1,28 @@
import React from 'react';
import React from "react";
import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
import { Links } from '@scm-manager/ui-types';
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
import { Links } from "@scm-manager/ui-types";
import Overview from '../repos/containers/Overview';
import Users from '../users/containers/Users';
import Login from '../containers/Login';
import Logout from '../containers/Logout';
import Overview from "../repos/containers/Overview";
import Users from "../users/containers/Users";
import Login from "../containers/Login";
import Logout from "../containers/Logout";
import { ProtectedRoute } from '@scm-manager/ui-components';
import { binder, ExtensionPoint } from '@scm-manager/ui-extensions';
import { ProtectedRoute } from "@scm-manager/ui-components";
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
import CreateUser from '../users/containers/CreateUser';
import SingleUser from '../users/containers/SingleUser';
import RepositoryRoot from '../repos/containers/RepositoryRoot';
import Create from '../repos/containers/Create';
import CreateUser from "../users/containers/CreateUser";
import SingleUser from "../users/containers/SingleUser";
import RepositoryRoot from "../repos/containers/RepositoryRoot";
import Create from "../repos/containers/Create";
import Groups from '../groups/containers/Groups';
import SingleGroup from '../groups/containers/SingleGroup';
import CreateGroup from '../groups/containers/CreateGroup';
import Groups from "../groups/containers/Groups";
import SingleGroup from "../groups/containers/SingleGroup";
import CreateGroup from "../groups/containers/CreateGroup";
import Admin from '../admin/containers/Admin';
import Admin from "../admin/containers/Admin";
import Profile from './Profile';
import Profile from "./Profile";
type Props = {
authenticated?: boolean;
@@ -32,8 +32,8 @@ type Props = {
class Main extends React.Component<Props> {
render() {
const { authenticated, links } = this.props;
const redirectUrlFactory = binder.getExtension('main.redirect', this.props);
let url = '/repos/';
const redirectUrlFactory = binder.getExtension("main.redirect", this.props);
let url = "/repos/";
if (redirectUrlFactory) {
url = redirectUrlFactory(this.props);
}
@@ -128,7 +128,7 @@ class Main extends React.Component<Props> {
renderAll={true}
props={{
authenticated,
links,
links
}}
/>
</Switch>

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import { apiClient, Loading } from '@scm-manager/ui-components';
import { getUiPluginsLink } from '../modules/indexResource';
import { connect } from 'react-redux';
import loadBundle from './loadBundle';
import * as React from "react";
import { apiClient, Loading } from "@scm-manager/ui-components";
import { getUiPluginsLink } from "../modules/indexResource";
import { connect } from "react-redux";
import loadBundle from "./loadBundle";
type Props = {
loaded: boolean;
@@ -24,7 +24,7 @@ class PluginLoader extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
message: 'booting',
message: "booting"
};
}
@@ -32,7 +32,7 @@ class PluginLoader extends React.Component<Props, State> {
const { loaded } = this.props;
if (!loaded) {
this.setState({
message: 'loading plugin information',
message: "loading plugin information"
});
this.getPlugins(this.props.link);
@@ -51,7 +51,7 @@ class PluginLoader extends React.Component<Props, State> {
loadPlugins = (plugins: Plugin[]) => {
this.setState({
message: 'loading plugins',
message: "loading plugins"
});
const promises = [];
@@ -68,7 +68,7 @@ class PluginLoader extends React.Component<Props, State> {
loadPlugin = (plugin: Plugin) => {
this.setState({
message: `loading ${plugin.name}`,
message: `loading ${plugin.name}`
});
const promises = [];
@@ -99,7 +99,7 @@ const comparePluginsByName = (a: Plugin, b: Plugin) => {
const mapStateToProps = state => {
const link = getUiPluginsLink(state);
return {
link,
link
};
};

View File

@@ -1,22 +1,22 @@
import React from 'react';
import React from "react";
import { Route, withRouter } from 'react-router-dom';
import { getMe } from '../modules/auth';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import { Route, withRouter } from "react-router-dom";
import { getMe } from "../modules/auth";
import { compose } from "redux";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import {
ErrorPage,
Page,
Navigation,
SubNavigation,
Section,
NavLink,
} from '@scm-manager/ui-components';
import ChangeUserPassword from './ChangeUserPassword';
import ProfileInfo from './ProfileInfo';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
NavLink
} from "@scm-manager/ui-components";
import ChangeUserPassword from "./ChangeUserPassword";
import ProfileInfo from "./ProfileInfo";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = {
me: Me;
@@ -29,7 +29,7 @@ type State = {};
class Profile extends React.Component<Props, State> {
stripEndingSlash = (url: string) => {
if (url.endsWith('/')) {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
}
return url;
@@ -47,11 +47,11 @@ class Profile extends React.Component<Props, State> {
if (!me) {
return (
<ErrorPage
title={t('profile.error-title')}
subtitle={t('profile.error-subtitle')}
title={t("profile.error-title")}
subtitle={t("profile.error-subtitle")}
error={{
name: t('profile.error'),
message: t('profile.error-message'),
name: t("profile.error"),
message: t("profile.error-message")
}}
/>
);
@@ -59,7 +59,7 @@ class Profile extends React.Component<Props, State> {
const extensionProps = {
me,
url,
url
};
return (
@@ -79,19 +79,19 @@ class Profile extends React.Component<Props, State> {
</div>
<div className="column">
<Navigation>
<Section label={t('profile.navigationLabel')}>
<Section label={t("profile.navigationLabel")}>
<NavLink
to={`${url}`}
icon="fas fa-info-circle"
label={t('profile.informationNavLink')}
label={t("profile.informationNavLink")}
/>
<SubNavigation
to={`${url}/settings/password`}
label={t('profile.settingsNavLink')}
label={t("profile.settingsNavLink")}
>
<NavLink
to={`${url}/settings/password`}
label={t('profile.changePasswordNavLink')}
label={t("profile.changePasswordNavLink")}
/>
<ExtensionPoint
name="profile.setting"
@@ -110,12 +110,12 @@ class Profile extends React.Component<Props, State> {
const mapStateToProps = state => {
return {
me: getMe(state),
me: getMe(state)
};
};
export default compose(
translate('commons'),
translate("commons"),
connect(mapStateToProps),
withRouter,
withRouter
)(Profile);

View File

@@ -1,11 +1,11 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import {
MailLink,
AvatarWrapper,
AvatarImage,
} from '@scm-manager/ui-components';
AvatarImage
} from "@scm-manager/ui-components";
type Props = {
me: Me;
@@ -30,15 +30,15 @@ class ProfileInfo extends React.Component<Props> {
<table className="table content">
<tbody>
<tr>
<th>{t('profile.username')}</th>
<th>{t("profile.username")}</th>
<td>{me.name}</td>
</tr>
<tr>
<th>{t('profile.displayName')}</th>
<th>{t("profile.displayName")}</th>
<td>{me.displayName}</td>
</tr>
<tr>
<th>{t('profile.mail')}</th>
<th>{t("profile.mail")}</th>
<td>
<MailLink address={me.mail} />
</td>
@@ -58,7 +58,7 @@ class ProfileInfo extends React.Component<Props> {
if (me.groups.length > 0) {
groups = (
<tr>
<th>{t('profile.groups')}</th>
<th>{t("profile.groups")}</th>
<td className="is-paddingless">
<ul>
{me.groups.map(group => {
@@ -73,4 +73,4 @@ class ProfileInfo extends React.Component<Props> {
}
}
export default translate('commons')(ProfileInfo);
export default translate("commons")(ProfileInfo);

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { withRouter } from 'react-router-dom';
import React from "react";
import { withRouter } from "react-router-dom";
type Props = {
location: any;

View File

@@ -1,33 +1,33 @@
/* global SystemJS */
// eslint-disable-next-line import/no-webpack-loader-syntax
import 'script-loader!../../../../node_modules/systemjs/dist/system.js';
import "script-loader!../../../../node_modules/systemjs/dist/system.js";
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactRouterDom from 'react-router-dom';
import * as Redux from 'redux';
import * as ReactRedux from 'react-redux';
import SytleComponentsDefault from 'styled-components';
import * as SytleComponents from 'styled-components';
import * as ReactI18Next from 'react-i18next';
import ClassNamesDefault from 'classnames';
import * as ClassNames from 'classnames';
import QueryStringDefault from 'query-string';
import * as QueryString from 'query-string';
import * as UIExtensions from '@scm-manager/ui-extensions';
import * as UIComponents from '@scm-manager/ui-components';
import { urls } from '@scm-manager/ui-components';
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as ReactRouterDom from "react-router-dom";
import * as Redux from "redux";
import * as ReactRedux from "react-redux";
import SytleComponentsDefault from "styled-components";
import * as SytleComponents from "styled-components";
import * as ReactI18Next from "react-i18next";
import ClassNamesDefault from "classnames";
import * as ClassNames from "classnames";
import QueryStringDefault from "query-string";
import * as QueryString from "query-string";
import * as UIExtensions from "@scm-manager/ui-extensions";
import * as UIComponents from "@scm-manager/ui-components";
import { urls } from "@scm-manager/ui-components";
// TODO add headers "Cache": "no-cache", "X-Requested-With": "XMLHttpRequest"
SystemJS.config({
baseURL: urls.withContextPath('/assets'),
baseURL: urls.withContextPath("/assets"),
meta: {
'/*': {
"/*": {
esModule: true,
authorization: true,
},
},
authorization: true
}
}
});
const expose = (name, cmp, defaultCmp) => {
@@ -37,22 +37,22 @@ const expose = (name, cmp, defaultCmp) => {
// https://github.com/systemjs/systemjs/issues/1749
mod = {
...cmp,
__useDefault: defaultCmp,
__useDefault: defaultCmp
};
}
SystemJS.set(name, SystemJS.newModule(mod));
};
expose('react', React);
expose('react-dom', ReactDOM);
expose('react-router-dom', ReactRouterDom);
expose('styled-components', SytleComponents, SytleComponentsDefault);
expose('redux', Redux);
expose('react-redux', ReactRedux);
expose('react-i18next', ReactI18Next);
expose('classnames', ClassNames, ClassNamesDefault);
expose('query-string', QueryString, QueryStringDefault);
expose('@scm-manager/ui-extensions', UIExtensions);
expose('@scm-manager/ui-components', UIComponents);
expose("react", React);
expose("react-dom", ReactDOM);
expose("react-router-dom", ReactRouterDom);
expose("styled-components", SytleComponents, SytleComponentsDefault);
expose("redux", Redux);
expose("react-redux", ReactRedux);
expose("react-i18next", ReactI18Next);
expose("classnames", ClassNames, ClassNamesDefault);
expose("query-string", QueryString, QueryStringDefault);
expose("@scm-manager/ui-extensions", UIExtensions);
expose("@scm-manager/ui-components", UIComponents);
export default plugin => SystemJS.import(plugin);

View File

@@ -1,23 +1,23 @@
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import { createStore, compose, applyMiddleware, combineReducers } from 'redux';
import users from './users/modules/users';
import repos from './repos/modules/repos';
import repositoryTypes from './repos/modules/repositoryTypes';
import changesets from './repos/modules/changesets';
import sources from './repos/sources/modules/sources';
import groups from './groups/modules/groups';
import auth from './modules/auth';
import pending from './modules/pending';
import failure from './modules/failure';
import permissions from './repos/permissions/modules/permissions';
import config from './admin/modules/config';
import roles from './admin/roles/modules/roles';
import namespaceStrategies from './admin/modules/namespaceStrategies';
import indexResources from './modules/indexResource';
import plugins from './admin/plugins/modules/plugins';
import thunk from "redux-thunk";
import logger from "redux-logger";
import { createStore, compose, applyMiddleware, combineReducers } from "redux";
import users from "./users/modules/users";
import repos from "./repos/modules/repos";
import repositoryTypes from "./repos/modules/repositoryTypes";
import changesets from "./repos/modules/changesets";
import sources from "./repos/sources/modules/sources";
import groups from "./groups/modules/groups";
import auth from "./modules/auth";
import pending from "./modules/pending";
import failure from "./modules/failure";
import permissions from "./repos/permissions/modules/permissions";
import config from "./admin/modules/config";
import roles from "./admin/roles/modules/roles";
import namespaceStrategies from "./admin/modules/namespaceStrategies";
import indexResources from "./modules/indexResource";
import plugins from "./admin/plugins/modules/plugins";
import branches from './repos/branches/modules/branches';
import branches from "./repos/branches/modules/branches";
function createReduxStore() {
const composeEnhancers =
@@ -39,7 +39,7 @@ function createReduxStore() {
roles,
sources,
namespaceStrategies,
plugins,
plugins
});
return createStore(reducer, composeEnhancers(applyMiddleware(thunk, logger)));

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { translate } from 'react-i18next';
import React from "react";
import { translate } from "react-i18next";
import {
Subtitle,
AutocompleteAddEntryToTableField,
@@ -7,11 +7,11 @@ import {
InputField,
SubmitButton,
Textarea,
Checkbox,
} from '@scm-manager/ui-components';
import { Group, SelectValue } from '@scm-manager/ui-types';
Checkbox
} from "@scm-manager/ui-components";
import { Group, SelectValue } from "@scm-manager/ui-types";
import * as validator from './groupValidation';
import * as validator from "./groupValidation";
type Props = {
t: (p: string) => string;
@@ -31,17 +31,17 @@ class GroupForm extends React.Component<Props, State> {
super(props);
this.state = {
group: {
name: '',
description: '',
name: "",
description: "",
_embedded: {
members: [],
members: []
},
_links: {},
members: [],
type: '',
external: false,
type: "",
external: false
},
nameValidationError: false,
nameValidationError: false
};
}
@@ -51,8 +51,8 @@ class GroupForm extends React.Component<Props, State> {
this.setState({
...this.state,
group: {
...group,
},
...group
}
});
}
}
@@ -92,12 +92,12 @@ class GroupForm extends React.Component<Props, State> {
<AutocompleteAddEntryToTableField
addEntry={this.addMember}
disabled={false}
buttonLabel={t('add-member-button.label')}
errorMessage={t('add-member-textfield.error')}
buttonLabel={t("add-member-button.label")}
errorMessage={t("add-member-textfield.error")}
loadSuggestions={loadUserSuggestions}
placeholder={t('add-member-autocomplete.placeholder')}
loadingMessage={t('add-member-autocomplete.loading')}
noOptionsMessage={t('add-member-autocomplete.no-options')}
placeholder={t("add-member-autocomplete.placeholder")}
loadingMessage={t("add-member-autocomplete.loading")}
noOptionsMessage={t("add-member-autocomplete.no-options")}
/>
</>
);
@@ -110,9 +110,9 @@ class GroupForm extends React.Component<Props, State> {
}
return (
<Checkbox
label={t('group.external')}
label={t("group.external")}
checked={group.external}
helpText={t('groupForm.help.externalHelpText')}
helpText={t("groupForm.help.externalHelpText")}
onChange={this.handleExternalChange}
/>
);
@@ -129,18 +129,18 @@ class GroupForm extends React.Component<Props, State> {
// create new group
nameField = (
<InputField
label={t('group.name')}
errorMessage={t('groupForm.nameError')}
label={t("group.name")}
errorMessage={t("groupForm.nameError")}
onChange={this.handleGroupNameChange}
value={group.name}
validationError={this.state.nameValidationError}
helpText={t('groupForm.help.nameHelpText')}
helpText={t("groupForm.help.nameHelpText")}
/>
);
} else if (group.external) {
subtitle = <Subtitle subtitle={t('groupForm.externalSubtitle')} />;
subtitle = <Subtitle subtitle={t("groupForm.externalSubtitle")} />;
} else {
subtitle = <Subtitle subtitle={t('groupForm.subtitle')} />;
subtitle = <Subtitle subtitle={t("groupForm.subtitle")} />;
}
return (
@@ -149,18 +149,18 @@ class GroupForm extends React.Component<Props, State> {
<form onSubmit={this.submit}>
{nameField}
<Textarea
label={t('group.description')}
errorMessage={t('groupForm.descriptionError')}
label={t("group.description")}
errorMessage={t("groupForm.descriptionError")}
onChange={this.handleDescriptionChange}
value={group.description}
validationError={false}
helpText={t('groupForm.help.descriptionHelpText')}
helpText={t("groupForm.help.descriptionHelpText")}
/>
{this.renderExternalField(group)}
{this.renderMemberfields(group)}
<SubmitButton
disabled={!this.isValid()}
label={t('groupForm.submit')}
label={t("groupForm.submit")}
loading={loading}
/>
</form>
@@ -173,8 +173,8 @@ class GroupForm extends React.Component<Props, State> {
...this.state,
group: {
...this.state.group,
members: membernames,
},
members: membernames
}
});
};
@@ -187,8 +187,8 @@ class GroupForm extends React.Component<Props, State> {
...this.state,
group: {
...this.state.group,
members: [...this.state.group.members, value.value.id],
},
members: [...this.state.group.members, value.value.id]
}
});
};
@@ -201,8 +201,8 @@ class GroupForm extends React.Component<Props, State> {
nameValidationError: !validator.isNameValid(name),
group: {
...this.state.group,
name,
},
name
}
});
};
@@ -210,8 +210,8 @@ class GroupForm extends React.Component<Props, State> {
this.setState({
group: {
...this.state.group,
description,
},
description
}
});
};
@@ -219,10 +219,10 @@ class GroupForm extends React.Component<Props, State> {
this.setState({
group: {
...this.state.group,
external,
},
external
}
});
};
}
export default translate('groups')(GroupForm);
export default translate("groups")(GroupForm);

View File

@@ -1,4 +1,4 @@
import { validation } from '@scm-manager/ui-components';
import { validation } from "@scm-manager/ui-components";
const isNameValid = validation.isNameValid;

View File

@@ -1,31 +1,31 @@
import React from 'react';
import { shallow } from 'enzyme';
import '@scm-manager/ui-tests/enzyme';
import '@scm-manager/ui-tests/i18n';
import EditGroupNavLink from './EditGroupNavLink';
import React from "react";
import { shallow } from "enzyme";
import "@scm-manager/ui-tests/enzyme";
import "@scm-manager/ui-tests/i18n";
import EditGroupNavLink from "./EditGroupNavLink";
it('should render nothing, if the edit link is missing', () => {
it("should render nothing, if the edit link is missing", () => {
const group = {
_links: {},
_links: {}
};
const navLink = shallow(
<EditGroupNavLink group={group} editUrl="/group/edit" />,
<EditGroupNavLink group={group} editUrl="/group/edit" />
);
expect(navLink.text()).toBe('');
expect(navLink.text()).toBe("");
});
it('should render the navLink', () => {
it("should render the navLink", () => {
const group = {
_links: {
update: {
href: '/groups',
},
},
href: "/groups"
}
}
};
const navLink = shallow(
<EditGroupNavLink group={group} editUrl="/group/edit" />,
<EditGroupNavLink group={group} editUrl="/group/edit" />
);
expect(navLink.text()).not.toBe('');
expect(navLink.text()).not.toBe("");
});

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Group } from '@scm-manager/ui-types';
import { NavLink } from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import React from "react";
import { Group } from "@scm-manager/ui-types";
import { NavLink } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = {
group: Group;
@@ -21,9 +21,9 @@ class EditGroupNavLink extends React.Component<Props> {
return null;
}
return (
<NavLink to={editUrl} label={t('singleGroup.menu.generalNavLink')} />
<NavLink to={editUrl} label={t("singleGroup.menu.generalNavLink")} />
);
}
}
export default translate('groups')(EditGroupNavLink);
export default translate("groups")(EditGroupNavLink);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Group } from '@scm-manager/ui-types';
import { NavLink } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { Group } from "@scm-manager/ui-types";
import { NavLink } from "@scm-manager/ui-components";
type Props = {
t: (p: string) => string;
@@ -19,7 +19,7 @@ class ChangePermissionNavLink extends React.Component<Props> {
return (
<NavLink
to={permissionsUrl}
label={t('singleGroup.menu.setPermissionsNavLink')}
label={t("singleGroup.menu.setPermissionsNavLink")}
/>
);
}
@@ -29,4 +29,4 @@ class ChangePermissionNavLink extends React.Component<Props> {
};
}
export default translate('groups')(ChangePermissionNavLink);
export default translate("groups")(ChangePermissionNavLink);

View File

@@ -1,2 +1,2 @@
export { default as EditGroupNavLink } from './EditGroupNavLink';
export { default as SetPermissionsNavLink } from './SetPermissionsNavLink';
export { default as EditGroupNavLink } from "./EditGroupNavLink";
export { default as SetPermissionsNavLink } from "./SetPermissionsNavLink";

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Group } from '@scm-manager/ui-types';
import { DateFromNow, Checkbox } from '@scm-manager/ui-components';
import GroupMember from './GroupMember';
import React from "react";
import { translate } from "react-i18next";
import { Group } from "@scm-manager/ui-types";
import { DateFromNow, Checkbox } from "@scm-manager/ui-components";
import GroupMember from "./GroupMember";
type Props = {
group: Group;
@@ -18,31 +18,31 @@ class Details extends React.Component<Props> {
<table className="table content">
<tbody>
<tr>
<th>{t('group.name')}</th>
<th>{t("group.name")}</th>
<td>{group.name}</td>
</tr>
<tr>
<th>{t('group.description')}</th>
<th>{t("group.description")}</th>
<td>{group.description}</td>
</tr>
<tr>
<th>{t('group.external')}</th>
<th>{t("group.external")}</th>
<td>
<Checkbox checked={group.external} />
</td>
</tr>
<tr>
<th>{t('group.type')}</th>
<th>{t("group.type")}</th>
<td>{group.type}</td>
</tr>
<tr>
<th>{t('group.creationDate')}</th>
<th>{t("group.creationDate")}</th>
<td>
<DateFromNow date={group.creationDate} />
</td>
</tr>
<tr>
<th>{t('group.lastModified')}</th>
<th>{t("group.lastModified")}</th>
<td>
<DateFromNow date={group.lastModified} />
</td>
@@ -60,7 +60,7 @@ class Details extends React.Component<Props> {
if (group.members.length > 0) {
member = (
<tr>
<th>{t('group.members')}</th>
<th>{t("group.members")}</th>
<td className="is-paddingless">
<ul>
{group._embedded.members.map((member, index) => {
@@ -75,4 +75,4 @@ class Details extends React.Component<Props> {
}
}
export default translate('groups')(Details);
export default translate("groups")(Details);

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Member } from '@scm-manager/ui-types';
import React from "react";
import { Link } from "react-router-dom";
import { Member } from "@scm-manager/ui-types";
type Props = {
member: Member;

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Link } from 'react-router-dom';
import { Group } from '@scm-manager/ui-types';
import { Icon } from '@scm-manager/ui-components';
import React from "react";
import { translate } from "react-i18next";
import { Link } from "react-router-dom";
import { Group } from "@scm-manager/ui-types";
import { Icon } from "@scm-manager/ui-components";
type Props = {
group: Group;
@@ -20,9 +20,9 @@ class GroupRow extends React.Component<Props> {
const { group, t } = this.props;
const to = `/group/${group.name}`;
const iconType = group.external ? (
<Icon title={t('group.external')} name="sign-out-alt fa-rotate-270" />
<Icon title={t("group.external")} name="sign-out-alt fa-rotate-270" />
) : (
<Icon title={t('group.internal')} name="sign-in-alt fa-rotate-90" />
<Icon title={t("group.internal")} name="sign-in-alt fa-rotate-90" />
);
return (
@@ -36,4 +36,4 @@ class GroupRow extends React.Component<Props> {
}
}
export default translate('groups')(GroupRow);
export default translate("groups")(GroupRow);

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { translate } from 'react-i18next';
import GroupRow from './GroupRow';
import { Group } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import GroupRow from "./GroupRow";
import { Group } from "@scm-manager/ui-types";
type Props = {
t: (p: string) => string;
@@ -15,8 +15,8 @@ class GroupTable extends React.Component<Props> {
<table className="card-table table is-hoverable is-fullwidth">
<thead>
<tr>
<th>{t('group.name')}</th>
<th className="is-hidden-mobile">{t('group.description')}</th>
<th>{t("group.name")}</th>
<th className="is-hidden-mobile">{t("group.description")}</th>
</tr>
</thead>
<tbody>
@@ -29,4 +29,4 @@ class GroupTable extends React.Component<Props> {
}
}
export default translate('groups')(GroupTable);
export default translate("groups")(GroupTable);

View File

@@ -1,3 +1,3 @@
export { default as Details } from './Details';
export { default as GroupRow } from './GroupRow';
export { default as GroupTable } from './GroupTable';
export { default as Details } from "./Details";
export { default as GroupRow } from "./GroupRow";
export { default as GroupTable } from "./GroupTable";

Some files were not shown because too many files have changed in this diff Show More