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AKa,KAAMA,OAKzCvB,EAAAA,cAAA,WACK,aACDA,EAAAA,cAAC4C,EAAAA,EAAO,CAACN,KAAMO,KAAKC,MAAMR,GAAOS,UAAWA,EAAAA,MAI5D,ECnJA,MAAMC,EAA4BpD,IAAmD,IAAjD2B,MAAO0B,cAAeC,EAAM,YAAEb,IAAazC,EAC3E,OACII,EAAAA,cAACmD,EAAAA,EAAgB,CAACD,OAAQA,GACrBb,GAAerC,EAAAA,cAACoD,EAAiB,CAACf,YAAaA,IACjC,EAI3BW,EAA0BK,YAAc,4BAqDxC,O","sources":["webpack://@jenkins-cd/jenkins-plugin-site/./src/components/PluginHealthScore.jsx","webpack://@jenkins-cd/jenkins-plugin-site/./src/templates/plugin_healthScore.jsx"],"sourcesContent":["import React, {useState} from 'react';\nimport PropTypes from 'prop-types';\nimport TimeAgo from 'react-timeago';\n\nimport ucFirst from '../utils/ucfirst';\nimport {formatter} from '../commons/helper';\nimport './PluginHealthScore.css';\n\nfunction ScoreIcon({score, className}) {\n const isCorrect = score === 100;\n return (\n
\n {isCorrect ?\n :\n \n }\n
\n );\n}\n\nScoreIcon.propTypes = {\n className: PropTypes.string,\n score: PropTypes.number.isRequired,\n};\n\nfunction ScoreValue({value}) {\n return (\n
\n {`${value}%`}\n
\n );\n}\n\nScoreValue.propTypes = {\n value: PropTypes.number.isRequired,\n};\n\nfunction ScoreResolutions({resolutions}) {\n return (\n
\n \n
\n );\n}\n\nScoreResolutions.propTypes = {\n resolutions: PropTypes.arrayOf(PropTypes.shape({\n text: PropTypes.string,\n link: PropTypes.string,\n })),\n};\n\nfunction ScoreComponent({component: {value, reasons, resolutions}}) {\n return (\n
\n \n
\n {reasons.map((reason, idx) => {\n return (\n {reason}\n );\n })}\n {resolutions.length > 0 && }\n
\n \n
\n );\n}\n\nScoreComponent.propTypes = {\n component: PropTypes.shape({\n value: PropTypes.number.isRequired,\n weight: PropTypes.number.isRequired,\n reasons: PropTypes.arrayOf(PropTypes.string),\n resolutions: ScoreResolutions.propTypes.resolutions,\n }).isRequired\n};\n\nfunction ScoreDetail({data: {name, components, value}}) {\n const [collapsed, setCollapsed] = useState(value === 100);\n return (\n
\n
setCollapsed(!collapsed)}>\n
\n \n
\n
\n {name.split('-').map(ucFirst).join(' ')}\n
\n \n
\n {collapsed ?\n :\n \n }\n
\n
\n
\n {components.sort((d1, d2) => d2.weight - d2.weight).map((component, idx) => {\n return ();\n })}\n
\n
\n );\n}\n\nScoreDetail.propTypes = {\n data: PropTypes.shape({\n name: PropTypes.string.isRequired,\n components: PropTypes.arrayOf(ScoreComponent.propTypes.component).isRequired,\n value: PropTypes.number.isRequired,\n weight: PropTypes.number.isRequired,\n }),\n};\n\nfunction compareString(a, b) {\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n}\n\nfunction PluginHealthScore({healthScore: {value: score, date, details}}) {\n return (\n
\n
\n
\n
\n {score}\n %\n
\n health score\n
\n
\n
\n {details.sort((d1, d2) => compareString(d1.name, d2.name)).map((data, idx) => {\n return (\n \n );\n })}\n
\n\n
\n {'Computed: '}\n \n
\n
\n );\n}\n\nPluginHealthScore.propTypes = {\n healthScore: PropTypes.shape({\n value: PropTypes.number.isRequired,\n date: PropTypes.string.isRequired,\n details: PropTypes.arrayOf(ScoreDetail.propTypes.data).isRequired\n }).isRequired,\n};\nexport default PluginHealthScore;\n","import {graphql} from 'gatsby';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport {PropTypesJenkinsPlugin} from '../proptypes';\n\nimport PluginPageLayout from '../components/PluginPageLayout';\nimport PluginHealthScore from '../components/PluginHealthScore';\n\nconst TemplatePluginHealthScore = ({data: {jenkinsPlugin: plugin, healthScore}}) => {\n return (\n \n {healthScore && }\n \n );\n};\n\nTemplatePluginHealthScore.displayName = 'TemplatePluginHealthScore';\nTemplatePluginHealthScore.propTypes = {\n data: PropTypes.shape({\n jenkinsPlugin: PropTypesJenkinsPlugin.isRequired,\n healthScore: PropTypes.shape({\n value: PropTypes.number.isRequired,\n date: PropTypes.string.isRequired,\n details: PropTypes.arrayOf(PropTypes.shape({\n components: PropTypes.arrayOf(PropTypes.shape({\n max: PropTypes.number.isRequired,\n value: PropTypes.number.isRequired,\n reasons: PropTypes.arrayOf(PropTypes.string).isRequired,\n resolutions: PropTypes.arrayOf(PropTypes.shape({\n text: PropTypes.string,\n link: PropTypes.string,\n })),\n })).isRequired,\n name: PropTypes.string.isRequired,\n value: PropTypes.number.isRequired,\n weight: PropTypes.number.isRequired,\n }))\n }).isRequired\n })\n};\n\n/* eslint no-undef: \"off\" */\nexport const pageQuery = graphql`\n query ($name: String!) {\n jenkinsPlugin(name: {eq: $name}) {\n ...JenkinsPluginFragment\n }\n\n healthScore: jenkinsPluginHealthScore(id: {eq: $name}) {\n date\n details {\n components {\n weight\n value\n reasons\n resolutions {\n text\n link\n }\n }\n name\n value\n weight\n }\n value\n }\n }\n`;\n\nexport default TemplatePluginHealthScore;\n"],"names":["ScoreIcon","_ref","score","className","isCorrect","React","name","ScoreValue","_ref2","value","ScoreResolutions","_ref3","resolutions","map","resolution","idx","key","href","link","text","ScoreComponent","_ref4","component","reasons","reason","length","ScoreDetail","_ref5","data","components","collapsed","setCollapsed","useState","onClick","split","ucFirst","join","sort","d1","d2","weight","_ref6","healthScore","date","details","id","compareString","a","b","TimeAgo","Date","parse","formatter","TemplatePluginHealthScore","jenkinsPlugin","plugin","PluginPageLayout","PluginHealthScore","displayName"],"sourceRoot":""}