debian-mirror-gitlab/app/assets/javascripts/jobs/components/log/line_number.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
795 B
Vue
Raw Normal View History

2019-12-04 20:38:33 +05:30
<script>
2021-09-30 23:02:18 +05:30
import { INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF } from '../../constants';
2019-12-04 20:38:33 +05:30
export default {
2020-07-28 23:09:34 +05:30
functional: true,
2019-12-04 20:38:33 +05:30
props: {
lineNumber: {
type: Number,
required: true,
},
path: {
type: String,
required: true,
},
},
2020-07-28 23:09:34 +05:30
render(h, { props }) {
const { lineNumber, path } = props;
2019-12-04 20:38:33 +05:30
2021-09-30 23:02:18 +05:30
const parsedLineNumber = gon.features?.[INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF]
? lineNumber
: lineNumber + 1;
2020-07-28 23:09:34 +05:30
const lineId = `L${parsedLineNumber}`;
const lineHref = `${path}#${lineId}`;
return h(
'a',
{
class: 'gl-link d-inline-block text-right line-number flex-shrink-0',
attrs: {
id: lineId,
href: lineHref,
},
},
parsedLineNumber,
);
2019-12-04 20:38:33 +05:30
},
};
</script>