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

Feature: ComputedProperty Dependent keys in debugger & services highlighting #781

Merged
merged 18 commits into from
Apr 29, 2018

Conversation

lifeart
Copy link
Contributor

@lifeart lifeart commented Apr 9, 2018

image

  • blue - computed property deps
  • bold green - services

#779

it will be greate to get some view-component like
http://basisjs.com/basisjs/demo/data/data-flow.html

emberjs/ember.js#16478

@lifeart lifeart changed the title Feature: ComputedProperty Dependent keys in debugger WIP / Feature: ComputedProperty Dependent keys in debugger Apr 9, 2018
@lifeart lifeart changed the title WIP / Feature: ComputedProperty Dependent keys in debugger WIP / Feature: ComputedProperty Dependent keys in debugger & services highlighting Apr 9, 2018
@nummi
Copy link
Collaborator

nummi commented Apr 9, 2018

Just playing with some ideas. In this mockup I went the Apple route (Safari and Xcode) with icons that just have a letter. Not sure if this is a good idea for people where English isn't their first language. But overall I think it's easily scannable by the eyes.

I do want to be careful not to make the Object Inspector too busy.

screen shot 2018-04-09 at 4 58 35 pm

A variation without lines:

screen shot 2018-04-09 at 6 55 02 pm

Another:

untitled-1

@lolmaus
Copy link
Contributor

lolmaus commented Apr 10, 2018

This is a fantastic, very useful feature!

However, I believe displaying dependency trees inline is inefficient, since they can be arbitrarily deep and branchy.

I'd rather have a button next to each CP that would pop up a modal with a full-screen interactive dependency tree, similar to how @lahmatiy's Basis.JS does it:

image

However, I don't remember seeing any modals in Ember Inspector, and I'm not sure if it's even possible.

@lifeart
Copy link
Contributor Author

lifeart commented Apr 10, 2018

@nummi codepen for icons

path? M 150 50 Q 150 100 200 100 L 300 100 Q 350 100 350 150

@summerisgone
Copy link

@lifeart https://codepen.io/summerisgone/pen/bvzvKB

@nummi
Copy link
Collaborator

nummi commented Apr 10, 2018

However, I believe displaying dependency trees inline is inefficient, since they can be arbitrarily deep and branchy.

Makes sense. Maybe the immediate dependency is okay for a first pass?

