@backstage-community/plugin-cicd-statistics 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/alpha/entityContent.esm.js +2 -2
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/alpha.d.ts +9 -3
- package/dist/charts/stage-chart.esm.js +136 -100
- package/dist/charts/stage-chart.esm.js.map +1 -1
- package/dist/charts/status-chart.esm.js +59 -41
- package/dist/charts/status-chart.esm.js.map +1 -1
- package/dist/charts/zoom.esm.js +6 -5
- package/dist/charts/zoom.esm.js.map +1 -1
- package/dist/components/button-switch.esm.js +22 -21
- package/dist/components/button-switch.esm.js.map +1 -1
- package/dist/components/chart-filters.esm.js +182 -150
- package/dist/components/chart-filters.esm.js.map +1 -1
- package/dist/components/duration-slider.esm.js +24 -16
- package/dist/components/duration-slider.esm.js.map +1 -1
- package/dist/components/label.esm.js +2 -2
- package/dist/components/label.esm.js.map +1 -1
- package/dist/components/progress.esm.js +22 -15
- package/dist/components/progress.esm.js.map +1 -1
- package/dist/components/toggle.esm.js +4 -3
- package/dist/components/toggle.esm.js.map +1 -1
- package/dist/components/utils.esm.js +9 -4
- package/dist/components/utils.esm.js.map +1 -1
- package/dist/entity-page.esm.js +41 -32
- package/dist/entity-page.esm.js.map +1 -1
- package/package.json +11 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-filters.esm.js","sources":["../../src/components/chart-filters.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback, useState, useEffect, useMemo } from 'react';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport CardContent from '@material-ui/core/CardContent';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Grid from '@material-ui/core/Grid';\nimport Switch from '@material-ui/core/Switch';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ShowChartIcon from '@material-ui/icons/ShowChart';\nimport BarChartIcon from '@material-ui/icons/BarChart';\nimport MuiPickersUtilsProvider from '@material-ui/pickers/MuiPickersUtilsProvider';\nimport { KeyboardDatePicker } from '@material-ui/pickers/DatePicker';\nimport { DateTime } from 'luxon';\nimport LuxonUtils from '@date-io/luxon';\n\nimport {\n ChartType,\n ChartTypes,\n CicdConfiguration,\n CicdDefaults,\n FilterBranchType,\n FilterStatusType,\n statusTypes,\n} from '../apis/types';\nimport { ChartableStagesAnalysis } from '../charts/types';\nimport { ButtonSwitch, SwitchValue } from './button-switch';\nimport { Toggle } from './toggle';\nimport { DurationSlider } from './duration-slider';\nimport { Label } from './label';\n\nexport const useStyles = makeStyles(\n theme => ({\n rootCard: {\n padding: theme.spacing(0, 0, 0, 0),\n margin: theme.spacing(0, 0, 2, 0),\n },\n updateButton: {\n margin: theme.spacing(1, 0, 0, 0),\n },\n header: {\n margin: theme.spacing(0, 0, 0, 0),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n },\n title: {\n margin: theme.spacing(3, 0, 1, 0),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n '&:first-child': {\n margin: theme.spacing(1, 0, 1, 0),\n },\n },\n buttonDescription: {\n textTransform: 'uppercase',\n margin: theme.spacing(1, 0, 0, 1),\n },\n }),\n {\n name: 'CicdStatistics',\n },\n);\n\nexport type BranchSelection = FilterBranchType | 'all';\nexport type StatusSelection = FilterStatusType;\n\nexport interface ChartFilter {\n fromDate: Date;\n toDate: Date;\n branch: string;\n status: Array<string>;\n}\n\nexport function getDefaultChartFilter(\n cicdConfiguration: CicdConfiguration,\n): ChartFilter {\n const toDate = cicdConfiguration.defaults?.timeTo ?? new Date();\n return {\n fromDate:\n cicdConfiguration.defaults?.timeFrom ??\n DateTime.fromJSDate(toDate).minus({ months: 1 }).toJSDate(),\n toDate,\n branch: cicdConfiguration.defaults?.filterType ?? 'branch',\n status:\n cicdConfiguration.defaults?.filterStatus ??\n cicdConfiguration.availableStatuses.filter(\n status => status === 'succeeded' || status === 'failed',\n ),\n };\n}\n\nfunction isSameChartFilter(a: ChartFilter, b: ChartFilter): boolean {\n return (\n a.branch === b.branch &&\n [...a.status].sort().join(' ') === [...b.status].sort().join(' ') &&\n DateTime.fromJSDate(a.fromDate).hasSame(\n DateTime.fromJSDate(b.fromDate),\n 'day',\n ) &&\n DateTime.fromJSDate(a.toDate).hasSame(DateTime.fromJSDate(b.toDate), 'day')\n );\n}\n\nexport type ViewOptions = Pick<\n CicdDefaults,\n | 'lowercaseNames'\n | 'normalizeTimeRange'\n | 'collapsedLimit'\n | 'hideLimit'\n | 'chartTypes'\n>;\n\nexport function getDefaultViewOptions(\n cicdConfiguration: CicdConfiguration,\n): ViewOptions {\n return {\n lowercaseNames: cicdConfiguration.defaults?.lowercaseNames ?? false,\n normalizeTimeRange: cicdConfiguration.defaults?.normalizeTimeRange ?? true,\n collapsedLimit: 60 * 1000, // 1m\n hideLimit: 20 * 1000, // 20s\n chartTypes: {\n succeeded: ['duration'],\n failed: ['count'],\n enqueued: ['count'],\n scheduled: ['count'],\n running: ['count'],\n aborted: ['count'],\n stalled: ['count'],\n expired: ['count'],\n unknown: ['count'],\n },\n };\n}\n\nconst branchValues: Array<SwitchValue<BranchSelection>> = [\n 'master',\n 'branch',\n {\n value: 'all',\n tooltip:\n 'NOTE; If the build pipelines are very different between master and branch ' +\n 'builds, viewing them combined might not result in a very useful chart',\n },\n];\n\nconst chartTypeValues: Array<SwitchValue<ChartType>> = [\n { value: 'duration', text: <ShowChartIcon />, tooltip: 'Duration' },\n { value: 'count', text: <BarChartIcon />, tooltip: 'Count per day' },\n];\n\nexport interface ChartFiltersProps {\n analysis?: ChartableStagesAnalysis;\n\n cicdConfiguration: CicdConfiguration;\n initialFetchFilter: ChartFilter;\n currentFetchFilter?: ChartFilter;\n onChangeFetchFilter(filter: ChartFilter): void;\n updateFetchFilter(filter: ChartFilter): void;\n\n initialViewOptions: ViewOptions;\n onChangeViewOptions(filter: ViewOptions): void;\n}\n\ninterface InternalRef {\n first: boolean;\n}\n\nexport function ChartFilters(props: ChartFiltersProps) {\n const {\n analysis,\n cicdConfiguration,\n initialFetchFilter,\n currentFetchFilter,\n onChangeFetchFilter,\n updateFetchFilter,\n initialViewOptions,\n onChangeViewOptions,\n } = props;\n\n const classes = useStyles();\n\n const [internalRef] = useState<InternalRef>({ first: true });\n\n const [useNowAsToDate, setUseNowAsToDate] = useState(true);\n const [toDate, setToDate] = useState(initialFetchFilter.toDate);\n const [fromDate, setFromDate] = useState(initialFetchFilter.fromDate);\n\n const [branch, setBranch] = useState(initialFetchFilter.branch);\n\n const statusValues: ReadonlyArray<StatusSelection> =\n cicdConfiguration.availableStatuses;\n const [selectedStatus, setSelectedStatus] = useState(\n initialFetchFilter.status,\n );\n\n const [viewOptions, setViewOptions] = useState(initialViewOptions);\n\n const setLowercaseNames = useCallback(\n (lowercaseNames: boolean) => {\n setViewOptions(old => ({ ...old, lowercaseNames }));\n },\n [setViewOptions],\n );\n\n const setNormalizeTimeRange = useCallback(\n (normalizeTimeRange: boolean) => {\n setViewOptions(old => ({ ...old, normalizeTimeRange }));\n },\n [setViewOptions],\n );\n\n const setHideLimit = useCallback(\n (value: number) => {\n setViewOptions(old => ({ ...old, hideLimit: value }));\n },\n [setViewOptions],\n );\n\n const setCollapseLimit = useCallback(\n (value: number) => {\n setViewOptions(old => ({ ...old, collapsedLimit: value }));\n },\n [setViewOptions],\n );\n\n const setChartType = useCallback(\n (statusType: FilterStatusType, chartTypes: ChartTypes) => {\n setViewOptions(old => ({\n ...old,\n chartTypes: { ...old.chartTypes, [statusType]: chartTypes },\n }));\n },\n [setViewOptions],\n );\n const setChartTypeSpecific = useMemo(\n () =>\n Object.fromEntries(\n statusTypes.map(\n status =>\n [\n status,\n (chartTypes: ChartTypes) => setChartType(status, chartTypes),\n ] as const,\n ),\n ),\n [setChartType],\n );\n\n useEffect(() => {\n onChangeViewOptions(viewOptions);\n }, [onChangeViewOptions, viewOptions]);\n\n useEffect(() => {\n if (internalRef.first) {\n // Skip calling onChangeFetchFilter first time\n internalRef.first = false;\n return;\n }\n onChangeFetchFilter({\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n });\n }, [\n internalRef,\n toDate,\n fromDate,\n branch,\n selectedStatus,\n onChangeFetchFilter,\n ]);\n\n const toggleUseNowAsDate = useCallback(() => {\n setUseNowAsToDate(!useNowAsToDate);\n if (!DateTime.fromJSDate(toDate).hasSame(DateTime.now(), 'day')) {\n setToDate(new Date());\n }\n }, [useNowAsToDate, toDate]);\n\n const hasFetchFilterChanges = useMemo(\n () =>\n !currentFetchFilter ||\n !isSameChartFilter(\n {\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n },\n currentFetchFilter,\n ),\n [toDate, fromDate, branch, selectedStatus, currentFetchFilter],\n );\n\n const updateFilter = useCallback(() => {\n updateFetchFilter({\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n });\n }, [toDate, fromDate, branch, selectedStatus, updateFetchFilter]);\n\n const inrefferedStatuses = analysis?.statuses ?? selectedStatus;\n\n return (\n <MuiPickersUtilsProvider utils={LuxonUtils}>\n <Card className={classes.rootCard}>\n <CardHeader\n action={\n <Button\n size=\"small\"\n color=\"secondary\"\n variant=\"contained\"\n onClick={updateFilter}\n disabled={!hasFetchFilterChanges}\n >\n Update\n </Button>\n }\n title={\n <Typography variant=\"subtitle2\" className={classes.header}>\n Fetching options\n </Typography>\n }\n />\n <CardContent>\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Date range\n </Typography>\n <KeyboardDatePicker\n autoOk\n variant=\"inline\"\n inputVariant=\"outlined\"\n label=\"From date\"\n format=\"yyyy-MM-dd\"\n value={fromDate}\n InputAdornmentProps={{ position: 'start' }}\n onChange={date => setFromDate(date?.toJSDate() ?? new Date())}\n />\n <br />\n <FormControl component=\"fieldset\">\n <FormGroup>\n <FormControlLabel\n control={\n <Switch\n checked={useNowAsToDate}\n onChange={toggleUseNowAsDate}\n />\n }\n label={<Label>To today</Label>}\n />\n {useNowAsToDate ? null : (\n <KeyboardDatePicker\n autoOk\n variant=\"inline\"\n inputVariant=\"outlined\"\n label=\"To date\"\n format=\"yyyy-MM-dd\"\n value={toDate}\n InputAdornmentProps={{ position: 'start' }}\n onChange={date => setToDate(date?.toJSDate() ?? new Date())}\n />\n )}\n </FormGroup>\n </FormControl>\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Branch\n </Typography>\n <ButtonSwitch<string>\n values={branchValues}\n selection={branch}\n onChange={setBranch}\n />\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Status\n </Typography>\n <ButtonSwitch<string>\n values={statusValues}\n multi\n vertical\n selection={selectedStatus}\n onChange={setSelectedStatus}\n />\n </CardContent>\n </Card>\n <Card className={classes.rootCard}>\n <CardHeader\n title={\n <Typography variant=\"subtitle2\" className={classes.header}>\n View options\n </Typography>\n }\n />\n <CardContent>\n <Toggle\n checked={viewOptions.lowercaseNames}\n setChecked={setLowercaseNames}\n >\n <Tooltip\n arrow\n title={\n 'Lowercasing names can reduce duplications ' +\n 'when stage names have changed casing'\n }\n >\n <Label>Lowercase names</Label>\n </Tooltip>\n </Toggle>\n <Toggle\n checked={viewOptions.normalizeTimeRange}\n setChecked={setNormalizeTimeRange}\n >\n <Tooltip\n arrow\n title={\n 'All charts will use the same x-axis. ' +\n 'This reduces confusion when stages have been altered over time ' +\n 'and only appear in a part of the time range.'\n }\n >\n <Label>Normalize time range</Label>\n </Tooltip>\n </Toggle>\n <DurationSlider\n header=\"Hide under peak\"\n value={viewOptions.hideLimit}\n setValue={setHideLimit}\n />\n <DurationSlider\n header=\"Collapse under peak\"\n value={viewOptions.collapsedLimit}\n setValue={setCollapseLimit}\n />\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Chart styles\n </Typography>\n {inrefferedStatuses.map(status => (\n <Grid key={status} container spacing={0}>\n <Grid item>\n <ButtonSwitch<ChartType>\n values={chartTypeValues}\n selection={viewOptions.chartTypes[status as FilterStatusType]}\n onChange={setChartTypeSpecific[status]}\n multi\n />\n </Grid>\n <Grid item className={classes.buttonDescription}>\n <div>{status}</div>\n </Grid>\n </Grid>\n ))}\n </CardContent>\n </Card>\n </MuiPickersUtilsProvider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmDO,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,CAAU,KAAA,MAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MACjC,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC;AAAA,KAClC;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC;AAAA,KAClC;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,QAAQ,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MAChC,aAAe,EAAA,WAAA;AAAA,MACf,QAAU,EAAA,EAAA;AAAA,MAC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KAAK,EAAA;AAAA;AAAA,GAET,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,SAAW,EAAA,OAAA,CAAQ,iBAC5B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAK,MAAO,CACf,CACF,CACD,CACH,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"chart-filters.esm.js","sources":["../../src/components/chart-filters.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useState, useEffect, useMemo } from 'react';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport CardContent from '@material-ui/core/CardContent';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Grid from '@material-ui/core/Grid';\nimport Switch from '@material-ui/core/Switch';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ShowChartIcon from '@material-ui/icons/ShowChart';\nimport BarChartIcon from '@material-ui/icons/BarChart';\nimport MuiPickersUtilsProvider from '@material-ui/pickers/MuiPickersUtilsProvider';\nimport { KeyboardDatePicker } from '@material-ui/pickers/DatePicker';\nimport { DateTime } from 'luxon';\nimport LuxonUtils from '@date-io/luxon';\n\nimport {\n ChartType,\n ChartTypes,\n CicdConfiguration,\n CicdDefaults,\n FilterBranchType,\n FilterStatusType,\n statusTypes,\n} from '../apis/types';\nimport { ChartableStagesAnalysis } from '../charts/types';\nimport { ButtonSwitch, SwitchValue } from './button-switch';\nimport { Toggle } from './toggle';\nimport { DurationSlider } from './duration-slider';\nimport { Label } from './label';\n\nexport const useStyles = makeStyles(\n theme => ({\n rootCard: {\n padding: theme.spacing(0, 0, 0, 0),\n margin: theme.spacing(0, 0, 2, 0),\n },\n updateButton: {\n margin: theme.spacing(1, 0, 0, 0),\n },\n header: {\n margin: theme.spacing(0, 0, 0, 0),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n },\n title: {\n margin: theme.spacing(3, 0, 1, 0),\n textTransform: 'uppercase',\n fontSize: 12,\n fontWeight: 'bold',\n '&:first-child': {\n margin: theme.spacing(1, 0, 1, 0),\n },\n },\n buttonDescription: {\n textTransform: 'uppercase',\n margin: theme.spacing(1, 0, 0, 1),\n },\n }),\n {\n name: 'CicdStatistics',\n },\n);\n\nexport type BranchSelection = FilterBranchType | 'all';\nexport type StatusSelection = FilterStatusType;\n\nexport interface ChartFilter {\n fromDate: Date;\n toDate: Date;\n branch: string;\n status: Array<string>;\n}\n\nexport function getDefaultChartFilter(\n cicdConfiguration: CicdConfiguration,\n): ChartFilter {\n const toDate = cicdConfiguration.defaults?.timeTo ?? new Date();\n return {\n fromDate:\n cicdConfiguration.defaults?.timeFrom ??\n DateTime.fromJSDate(toDate).minus({ months: 1 }).toJSDate(),\n toDate,\n branch: cicdConfiguration.defaults?.filterType ?? 'branch',\n status:\n cicdConfiguration.defaults?.filterStatus ??\n cicdConfiguration.availableStatuses.filter(\n status => status === 'succeeded' || status === 'failed',\n ),\n };\n}\n\nfunction isSameChartFilter(a: ChartFilter, b: ChartFilter): boolean {\n return (\n a.branch === b.branch &&\n [...a.status].sort().join(' ') === [...b.status].sort().join(' ') &&\n DateTime.fromJSDate(a.fromDate).hasSame(\n DateTime.fromJSDate(b.fromDate),\n 'day',\n ) &&\n DateTime.fromJSDate(a.toDate).hasSame(DateTime.fromJSDate(b.toDate), 'day')\n );\n}\n\nexport type ViewOptions = Pick<\n CicdDefaults,\n | 'lowercaseNames'\n | 'normalizeTimeRange'\n | 'collapsedLimit'\n | 'hideLimit'\n | 'chartTypes'\n>;\n\nexport function getDefaultViewOptions(\n cicdConfiguration: CicdConfiguration,\n): ViewOptions {\n return {\n lowercaseNames: cicdConfiguration.defaults?.lowercaseNames ?? false,\n normalizeTimeRange: cicdConfiguration.defaults?.normalizeTimeRange ?? true,\n collapsedLimit: 60 * 1000, // 1m\n hideLimit: 20 * 1000, // 20s\n chartTypes: {\n succeeded: ['duration'],\n failed: ['count'],\n enqueued: ['count'],\n scheduled: ['count'],\n running: ['count'],\n aborted: ['count'],\n stalled: ['count'],\n expired: ['count'],\n unknown: ['count'],\n },\n };\n}\n\nconst branchValues: Array<SwitchValue<BranchSelection>> = [\n 'master',\n 'branch',\n {\n value: 'all',\n tooltip:\n 'NOTE; If the build pipelines are very different between master and branch ' +\n 'builds, viewing them combined might not result in a very useful chart',\n },\n];\n\nconst chartTypeValues: Array<SwitchValue<ChartType>> = [\n { value: 'duration', text: <ShowChartIcon />, tooltip: 'Duration' },\n { value: 'count', text: <BarChartIcon />, tooltip: 'Count per day' },\n];\n\nexport interface ChartFiltersProps {\n analysis?: ChartableStagesAnalysis;\n\n cicdConfiguration: CicdConfiguration;\n initialFetchFilter: ChartFilter;\n currentFetchFilter?: ChartFilter;\n onChangeFetchFilter(filter: ChartFilter): void;\n updateFetchFilter(filter: ChartFilter): void;\n\n initialViewOptions: ViewOptions;\n onChangeViewOptions(filter: ViewOptions): void;\n}\n\ninterface InternalRef {\n first: boolean;\n}\n\nexport function ChartFilters(props: ChartFiltersProps) {\n const {\n analysis,\n cicdConfiguration,\n initialFetchFilter,\n currentFetchFilter,\n onChangeFetchFilter,\n updateFetchFilter,\n initialViewOptions,\n onChangeViewOptions,\n } = props;\n\n const classes = useStyles();\n\n const [internalRef] = useState<InternalRef>({ first: true });\n\n const [useNowAsToDate, setUseNowAsToDate] = useState(true);\n const [toDate, setToDate] = useState(initialFetchFilter.toDate);\n const [fromDate, setFromDate] = useState(initialFetchFilter.fromDate);\n\n const [branch, setBranch] = useState(initialFetchFilter.branch);\n\n const statusValues: ReadonlyArray<StatusSelection> =\n cicdConfiguration.availableStatuses;\n const [selectedStatus, setSelectedStatus] = useState(\n initialFetchFilter.status,\n );\n\n const [viewOptions, setViewOptions] = useState(initialViewOptions);\n\n const setLowercaseNames = useCallback(\n (lowercaseNames: boolean) => {\n setViewOptions(old => ({ ...old, lowercaseNames }));\n },\n [setViewOptions],\n );\n\n const setNormalizeTimeRange = useCallback(\n (normalizeTimeRange: boolean) => {\n setViewOptions(old => ({ ...old, normalizeTimeRange }));\n },\n [setViewOptions],\n );\n\n const setHideLimit = useCallback(\n (value: number) => {\n setViewOptions(old => ({ ...old, hideLimit: value }));\n },\n [setViewOptions],\n );\n\n const setCollapseLimit = useCallback(\n (value: number) => {\n setViewOptions(old => ({ ...old, collapsedLimit: value }));\n },\n [setViewOptions],\n );\n\n const setChartType = useCallback(\n (statusType: FilterStatusType, chartTypes: ChartTypes) => {\n setViewOptions(old => ({\n ...old,\n chartTypes: { ...old.chartTypes, [statusType]: chartTypes },\n }));\n },\n [setViewOptions],\n );\n const setChartTypeSpecific = useMemo(\n () =>\n Object.fromEntries(\n statusTypes.map(\n status =>\n [\n status,\n (chartTypes: ChartTypes) => setChartType(status, chartTypes),\n ] as const,\n ),\n ),\n [setChartType],\n );\n\n useEffect(() => {\n onChangeViewOptions(viewOptions);\n }, [onChangeViewOptions, viewOptions]);\n\n useEffect(() => {\n if (internalRef.first) {\n // Skip calling onChangeFetchFilter first time\n internalRef.first = false;\n return;\n }\n onChangeFetchFilter({\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n });\n }, [\n internalRef,\n toDate,\n fromDate,\n branch,\n selectedStatus,\n onChangeFetchFilter,\n ]);\n\n const toggleUseNowAsDate = useCallback(() => {\n setUseNowAsToDate(!useNowAsToDate);\n if (!DateTime.fromJSDate(toDate).hasSame(DateTime.now(), 'day')) {\n setToDate(new Date());\n }\n }, [useNowAsToDate, toDate]);\n\n const hasFetchFilterChanges = useMemo(\n () =>\n !currentFetchFilter ||\n !isSameChartFilter(\n {\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n },\n currentFetchFilter,\n ),\n [toDate, fromDate, branch, selectedStatus, currentFetchFilter],\n );\n\n const updateFilter = useCallback(() => {\n updateFetchFilter({\n toDate,\n fromDate,\n branch,\n status: selectedStatus,\n });\n }, [toDate, fromDate, branch, selectedStatus, updateFetchFilter]);\n\n const inrefferedStatuses = analysis?.statuses ?? selectedStatus;\n\n return (\n <MuiPickersUtilsProvider utils={LuxonUtils}>\n <Card className={classes.rootCard}>\n <CardHeader\n action={\n <Button\n size=\"small\"\n color=\"secondary\"\n variant=\"contained\"\n onClick={updateFilter}\n disabled={!hasFetchFilterChanges}\n >\n Update\n </Button>\n }\n title={\n <Typography variant=\"subtitle2\" className={classes.header}>\n Fetching options\n </Typography>\n }\n />\n <CardContent>\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Date range\n </Typography>\n <KeyboardDatePicker\n autoOk\n variant=\"inline\"\n inputVariant=\"outlined\"\n label=\"From date\"\n format=\"yyyy-MM-dd\"\n value={fromDate}\n InputAdornmentProps={{ position: 'start' }}\n onChange={date => setFromDate(date?.toJSDate() ?? new Date())}\n />\n <br />\n <FormControl component=\"fieldset\">\n <FormGroup>\n <FormControlLabel\n control={\n <Switch\n checked={useNowAsToDate}\n onChange={toggleUseNowAsDate}\n />\n }\n label={<Label>To today</Label>}\n />\n {useNowAsToDate ? null : (\n <KeyboardDatePicker\n autoOk\n variant=\"inline\"\n inputVariant=\"outlined\"\n label=\"To date\"\n format=\"yyyy-MM-dd\"\n value={toDate}\n InputAdornmentProps={{ position: 'start' }}\n onChange={date => setToDate(date?.toJSDate() ?? new Date())}\n />\n )}\n </FormGroup>\n </FormControl>\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Branch\n </Typography>\n <ButtonSwitch<string>\n values={branchValues}\n selection={branch}\n onChange={setBranch}\n />\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Status\n </Typography>\n <ButtonSwitch<string>\n values={statusValues}\n multi\n vertical\n selection={selectedStatus}\n onChange={setSelectedStatus}\n />\n </CardContent>\n </Card>\n <Card className={classes.rootCard}>\n <CardHeader\n title={\n <Typography variant=\"subtitle2\" className={classes.header}>\n View options\n </Typography>\n }\n />\n <CardContent>\n <Toggle\n checked={viewOptions.lowercaseNames}\n setChecked={setLowercaseNames}\n >\n <Tooltip\n arrow\n title={\n 'Lowercasing names can reduce duplications ' +\n 'when stage names have changed casing'\n }\n >\n <Label>Lowercase names</Label>\n </Tooltip>\n </Toggle>\n <Toggle\n checked={viewOptions.normalizeTimeRange}\n setChecked={setNormalizeTimeRange}\n >\n <Tooltip\n arrow\n title={\n 'All charts will use the same x-axis. ' +\n 'This reduces confusion when stages have been altered over time ' +\n 'and only appear in a part of the time range.'\n }\n >\n <Label>Normalize time range</Label>\n </Tooltip>\n </Toggle>\n <DurationSlider\n header=\"Hide under peak\"\n value={viewOptions.hideLimit}\n setValue={setHideLimit}\n />\n <DurationSlider\n header=\"Collapse under peak\"\n value={viewOptions.collapsedLimit}\n setValue={setCollapseLimit}\n />\n <Typography\n variant=\"subtitle2\"\n className={`${classes.title} ${classes.title}`}\n >\n Chart styles\n </Typography>\n {inrefferedStatuses.map(status => (\n <Grid key={status} container spacing={0}>\n <Grid item>\n <ButtonSwitch<ChartType>\n values={chartTypeValues}\n selection={viewOptions.chartTypes[status as FilterStatusType]}\n onChange={setChartTypeSpecific[status]}\n multi\n />\n </Grid>\n <Grid item className={classes.buttonDescription}>\n <div>{status}</div>\n </Grid>\n </Grid>\n ))}\n </CardContent>\n </Card>\n </MuiPickersUtilsProvider>\n );\n}\n"],"names":[],"mappings":";;;;;;;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BACA,GAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,MAAO,EAAA,qBAAA;AAAA,YACP,OAAO,WAAY,CAAA,cAAA;AAAA,YACnB,QAAU,EAAA;AAAA;AAAA,SACZ;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,WAAA;AAAA,YACR,WAAW,CAAG,EAAA,OAAA,CAAQ,KAAK,CAAA,CAAA,EAAI,QAAQ,KAAK,CAAA,CAAA;AAAA,YAC7C,QAAA,EAAA;AAAA;AAAA,SAED;AAAA,QACC,kBAAA,CAAmB,IAAI,CACtB,MAAA,qBAAA,IAAA,CAAC,QAAkB,SAAS,EAAA,IAAA,EAAC,SAAS,CACpC,EAAA,QAAA,EAAA;AAAA,0BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IACR,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,MAAQ,EAAA,eAAA;AAAA,cACR,SAAA,EAAW,WAAY,CAAA,UAAA,CAAW,MAA0B,CAAA;AAAA,cAC5D,QAAA,EAAU,qBAAqB,MAAM,CAAA;AAAA,cACrC,KAAK,EAAA;AAAA;AAAA,WAET,EAAA,CAAA;AAAA,0BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,SAAA,EAAW,QAAQ,iBAC5B,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAK,EAAA,EAAA,QAAA,EAAA,MAAA,EAAO,CACf,EAAA;AAAA,SAAA,EAAA,EAXS,MAYX,CACD;AAAA,OACH,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
2
3
|
import Slider from '@material-ui/core/Slider';
|
|
3
4
|
import { debounce } from 'lodash';
|
|
4
5
|
import { formatDurationFromSeconds, formatDuration } from './utils.esm.js';
|
|
@@ -64,21 +65,28 @@ function DurationSlider(props) {
|
|
|
64
65
|
[debouncedSetValue]
|
|
65
66
|
);
|
|
66
67
|
const indexValue = useMemo(() => findMarkIndex(curValue / 1e3), [curValue]);
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(Label, { children: [
|
|
70
|
+
header,
|
|
71
|
+
" ",
|
|
72
|
+
formatDuration(curValue)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
Slider,
|
|
76
|
+
{
|
|
77
|
+
value: indexValue,
|
|
78
|
+
min: 0,
|
|
79
|
+
step: 1,
|
|
80
|
+
max: marks.length - 1,
|
|
81
|
+
marks: true,
|
|
82
|
+
getAriaValueText: formatDurationFromIndex,
|
|
83
|
+
valueLabelFormat: formatDurationFromIndex,
|
|
84
|
+
onChange,
|
|
85
|
+
valueLabelDisplay: "auto",
|
|
86
|
+
"aria-labelledby": "slider-hide-limit"
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] });
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
export { DurationSlider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration-slider.esm.js","sources":["../../src/components/duration-slider.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"duration-slider.esm.js","sources":["../../src/components/duration-slider.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useMemo, useState } from 'react';\nimport Slider from '@material-ui/core/Slider';\nimport { debounce } from 'lodash';\n\nimport { formatDuration, formatDurationFromSeconds } from './utils';\nimport { Label } from './label';\n\nconst marks = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 10,\n 20,\n 30,\n 60,\n 2 * 60,\n 3 * 60,\n 4 * 60,\n 5 * 60,\n 10 * 60,\n 15 * 60,\n 30 * 60,\n 45 * 60,\n 60 * 60,\n].map((value, index) => ({\n value: index,\n label: formatDurationFromSeconds(value),\n seconds: value,\n}));\n\nfunction findMarkIndex(seconds: number): number {\n if (marks[0].seconds > seconds) {\n return 0;\n } else if (marks[marks.length - 1].seconds < seconds) {\n return marks.length - 1;\n }\n for (let i = 0; i < marks.length - 1; ++i) {\n const a = marks[i];\n const b = marks[i + 1];\n if (seconds === a.seconds) {\n return i;\n } else if (seconds === b.seconds) {\n return i + 1;\n } else if (a.seconds < seconds && b.seconds > seconds) {\n return seconds - a.seconds < b.seconds - seconds ? i : i - 1;\n }\n }\n return 0; // Won't happen\n}\n\nfunction formatDurationFromIndex(index: number) {\n return formatDurationFromSeconds(marks[index].seconds);\n}\n\nexport interface DurationSliderProps {\n header: string;\n value: number;\n setValue: (value: number) => void;\n}\n\nexport function DurationSlider(props: DurationSliderProps) {\n const { header, value, setValue } = props;\n\n const [curValue, setCurValue] = useState(value);\n\n const debouncedSetValue = useMemo(() => debounce(setValue, 1000), [setValue]);\n\n const onChange = useCallback(\n (_: any, index: number | number[]) => {\n const millis = marks[index as number].seconds * 1000;\n setCurValue(millis);\n debouncedSetValue(millis);\n },\n [debouncedSetValue],\n );\n\n const indexValue = useMemo(() => findMarkIndex(curValue / 1000), [curValue]);\n\n return (\n <>\n <Label>\n {header} {formatDuration(curValue)}\n </Label>\n <Slider\n value={indexValue}\n min={0}\n step={1}\n max={marks.length - 1}\n marks\n getAriaValueText={formatDurationFromIndex}\n valueLabelFormat={formatDurationFromIndex}\n onChange={onChange}\n valueLabelDisplay=\"auto\"\n aria-labelledby=\"slider-hide-limit\"\n />\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,KAAQ,GAAA;AAAA,EACZ,CAAA;AAAA,EACA,CAAA;AAAA,EACA,CAAA;AAAA,EACA,CAAA;AAAA,EACA,CAAA;AAAA,EACA,CAAA;AAAA,EACA,EAAA;AAAA,EACA,EAAA;AAAA,EACA,EAAA;AAAA,EACA,EAAA;AAAA,EACA,CAAI,GAAA,EAAA;AAAA,EACJ,CAAI,GAAA,EAAA;AAAA,EACJ,CAAI,GAAA,EAAA;AAAA,EACJ,CAAI,GAAA,EAAA;AAAA,EACJ,EAAK,GAAA,EAAA;AAAA,EACL,EAAK,GAAA,EAAA;AAAA,EACL,EAAK,GAAA,EAAA;AAAA,EACL,EAAK,GAAA,EAAA;AAAA,EACL,EAAK,GAAA;AACP,CAAE,CAAA,GAAA,CAAI,CAAC,KAAA,EAAO,KAAW,MAAA;AAAA,EACvB,KAAO,EAAA,KAAA;AAAA,EACP,KAAA,EAAO,0BAA0B,KAAK,CAAA;AAAA,EACtC,OAAS,EAAA;AACX,CAAE,CAAA,CAAA;AAEF,SAAS,cAA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,CAAC,CAAA;AAE5E,EAAA,MAAM,QAAW,GAAA,WAAA;AAAA,IACf,CAAC,GAAQ,KAA6B,KAAA;AACpC,MAAA,MAAM,MAAS,GAAA,KAAA,CAAM,KAAe,CAAA,CAAE,OAAU,GAAA,GAAA;AAChD,MAAA,WAAA,CAAY,MAAM,CAAA;AAClB,MAAA,iBAAA,CAAkB,MAAM,CAAA;AAAA,KAC1B;AAAA,IACA,CAAC,iBAAiB;AAAA,GACpB;AAEA,EAAM,MAAA,UAAA,GAAa,QAAQ,MAAM,aAAA,CAAc,WAAW,GAAI,CAAA,EAAG,CAAC,QAAQ,CAAC,CAAA;AAE3E,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,KACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,MAAA;AAAA,MAAO,GAAA;AAAA,MAAE,eAAe,QAAQ;AAAA,KACnC,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,UAAA;AAAA,QACP,GAAK,EAAA,CAAA;AAAA,QACL,IAAM,EAAA,CAAA;AAAA,QACN,GAAA,EAAK,MAAM,MAAS,GAAA,CAAA;AAAA,QACpB,KAAK,EAAA,IAAA;AAAA,QACL,gBAAkB,EAAA,uBAAA;AAAA,QAClB,gBAAkB,EAAA,uBAAA;AAAA,QAClB,QAAA;AAAA,QACA,iBAAkB,EAAA,MAAA;AAAA,QAClB,iBAAgB,EAAA;AAAA;AAAA;AAClB,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Typography from '@material-ui/core/Typography';
|
|
3
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ const useStyles = makeStyles(
|
|
|
15
15
|
);
|
|
16
16
|
function Label({ children }) {
|
|
17
17
|
const classes = useStyles();
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: classes.label, children });
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export { Label, useStyles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.esm.js","sources":["../../src/components/label.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"label.esm.js","sources":["../../src/components/label.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\n\nexport const useStyles = makeStyles(\n theme => ({\n label: {\n fontWeight: 'normal',\n margin: theme.spacing(0),\n },\n }),\n {\n name: 'CicdStatisticsLabel',\n },\n);\n\nexport function Label({ children }: PropsWithChildren<{}>) {\n const classes = useStyles();\n\n return (\n <Typography variant=\"subtitle2\" className={classes.label}>\n {children}\n </Typography>\n );\n}\n"],"names":[],"mappings":";;;;AAoBO,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,CAAU,KAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,MACL,UAAY,EAAA,QAAA;AAAA,MACZ,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AACzB,GACF,CAAA;AAAA,EACA;AAAA,IACE,IAAM,EAAA;AAAA;AAEV;AAEgB,SAAA,KAAA,CAAM,EAAE,QAAA,EAAmC,EAAA;AACzD,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,2BACG,UAAW,EAAA,EAAA,OAAA,EAAQ,aAAY,SAAW,EAAA,OAAA,CAAQ,OAChD,QACH,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import useAsync from 'react-use/esm/useAsync';
|
|
3
3
|
import Box from '@material-ui/core/Box';
|
|
4
4
|
import LinearProgress from '@material-ui/core/LinearProgress';
|
|
@@ -30,9 +30,9 @@ function useAsyncChain(parentState, fn, deps) {
|
|
|
30
30
|
}
|
|
31
31
|
function renderFallbacks(state, success) {
|
|
32
32
|
if (state.loading) {
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx(ViewProgress, { state });
|
|
34
34
|
} else if (state.error) {
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(Alert, { severity: "error", children: state.error.stack });
|
|
36
36
|
}
|
|
37
37
|
return success(state.value);
|
|
38
38
|
}
|
|
@@ -43,26 +43,33 @@ function ViewProgress({
|
|
|
43
43
|
const stateAsSingleProgress = state;
|
|
44
44
|
const stateAsStepProgress = state;
|
|
45
45
|
if (!stateAsSingleProgress.progress && !stateAsSingleProgress.progressBuffer && !stateAsStepProgress.steps) {
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
47
47
|
} else if (stateAsSingleProgress.progress !== void 0) {
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
49
49
|
LinearProgress,
|
|
50
50
|
{
|
|
51
51
|
variant: "buffer",
|
|
52
52
|
value: (stateAsSingleProgress.progress ?? 0) * 100,
|
|
53
53
|
valueBuffer: (stateAsSingleProgress.progressBuffer ?? 0) * 100
|
|
54
54
|
}
|
|
55
|
-
));
|
|
55
|
+
) });
|
|
56
56
|
}
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(Timeline, { children: stateAsStepProgress.steps.map((step, index) => /* @__PURE__ */ jsxs(TimelineItem, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(TimelineOppositeContent, { children: step.title }),
|
|
59
|
+
/* @__PURE__ */ jsxs(TimelineSeparator, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(TimelineDot, { color: getDotColor(step) }),
|
|
61
|
+
index < stateAsStepProgress.steps.length - 1 ? /* @__PURE__ */ jsx(TimelineConnector, {}) : null
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx(TimelineContent, { children: !step.progress && !step.progressBuffer ? null : /* @__PURE__ */ jsx(
|
|
64
|
+
LinearProgress,
|
|
65
|
+
{
|
|
66
|
+
style: stepProgressStyle,
|
|
67
|
+
variant: "buffer",
|
|
68
|
+
value: (step.progress ?? 0) * 100,
|
|
69
|
+
valueBuffer: (step.progressBuffer ?? 0) * 100
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
] }, index)) }) });
|
|
66
73
|
}
|
|
67
74
|
function getDotColor(step) {
|
|
68
75
|
const progress = step.progress ?? 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.esm.js","sources":["../../src/components/progress.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"progress.esm.js","sources":["../../src/components/progress.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CSSProperties, DependencyList } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport Box from '@material-ui/core/Box';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Timeline from '@material-ui/lab/Timeline';\nimport TimelineItem from '@material-ui/lab/TimelineItem';\nimport TimelineSeparator from '@material-ui/lab/TimelineSeparator';\nimport TimelineConnector from '@material-ui/lab/TimelineConnector';\nimport TimelineContent from '@material-ui/lab/TimelineContent';\nimport TimelineOppositeContent from '@material-ui/lab/TimelineOppositeContent';\nimport TimelineDot, { TimelineDotProps } from '@material-ui/lab/TimelineDot';\nimport Alert from '@material-ui/lab/Alert';\nimport { useApp } from '@backstage/core-plugin-api';\n\nconst stepProgressStyle: CSSProperties = {\n marginTop: 6,\n};\n\n// Matching react-use, only has loading/error/value\ntype AsyncState<T> =\n | {\n loading: boolean;\n error?: undefined;\n value?: undefined;\n }\n | {\n loading: true;\n error?: Error | undefined;\n value?: T;\n }\n | {\n loading: false;\n error: Error;\n value?: undefined;\n }\n | {\n loading: false;\n error?: undefined;\n value: T;\n };\n\nexport interface ProgressStep extends ProgessAsSingle {\n title: string;\n}\nexport interface ProgessAsSteps {\n steps: Array<ProgressStep>;\n}\nexport interface ProgessAsSingle<T = number> {\n progress?: T;\n progressBuffer?: T;\n}\n\nexport type ProgessState<T = number> =\n | ProgessAsSingle<T>\n | (T extends number ? ProgessAsSteps : { steps?: undefined });\n\nexport type ProgressAsLoading = ProgessState & {\n loading: true;\n error?: undefined;\n value?: undefined;\n};\nexport type ProgressAsError = ProgessState<undefined> & {\n loading?: false | undefined;\n error: Error;\n value?: undefined;\n};\nexport type ProgressAsValue<T> = ProgessState<undefined> & {\n loading?: false | undefined;\n error?: undefined;\n value: T;\n};\n\n/**\n * An AsyncState but with the addition of progress (decimal 0-1) to allow\n * rendering a progress bar while waiting.\n */\nexport type ProgressType<T> =\n | ProgressAsLoading\n | ProgressAsError\n | ProgressAsValue<T>;\n\nconst sentry = Symbol();\n\n/**\n * Casts an AsyncState or Progress into its non-succeeded sub types\n */\ntype Unsuccessful<S extends ProgressType<any> | AsyncState<any>> =\n S extends ProgressType<any>\n ? ProgressAsLoading | ProgressAsError\n : Omit<AsyncState<any>, 'value'>;\n\n/**\n * Similar to useAsync except it \"waits\" for a dependent (upstream) async state\n * to finish first, otherwise it forwards the dependent pending state.\n *\n * When/if the dependent state has settled successfully, the callback will be\n * invoked for a new layer of async state with the dependent (upstream) success\n * result as argument.\n */\nexport function useAsyncChain<S extends ProgressType<any> | AsyncState<any>, R>(\n parentState: S,\n fn: (value: NonNullable<S['value']>) => Promise<R>,\n deps: DependencyList,\n): Unsuccessful<S> | AsyncState<R> {\n const childState = useAsync(\n async () => (!parentState.value ? sentry : fn(parentState.value)),\n [!parentState.error, !parentState.loading, parentState.value, ...deps],\n );\n\n if (!parentState.value) {\n return parentState as Unsuccessful<S>;\n } else if (childState.value === sentry) {\n return { loading: true };\n }\n return childState as AsyncState<R>;\n}\n\nexport function renderFallbacks<T>(\n state: ProgressType<T> | AsyncState<T>,\n success: (value: T) => JSX.Element,\n): JSX.Element {\n if (state.loading) {\n return <ViewProgress state={state} />;\n } else if (state.error) {\n return <Alert severity=\"error\">{state.error.stack}</Alert>;\n }\n\n return success(state.value!);\n}\n\nexport function ViewProgress({\n state,\n}: {\n state: ProgressAsLoading | { loading: boolean };\n}) {\n const { Progress } = useApp().getComponents();\n\n const stateAsSingleProgress = state as ProgessAsSingle;\n const stateAsStepProgress = state as ProgessAsSteps;\n\n if (\n !stateAsSingleProgress.progress &&\n !stateAsSingleProgress.progressBuffer &&\n !stateAsStepProgress.steps\n ) {\n // Simple spinner\n return <Progress />;\n } else if (stateAsSingleProgress.progress !== undefined) {\n // Simple _single_ progress\n return (\n <Box sx={{ width: '100%' }}>\n <LinearProgress\n variant=\"buffer\"\n value={(stateAsSingleProgress.progress ?? 0) * 100}\n valueBuffer={(stateAsSingleProgress.progressBuffer ?? 0) * 100}\n />\n </Box>\n );\n }\n\n // Multi-step progresses\n\n return (\n <Box sx={{ width: '100%' }}>\n <Timeline>\n {stateAsStepProgress.steps.map((step, index) => (\n <TimelineItem key={index}>\n <TimelineOppositeContent>{step.title}</TimelineOppositeContent>\n <TimelineSeparator>\n <TimelineDot color={getDotColor(step)} />\n {index < stateAsStepProgress.steps.length - 1 ? (\n <TimelineConnector />\n ) : null}\n </TimelineSeparator>\n <TimelineContent>\n {!step.progress && !step.progressBuffer ? null : (\n <LinearProgress\n style={stepProgressStyle}\n variant=\"buffer\"\n value={(step.progress ?? 0) * 100}\n valueBuffer={(step.progressBuffer ?? 0) * 100}\n />\n )}\n </TimelineContent>\n </TimelineItem>\n ))}\n </Timeline>\n </Box>\n );\n}\n\nfunction getDotColor(step: ProgressStep): TimelineDotProps['color'] {\n const progress = step.progress ?? 0;\n\n if (progress >= 1) {\n return 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AA,MAAA;AAAA,QACC,KAAO,EAAA,iBAAA;AAAA,QACP,OAAQ,EAAA,QAAA;AAAA,QACR,KAAA,EAAA,CAAQ,IAAK,CAAA,QAAA,IAAY,CAAK,IAAA,GAAA;AAAA,QAC9B,WAAA,EAAA,CAAc,IAAK,CAAA,cAAA,IAAkB,CAAK,IAAA;AAAA;AAAA,KAGhD,EAAA;AAAA,GAjBiB,EAAA,EAAA,KAkBnB,CACD,CAAA,EACH,CACF,EAAA,CAAA;AAEJ;AAEA,SAAS,YAAY,IAA+C,EAAA;AAClE,EAAM,MAAA,QAAA,GAAW,KAAK,QAAY,IAAA,CAAA;AAElC,EAAA,IAAI,YAAY,CAAG,EAAA;AACjB,IAAO,OAAA,SAAA;AAAA,GACT,MAAA,IAAW,WAAW,CAAG,EAAA;AACvB,IAAO,OAAA,WAAA;AAAA;AAET,EAAO,OAAA,MAAA;AACT;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback } from 'react';
|
|
2
3
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
3
4
|
import Switch from '@material-ui/core/Switch';
|
|
4
5
|
|
|
@@ -10,10 +11,10 @@ function Toggle({
|
|
|
10
11
|
const toggler = useCallback(() => {
|
|
11
12
|
setChecked(!checked);
|
|
12
13
|
}, [checked, setChecked]);
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
14
15
|
FormControlLabel,
|
|
15
16
|
{
|
|
16
|
-
control: /* @__PURE__ */
|
|
17
|
+
control: /* @__PURE__ */ jsx(Switch, { checked, onChange: toggler }),
|
|
17
18
|
label: children
|
|
18
19
|
}
|
|
19
20
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.esm.js","sources":["../../src/components/toggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"toggle.esm.js","sources":["../../src/components/toggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, PropsWithChildren } from 'react';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Switch from '@material-ui/core/Switch';\n\nexport interface ToggleProps {\n checked: boolean;\n setChecked: (checked: boolean) => void;\n}\n\nexport function Toggle({\n checked,\n setChecked,\n children,\n}: PropsWithChildren<ToggleProps>) {\n const toggler = useCallback(() => {\n setChecked(!checked);\n }, [checked, setChecked]);\n\n return (\n <FormControlLabel\n control={<Switch checked={checked} onChange={toggler} />}\n label={children}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AAyBO,SAAS,MAAO,CAAA;AAAA,EACrB,OAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAmC,EAAA;AACjC,EAAM,MAAA,OAAA,GAAU,YAAY,MAAM;AAChC,IAAA,UAAA,CAAW,CAAC,OAAO,CAAA;AAAA,GAClB,EAAA,CAAC,OAAS,EAAA,UAAU,CAAC,CAAA;AAExB,EACE,uBAAA,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,OAAS,kBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAkB,UAAU,OAAS,EAAA,CAAA;AAAA,MACtD,KAAO,EAAA;AAAA;AAAA,GACT;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Duration, DateTime } from 'luxon';
|
|
3
3
|
import humanizeDuration from 'humanize-duration';
|
|
4
4
|
import { capitalize } from 'lodash';
|
|
@@ -32,10 +32,10 @@ function formatDateTimeShort(milliseconds) {
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
function labelFormatter(epoch) {
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(Typography, { component: "span", style: infoText, children: formatDateTimeShort(epoch) });
|
|
36
36
|
}
|
|
37
37
|
function labelFormatterWithoutTime(epoch) {
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(Typography, { component: "span", style: infoText, children: formatDateShort(epoch) });
|
|
39
39
|
}
|
|
40
40
|
function tickFormatterX(epoch) {
|
|
41
41
|
return formatDateShort(epoch);
|
|
@@ -51,7 +51,12 @@ function tickFormatterY(duration) {
|
|
|
51
51
|
function tooltipValueFormatter(durationOrCount, name) {
|
|
52
52
|
return [
|
|
53
53
|
// TODO(Rugvip): Types don't allow returning elements, but it was here before so presumably works
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ jsxs(Typography, { component: "span", style: infoText, children: [
|
|
55
|
+
capitalize(name),
|
|
56
|
+
":",
|
|
57
|
+
" ",
|
|
58
|
+
name.endsWith(" count") ? durationOrCount : formatDuration(durationOrCount)
|
|
59
|
+
] }),
|
|
55
60
|
null
|
|
56
61
|
];
|
|
57
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../../src/components/utils.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../../src/components/utils.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CSSProperties } from 'react';\nimport { DateTime, Duration } from 'luxon';\nimport humanizeDuration from 'humanize-duration';\nimport { capitalize } from 'lodash';\nimport Typography from '@material-ui/core/Typography';\n\nconst infoText: CSSProperties = { color: 'InfoText' };\n\n/**\n * Picks {num} elements from {arr} evenly, from the first to the last\n */\nexport function pickElements<T>(arr: ReadonlyArray<T>, num: number): Array<T> {\n if (arr.length <= num) {\n return [...arr];\n }\n\n if (num < 2) {\n return [arr[arr.length / 2]];\n }\n\n const step = arr.length / (num - 1);\n return [\n ...Array.from(Array(num - 1)).map(\n (_, index) => arr[Math.round(index * step)],\n ),\n arr[arr.length - 1],\n ];\n}\n\nfunction formatDateShort(milliseconds: number) {\n if ((milliseconds as any) === 'auto') {\n // When recharts gets confused (empty data)\n return '';\n }\n return DateTime.fromMillis(milliseconds).toLocaleString(DateTime.DATE_SHORT);\n}\nfunction formatDateTimeShort(milliseconds: number) {\n if ((milliseconds as any) === 'auto') {\n // When recharts gets confused (empty data)\n return '';\n }\n return DateTime.fromMillis(milliseconds).toLocaleString(\n DateTime.DATETIME_SHORT,\n );\n}\n\nexport function labelFormatter(epoch: number) {\n return (\n <Typography component=\"span\" style={infoText}>\n {formatDateTimeShort(epoch)}\n </Typography>\n );\n}\n\nexport function labelFormatterWithoutTime(epoch: number) {\n return (\n <Typography component=\"span\" style={infoText}>\n {formatDateShort(epoch)}\n </Typography>\n );\n}\n\nexport function tickFormatterX(epoch: number) {\n return formatDateShort(epoch);\n}\n\nexport function tickFormatterY(duration: number) {\n if (duration === 0) {\n return '0';\n } else if (duration < 500) {\n return `${duration} ms`;\n }\n return formatDuration(duration)\n .replace(/second.*/, 'sec')\n .replace(/minute.*/, 'min')\n .replace(/hour.*/, 'h')\n .replace(/day.*/, 'd')\n .replace(/month.*/, 'm')\n .replace(/year.*/, 'y');\n}\n\nexport function tooltipValueFormatter(\n durationOrCount: number,\n name: string,\n): [any, any] {\n return [\n // TODO(Rugvip): Types don't allow returning elements, but it was here before so presumably works\n <Typography component=\"span\" style={infoText}>\n {capitalize(name)}:{' '}\n {name.endsWith(' count')\n ? durationOrCount\n : formatDuration(durationOrCount)}\n </Typography>,\n null,\n ];\n}\n\nexport function formatDuration(millis: number) {\n let rest = Math.round(millis);\n const days = Math.floor(rest / (1000 * 60 * 60 * 24));\n rest -= days * (1000 * 60 * 60 * 24);\n const hours = Math.floor(rest / (1000 * 60 * 60));\n rest -= hours * (1000 * 60 * 60);\n const minutes = Math.floor(rest / (1000 * 60));\n rest -= minutes * (1000 * 60);\n const seconds = Math.floor(rest / 1000);\n rest -= seconds * 1000;\n const milliseconds = rest;\n\n if (!days && !hours && !minutes) {\n if (seconds < 1) {\n return `${milliseconds}ms`;\n } else if (seconds < 2) {\n return `${((milliseconds + seconds * 1000) / 1000).toFixed(1)}s`;\n }\n }\n\n const dur = Duration.fromObject({\n ...(days && { days }),\n ...(hours && { hours }),\n ...(minutes && !days && { minutes }),\n ...(seconds && !days && !hours && { seconds }),\n });\n\n return humanizeDuration(dur.toMillis(), { round: true });\n}\n\nexport function formatDurationFromSeconds(seconds: number) {\n return formatDuration(seconds * 1000);\n}\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,QAAA,GAA0B,EAAE,KAAA,EAAO,UAAW,EAAA;AAKpC,SAAA,YAAA,CAAgB,KAAuB,GAAuB,EAAA;AAC5E,EAAI,IAAA,GAAA,CAAI,UAAU,GAAK,EAAA;AACrB,IAAO,OAAA,CAAC,GAAG,GAAG,CAAA;AAAA;AAOhB,EAAM,MAAA,IAAA,GAAO,GAAI,CAAA,MAAA,IAAU,GAAM,GAAA,CAAA,CAAA;AACjC,EAAO,OAAA;AAAA,IACL,GAAG,KAAM,CAAA,IAAA,CAAK,MAAM,GAAM,GAAA,CAAC,CAAC,CAAE,CAAA,GAAA;AAAA,MAC5B,CAAC,GAAG,KAAU,KAAA,GAAA,CAAI,KAAK,KAAM,CAAA,KAAA,GAAQ,IAAI,CAAC;AAAA,KAC5C;AAAA,IACA,GAAA,CAAI,GAAI,CAAA,MAAA,GAAS,CAAC;AAAA,GACpB;AACF;AAEA,SAAS,gBAAgB,YAAsB,EAAA;AAC7C,EAAA,IAAK,iBAAyB,MAAQ,EAAA;AAEpC,IAAO,OAAA,EAAA;AAAA;AAET,EAAA,OAAO,SAAS,UAAW,CAAA,YAAY,CAAE,CAAA,cAAA,CAAe,SAAS,UAAU,CAAA;AAC7E;AACA,SAAS,oBAAoB,YAAsB,EAAA;AACjD,EAAA,IAAK,iBAAyB,MAAQ,EAAA;AAEpC,IAAO,OAAA,EAAA;AAAA;AAET,EAAO,OAAA,QAAA,CAAS,UAAW,CAAA,YAAY,CAAE,CAAA,cAAA;AAAA,IACvC,QAAS,CAAA;AAAA,GACX;AACF;AAEO,SAAS,eAAe,KAAe,EAAA;AAC5C,EACE,uBAAA,GAAA,CAAC,cAAW,SAAU,EAAA,MAAA,EAAO,OAAO,QACjC,EAAA,QAAA,EAAA,mBAAA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AW,IAAA,CAAC,QAAQ,CAAC,KAAA,IAAS,EAAE,OAAQ;AAAA,GAC7C,CAAA;AAED,EAAA,OAAO,iBAAiB,GAAI,CAAA,QAAA,IAAY,EAAE,KAAA,EAAO,MAAM,CAAA;AACzD;AAEO,SAAS,0BAA0B,OAAiB,EAAA;AACzD,EAAO,OAAA,cAAA,CAAe,UAAU,GAAI,CAAA;AACtC;;;;"}
|
package/dist/entity-page.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useCallback, useEffect } from 'react';
|
|
2
3
|
import Grid from '@material-ui/core/Grid';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import Alert from '@material-ui/lab/Alert';
|
|
@@ -18,7 +19,7 @@ import { sortFilterStatusType } from './utils/api.esm.js';
|
|
|
18
19
|
|
|
19
20
|
function EntityPageCicdCharts() {
|
|
20
21
|
const state = useCicdConfiguration();
|
|
21
|
-
return renderFallbacks(state, (value) => /* @__PURE__ */
|
|
22
|
+
return renderFallbacks(state, (value) => /* @__PURE__ */ jsx(ZoomProvider, { children: /* @__PURE__ */ jsx(CicdCharts, { cicdConfiguration: value }) }));
|
|
22
23
|
}
|
|
23
24
|
const useStyles = makeStyles(
|
|
24
25
|
(theme) => ({
|
|
@@ -104,36 +105,44 @@ function CicdCharts(props) {
|
|
|
104
105
|
}
|
|
105
106
|
errorApi.post(chartableStagesState.error);
|
|
106
107
|
}, [errorApi, chartableStagesState.error]);
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
108
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Grid, { item: true, lg: 2, className: classes.pane, children: /* @__PURE__ */ jsx(
|
|
110
|
+
ChartFilters,
|
|
111
|
+
{
|
|
112
|
+
analysis: chartableStagesState.value,
|
|
113
|
+
cicdConfiguration,
|
|
114
|
+
initialFetchFilter: chartFilter,
|
|
115
|
+
currentFetchFilter: fetchedChartData.chartFilter,
|
|
116
|
+
onChangeFetchFilter: onFilterChange,
|
|
117
|
+
updateFetchFilter: updateFilter,
|
|
118
|
+
initialViewOptions: viewOptions,
|
|
119
|
+
onChangeViewOptions: onViewOptionsChange
|
|
120
|
+
}
|
|
121
|
+
) }),
|
|
122
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, lg: 10, className: classes.pane, children: renderFallbacks(chartableStagesState, (chartableStages) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
123
|
+
chartableStages.stages.size > 0 ? null : /* @__PURE__ */ jsx(Alert, { severity: "info", children: "No data" }),
|
|
124
|
+
!statisticsState.value?.builds?.length || !chartableStagesState.value?.daily?.values?.length ? null : /* @__PURE__ */ jsx(StatusChart, { analysis: chartableStagesState.value }),
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
StageChart,
|
|
127
|
+
{
|
|
128
|
+
stage: chartableStages.total,
|
|
129
|
+
defaultCollapsed: 0,
|
|
130
|
+
defaultHidden: viewOptions.hideLimit,
|
|
131
|
+
chartTypes: viewOptions.chartTypes
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
[...chartableStages.stages.entries()].map(([name, stage]) => /* @__PURE__ */ jsx(
|
|
135
|
+
StageChart,
|
|
136
|
+
{
|
|
137
|
+
stage,
|
|
138
|
+
defaultCollapsed: viewOptions.collapsedLimit,
|
|
139
|
+
defaultHidden: viewOptions.hideLimit,
|
|
140
|
+
chartTypes: viewOptions.chartTypes
|
|
141
|
+
},
|
|
142
|
+
name
|
|
143
|
+
))
|
|
144
|
+
] })) })
|
|
145
|
+
] });
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
export { EntityPageCicdCharts };
|