Let prettier change a load of things because new prettier has new rules :(

This commit is contained in:
Julian Stirling 2025-11-02 18:15:02 +00:00
parent a05156407b
commit 1601bdd123
44 changed files with 218 additions and 262 deletions

View file

@ -145,7 +145,7 @@ export default {
},
},
data: function() {
data: function () {
return {
taskUrl: null,
progress: null,
@ -245,13 +245,13 @@ export default {
}
// Check for a task that is ongoing.
// We can't handle multiple tasks ongoing, so this picks the first.
const ongoingTask = response.data.find(t => ["pending", "running"].includes(t.status));
const ongoingTask = response.data.find((t) => ["pending", "running"].includes(t.status));
if (ongoingTask) {
// There is a started task
this.taskStarted = true;
this.$emit("taskStarted");
// Find its URL
const taskUrl = ongoingTask.links.find(t => t.rel == "self").href;
const taskUrl = ongoingTask.links.find((t) => t.rel == "self").href;
try {
await this.pollOngoingTask(ongoingTask.id, taskUrl);
} catch (error) {
@ -262,7 +262,7 @@ export default {
}
},
bootstrapTask: function() {
bootstrapTask: function () {
// Starts the process of creating a new Actiont ask
if (this.requiresConfirmation) {
this.modalConfirm(this.confirmationMessage).then(
@ -309,14 +309,14 @@ export default {
}
},
onTaskEnd: function() {
onTaskEnd: function () {
// Reset taskRunning and taskId
this.taskRunning = false;
this.taskStarted = false;
this.$emit("finished");
},
startPolling: function(taskId, taskUrl) {
startPolling: function (taskId, taskUrl) {
if (this.taskRunning != true) {
// Starts polling an existing Action task
this.taskUrl = taskUrl;
@ -327,12 +327,12 @@ export default {
}
},
pollTask: function(taskId, interval) {
pollTask: function (taskId, interval) {
interval = interval * 1000 || 500;
var checkCondition = (resolve, reject) => {
// If the condition is met, we're done!
axios.get(this.taskUrl, { baseURL: this.$store.getters.baseUri }).then(response => {
axios.get(this.taskUrl, { baseURL: this.$store.getters.baseUri }).then((response) => {
var result = response.data.status;
this.taskStatus = result;
if ((result == "running") | (result == "pending")) {
@ -382,7 +382,7 @@ export default {
this.$root.$emit("modalClosed");
},
terminateTask: function() {
terminateTask: function () {
axios.delete(this.taskUrl, { baseURL: this.$store.getters.baseUri });
this.$root.$emit("modalClosed");
},

View file

@ -17,9 +17,7 @@
</div>
<!-- Paused banner outside scroll container, positioned relative to wrapper -->
<div v-if="userIsHovering" class="paused-banner">
Auto-scroll paused
</div>
<div v-if="userIsHovering" class="paused-banner">Auto-scroll paused</div>
</div>
</div>
</template>
@ -46,10 +44,10 @@ export default {
},
watch: {
log: function() {
log: function () {
this.scrollToBottom();
},
taskStatus: function() {
taskStatus: function () {
this.scrollToBottom();
},
},

View file

@ -22,12 +22,12 @@ export default {
},
computed: {
barWidthFromProgress: function() {
barWidthFromProgress: function () {
var progress = this.progress <= 100 ? this.progress : 100;
var styleString = `width: ${progress}%`;
return styleString;
},
indeterminateProgressBar: function() {
indeterminateProgressBar: function () {
if (this.taskStatus == "pending") return true;
if ((this.taskStatus == "running") & !this.progress) {
return true;

View file

@ -128,7 +128,7 @@ export default {
};
},
computed: {
internalLabels: function() {
internalLabels: function () {
if (this.dataType == "number_object") {
let labels = {};
for (const key in this.internalValue) {
@ -138,7 +138,7 @@ export default {
}
return [];
},
valueLength: function() {
valueLength: function () {
if (this.dataType == "number_array") {
if (this.internalValue == undefined) {
return 0;
@ -148,7 +148,7 @@ export default {
return 1;
}
},
dataType: function() {
dataType: function () {
let prop = this.dataSchema;
if (prop == undefined) {
return "undefined";
@ -162,7 +162,7 @@ export default {
return "number_array";
}
if (Array.isArray(prop.items)) {
if (prop.items.every(t => num_types.includes(t.type))) {
if (prop.items.every((t) => num_types.includes(t.type))) {
return "number_array";
}
}
@ -210,46 +210,46 @@ export default {
},
methods: {
resetInternalValue: function() {
resetInternalValue: function () {
// Whenever updatirng th internal value stringify and parse as a form of deepcopy.
// This ensure that the this.value prop is not mutated for when elements of arrays
// or objects are updated.
this.internalValue = JSON.parse(JSON.stringify(this.value));
},
requestUpdate: async function() {
requestUpdate: async function () {
this.$emit("requestUpdate");
},
sendValue: async function() {
sendValue: async function () {
this.$emit("sendValue", this.internalValue);
},
checkboxUpdated: function() {
checkboxUpdated: function () {
if (this.internalValue != this.$refs.checkbox.checked) {
this.internalValue = this.$refs.checkbox.checked;
this.sendValue();
}
},
focusIn: function(event) {
focusIn: function (event) {
this.valueOnEnter = event.target.value;
},
focusOut: function(event) {
focusOut: function (event) {
if (this.valueOnEnter != event.target.value) {
this.sendValue(event.target.value);
}
},
keyDown: function(event) {
keyDown: function (event) {
// Pressing enter should set the property, whether or not we think it's changed.
if (event.keyCode == 13) {
this.sendValue();
}
},
updateIsEdited: function() {
updateIsEdited: function () {
this.isEdited = this.deepStringify(this.internalValue) !== this.deepStringify(this.value);
},
animationEnd: function() {
animationEnd: function () {
this.animateUpdate = false;
this.$emit("animationShown");
},
deepStringify: function(val) {
deepStringify: function (val) {
// Create a json string where all internal numbers are also JSON strings. This is
// needed to robustly check if the value is updated because the raw value may be a
// number but anything typed in the input is a string. In the case of arrays or

View file

@ -54,7 +54,7 @@ export default {
},
computed: {
propertyDescription: function() {
propertyDescription: function () {
try {
return this.thingDescription(this.thingName).properties[this.propertyName];
} catch (error) {
@ -64,13 +64,13 @@ export default {
},
watch: {
propertyDescription: function() {
propertyDescription: function () {
// Ensure we read the property once the URL is known
this.readProperty();
},
},
mounted: function() {
mounted: function () {
// Read the property when we're mounted - usually this won't
// work because the URL isn't set yet. However, it's helpful if
// the app is reloaded (e.g. from a dev server).
@ -80,17 +80,17 @@ export default {
},
methods: {
readProperty: async function() {
readProperty: async function () {
let data = await this.readThingProperty(this.thingName, this.propertyName);
this.value = data;
return data;
},
writeProperty: async function(requestedValue) {
writeProperty: async function (requestedValue) {
try {
this.value = requestedValue;
await this.writeThingProperty(this.thingName, this.propertyName, requestedValue);
if (this.readBack) {
await new Promise(r => setTimeout(r, this.readBackDelay));
await new Promise((r) => setTimeout(r, this.readBackDelay));
let newVal = await this.readProperty();
if (newVal == requestedValue) {
this.animate = true;
@ -112,7 +112,7 @@ export default {
this.readProperty();
}
},
resetAnimate: function() {
resetAnimate: function () {
this.animate = false;
},
},

View file

@ -33,7 +33,7 @@ export default {
},
methods: {
actionResponse: function() {
actionResponse: function () {
if (this.actionData.notify_on_success) {
this.modalNotify(this.actionData.success_message);
}