add lazy loader to g-code files & history thumbnails

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-03-21 00:00:29 +01:00
1 parent ed3aca4a8b
commit 95d3db49c5
5 files changed
+105 -23

No files matched your search

+17 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mainsail",
"version": "1.3.0",
"version": "1.4.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mainsail",
"version": "1.3.0",
"version": "1.4.0",
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.8.2",
@@ -20,6 +20,7 @@
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
"vue-load-image": "^0.1.12",
"vue-observe-visibility": "^1.0.0",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
@@ -17403,6 +17404,14 @@
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
"dev": true
},
"node_modules/vue-load-image": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/vue-load-image/-/vue-load-image-0.1.12.tgz",
"integrity": "sha512-F2OwNP0hB0OG1wOy/r9SJ5oFiKvpgS1jluMkHtr3VFtbrhQPvuL53wNxatjkONn3Ciw6Ui54hBCgGBLAwwkZYw==",
"peerDependencies": {
"vue": "^2.0.0"
}
},
"node_modules/vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz",
@@ -35233,6 +35242,12 @@
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
"dev": true
},
"vue-load-image": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/vue-load-image/-/vue-load-image-0.1.12.tgz",
"integrity": "sha512-F2OwNP0hB0OG1wOy/r9SJ5oFiKvpgS1jluMkHtr3VFtbrhQPvuL53wNxatjkONn3Ciw6Ui54hBCgGBLAwwkZYw==",
"requires": {}
},
"vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz",
+1
View File
@@ -21,6 +21,7 @@
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
"vue-load-image": "^0.1.12",
"vue-observe-visibility": "^1.0.0",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
+28 -10
View File
@@ -60,14 +60,28 @@
class="file-list-cursor user-select-none"
>
<td class="pr-0 text-center" style="width: 32px;">
<v-icon v-if="!(getSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="getSmallThumbnail(item) && getBigThumbnail(item)" top>
<template v-slot:activator="{ on, attrs }">
<img :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
</template>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
<img v-if="getSmallThumbnail(item) && !getBigThumbnail(item)" :src="getSmallThumbnail(item)" width="32" height="32" />
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<vue-load-image>
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
<v-progress-circular slot="preloader" indeterminate color="primary"></v-progress-circular>
<v-icon slot="error">mdi-file</v-icon>
</vue-load-image>
</template>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
</template>
<template v-else-if="getSmallThumbnail(item)">
<vue-load-image>
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
<v-progress-circular slot="preloader" indeterminate color="primary"></v-progress-circular>
<v-icon slot="error">mdi-file</v-icon>
</vue-load-image>
</template>
<template v-else>
<v-icon >mdi-file</v-icon>
</template>
</td>
<td class=" ">{{ item.filename }}</td>
<td class=" ">
@@ -206,9 +220,13 @@
</template>
<script>
import {mapGetters, mapState} from 'vuex';
import {mapGetters, mapState} from 'vuex'
import VueLoadImage from 'vue-load-image'
export default {
components: {
'vue-load-image': VueLoadImage
},
data() {
return {
search: '',
@@ -459,7 +477,7 @@ import {mapGetters, mapState} from 'vuex';
}
return 400
}
},
},
watch: {
hideColums: function(newVal) {
+56 -10
View File
@@ -45,6 +45,25 @@
.minHeight36 {
min-height: 36px;
}
td.jobStatus {
padding-left: 6px !important;
border-left-width: 10px;
border-left-style: solid;
border-left-color: transparent;
}
td.jobStatus.jobStatusCompleted {
border-left-color: #388E3C99;
}
td.jobStatus.jobStatusInProgress {
border-left-color: #546E7A99;
}
td.jobStatus.jobStatusCanceled{
border-left-color: #ff525299;
}
</style>
<template>
@@ -147,16 +166,34 @@
@dragover="dragOverFilelist($event, item)" @dragleave="dragLeaveFilelist" @drop.prevent.stop="dragDropFilelist($event, item)"
:data-name="item.filename"
>
<td class="pr-0 text-center" style="width: 32px;">
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
<v-icon v-if="!item.isDirectory && !(getSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)" top>
<template v-slot:activator="{ on, attrs }">
<img :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
<td :class="'pr-0 text-center jobStatus '+getFileStatus(item)" style="width: 32px;">
<template v-if="item.isDirectory">
<v-icon>mdi-folder</v-icon>
</template>
<template v-else>
<template v-if="getSmallThumbnail(item) && getBigThumbnail(item)">
<v-tooltip v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)" top>
<template v-slot:activator="{ on, attrs }">
<vue-load-image>
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
<v-progress-circular slot="preloader" indeterminate color="primary"></v-progress-circular>
<v-icon slot="error">mdi-file</v-icon>
</vue-load-image>
</template>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
</template>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
<img v-if="!item.isDirectory && getSmallThumbnail(item) && !getBigThumbnail(item)" :src="getSmallThumbnail(item)" width="32" height="32" />
<template v-else-if="getSmallThumbnail(item)">
<vue-load-image>
<img slot="image" :src="getSmallThumbnail(item)" width="32" height="32" />
<v-progress-circular slot="preloader" indeterminate color="primary"></v-progress-circular>
<v-icon slot="error">mdi-file</v-icon>
</vue-load-image>
</template>
<template v-else>
<v-icon>mdi-file</v-icon>
</template>
</template>
</td>
<td class=" ">{{ item.filename }}</td>
<td class="text-no-wrap text-right" v-if="headers.filter(header => header.value === 'size')[0].visible">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
@@ -168,7 +205,6 @@
<td class="text-no-wrap text-right" v-if="headers.filter(header => header.value === 'slicer')[0].visible">{{ item.slicer ? item.slicer : '--' }}<br /><small v-if="item.slicer_version">{{ item.slicer_version}}</small></td>
</tr>
</template>
<v-data-footer>bla bla</v-data-footer>
</v-data-table>
<div class="dragzone" :style="'visibility: '+dropzone.visibility+'; opacity: '+dropzone.hidden">
<div class="textnode">Drop files to add gcode.</div>
@@ -295,8 +331,12 @@
import axios from 'axios'
import { findDirectory } from "@/plugins/helpers"
import { validGcodeExtensions } from "@/store/variables"
import VueLoadImage from "vue-load-image"
export default {
components: {
'vue-load-image': VueLoadImage
},
data () {
return {
search: '',
@@ -831,6 +871,12 @@
}
return 400
},
getFileStatus(item) {
return this.$store.getters["server/history/getPrintStatus"]({
filename: (this.currentPath+"/"+item.filename).substr(7),
modified: new Date(item.modified).getTime()
})
}
},
watch: {
+3 -1
View File
@@ -87,5 +87,7 @@ export default {
total: 0,
used: 0,
}
}
},
}