-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Apply condition sets to drawing objects in a layout + Static styling for objects. #2767
Conversation
…tor domain objects only. Needs Architectural review
Removes hardcoded conditionSet work used for prototype
… to the domain object.
Change variable name for better readability and clarity Remove unused code
Pass missing arguments
- Tweaks for layout/overflow issues; - Better header alignment; - Much better approach to "accordion" spacing;
- New `.c-selector` class; - Markup added to tree-item.vue to fix missing `c-object-label` wrapper;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
- Added new $glyph-icon-eye-disabled font symbol and related class; - Modded glyphs used for visibility toggle button; - Modded StyleEditor thumb preview to reflect visibility setting; - Tweaked `is-style-invisible` opacity property; - Code cleanup;
- Display disabled toolbar for Inspector styles in Browse mode; - Better approach to 'is-style-invisible' `c-style-thumb` with new bgCheckerboard mixin; - Moved `$controlDisabledOpacity` into a theme constant; - Refined spacing in Inspector grid;
} else { | ||
if (this.currentStyle) { | ||
Object.keys(this.currentStyle).forEach(key => { | ||
this.currentStyle[key] = 'transparent'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is used later on to identify which styles should be deleted from the element's style definition. If so, can we use something other than transparent
? This is a valid CSS value for some style rules, so it may not be clear to developers that this will result in the subsequent deletion of this style rule. Could use a distinct value save in a named constant instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Will do.
|
||
<script> | ||
import {TRIGGER} from "@/plugins/condition/utils/constants"; | ||
import { OPERATIONS } from "@/plugins/condition/utils/operations"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
}); | ||
if (this.condition.isDefault) { | ||
this.criterionDescriptions.splice(0, 0, { | ||
description: 'all else fails' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is criterionDescriptions
an array of objects rather than an array of Strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! initially i was using the same component to show errors but then I moved errors into its own component. I've changed this to be strings.
}); | ||
}, | ||
getOperatorText(operationName, values) { | ||
const found = OPERATIONS.find((operation) => operation.name === operationName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPERATIONS
should be an object keyed on the value of name
to avoid an O(n) array scan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will affect a lot of things. I'll create an issue for it and fix later.
#2771
data() { | ||
return { | ||
conditionErrors: [], | ||
ERROR: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be returned by data
. Vue will make it reactive unnecessarily. Let's just make it a const
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
}, | ||
getCriterionErrors(criterion, index) { | ||
this.openmct.objects.get(criterion.telemetry).then((telemetryObject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's way too much get
ting of objects. This is already an issue that users complain about. Criterion objects should evaluate a description and an error message only once - when the telemetry
property changes and then store them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
} | ||
}, | ||
mounted() { | ||
// TODO: should update on mutation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any of these todo items are relevant in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@shefalijoshi Won't be able to get through this today, code diff is huge. So that testing is not blocked, could you please just fix the code style issues reported by Circle CI, then I'll merge and file a followup with any changes necessary. |
}, | ||
// mixins: [ObjectLink], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this commented code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
</span> | ||
</template> | ||
<span v-else> | ||
<condition-description :show-label="false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good choice to make as its own component. we just need to be sure the styling remains the same. the description component is inline in read-only mode and as a block element in edit mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@charlesh88 Can you take a look at the CSS here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I'm not trying to say its not working. Just making sure this was verified. The markup was slightly different. One block used divs and one used spans. Maybe the container elements take care of the proper displays.
@@ -36,7 +36,7 @@ export default { | |||
}, | |||
methods: { | |||
onClick(event) { | |||
if (this.options.dialog) { | |||
if ((this.options.isEditing === undefined || this.options.isEditing) && this.options.dialog) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see (this.options.isEditing === undefined) || this.options.isEditing)
several times. i know it'd be extra code but i wonder if this should be in a computed with a descriptive name so that someone doesn't come along and mistakenly stomp over this thinking it can be a simple truthy check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Why a computed property? Could it be a regular method? like
showDialog() {
return (this.options.isEditing === undefined || this.options.isEditing);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method would work fine if used for pure js logic. The computed would allow vue to cache the result if this is to be used in templates.
<div v-for="(error, index) in conditionErrors" | ||
:key="index" | ||
class="u-alert u-alert--block u-alert--with-icon" | ||
>{{ error.message.errorText }} <template v-if="error.additionalInfo">{{ error.additionalInfo }}</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need the v-if? if error.additionalInfo is undefined then nothing will be rendered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
…into conditionals-use-conditionSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have anything major to report. Just suggestions. Andrews comments are much more critical to address.
}, | ||
data() { | ||
return { | ||
hasChildren: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have this as a computed based on children.length or is this a way to get around an async call for children?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. To avoid additional calls.
computed: { | ||
navigated() { | ||
const itemId = this.selectedItem && this.selectedItem.itemId; | ||
const isSelectedObject = itemId && this.openmct.objects.areIdsEqual(this.node.object.identifier, itemId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think areIdsEqual would not be true if itemId is undefined so I think you are safe removing itemId check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I can check how it behaves without that.
removeChild(identifier) { | ||
let removeId = this.openmct.objects.makeKeyString(identifier); | ||
this.children = this.children | ||
.filter(c => c.id !== removeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncharacteristic non-descriptive var name for you @shefalijoshi , 😉
} else { | ||
this.styleItem.style[item.property] = value; | ||
} | ||
this.$emit('persist', this.styleItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename to reflect it has updated style. whatever is listening to this is going to be persisting i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can rename the event to persistUpdatedStyle
this.openmct.objects.getOriginalPath(this.conditionSetDomainObject.identifier).then( | ||
(objectPath) => { | ||
this.objectPath = objectPath; | ||
this.navigateToPath = '#/browse/' + this.objectPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this use a call to get root path instead of hardcoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think I can get rid of that property altogether.
Merged to unblock testing. Will continue review and file followups. |
Static styles for drawing objects Resolves #2762
Conditional styles for drawing objects
Static Styles for domain objects
Control visibility for domain objects and drawing objects in a layout Resolves #2766
Add condition sets (one or more) to inspector view Resolves #2644
Default style for domain objects Resolves #2643
Author Checklist