Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

feat(panel): Configuration ID for tracking #9379

Merged
merged 1 commit into from
Aug 24, 2016

Conversation

bradrich
Copy link
Contributor

The user is now able to provide an ID as a property of the panel configuration object. When an ID is provided, the created panel is added to a tracked panels object. Any subsequent requests made to create a panel with that ID are ignored. This is useful in having the panel service not open multiple panels from the same user interaction when there is no backdrop and events are propagated.

Fixes #9356

Also, several syntax issues throughout the documentation/commenting have been corrected.

Fixes #9357

Ping ErinCoughlan

@bradrich bradrich added this to the 1.1.1 milestone Aug 22, 2016
* @param {!Object=} config Configuration object for the panel.
* @returns {!MdPanelRef}
*/
MdPanelService.prototype.create = function(config) {
var configSettings = config || {};

if (angular.isDefined(configSettings.id) &&
Copy link
Member

Choose a reason for hiding this comment

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

I can understand why angular.isDefined(configSettings.id) is necessary but
angular.isDefined(this._trackedPanels[configSettings.id]) is pretty much this._trackedPanels[configSettings.id]
correct me if i'm wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EladBezalel You are correct about that. Is the angular.isDefined() method more expensive?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure, just makes more sense to me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EladBezalel I don't see why not! I will change it and commit.

@bradrich bradrich force-pushed the feat/panel-config-id branch from 24ac2f6 to 1c08e5e Compare August 22, 2016 19:29
* Creates a panel with the specified options.
*
* @param {!Object=} config Configuration object for the panel.
* @returns {!MdPanelRef}
*/
MdPanelService.prototype.create = function(config) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EladBezalel I think that this is a much better formatted create method. Do you think so?

@ThomasBurleson ThomasBurleson added the pr: merge ready This PR is ready for a caretaker to review label Aug 22, 2016
@@ -637,7 +660,9 @@ var FOCUS_TRAP_TEMPLATE = angular.element(


/**
* @description
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do the @decription come from? These aren't ngdoc, like above where @decription matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ErinCoughlan I just thought that all documentation / comment areas should follow the same format. I will remove the @description tags.

@ThomasBurleson
Copy link
Contributor

Is this still work in progress? It is currently married for merging

@bradrich
Copy link
Contributor Author

@ThomasBurleson I am finalizing the nits that @ErinCoughlan has assigned. Please wait for a LGTM from her.

@bradrich bradrich force-pushed the feat/panel-config-id branch from 1c08e5e to 7b7d7d4 Compare August 23, 2016 13:07
@bradrich
Copy link
Contributor Author

@ErinCoughlan All nits have been corrected. Please re-review and provide your LGTM.

@ThomasBurleson ThomasBurleson added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs and removed pr: merge ready This PR is ready for a caretaker to review labels Aug 23, 2016
@@ -1320,6 +1377,7 @@ MdPanelRef.prototype._updatePosition = function(init) {

/**
* Focuses on the panel or the first focus target.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

So a lot of this extra space feels excessive, especially for methods like this one, where the description is only a single line and there's no extra information we care about. I've never seen it before (unless it's a multi-paragraph description).

Where does this pattern come from?

Here's the style guide we follow:
https://google.github.io/styleguide/javascriptguide.xml?showone=Comments#Comments

@@ -2090,7 +2197,8 @@ MdPanelPosition.prototype._setPanelPosition = function(panelEl) {


/**
* Switching between 'start' and 'end'
* Switching between 'start' and 'end'.
Copy link
Contributor

Choose a reason for hiding this comment

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

Switching -> Switches

@bradrich bradrich force-pushed the feat/panel-config-id branch from 7b7d7d4 to b6ee88b Compare August 23, 2016 16:15
@bradrich
Copy link
Contributor Author

@ErinCoughlan Round two... FIGHT!

@ErinCoughlan
Copy link
Contributor

LGTM, looks like you need to rebase again. There are conflicts with this branch.

@bradrich
Copy link
Contributor Author

Interesting. I will handle this before EOD today.

The user is now able to provide an ID as a property of the panel configuration object. When an ID is provided, the created panel is added to a tracked panels object. Any subsequent requests made to create a panel with that ID are ignored. This is useful in having the panel service not open multiple panels from the same user interaction when there is no backdrop and events are propagated.

Fixes angular#9356

Also, several syntax issues throughout the documentation/commenting have been corrected.

Fixes angular#9357

Ping ErinCoughlan
@bradrich bradrich force-pushed the feat/panel-config-id branch from b6ee88b to bcbc2ab Compare August 24, 2016 17:59
@ThomasBurleson ThomasBurleson added pr: merge ready This PR is ready for a caretaker to review and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs labels Aug 24, 2016
@jelbourn jelbourn merged commit d230aec into angular:master Aug 24, 2016
Copy link
Contributor

@fsmeier fsmeier left a comment

Choose a reason for hiding this comment

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

@ErinCoughlan @bradrich @ThomasBurleson I think we need to adjust the logic here to make it work properly. Anyone of you still spending time on this repo? I could make pull-requests^^ But if i dont know if they getting merged (like other PR atm) i dont want to invest time...

var instanceId = 'panel_' + this._$injector.get('$mdUtil').nextUid();
var instanceConfig = angular.extend({ id: instanceId }, this._config);
var panelRef = new MdPanelRef(this._config, this._$injector);
this._trackedPanels[config.id] = panelRef;
Copy link
Contributor

Choose a reason for hiding this comment

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

config.id is undefined if no id is set!

Copy link
Contributor

@fsmeier fsmeier Sep 26, 2017

Choose a reason for hiding this comment

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

this._trackedPanels is set here but there is no chance of removing elements here.
Example: Create config with id-property and create panel. So in the first run a new scope is set and the panelRef is cached in _trackedPanels. Now destroy() the panelRef and create a new panel-instance with the same id -> the scope is $destroy(ed) but the old panelRef with the destroyed scope is used.

@EladBezalel
Copy link
Member

@IMM0rtalis we're addressing the hold ATM, creating a pr would help us, as soon as we will resolve our internal issues with merging PRs we will merge your PRs and will try to revive the project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants