)]}'
{"openstack_dashboard/dashboards/admin/ngimages/templates/ngimages/index.html":[{"author":{"_account_id":9576,"name":"Thai Tran","email":"tqtran@us.ibm.com","username":"tqtran"},"change_message_id":"0a8e09342fde062ac3bcf26aa8e4780647e613fa","unresolved":false,"context_lines":[{"line_number":3,"context_line":"{% block title %}{% trans \"Images\" %}{% endblock %}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"{% block page_header %}"},{"line_number":6,"context_line":"  \u003chz-page-header header\u003d\"\u0027{% trans \"Images\" %}\u0027\"\u003e\u003c/hz-page-header\u003e"},{"line_number":7,"context_line":"{% endblock page_header %}"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"{% block main %}"}],"source_content_type":"text/html","patch_set":13,"id":"da6ed579_9332445e","line":6,"range":{"start_line":6,"start_character":66,"end_line":6,"end_character":67},"updated":"2016-01-13 23:35:39.000000000","message":"remove this hz-page-header, already defined in images-table.html","commit_id":"c16304595c5d8508733b005e57c85082c0129013"},{"author":{"_account_id":17013,"name":"Rajat Vig","email":"rajatv@thoughtworks.com","username":"rajatvig"},"change_message_id":"d14004a5c587fcee6948839a56349ce13ac53703","unresolved":false,"context_lines":[{"line_number":3,"context_line":"{% block title %}{% trans \"Images\" %}{% endblock %}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"{% block page_header %}"},{"line_number":6,"context_line":"  \u003chz-page-header header\u003d\"\u0027{% trans \"Images\" %}\u0027\"\u003e\u003c/hz-page-header\u003e"},{"line_number":7,"context_line":"{% endblock page_header %}"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"{% block main %}"}],"source_content_type":"text/html","patch_set":13,"id":"da6ed579_53d4ccbb","line":6,"range":{"start_line":6,"start_character":66,"end_line":6,"end_character":67},"in_reply_to":"da6ed579_9332445e","updated":"2016-01-13 23:38:52.000000000","message":"Done","commit_id":"c16304595c5d8508733b005e57c85082c0129013"}],"openstack_dashboard/static/app/core/images/table/images-table.controller.js":[{"author":{"_account_id":14307,"name":"Tyr Johanson","email":"tyr@hpe.com","username":"tyr"},"change_message_id":"0eb049e5959f514d7faa252064c6ed6df38a474e","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_8ee457e1","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"updated":"2016-01-14 00:18:59.000000000","message":"-1: It is better for the controller to not know so much about the parent environment. This is fragile.\n\nInstead, consider creating a simple directive to use on the index.html page:\n\u003chz-images-panel is-admin\u003d\"true\"\u003e\n\nThis directive can be shared with the project version of the panel.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":14307,"name":"Tyr Johanson","email":"tyr@hpe.com","username":"tyr"},"change_message_id":"a9b6af73d966549e75771fd42454ce055b108d94","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_e3a7e9ba","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_3b10cf56","updated":"2016-01-15 00:11:55.000000000","message":"You summarized it perfectly! For what it is worth, Angular and directives are hand in hand. We will have to find a way to make directives not intimidating...otherwise we are missing their architectural and semantic benefit.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"4c8fcd5bd0badf3483c9afd3f557714183199ed3","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_828aeb19","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_8260aba6","updated":"2016-01-14 00:44:26.000000000","message":"Agreed. So, ake a look at the django horizon way:\n\nhttps://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/admin/dashboard.py#L23\n\nI would say this could be done as policy (hz-if-policy), but the use case is actually a little different here, which also complicates the idea of doing hz-if-policy or a new hz-if-role directive like all our other hz-if friends here:  https://github.com/openstack/horizon/tree/master/openstack_dashboard/static/app/core/cloud-services \n\nHowever, this is definitely a bit different because even an admin in the project would evaluate to true and the content would be shown, when the truth is that we are differentiating columns based on what dashboard is being displayed.  So, would it be possible to be hz-if-dashboard? Django side is handling it through the whole extension mechanism with python rendering (https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/admin/images/tables.py#L88)\n\nAs a note, if this end up requiring a new API (lookup current dashboard slug), that definitely would need to be cached like we do with many of the extension services.\n\nFrom DOA:\n\nhttps://github.com/openstack/django_openstack_auth/blob/e034ced622b9a6b1ba49fb58a76ee711dc6787e4/openstack_auth/user.py#L300\n\nhttps://github.com/openstack/django_openstack_auth/blob/542ae6294f4916d8f8691a7400cf7bfeb41fa9f0/openstack_auth/backend.py#L297","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"d8ee1c3fc90c3140f59037e529c7d8f0800c8a28","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_85ebd512","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_828aeb19","updated":"2016-01-14 00:47:15.000000000","message":"Apologies for the poor grammar above as well.  I was interrupted a few times while writing it and didn\u0027t proofread.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":14307,"name":"Tyr Johanson","email":"tyr@hpe.com","username":"tyr"},"change_message_id":"61c6c1bc2e27570645b2d4137b07a8877c9611d4","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_82e2b92d","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_828aeb19","updated":"2016-01-14 17:30:55.000000000","message":"Travis has a good point. There are (at least) two aspects to consider.\n\n1) Is the panel part of the Admin dashboard?\n   This one is easier at the moment because we have an admin dashboard specific Django index.html. This html can use static HTML to set variables on the directive to tell the directive if it is on the admin dashboard, or not. For example:\n\n\u003chz-images-panel is-admin\u003d\"true\"\u003e\n\n  - \"hz-images-panel\" would be the directive used on both the admin and project versions of index.html\n  - \"is-admin\" is a simple boolean variable on that directive\n\n2) Is the user an administrator?\n   I don\u0027t think this matters at this point, provided the existing Django panel mechanism (permissions or policy check) are used on the admin/ngimages/panel.py. This will prevent the admin version of the panel from being served in the first place, even if a non-admin enters the /admin/ngimages URL directly.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"a94f83a07b3dd69c4af71d113b63247ddc93e015","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_9b04644a","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_82e2b92d","updated":"2016-01-14 18:37:40.000000000","message":"The HTML is shared across panels in order to reduce duplication, so, I\u0027m a little lost on why we would build an hz-images-panel directive and what the added value is? i\u0027m suggesting a new attribute directive like this that can go anywhere in the html:\n\n hz-if-dashboard\u003d\"admin\"\n\nvery similar to this one: https://github.com/openstack/horizon/blob/master/openstack_dashboard/static/app/core/cloud-services/hz-if-settings.directive.js\n\nis-admin is kind of vague and if i came across it, i\u0027d probably assume it is doing a check on the user\u0027s current role.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":17013,"name":"Rajat Vig","email":"rajatv@thoughtworks.com","username":"rajatvig"},"change_message_id":"00094152edc528c9fcec7c2c0d48a2be8d95a19a","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_8260aba6","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_8ee457e1","updated":"2016-01-14 00:25:05.000000000","message":"Let me think on this particular approach. It\u0027s also relevant for other similar panels, so a common cleaner approach like the one you\u0027ve suggested will work out better.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":14307,"name":"Tyr Johanson","email":"tyr@hpe.com","username":"tyr"},"change_message_id":"f6085d7f348ef4888f7e1206f4e9b40e3a02082f","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_b56130ab","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_9b04644a","updated":"2016-01-14 20:55:36.000000000","message":"@Travis. Sorry. I wasn\u0027t very clear. What I mean is that in each panel\u0027s \"views.py\" there is a specific Django HTML template for that panel. In this case:\n\nadmin/ngimages/index.html\nproject/ngimages/index.html\n\nThese HTML files are coded explicitly for their respective dashboards, and therefore it is good for them to have dashboard specific knowledge (like \"Am I in the Admin dashboard\"). They can each reference a common \u003chz-images-panel\u003e directive and each pass different parameters into that directive like \"is-admin-view\u003dtrue\".\n\nAn in-line \"hz-if-dashboard\u003d\"admin\"\" directive is not a bad idea, but does encode knowledge about a view\u0027s container into the view itself. This makes it difficult to maintain that view over time as others attempt to use the same view in other dashboards or contexts.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"},{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"5ad4b60ff12f1fabbd3303af8b447f7709437bde","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    }"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    function isAdminPanelActive() {"},{"line_number":94,"context_line":"      var activePanel \u003d angular.element(\u0027.openstack-panel.active .openstack-spin\u0027);"},{"line_number":95,"context_line":"      return activePanel.attr(\u0027href\u0027).indexOf(\u0027admin\u0027) \u003e 0;"},{"line_number":96,"context_line":"    }"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    function onDeleteSuccess(e, removedImageIds) {"}],"source_content_type":"text/javascript","patch_set":14,"id":"da6ed579_3b10cf56","line":95,"range":{"start_line":94,"start_character":6,"end_line":95,"end_character":59},"in_reply_to":"da6ed579_b56130ab","updated":"2016-01-14 22:15:17.000000000","message":"Thanks for the clarification. So, if we were to customize the panel and add more fields in an admin only view (like projects here), you are suggesting it still would be done similar to ng-if as done in this patches html, just that the information about whether \"is admin\" or not is passed through via the django processing.\n\nIf that is what you are saying, then it would be nice and fast with no API callbacks. And uses directives how they are intended.\n\nBasically don\u0027t do ng-include here: \n\nhttps://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/ngimages/templates/ngimages/index.html#L6\n\nThat said, I\u0027d like to avoid having to create a new directive for every panel unless that directive is doing something special.  Otherwise, maybe just an hz-panel would be good enough that also takes in the template URL?  We have a lot of complaints right now about people saying the angular panels are hard and take way more code than django side. So, if there is anything we can do to make that easier... Bonus points for anything that does additional code removal.","commit_id":"b67445a5a4d4f0a56bfaea5570cf26d9d2bbff34"}]}
