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

Add DeleteTopNavigationNodesDefinition / DeleteQuickLaunchNavigationNodesDefinition to delete navigation nodes #804

Closed
SubPointSupport opened this issue Mar 7, 2016 · 14 comments

Comments

@SubPointSupport
Copy link
Contributor

M2 should be able to hide / delete quick and top navigation nodes based on criteria:

  • all of them
  • some of them by Title or Url match

This feature was highly desired by the community. Should be implemented in the first place.

@ghost
Copy link

ghost commented Mar 8, 2016

Because the IsVisible property does not work as expected because of a SharePoint bug, an easy way to remove Navigation nodes by Title or Url match would be a modification of QuickLaunchNavigationNodeModelHandler: Instead of setting the IsVisible property to false, we could remove the navigation node.

@SubPointSupport
Copy link
Contributor Author

Thanks for the input, @markusjenni.

We'll go with a new definition similar to DeleteWebPartsDefinition. The goal is to separate deleting operation avoiding mixing up creation / update process and potential data losses. M2 always creates or updates stuff, deleting is extremely rare.

@SubPointSupport
Copy link
Contributor Author

SubPointSupport commented May 30, 2016

As IsVisible property does not work properly due to SharePoint bug, a workaround should be considered:

@SubPointSupport SubPointSupport changed the title Add new definition to remove / hide navigation nodes Add Delete(Top/Quick)NavigationNodesDefinition to delete navigation nodes May 30, 2016
@SubPointSupport SubPointSupport changed the title Add Delete(Top/Quick)NavigationNodesDefinition to delete navigation nodes Add DeleteTopNavigationNodesDefinition / DeleteQuickLaunchNavigationNodesDefinition to delete navigation nodes Jun 1, 2016
SubPointSupport added a commit that referenced this issue Jun 1, 2016
…nNodesDefinition to delete navigation nodes #804

Passed the following tests for CSOM/SSOM:

+ CanDeployRandom_DeleteTopNavigationNodesDefinition
+ CanDeploy_DeleteTopNavigationNodes_ByTitle
+ CanDeploy_DeleteTopNavigationNodes_ByUrl
+ CanDeploy_DeleteTopNavigationNodes_ByTitleAndUrl

+ CanDeployRandom_DeleteQuickLaunchNavigationNodesDefinition
+ CanDeploy_DeleteQuickLaunchNavigationNodes_ByTitle
+ CanDeploy_DeleteQuickLaunchNavigationNodes_ByUrl
+ CanDeploy_DeleteQuickLaunchNavigationNodes_ByTitleAndUrl
@SubPointSupport
Copy link
Contributor Author

Added DeleteTopNavigationNodesDefinition / DeleteQuickLaunchNavigationNodesDefinition.
Implemented for both CSOM/SSOM, covered by the following tests:

  • CanDeployRandom_DeleteTopNavigationNodesDefinition
  • CanDeploy_DeleteTopNavigationNodes_ByTitle
  • CanDeploy_DeleteTopNavigationNodes_ByUrl
  • CanDeploy_DeleteTopNavigationNodes_ByTitleAndUrl
  • CanDeployRandom_DeleteQuickLaunchNavigationNodesDefinition
  • CanDeploy_DeleteQuickLaunchNavigationNodes_ByTitle
  • CanDeploy_DeleteQuickLaunchNavigationNodes_ByUrl
  • CanDeploy_DeleteQuickLaunchNavigationNodes_ByTitleAndUrl

@babakb
Copy link

babakb commented Jun 3, 2016

Hi
Just wondering which version have this class "DeleteQuickLaunchNavigationNodesDefinition" ?

@SubPointSupport
Copy link
Contributor Author

Upcoming 1.2.70
Will also include a list of all definitions per version, here is a ticket: #846

@babakb
Copy link

babakb commented Jun 3, 2016

Cool, when do you think it will be published?

@SubPointSupport
Copy link
Contributor Author

Over the weekend or Monday. Testing internally.

What are the scenarios you are looking for?

@babakb
Copy link

babakb commented Jun 3, 2016

Just want to hide/remove some OOTB navigation from Quick lunch and as the rest of project is on SPMeta2 don't want to use CSOM.

@babakb
Copy link

babakb commented Jun 7, 2016

Hi again. I've tested DeleteQuickLaunchNavigationNodesDefinition class with my scenario from your dev branch and it's working fine. I removed all OOTB navigation and added new ones. just waiting for a published version (1.2.7)

@SubPointSupport
Copy link
Contributor Author

Thanks @babakb, appreciate your feedback.

Curious on the particular OOTB nodes in your scenarios. What are they? Would you please provide more context, so that we would add this case in the regression tests as well.

Next, we aren't sure how to get the right deleting experience for the 2nd/3rd navigation nodes. Current implementation works well for the 1st level only. Guess, will leave it as it is for the time being until the community asks for more cases.

1.2.7 is being tested, delaying. Current dev is stable for both CSOM/SSOM.

@babakb
Copy link

babakb commented Jun 7, 2016

I'm using it for project sites on project online. they have a few default navigation (Notebook-Documents-Tasks-Calendar-Projects-Project details) which in our scenario should be removed. they are all 1st level navigation nodes.

Just as a sample :

static DeleteQuickLaunchNavigationNodesDefinition OOTBNotebook = new DeleteQuickLaunchNavigationNodesDefinition
{NavigationNodes = new List<NavigationNodeMatch>() { new NavigationNodeMatch(){Title= "Notebook",}}};

var projectWebModel = SPMeta2Model.NewWebModel(web =>
{web.AddDeleteQuickLaunchNavigationNodes(OOTBNotebook)});
var csomProvisionService = new StandardCSOMProvisionService();
csomProvisionService.DeployWebModel(projectSiteClientContext, projectWebModel);

@SubPointSupport
Copy link
Contributor Author

Right, makes perfect sense. Thank you for sharing that.

@babakb
Copy link

babakb commented Jun 12, 2016

Any update on publishing version 1.2.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants