Skip to content

Icons on app inspector#140

Merged
asfgit merged 6 commits into
apache:masterfrom
ahgittin:icons-on-app-inspector
Nov 18, 2019
Merged

Icons on app inspector#140
asfgit merged 6 commits into
apache:masterfrom
ahgittin:icons-on-app-inspector

Conversation

@ahgittin
Copy link
Copy Markdown
Contributor

show icons on app-inspector tree view and summary, to help navigate/understand

also optimize/tidy icon generation code

Copy link
Copy Markdown
Member

@tbouron tbouron left a comment

Choose a reason for hiding this comment

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

Thanks @ahgittin. Couple of comments regarding the code.
It would be great to have a screenshot so everyone can see how it looks like :)

}
}
.node-icon {
.pull-right();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why using .pull-right() mixin where the whole block is using flexbox? This is not right, should be one or the other. Based on the current setup, I think this should use flexbox only)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

as it's non-growable and the other field is growable, we don't need it at all, quite right

<span class="node-icon"><img ng-src="{{ iconUrl }}"/></span>
</a>
<div class="entity-node-toggle" ng-if="entity.children.length > 0 || entity.members.length > 0" ng-click="onToggle($event)" >
<div class="entity-node-toggle-wrapper">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why wrapping this into another div? This entire "row" (i.e. entity status, entity name, icon and expand toggle) can be handled with flexbox which would be cleaner and easier to implement, rather than doing it with unnecessary HTML layout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the ng-if hides the toggle on leaf nodes. but we want the icons to align so we need a placeholder/wrapper.

}

export function entityNodeDirective() {
export function entityNodeDirective($log, iconService) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems to not be necessary. The $log service is not used and the iconService is injected on the controller level

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

correct. also removed the inject line


}
}
entityNodeDirective.$inject = ['$log', 'iconService'];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yup

<brooklyn-status-icon value="{{entity.serviceState}}" ng-if="entity.serviceState || entity.applicationId"></brooklyn-status-icon>
<i class="fa fa-2x fa-external-link" ng-if="!entity.serviceState && !entity.applicationId"></i>
<span>{{entity.name}}</span>
<span class="node-icon"><img ng-src="{{ iconUrl }}"/></span>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should use the entity.iconUrl instead of adding this into the scope, so the icon will be saved on the model which is propagated everywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nice idea but i think $scope.entity can be updated by the caller, so we'd need to watch for it to prevent it being cleared. it isn't usually the icon which updates, it's things like status, so watching for that and reloading icon seems overkill.

function controller ($scope, $state, $stateParams, iconService) {
$scope.isOpen = true;

iconService.get($scope.entity, true).then(value => $scope.iconUrl = value);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should set the entity.iconUrl instead of adding this into the scope, so the icon will be saved on the model which is propagated everywhere.

vm.name = response.data.name;
vm.error.entity = undefined;
}));
iconService.get(response.data, true).then(value => vm.iconUrl = value);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should set the entity.iconUrl instead of adding this into the scope, so the icon will be saved on the model which is propagated everywhere.

function IconService($q, $http, iconGenerator, $log, cache) {
this.get = getIcon;
function getIcon(id) {
function getIcon(entityOrTypeId, doNotAutogenerate) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I can see, the there is no called using the doNotAutogenerate. It seems to be used only on the pipe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's used in entity-tree.directive.js:

iconService.get($scope.entity, true).then(value => $scope.iconUrl = value);

@ahgittin
Copy link
Copy Markdown
Contributor Author

all addressed

screen-shot:

image

@ahgittin
Copy link
Copy Markdown
Contributor Author

merging now, as discussed with 1:1 review @tbouron

@asfgit asfgit closed this in b7afa2c Nov 18, 2019
@asfgit asfgit merged commit ecdf6fa into apache:master Nov 18, 2019
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.

3 participants