Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proxy list #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The __YAML__ structure follow the given hierarchy:
1. type: Name of the domain class
2. name: (optional) identifier when we don't want to use its `type` as identifier.
3. **: additional parameters specific to domain type expectation.
2. proxyType: Name of proxy used in proxy lists

# Domain definitions

Expand Down
6 changes: 5 additions & 1 deletion trame_simput/core/ui/resolvers/vuetify.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self):

def get_widget(self, elem):
model = self._model.get(elem.get("name"), {})
attributes = {key: model[key] for key in model if not key.startswith("_")}
attributes = {}
if elem.tag in VUETIFY_MAP:
return VUETIFY_MAP[elem.tag], attributes
elif elem.tag == "input":
Expand Down Expand Up @@ -80,6 +80,10 @@ def get_widget(self, elem):
if self._model.get(elem.get("name"), {}).get("type", "string") == "bool":
widget = "sw-switch"

proxy_type = model.get("proxyType", None)
if proxy_type is not None:
attributes["proxyType"] = proxy_type

return widget, attributes
elif elem.tag == "proxy":
return "sw-proxy", attributes
Expand Down
13 changes: 7 additions & 6 deletions vue2-components/src/widgets/TextField/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export default {
if (!this.model) {
this.model = [];
}
this.dynamicSize = this.model.length + 1;
this.model.length = this.dynamicSize;
if (this.type == 'proxy') {
this.getSimput()
.wsClient.getConnection()
Expand All @@ -158,16 +156,19 @@ export default {
])
.then((proxy_id) => {
if (proxy_id != undefined) {
this.model[this.dynamicSize - 1] = proxy_id;
this.validate(this.dynamicSize);
this.model.push(proxy_id);
this.dirty(this.name);
}
this.dynamicSize = this.model.length;
this.validate(this.dynamicSize);
});
} else {
if (this.newValue === 'null') {
this.model[this.dynamicSize - 1] = null;
this.model.push(null);
} else if (this.newValue === 'same') {
this.model[this.dynamicSize - 1] = this.model[this.dynamicSize - 2];
this.model.push(this.model[this.model.length - 2]);
}
this.dynamicSize = this.model.length;
this.validate(this.dynamicSize);
}
},
Expand Down
Loading