Skip to content

Commit 5bfcbdc

Browse files
authored
Merge pull request #108 from simonsobs/dev
Show all lines of code in the monaco editor without overflow on the history tab
2 parents 647bbb9 + d4d72c6 commit 5bfcbdc

File tree

5 files changed

+38
-28
lines changed

5 files changed

+38
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextline-web",
3-
"version": "0.11.2",
3+
"version": "0.11.3",
44
"private": false,
55
"type": "module",
66
"scripts": {

src/components/rdb/AsyncEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<template #fallback>
55
<div style="height: 100%">
66
<VProgressLinear indeterminate></VProgressLinear>
7-
<!-- <pre class="overflow-auto" style="height: 100%">{{ source }}</pre> -->
7+
<pre class="pl-5">{{ source }}</pre>
88
</div>
99
</template>
1010
</Suspense>

src/components/rdb/Editor.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<div ref="element" style="height: 100%"></div>
2+
<div ref="element" :style="{ height: editorHeight }" @wheel.stop.capture></div>
33
</template>
44

55
<script setup lang="ts">
6-
import { ref, toRefs } from "vue";
6+
import { computed, ref, toRefs } from "vue";
77
88
import { useMonacoEditor } from "@/utils/monaco-editor";
99
@@ -13,6 +13,15 @@ interface Props {
1313
const props = defineProps<Props>();
1414
const { source } = toRefs(props);
1515
const element = ref<HTMLElement>();
16+
17+
const nLines = computed(() => source.value.split("\n").length);
18+
const lineHeight = 24; // From monaco-editor
19+
const padding = 10; // TODO: Check if this is correct
20+
const editorHeight = computed(() => {
21+
const height = nLines.value * lineHeight + padding;
22+
return `${height}px`;
23+
});
24+
1625
// await new Promise((resolve) => setTimeout(resolve, 2000));
1726
await useMonacoEditor({ element, source });
1827
</script>

src/components/rdb/RunCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</div>
3131
<div class="g-script">
3232
<VCardSubtitle class="font-weight-bold"> Script </VCardSubtitle>
33-
<VCardText style="height: 100%">
33+
<VCardText>
3434
<AsyncEditor v-if="run?.script" :source="run?.script"></AsyncEditor>
3535
</VCardText>
3636
</div>
@@ -104,7 +104,8 @@ function formatDateTime(dateTime: string) {
104104
grid-area: script;
105105
display: grid;
106106
grid-template-columns: minmax(100px, 1fr);
107-
grid-template-rows: min-content minmax(200px, 1fr);
107+
/* grid-template-rows: min-content minmax(200px, 1fr); */
108+
grid-template-rows: min-content min-content;
108109
}
109110
110111
.g-stdout {

src/components/rdb/RunView.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
<script setup lang="ts">
2-
import { computed, ref } from "vue";
3-
import { useRoute } from "vue-router";
4-
5-
import { useRdbRunQuery } from "@/graphql/codegen/generated";
6-
7-
import RunCard from "./RunCard.vue";
8-
9-
const route = useRoute();
10-
const runNo = Number(route.params.runNo);
11-
12-
const breadcrumb = computed(() => [
13-
{ title: "Runs", to: { name: "runs" }, exact: true },
14-
{ title: `Run ${runNo}`, to: { name: "run", params: { runNo } } },
15-
]);
16-
17-
const queryResponse = useRdbRunQuery({ variables: { runNo } });
18-
19-
const run = computed(() => queryResponse.data.value?.rdb.run);
20-
</script>
21-
221
<template>
232
<div class="g-container">
243
<div class="g-navi">
@@ -39,13 +18,34 @@ const run = computed(() => queryResponse.data.value?.rdb.run);
3918
</div>
4019
</template>
4120

21+
<script setup lang="ts">
22+
import { computed } from "vue";
23+
import { useRoute } from "vue-router";
24+
25+
import { useRdbRunQuery } from "@/graphql/codegen/generated";
26+
27+
import RunCard from "./RunCard.vue";
28+
29+
const route = useRoute();
30+
const runNo = Number(route.params.runNo);
31+
32+
const breadcrumb = computed(() => [
33+
{ title: "Runs", to: { name: "runs" }, exact: true },
34+
{ title: `Run ${runNo}`, to: { name: "run", params: { runNo } } },
35+
]);
36+
37+
const queryResponse = useRdbRunQuery({ variables: { runNo } });
38+
39+
const run = computed(() => queryResponse.data.value?.rdb.run);
40+
</script>
41+
4242
<style scoped>
4343
.g-container {
4444
display: grid;
4545
padding: 12px;
4646
justify-content: center;
4747
grid-template-columns: minmax(min-content, 960px);
48-
grid-template-rows: min-content min-content 1fr;
48+
grid-template-rows: min-content min-content min-content;
4949
grid-template-areas: "navi" "button" "card";
5050
}
5151

0 commit comments

Comments
 (0)