MCPcopy Create free account
hub / github.com/dataease/SQLBot / OnlineValidatorBadge

Class OnlineValidatorBadge

frontend/public/swagger-ui-bundle.js:59900–59949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59898 )
59899 }
59900 }
59901 class OnlineValidatorBadge extends Re.Component {
59902 constructor(s, o) {
59903 super(s, o)
59904 let { getConfigs: i } = s,
59905 { validatorUrl: a } = i()
59906 this.state = {
59907 url: this.getDefinitionUrl(),
59908 validatorUrl: void 0 === a ? 'https://validator.swagger.io/validator' : a,
59909 }
59910 }
59911 getDefinitionUrl = () => {
59912 let { specSelectors: s } = this.props
59913 return new (Nt())(s.url(), lt.location).toString()
59914 }
59915 UNSAFE_componentWillReceiveProps(s) {
59916 let { getConfigs: o } = s,
59917 { validatorUrl: i } = o()
59918 this.setState({
59919 url: this.getDefinitionUrl(),
59920 validatorUrl: void 0 === i ? 'https://validator.swagger.io/validator' : i,
59921 })
59922 }
59923 render() {
59924 let { getConfigs: s } = this.props,
59925 { spec: o } = s(),
59926 i = sanitizeUrl(this.state.validatorUrl)
59927 return 'object' == typeof o && Object.keys(o).length
59928 ? null
59929 : this.state.url &&
59930 requiresValidationURL(this.state.validatorUrl) &&
59931 requiresValidationURL(this.state.url)
59932 ? Re.createElement(
59933 'span',
59934 { className: 'float-right' },
59935 Re.createElement(
59936 'a',
59937 {
59938 target: '_blank',
59939 rel: 'noopener noreferrer',
59940 href: `${i}/debug?url=${encodeURIComponent(this.state.url)}`,
59941 },
59942 Re.createElement(ValidatorImage, {
59943 src: `${i}?url=${encodeURIComponent(this.state.url)}`,
59944 alt: 'Online validator badge',
59945 })
59946 )
59947 )
59948 : null
59949 }
59950 }
59951 class ValidatorImage extends Re.Component {
59952 constructor(s) {

Callers

nothing calls this directly

Calls 3

NtFunction · 0.50
toStringMethod · 0.45
urlMethod · 0.45

Tested by

no test coverage detected