updating next tick, trying to filter

This commit is contained in:
sanjayk03-dev
2024-01-22 01:07:02 +05:30
parent 8a6f6f551e
commit 293e1f7420
2 changed files with 19 additions and 11 deletions

View File

@@ -55,17 +55,18 @@ module.exports = {
});
const text = (await response.text()).split(" ").join("\n");
console.log(text);
if (text.length > 20e6) {
this.newGcode[this.tab - 1] = "File is large - gcode view disabled";
} else {
this.newGcode[this.tab - 1] = text;
}
Vue.nextTick(() => {
if (text.length > 20e6) {
this.newGcode[this.tab - 1] = "File is large - gcode view disabled";
} else {
this.newGcode[this.tab - 1] = text;
}
});
} else {
this.newGcode = "";
Vue.nextTick(() => {
this.newGcode[this.tab - 1] = "";
});
}
Vue.nextTick(() => {
console.log("updated");
});
},
upload: function (e) {
const files = e.target.files || e.dataTransfer.files;
@@ -158,6 +159,13 @@ module.exports = {
document.getElementById(`gcodeSelect-${this.tab - 1}`).value = "default";
this.newGcode[this.tab - 1] = "";
},
macrosList: function () {
const macros = this.state.files.filter(
(name) => !this.config.macros.some((obj) => obj.name === name)
);
console.log("Only Macros: ", macros);
return macros;
},
resetConfig: async function () {
this.config.macros = [
{

View File

@@ -64,7 +64,7 @@ script#macros-template(type="text/x-template")
v-model="selectedValues[tab - 1]",@change="load", :disabled="!is_ready",
style="max-width:100%;height:40px;border-radius:5px")
option( selected='' value='default') Create G-Code
option(v-for="file in state.files", :value="file") {{file}}
option(v-for="file in macrosList", :value="file") {{file}}
button.pure-button(title="Upload a new GCode program.", @click="open",
:disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload
@@ -94,7 +94,7 @@ script#macros-template(type="text/x-template")
v-model="selectedValues[tab - 1]", @change="load", :disabled="!is_ready",
style="max-width:100%;height:40px;border-radius:5px")
option(selected='' value='default') Create G-Code
option(v-for="file in state.files", :value="file") {{file}}
option(v-for="file in macrosList", :value="file") {{file}}
button.pure-button(title="Upload a new GCode program.", @click="open",
:disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload