Public
Edited
Oct 1, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof mergeRequests = cached('merge-requests', fetchMergeRequests, [])
Insert cell
Insert cell
Insert cell
pipelines = mergeRequestsWithPipelines.flatMap(x => x.pipelines)
Insert cell
massagedPipelines = pipelines.map(({created_at, duration, status, project_id}) => ({
created_at: new Date(created_at),
duration: duration / 60,
status,
project_id,
})).filter(({duration}) => duration <= runtimeOutlierCutoff)
Insert cell
pipelines.filter(({status}) => status === 'running')
Insert cell
Insert cell
fetchMergeRequests = () => allInfosAvailable
? firstPageOnly
? fetchFromGitLab(`/merge_requests?author_username=${username}`)
: fetchAllPagesFromGitLab(`/merge_requests?author_username=${username}`)
: []
Insert cell
fetchPipelines = async () => {
const copies = []
for (const mr of mergeRequests) {
const copy = {...mr, pipelines: []}
const pipelines = await fetchAllPagesFromGitLab(`/projects/${mr.project_id}/merge_requests/${mr.iid}/pipelines`)
for (const pipeline of pipelines) {
const details = await fetchFromGitLab(`/projects/${pipeline.project_id}/pipelines/${pipeline.id}`)

copy.pipelines.push(details)
}

copies.push(copy)
}

return copies
}
Insert cell
Insert cell
Insert cell
Insert cell
function alert(text, type) {
const color = type === 'ok'
? '6, 189, 0'
: type === 'nope'
? '224, 34, 0'
: '166, 166, 166'
return htl.html`
<div style="border-left: 6px solid rgb(${color}); background-color: rgba(${color}, 0.2); padding: 0.75em;">
${text}
</div>
`
}
Insert cell
Insert cell
parseLinkHeader = require('https://bundle.run/parse-link-header@2.0.0')
Insert cell
import {inspect} from "@observablehq/inspector"
Insert cell
import {cached} from '@senritsu/cached-data-fetching'
Insert cell
import {fetchFromGitLab, fetchAllPagesFromGitLab} with {username, accessToken} from '@senritsu/gitlab-api'
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more