-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Adding infobar for remote debugging enabled #14956
Adding infobar for remote debugging enabled #14956
Conversation
|
@jha-G I guess |
|
Perfect! |
src/widgets/InfoBar.js
Outdated
| }); | ||
| } | ||
| exports.showUpdateBar = showUpdateBar; | ||
| exports.RESTART_BTN_CLICKED = RESTART_BTN_CLICKED; |
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 code has been copied from AutoUpdate.
It would be better to trim down this file for just the relevant features required, or better yet make a generic InfoBar that can be reused later. Remove/rename any auto update related stuff.
| @@ -0,0 +1,20 @@ | |||
| <div id="update-bar" {{#type}}class={{{type}}}{{/type}} tabindex="0"> | |||
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.
Rename auto update related ids to generic ones.
src/widgets/InfoBar.js
Outdated
| } | ||
| }); | ||
| } | ||
| $(window.document).on("keydown.AutoUpdate", function (event) { |
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.
Rename event on all other instances.
src/brackets.js
Outdated
| brackets.app.getRemoteDebuggingPort(function (err, remote_debugging_port){ | ||
| if (remote_debugging_port && remote_debugging_port > 0) { | ||
| var InfoBar = require('widgets/InfoBar'); | ||
| InfoBar.showUpdateBar({ |
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.
Again this is context of AutoUpdate. InfoBar.show() would be a better name.
swmitra
left a comment
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.
PR looks OK to me barring some minor comments and questions.
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> | ||
| <defs> | ||
| <style> | ||
| .cls-1 { | ||
| fill: #fff; | ||
| } | ||
| </style> | ||
| </defs> | ||
| <path id="icon-checkmark" class="cls-1" d="M8,16a8,8,0,1,1,8-8A8.009,8.009,0,0,1,8,16ZM3.823,7.833,2.72,9.044l3.071,3.017a1.852,1.852,0,0,0,.919.265,1.463,1.463,0,0,0,1.132-.547c.494-.568,1.131-1.285,1.643-1.861.408-.459.728-.819.77-.873.09-.113,2.462-2.862,2.732-3.175L11.671,4.661c0,.007-.086.1-.222.266C8.679,8.22,7.187,9.976,7.012,10.147c-.084.081-.142.143-.185.188-.115.121-.13.136-.254.151h-.02c-.169,0-.4-.235-.4-.237Z"/> | ||
| </svg> |
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.
Where is this being used?
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 have retained all three states for InfoBar, Success, Warning, and Error for sake of completion. So infobar-checkmarkcircle.svg will be used if InfoBar.showInfoBar() is called with success state.
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> | ||
| <defs> | ||
| <style> | ||
| .cls-1 { | ||
| fill: #fff; | ||
| } | ||
| </style> | ||
| </defs> | ||
| <path id="icon-info" class="cls-1" d="M8,17a8,8,0,1,1,8-8A8.009,8.009,0,0,1,8,17ZM6.91,7.056V14H8.968V7.056ZM7.932,3.892a1.077,1.077,0,1,0,0,2.142,1.077,1.077,0,1,0,0-2.142Z" transform="translate(0 -1)"/> | ||
| </svg> |
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.
Usage?
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.
Info icon background.
| /* | ||
| * Copyright (c) 2019 - present Adobe Systems Incorporated. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a | ||
| * copy of this software and associated documentation files (the "Software"), | ||
| * to deal in the Software without restriction, including without limitation | ||
| * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| * and/or sell copies of the Software, and to permit persons to whom the | ||
| * Software is furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| * DEALINGS IN THE SOFTWARE. | ||
| * | ||
| */ | ||
|
|
||
| /*info Bar*/ | ||
| #info-bar-template { | ||
| display: block; | ||
| background-color: #105F9C; |
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 are few unused selectors. Please clean them up.
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.
Cleaned unused selectors.
src/widgets/infobar.js
Outdated
| InfoBarHtml = require("text!htmlContent/infobar-template.html"), | ||
| _ = require("thirdparty/lodash"); | ||
|
|
||
| //addLinkedStyleSheet('styles/infobar-styles.css'); |
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.
Remove this line.
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.
| var $infoBar = $('#info-bar-template'), | ||
| $infoContent = $infoBar.find('#info-content'), | ||
| $contentContainer = $infoBar.find('#content-container'), | ||
| $iconContainer = $infoBar.find('#icon-container'), | ||
| $closeIconContainer = $infoBar.find('#close-icon-container'), | ||
| $heading = $infoBar.find('#heading'), | ||
| $description = $infoBar.find('#description'), | ||
| $closeIcon = $infoBar.find('#close-icon'); |
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 we need to find all of these UI components for this use case?
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, all are used.
src/widgets/infobar.js
Outdated
| var MainViewManager = require("view/MainViewManager"), | ||
| Mustache = require("thirdparty/mustache/mustache"), | ||
| EventDispatcher = require("utils/EventDispatcher"), | ||
| InfoBarHtml = require("text!htmlContent/infobar-template.html"), |
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.
NIT: Indentation looks off in this line.
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 indentation.
src/widgets/infobar.js
Outdated
| }; | ||
|
|
||
| resizeContentContainer(); | ||
| $(window).on('resize.AutoInfoBar', _.debounce(resizeContentContainer, 150)); |
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.
The event name resize.AutoInfoBar doesn't look relevant to Debugger enabled warning!
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.
Renamed the label.
src/widgets/infobar.js
Outdated
| MainViewManager.focusActivePane(); | ||
| }); | ||
| } | ||
| $(window.document).on("keydown.AutoInfo", function (event) { |
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.
The event name keydown.AutoInfo doesn't look relevant to Debugger enabled warning!
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.
Renamed the label.
| @@ -0,0 +1,13 @@ | |||
| <div id="info-bar-template" {{#type}}class={{{type}}}{{/type}} tabindex="0"> | |||
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.
Please test tabindex conflict with actual Auto Update notification bars. Auto update notifications should get priority.
| // In case of an error | ||
| _socket.onerror = result.reject; | ||
| }); | ||
| brackets.app.getRemoteDebuggingPort(function (err, port){ |
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.
Just curious as to why they check for function definition here? Do we lazyload some modules?
shubhsnov
left a comment
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 now 👍
swmitra
left a comment
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.
LGTM 👍

Adding infobar to tell users, if remote debugging is enabled. This is complementary to brackets-shell PR adobe/brackets-shell#668