BigW Consortium Gitlab

Commit bc39218b by Jacob Schatz

Show warning for big files.

parent 7572aaf3
......@@ -42,7 +42,7 @@ export default {
</script>
<template>
<button class="btn btn-default" @click.prevent="editClicked" v-cloak v-if="isCommitable" :disabled="binary">
<button class="btn btn-default" @click.prevent="editClicked" v-cloak v-if="isCommitable && !activeFile.render_error" :disabled="binary">
<i :class="buttonIcon"></i>
<span>{{buttonLabel}}</span>
</button>
......
......@@ -23,5 +23,10 @@ export default {
</script>
<template>
<div v-html="activeFile.html"></div>
<div>
<div v-if="!activeFile.render_error" v-html="activeFile.html"></div>
<div v-if="activeFile.render_error" class="vertical-center render-error">
<p class="text-center">The source could not be displayed because it is too large. You can <a :href="activeFile.raw_path">download</a> it instead.</p>
</div>
</div>
</template>
......@@ -154,16 +154,19 @@ const RepoHelper = {
RepoHelper.setBinaryDataAsBase64(data);
Store.setViewToPreview();
} else if (!Store.isPreviewView()) {
Service.getRaw(data.raw_path)
if(!data.render_error){
Service.getRaw(data.raw_path)
.then((rawResponse) => {
Store.blobRaw = rawResponse.data;
data.plain = rawResponse.data;
RepoHelper.setFile(data, file);
}).catch(RepoHelper.loadingError);
}
}
if (Store.isPreviewView()) RepoHelper.setFile(data, file);
if (Store.isPreviewView()){
RepoHelper.setFile(data, file);
}
// if the file tree is empty
if (Store.files.length === 0) {
......@@ -187,6 +190,9 @@ const RepoHelper = {
newFile.url = file.url || location.pathname;
newFile.url = file.url;
if(newFile.render_error === 'too_large'){
newFile.tooLarge = true;
}
newFile.newContent = '';
Store.addToOpenedFiles(newFile);
......
......@@ -128,3 +128,11 @@ of the body element here, we negate cascading side effects but allow momentum sc
[v-cloak] {
display: none;
}
.vertical-center {
min-height: 100%;
min-height: 100vh;
display: flex;
align-items: center;
}
\ No newline at end of file
......@@ -369,6 +369,13 @@
}
}
.render-error {
min-height: calc(100vh - 63px);
p {
width: 100%;
}
}
@keyframes blockTextShine {
0% {
transform: translateX(-468px);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment