Skip to content

Commit

Permalink
Version 2.0.0-RC6
Browse files Browse the repository at this point in the history
Updated components (also fixes a bug that caused all inputs to stop working once the heightmap was activated)
Changed click behaviour of file list items to be activated on a single click again
Added touch events to event+file lists to show the context menu on devices that do not support the native JS contextmenu event
Print information is no longer cleared when a print finishes
Simplified file list reset when the connection is interrupted
Print+Simulate options are hidden when a job file is being processed
Escape closes the text editor again
Height map is automatically reloaded once 'heightmap.csv' shows up in a G-code response
Minor other changes
Bug fix: Notification when editing a large file was not displayed during download
Bug fix: Macro list did not return to the root directory when the connection was interrupted
Bug fix: Warm-up time was not displayed
Bug fix: Selected tool was no longer highlighted when the light theme was selected
Bug fix: Drag&Drop was completely broken in Chrome-based browsers and the drag animation was no longer working
  • Loading branch information
chrishamm committed Mar 6, 2019
1 parent d8f5cbf commit 22a275f
Show file tree
Hide file tree
Showing 28 changed files with 262 additions and 178 deletions.
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"jszip": "^3.2.0",
"piecon": "^0.5.0",
"roboto-fontface": "*",
"three": "^0.101.1",
"three-orbitcontrols": "^2.101.1",
"vue": "^2.6.7",
"three": "^0.102.1",
"three-orbitcontrols": "^2.102.1",
"vue": "^2.6.8",
"vue-i18n": "^8.8.2",
"vue-router": "^3.0.1",
"vuetify": "^1.5.4",
"vuetify": "^1.5.5",
"vuex": "^3.1.0"
},
"devDependencies": {
Expand All @@ -35,14 +35,14 @@
"babel-plugin-transform-builtin-extend": "^1.1.2",
"compression-webpack-plugin": "^2.0.0",
"core-js": "^2.6.5",
"eslint": "^5.14.1",
"eslint": "^5.15.1",
"eslint-plugin-vue": "^5.2.2",
"material-design-icons-iconfont": "^4.0.5",
"rimraf": "^2.6.3",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"vue-cli-plugin-vuetify": "^0.4.6",
"vue-template-compiler": "^2.6.7",
"vue-template-compiler": "^2.6.8",
"vuetify-loader": "^1.2.1",
"zip-webpack-plugin": "^3.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
},
mounted() {
// Attempt to disconnect from every machine when the page is being unloaded
window.addEventListener('onunload', this.disconnectAll);
window.addEventListener('unload', this.disconnectAll);
// Connect if running on a board
if (!this.isLocal) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/buttons/ConnectBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import { mapState, mapGetters, mapActions, mapMutations } from 'vuex'
export default {
computed: {
...mapState(['isConnecting', 'isDisconnecting', 'isLocal']),
...mapState('machine', ['isReconnecting']),
...mapGetters(['isConnected']),
isBusy() { return this.isConnecting || this.isDisconnecting },
isBusy() { return this.isConnecting || this.isReconnecting || this.isDisconnecting },
buttonColor() {
return this.isBusy ? 'warning'
: (this.isConnected ? 'success' : 'primary');
Expand All @@ -26,7 +27,7 @@ export default {
return this.isConnected ? 'close' : 'power_settings_new';
},
caption() {
return this.$t(this.isConnecting ? 'button.connect.connecting'
return this.$t((this.isConnecting || this.isReconnecting) ? 'button.connect.connecting'
: this.isDisconnecting ? 'button.connect.disconnecting'
: this.isConnected ? 'button.connect.disconnect'
: 'button.connect.connect');
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialogs/FileEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</v-toolbar-items>
</v-toolbar>

<v-textarea ref="textarea" :value="innerValue" @blur="innerValue = $event.target.value" @keydown.tab.exact.prevent="onTextareaTab" :rows="null" hide-details solo class="edit-textarea" browser-autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></v-textarea>
<v-textarea ref="textarea" :value="innerValue" @blur="innerValue = $event.target.value" @keydown.tab.exact.prevent="onTextareaTab" @keydown.esc="close" :rows="null" hide-details solo class="edit-textarea" browser-autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></v-textarea>
</v-card>
</v-dialog>
</template>
Expand Down
98 changes: 68 additions & 30 deletions src/components/lists/BaseFileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ th.checkbox {
</template>

<template slot="items" slot-scope="props">
<tr :active="props.selected" @click="props.selected = !props.selected" @dblclick="itemClicked(props.item)" @contextmenu.prevent="itemContextmenu(props, $event)" :data-filename="(props.item.isDirectory ? '*' : '') + props.item.name" draggable="true" @dragstart="dragStart(props.item, $event)" @dragover="dragOver(props.item, $event)" @drop.prevent="dragDrop(props.item, $event)" v-tab-control.contextmenu.dblclick @keydown.space="props.selected = !props.selected">
<tr :active="props.selected" @touchstart="onItemTouchStart(props, $event)" @touchend="onItemTouchEnd" @click="onItemClick(props)" @contextmenu.prevent="onItemContextmenu(props, $event)" :data-filename="(props.item.isDirectory ? '*' : '') + props.item.name" draggable="true" @dragstart="onItemDragStart(props.item, $event)" @dragover="onItemDragOver(props.item, $event)" @drop.prevent="onItemDragDrop(props.item, $event)" v-tab-control.contextmenu @keydown.space="props.selected = !props.selected">
<td class="pr-0">
<v-checkbox :input-value="props.selected" tabindex="-1" primary hide-details></v-checkbox>
<v-checkbox :input-value="props.selected" @touchstart.stop="" @touchend.stop="" @click.stop.prevent="props.selected = !props.selected" primary hide-details></v-checkbox>
</td>
<template v-for="header in headers">
<td v-if="header.value === 'name'" :key="header.value">
Expand Down Expand Up @@ -91,7 +91,7 @@ th.checkbox {
<v-list-tile v-show="!noDownload && innerValue.length === 1 && filesSelected" @click="download">
<v-icon class="mr-1">cloud_download</v-icon> {{ $tc('list.baseFileList.download', innerValue.length) }}
</v-list-tile>
<v-list-tile v-show="!noEdit && innerValue.length === 1 && filesSelected" :disabled="!canEditFile" @click="edit">
<v-list-tile v-show="!noEdit && innerValue.length === 1 && filesSelected" :disabled="!canEditFile" @click="edit(innerValue[0])">
<v-icon class="mr-1">edit</v-icon> {{ $t('list.baseFileList.edit') }}
</v-list-tile>
<v-list-tile v-show="!noRename && innerValue.length === 1" @click="rename">
Expand Down Expand Up @@ -175,6 +175,7 @@ export default {
computed: {
...mapState(['selectedMachine']),
...mapGetters(['isConnected']),
...mapState('machine', ['isReconnecting']),
...mapState('machine/cache', ['sorting']),
...mapState('machine/model', ['storages']),
storageIndex() {
Expand Down Expand Up @@ -211,6 +212,7 @@ export default {
innerValue: [],
contextMenu: {
shown: false,
touchTimer: undefined,
x: 0,
y: 0
},
Expand Down Expand Up @@ -355,20 +357,32 @@ export default {
}
return (item[prop] !== null) ? this.$displayTime(item[prop]) : this.$t('generic.noValue');
},
itemClicked(item) {
if (item.isDirectory) {
this.loadDirectory(Path.combine(this.innerDirectory, item.name));
onItemTouchStart(props, e) {
const that = this;
this.contextMenu.touchTimer = setTimeout(function() {
that.contextMenu.touchTimer = undefined;
that.onItemContextmenu(props, { clientX: e.targetTouches[0].clientX, clientY: e.targetTouches[0].clientY });
}, 1000);
},
onItemTouchEnd() {
if (this.contextMenu.touchTimer) {
clearTimeout(this.contextMenu.touchTimer);
this.contextMenu.touchTimer = undefined;
}
},
onItemClick(props) {
if (props.item.isDirectory) {
this.loadDirectory(Path.combine(this.innerDirectory, props.item.name));
} else {
this.$emit('fileClicked', item);
this.$emit('fileClicked', props.item);
}
},
itemContextmenu(props, e) {
onItemContextmenu(props, e) {
this.onItemTouchEnd();
// Deal with selection
if (!props.selected) {
this.innerValue = [];
this.$nextTick(() => {
props.selected = true;
});
props.selected = true;
}
// Open the context menu
Expand All @@ -379,7 +393,7 @@ export default {
this.contextMenu.shown = true;
});
},
dragStart(item, e) {
onItemDragStart(item, e) {
if (this.noDragDrop) {
return;
}
Expand Down Expand Up @@ -423,9 +437,10 @@ export default {
const x = e.clientX - table.getClientRects()[0].left;
const y = e.clientY - e.target.closest('tr').getClientRects()[0].top + offsetY;
e.dataTransfer.setDragImage(tableClone, x, y);
this.$nextTick(() => tableClone.remove());
setTimeout(() => tableClone.remove(), 0);
},
dragOver(item, e) {
onItemDragOver(item, e) {
if (!this.noDragDrop && item.isDirectory) {
const jsonData = e.dataTransfer.getData('application/json');
if (jsonData) {
Expand All @@ -434,20 +449,29 @@ export default {
e.preventDefault();
e.stopPropagation();
}
} else {
// Fix for Chrome: It does not grant access to dataTransfer on the same domain "for security reasons"...
e.preventDefault();
e.stopPropagation();
}
}
},
async dragDrop(item, e) {
const data = JSON.parse(e.dataTransfer.getData('application/json'));
const directory = this.innerDirectory;
for (let i = 0; i < data.items.length; i++) {
const from = Path.combine(data.directory, data.items[i].name);
const to = Path.combine(directory, item.name, data.items[i].name);
try {
await this.machineMove({ from, to });
} catch (e) {
this.$makeNotification('error', `Failed to move ${data.items[i].name} to ${directory}`, e.message);
break;
async onItemDragDrop(item, e) {
const jsonData = e.dataTransfer.getData('application/json');
if (jsonData) {
const data = JSON.parse(jsonData);
if (data.type === 'dwcFiles' && !data.items.some(dataItem => dataItem.isDirectory && dataItem.name === item.name)) {
const directory = this.innerDirectory;
for (let i = 0; i < data.items.length; i++) {
const from = Path.combine(data.directory, data.items[i].name);
const to = Path.combine(directory, item.name, data.items[i].name);
try {
await this.machineMove({ from, to });
} catch (e) {
this.$makeNotification('error', `Failed to move ${data.items[i].name} to ${directory}`, e.message);
break;
}
}
}
}
},
Expand All @@ -465,14 +489,14 @@ export default {
},
async edit(item) {
try {
const filename = Path.combine(this.innerDirectory, (item && item.name) ? item.name : this.innerValue[0].name);
const response = await this.machineDownload({ filename, type: 'text', showSuccess: false });
let notification, showDelay = 0;
if (response.length > bigFileThreshold) {
notification = this.$makeNotification('warning', this.$t('notification.loading.title'), this.$t('notification.loading.message'), false);
if (item.size > bigFileThreshold) {
notification = this.$makeNotification('warning', this.$t('notification.loadingFile.title'), this.$t('notification.loadingFile.message'), false);
showDelay = 1000;
}
const filename = Path.combine(this.innerDirectory, item.name);
const response = await this.machineDownload({ filename, type: 'text', showSuccess: false });
const editDialog = this.editDialog;
setTimeout(function() {
editDialog.filename = filename;
Expand Down Expand Up @@ -616,8 +640,22 @@ export default {
this.unsubscribe();
},
watch: {
isConnected(to) {
if (to) {
this.refresh();
} else {
this.innerDirectory = this.initialDirectory;
this.innerFilelist = [];
this.editDialog.shown = false;
this.renameDialog.shown = false;
}
},
selectedMachine() {
// TODO store current directory per selected machine
this.innerDirectory = this.initialDirectory;
this.innerFilelist = [];
this.editDialog.shown = false;
this.renameDialog.shown = false;
},
Expand Down
Loading

0 comments on commit 22a275f

Please sign in to comment.