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

Add ionic range control #1148

Merged

Conversation

edgarmueller
Copy link
Contributor

Furthermore:

  • Re-organize angular-test structure
  • Fix rule evaluation
  • Make componentRef lazily initialized
  • Fix group layout label property

@coveralls
Copy link

coveralls commented Nov 9, 2018

Coverage Status

Coverage decreased (-0.07%) to 86.535% when pulling 6110013 on edgarmueller:topic/ionic/range-control into 928bd09 on eclipsesource:master.

Copy link
Member

@eneufeld eneufeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some unclear changes

@@ -53,6 +54,7 @@ import { JsonFormsControl } from './control';
export class JsonFormsOutlet extends JsonFormsBaseRenderer implements OnInit, OnDestroy {

private subscription: Subscription;
private componentRef: ComponentRef<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe improve naming eg by using 'currentComponentRef' ?

const componentFactory =
this.componentFactoryResolver.resolveComponentFactory(bestComponent);
this.viewContainerRef.clear();
const component: ComponentRef<any> =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe improve naming eg by using 'newComponentRef' /

if (this.componentRef === undefined ||
this.componentRef.componentType !== component.componentType) {
this.viewContainerRef.clear();
this.componentRef = this.viewContainerRef.createComponent(componentFactory);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we simply assign 'component' to 'this.componentRef' ?

const condition = uischema.rule.condition;

if (isLeafCondition(condition)) {
const value = resolveData(data, toDataPath(condition.scope));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using considtion.scope and not conditionScope here?

RankedTester,
rankWith,
uiTypeIs
GroupLayout, JsonFormsProps,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

@@ -305,9 +305,14 @@ export interface ControlState {
*/
export const mapStateToControlProps =
(state: JsonFormsState, ownProps: OwnPropsOfControl): StatePropsOfControl => {
const { uischema } = ownProps;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after extracting the uischema we should use it everywhere

const path = composeWithUi(ownProps.uischema, ownProps.path);
const visible = _.has(ownProps, 'visible') ? ownProps.visible : isVisible(ownProps, state);
const enabled = _.has(ownProps, 'enabled') ? ownProps.enabled : isEnabled(ownProps, state);
const rulePath = _.has(ownProps.uischema, 'rule')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you fixed this because of a bug?
if so we should add tests for this.
how can I reproduce the bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's related to the ListWithDetail renderer where a scope is set and a detail view with a rule has been specified as well. The rule's scope is based on a schema ref, but actually should be depenent on an instance path because of array indices. I added a test case demonstrating this.

@eneufeld
Copy link
Member

LGTM, thank you

@edgarmueller edgarmueller merged commit 7a063c6 into eclipsesource:master Nov 13, 2018
@edgarmueller edgarmueller added this to the 2.0.12 milestone Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants