summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/components/blob_viewers/notebook_viewer.vue
blob: 1114a0942eca75177e7b6d23c84881dfa43e42e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import notebookLoader from '~/blob/notebook';
import { stripPathTail } from '~/lib/utils/url_utility';

export default {
  components: {
    GlLoadingIcon,
  },
  props: {
    blob: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      url: this.blob.rawPath,
    };
  },
  mounted() {
    notebookLoader({ el: this.$refs.viewer, relativeRawPath: stripPathTail(this.url) });
  },
};
</script>

<template>
  <div ref="viewer" :data-endpoint="url" data-testid="notebook">
    <gl-loading-icon class="gl-my-4" size="lg" />
  </div>
</template>