Remove contentShorten flags (#7245)
This commit is contained in:
parent
c2fc3b4174
commit
c0107b2e0c
@ -32,7 +32,7 @@ function Results ({ queue = [] }: Props): React.ReactElement<Props> | null {
|
|||||||
value={
|
value={
|
||||||
error
|
error
|
||||||
? error.message
|
? error.message
|
||||||
: <pre>{valueToText('', result as null, false)}</pre>
|
: <pre>{valueToText('', result as null)}</pre>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ interface Props {
|
|||||||
interface CacheInstance {
|
interface CacheInstance {
|
||||||
Component: React.ComponentType<any>;
|
Component: React.ComponentType<any>;
|
||||||
render: RenderFn;
|
render: RenderFn;
|
||||||
refresh: (swallowErrors: boolean, contentShorten: boolean) => React.ComponentType<any>;
|
refresh: (swallowErrors: boolean) => React.ComponentType<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cache: CacheInstance[] = [];
|
const cache: CacheInstance[] = [];
|
||||||
@ -66,13 +66,13 @@ function queryTypeToString (registry: Registry, { creator: { meta: { modifier, t
|
|||||||
: _type;
|
: _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createComponent (type: string, Component: React.ComponentType<any>, defaultProps: DefaultProps, renderHelper: ComponentRenderer): { Component: React.ComponentType<any>; render: (createComponent: RenderFn) => React.ComponentType<any>; refresh: (swallowErrors: boolean, contentShorten: boolean) => React.ComponentType<any> } {
|
function createComponent (type: string, Component: React.ComponentType<any>, defaultProps: DefaultProps, renderHelper: ComponentRenderer): { Component: React.ComponentType<any>; render: (createComponent: RenderFn) => React.ComponentType<any>; refresh: (swallowErrors: boolean) => React.ComponentType<any> } {
|
||||||
return {
|
return {
|
||||||
Component,
|
Component,
|
||||||
// In order to modify the parameters which are used to render the default component, we can use this method
|
// In order to modify the parameters which are used to render the default component, we can use this method
|
||||||
refresh: (contentShorten: boolean): React.ComponentType<any> =>
|
refresh: (): React.ComponentType<any> =>
|
||||||
renderHelper(
|
renderHelper(
|
||||||
(value: unknown) => <pre>{valueToText(type, value as null, contentShorten)}</pre>,
|
(value: unknown) => <pre>{valueToText(type, value as null)}</pre>,
|
||||||
defaultProps
|
defaultProps
|
||||||
),
|
),
|
||||||
// In order to replace the default component during runtime we can provide a RenderFn to create a new 'plugged' component
|
// In order to replace the default component during runtime we can provide a RenderFn to create a new 'plugged' component
|
||||||
@ -131,7 +131,7 @@ function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstan
|
|||||||
const defaultProps = { className: 'ui--output' };
|
const defaultProps = { className: 'ui--output' };
|
||||||
const Component = renderHelper(
|
const Component = renderHelper(
|
||||||
// By default we render a simple div node component with the query results in it
|
// By default we render a simple div node component with the query results in it
|
||||||
(value: unknown) => <pre>{valueToText(type, value as null, true)}</pre>,
|
(value: unknown) => <pre>{valueToText(type, value as null)}</pre>,
|
||||||
defaultProps
|
defaultProps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export function toHumanJson (value: any): string {
|
|||||||
.replace(/\],\[/g, '],\n[');
|
.replace(/\],\[/g, '],\n[');
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function valueToText (type: string, value: Codec | undefined | null, contentShorten = true): React.ReactNode {
|
export default function valueToText (type: string, value: Codec | undefined | null): React.ReactNode {
|
||||||
if (isNull(value) || isUndefined(value)) {
|
if (isNull(value) || isUndefined(value)) {
|
||||||
return div({}, '<unknown>');
|
return div({}, '<unknown>');
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ export default function valueToText (type: string, value: Codec | undefined | nu
|
|||||||
return div(
|
return div(
|
||||||
{},
|
{},
|
||||||
['Bytes', 'Raw', 'Option<Keys>', 'Keys'].includes(type) && isFunction(value.toU8a)
|
['Bytes', 'Raw', 'Option<Keys>', 'Keys'].includes(type) && isFunction(value.toU8a)
|
||||||
? u8aToHex(value.toU8a(true), contentShorten ? 512 : -1)
|
? u8aToHex(value.toU8a(true))
|
||||||
// HACK Handle Keys as hex-only (this should go away once the node value is
|
// HACK Handle Keys as hex-only (this should go away once the node value is
|
||||||
// consistently swapped to `Bytes`)
|
// consistently swapped to `Bytes`)
|
||||||
: type === 'Vec<(ValidatorId,Keys)>'
|
: type === 'Vec<(ValidatorId,Keys)>'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user