options.dependentKeys = hash[prop]._dependentKeys;
if (!options.isService) {
try {
options.code = hash[prop]._getter.toString();
Copy link
Member

Choose a reason for hiding this comment

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

Since you always expect this to be a function, could you essentially do Function.prototype.toString.call(hash[prop]._getter)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rwjblue no luck( Tests not passed

@lifeart
Copy link
Contributor Author

lifeart commented Apr 10, 2018

image

Features:

  • toggling / [c] button click, by default: toggled
  • cp code / [c] button hover

@lifeart lifeart changed the title WIP / Feature: ComputedProperty Dependent keys in debugger & services highlighting Feature: ComputedProperty Dependent keys in debugger & services highlighting Apr 10, 2018
@@ -10,3 +10,107 @@
margin-left: 39px;
word-break: break-all;
}

:root {

Choose a reason for hiding this comment

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

Probably not here, but in the top of the file?

}

.mixin__property-dependency-item:first-child::before {
background: url('data:image/svg+xml;utf8,<svg width="17" height="15" version="1" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" stroke="#979797"><circle cx="13" cy="11" r="3"/><path d="M13 8c0-3-1-4-4-4H5C2 4 1 3 1 0"/></g></svg>') no-repeat;
Copy link

@summerisgone summerisgone Apr 11, 2018

Choose a reason for hiding this comment

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

Let's try
background: url('data:image/svg+xml;utf8,<svg width="17" height="15" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1)" stroke="#979797" fill="none" fill-rule="evenodd"><circle fill="#FFF" cx="12" cy="11" r="3"/><path d="M12 8c0-3-1-4-4-4H4C1 4 0 3 0 0"/></g></svg>') no-repeat;

Copy link
Collaborator

Choose a reason for hiding this comment

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

data:image/svg+xml;utf8,<svg doesn't seem to working for me in Firefox

.mixin__property-dependency-item::before {
content: "";
display: block;
background: url("data:image/svg+xml;utf8,<svg width='8' height='16' xmlns='http://www.w3.org/2000/svg'><g transform='translate(-14 -16)' stroke='#979797' fill='none' fill-rule='evenodd'><circle cx='18' cy='28' r='3'/><path d='M18 24.571V16.5'/></g></svg>") no-repeat;
Copy link

@summerisgone summerisgone Apr 11, 2018

Choose a reason for hiding this comment

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

Longer arrow and white circle
<svg width="8" height="20" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 -1)" stroke="#979797" fill="none" fill-rule="evenodd"><circle fill="#FFF" cx="3" cy="17" r="3"/><path d="M3 13.571V1.489649"/></g></svg>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@lifeart lifeart force-pushed the computed-dependent-keys branch from 6e3c35a to c04384d Compare April 15, 2018 10:14
@lifeart
Copy link
Contributor Author

lifeart commented Apr 17, 2018

It’s ready for review

@lifeart
Copy link
Contributor Author

lifeart commented Apr 17, 2018

@rwwagner90 new tests added

@nummi
Copy link
Collaborator

nummi commented Apr 17, 2018

@lifeart, is toggling the display of the dependencies broken? Clicking the "C" isn't working for me.

@lifeart
Copy link
Contributor Author

lifeart commented Apr 17, 2018

@nummi, (it's fixed in my last commit with tests), Openable "C" property must have bold name. If name not "bold" - no dependent keys

@nummi
Copy link
Collaborator

nummi commented Apr 17, 2018

I wonder if we made the list a little more difficult for the eyes to scan. Right now the UI needs some spacing and alignment adjustments — which will help — but I want to tinker in Photoshop a little more. Thoughts?

Screenshot 1 is everything expanded; 2 is every collapsed; 3 is current.

screenshots

@lifeart
Copy link
Contributor Author

lifeart commented Apr 17, 2018

After 5 mins of comparing I can't say that my eyes tired about implemented part.
I think we need more space alignment between last expanded dependency and property under it.
As variant - we can remove "bold" from services, and replace icons to symbols with redued saturation.

@lolmaus
Copy link
Contributor

lolmaus commented Apr 18, 2018

@nummi:
I wonder if we made the list a little more difficult for the eyes to scan. Right now the UI needs some spacing and alignment adjustments — which will help — but I want to tinker in Photoshop a little more. Thoughts?

I agree with @nummi here:

  • The icons are too heavy and obtrusive, compared to the original calculator icon, which, I assume, represented computed ("calculated") properties. What's the reason for abandoning the existing icon? To my taste, the result is amateurish and gaudy.
  • Everything is bold now. Again, quite obtrusive. The existence of CP dependencies can be indicated by, for example, a triangle icon which is a universally accepted UI pattern for an expandable element, widely used in Ember Inspector already. Using bold to indicate expandability is wrong, UX-wise.
  • This may already be the case, but I believe all CPs should be collapsed by default. Otherwise, this listing can get unnecessarily long and hard to grasp.

PS Dependency listings are awesome! Are they clickable?

@lifeart
Copy link
Contributor Author

lifeart commented Apr 18, 2018

PS Dependency listings are awesome! Are they clickable?

Nope, right now they not clicable, there is some reasons for it:

  • CP dependency can be located in another mixin, we need to expand it and scroll user into it - this is not good UX for me
  • CP deps may look like foo.@each{a,b,c}, should we open foo and use default serialization, or we need to apply specific serialization approach for foo, to get only a, b, c keys for it's children?

padding: 0;
list-style: none;
display: block;
// margin-bottom: 0.2em;
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgotten comment.

prop.dependentKeys = options.dependentKeys || [];
let hasServiceFootprint = prop.value && typeof prop.value.inspect === 'string' ? prop.value.inspect.includes('@service:') : false;
prop.isService = options.isService || hasServiceFootprint;
prop.code = options.code;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add tests for services and DKs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lifeart lifeart force-pushed the computed-dependent-keys branch from e38f033 to cf31208 Compare April 18, 2018 20:22
tests for cp-expand & service highlight
valueType alias
css comment removal
cp deps and service serialization keys test
is service detection update
@lifeart lifeart force-pushed the computed-dependent-keys branch from cf31208 to 8a496c5 Compare April 18, 2018 20:24
@nummi
Copy link
Collaborator

nummi commented Apr 26, 2018

@lifeart, I have my own branch for playing with the UI. I have everything lined up and the SVG rendering pixel perfect. Let me know if you want to integrate this code.

screen shot 2018-04-26 at 12 14 19 pm

(working with SVG and this small of a scale is a nightmare)

@nummi
Copy link
Collaborator

nummi commented Apr 26, 2018

Also, this is the current state of my mockups:

screen shot 2018-04-26 at 12 24 12 pm

@summerisgone
Copy link

I agree with @nummi that new UI looks more heavy, but let's compare new proposal on the same screen, with more elements

@lifeart
Copy link
Contributor Author

lifeart commented Apr 27, 2018

@nummi, looks awesome! Sure, I want to integrate it! Could you open pr against https://github.com/lifeart/ember-inspector/tree/computed-dependent-keys and I will mege it, to add your stuff to this PR

@teddyzeenny
Copy link
Contributor

Hey! What's the status of this? I'm planning to release the inspector this weekend, do you think it can make it?

@lifeart
Copy link
Contributor Author

lifeart commented Apr 28, 2018

@teddyzeenny I'm waiting for @nummi PR, for me all looks good

@nummi
Copy link
Collaborator

nummi commented Apr 28, 2018

Hey! What's the status of this? I'm planning to release the inspector this weekend, do you think it can make it?

@teddyzeenny @lifeart, getting my commit ready now.

@nummi
Copy link
Collaborator

nummi commented Apr 28, 2018

@teddyzeenny @lifeart, here is the PR:
lifeart#3

Tested in Firefox and Chrome on macOS.

screen shot 2018-04-28 at 9 26 10 am

screen shot 2018-04-28 at 9 27 43 am

@lifeart
Copy link
Contributor Author

lifeart commented Apr 28, 2018

@nummi @teddyzeenny, merged, waiting for green CI flag

@lifeart
Copy link
Contributor Author

lifeart commented Apr 28, 2018

@nummi @teddyzeenny all green, I think thi PR ready for acceptance

@RobbieTheWagner RobbieTheWagner dismissed teddyzeenny’s stale review April 29, 2018 00:37

Dismissing old review, since changes were made

Copy link
Member

@RobbieTheWagner RobbieTheWagner left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for all the hard work! 🎉

@RobbieTheWagner RobbieTheWagner merged commit e6015b1 into emberjs:master Apr 29, 2018
@lolmaus
Copy link
Contributor

lolmaus commented Apr 29, 2018

Congrats!

Though this question was left unanswered:

The icons are too heavy and obtrusive, compared to the original calculator icon, which, I assume, represented computed ("calculated") properties. What's the reason for abandoning the existing icon?

@nummi
Copy link
Collaborator

nummi commented Apr 29, 2018

The letter icons are more about consistency. We are highlighting services in addition to computed properties; we struggled with an icon for services and two styles of icons looked even more busy. I guess we'll see how the community Reacts. Maybe I've been staring at the new design too long but I think it works well when looking at the inspector as a whole.

cyril-sf pushed a commit to cyril-sf/ember-inspector that referenced this pull request Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants