1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-08 15:58:45 +01:00

perf(UI): improved function and routine parameters modals

This commit is contained in:
Fabio Di Stasio 2021-11-12 12:22:39 +01:00
parent 795db96319
commit d19f475fc2
2 changed files with 10 additions and 6 deletions

View File

@ -237,10 +237,11 @@ export default {
this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom)); this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom));
}, },
addParameter () { addParameter () {
const newUid = uidGen();
this.parametersProxy = [...this.parametersProxy, { this.parametersProxy = [...this.parametersProxy, {
_antares_id: uidGen(), _antares_id: newUid,
name: `Param${this.i++}`, name: `param${this.i++}`,
type: 'INT', type: this.workspace.dataTypes[0].types[0].name,
context: 'IN', context: 'IN',
length: '' length: ''
}]; }];
@ -250,12 +251,13 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60; this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60;
this.selectedParam = newUid;
}, 20); }, 20);
}, },
removeParameter (uid) { removeParameter (uid) {
this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid); this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid);
if (this.selectedParam === name && this.parametersProxy.length) if (this.parametersProxy.length && this.selectedParam === uid)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {

View File

@ -237,8 +237,9 @@ export default {
this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom)); this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom));
}, },
addParameter () { addParameter () {
const newUid = uidGen();
this.parametersProxy = [...this.parametersProxy, { this.parametersProxy = [...this.parametersProxy, {
_antares_id: uidGen(), _antares_id: newUid,
name: `param${this.i++}`, name: `param${this.i++}`,
type: this.workspace.dataTypes[0].types[0].name, type: this.workspace.dataTypes[0].types[0].name,
context: 'IN', context: 'IN',
@ -250,12 +251,13 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60; this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60;
this.selectedParam = newUid;
}, 20); }, 20);
}, },
removeParameter (uid) { removeParameter (uid) {
this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid); this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid);
if (this.selectedParam === name && this.parametersProxy.length) if (this.parametersProxy.length && this.selectedParam === uid)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {