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

Nav collapsed feature #259

Merged
merged 21 commits into from
Dec 4, 2018
Merged

Conversation

parostatkiem-zz
Copy link
Contributor

@parostatkiem-zz parostatkiem-zz commented Nov 29, 2018

Description
I've also fixed the hideNav bug (some css rules weren't applied because somebody decided to use id instead of class attribute.

Changes proposed in this pull request:

  • introduce navCollapse property in Node configuration
  • describe it in the documentation
  • add unit & e2e tets
  • turn this feature on at /overview and an added example route in Angular example

Related issue(s)

Resolves #243

Copy link
Contributor

@dariadomagala-sap dariadomagala-sap left a comment

Choose a reason for hiding this comment

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

Please also add it to the overview page 'Luigi Core Features' section in the angular example.

@@ -115,5 +115,10 @@ describe('Navigation', () => {
expect(loc.hash).to.eq('#/projects/pr2/dps/dps1');
});
});
it('should hide left Nav', () => {
cy.visit('/#/projects/pr1/navCollapse');
cy.get('.no-left-nav');
Copy link
Contributor

Choose a reason for hiding this comment

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

This line doesn't do anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does. It checks if there is any element with no-left-nav class. It's important because this class moves our iframeContainer to the left edge. If you change the classname to anything else, Cypress won't be able to find it and the test will fail:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I would be also confused with this line. Maybe you could explicitly do the check, otherwise someone could also think this line does nothing, remove it and then the test will not check what it has to check. Maybe sth like this:
cy.get('.no-left-nav').should('exist');

@@ -419,7 +425,8 @@ Luigi.setConfig({
{
pathSegment: 'overview',
label: 'Overview',
viewUrl: '/sampleapp.html#/overview'
viewUrl: '/sampleapp.html#/overview',
navCollapse: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave the navigation here, it's enough to show it in the feature component. At the beginning I thought something was wrongly implemented that the navigation is not shown on the main page ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be fine for me to leave it, but then please add some left margin to the headline in the content area
in the content area

@@ -17,8 +17,8 @@
</div>
{/if}

<TopNav pathData={navigationPath} />
<LeftNav pathData={navigationPath} />
<TopNav pathData={navigationPath} /> {#if !(hideNav||hideLeftNav)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move those ifs to new lines so it's more readable.

- **sameWindow** defines if the external URL is opened in a new or current tab.
- **url** is the external URL that the node leads to.
- **externalLink** is an object which indicates that the node links to an external URL. If this parameter is defined, **pathSegment** and **link** parameters are ignored. It has the following properties:
- **sameWindow** defines if the external URL is opened in a new or current tab.
Copy link
Contributor

Choose a reason for hiding this comment

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

Those additional spaces here were actually needed. Same one line below.

@jesusreal jesusreal self-assigned this Nov 29, 2018
@@ -22,6 +22,7 @@ A navigation path is any existing path in the navigation tree. It connects the f

- The path of the main application, that is, the path in the browser URL. The path is defined in a Luigi navigation node through one of the following parameters, listed in order of precedence: **externalLink**, **link**, and **pathSegment**.
- The **viewUrl** of a micro front-end rendered in the content area of the main application.
- If the **navCollapse** property is set to `true`, the left navigation will be hidden while user visits the particular Node.
Copy link
Contributor

@bszwarc bszwarc Nov 29, 2018

Choose a reason for hiding this comment

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

Suggested change
- If the **navCollapse** property is set to `true`, the left navigation will be hidden while user visits the particular Node.
- If you set **navCollapse** property to `true`, the left navigation becomes hidden when you click the affected node.

I'm not sure if I didn't overthink this while wanting to make it simpler 🤔

Copy link
Contributor

@jesusreal jesusreal Nov 29, 2018

Choose a reason for hiding this comment

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

Please add explicitly that the default value is false. And maybe 'while the user' would be better.

Copy link
Contributor

@bszwarc bszwarc left a comment

Choose a reason for hiding this comment

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

One comment to one line :)

@@ -115,5 +115,10 @@ describe('Navigation', () => {
expect(loc.hash).to.eq('#/projects/pr2/dps/dps1');
});
});
it('should hide left Nav', () => {
cy.visit('/#/projects/pr1/navCollapse');
cy.get('.no-left-nav');
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be also confused with this line. Maybe you could explicitly do the check, otherwise someone could also think this line does nothing, remove it and then the test will not check what it has to check. Maybe sth like this:
cy.get('.no-left-nav').should('exist');

const viewUrl = getLastNodeObject(pathData).viewUrl || '';
const isolateView = getLastNodeObject(pathData).isolateView || false;

const {
Copy link
Contributor

Choose a reason for hiding this comment

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

You get a virtual big applause for this one, awesome refactoring I really like it.

@@ -22,6 +22,7 @@ A navigation path is any existing path in the navigation tree. It connects the f

- The path of the main application, that is, the path in the browser URL. The path is defined in a Luigi navigation node through one of the following parameters, listed in order of precedence: **externalLink**, **link**, and **pathSegment**.
- The **viewUrl** of a micro front-end rendered in the content area of the main application.
- If the **navCollapse** property is set to `true`, the left navigation will be hidden while user visits the particular Node.
Copy link
Contributor

@jesusreal jesusreal Nov 29, 2018

Choose a reason for hiding this comment

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

Please add explicitly that the default value is false. And maybe 'while the user' would be better.

@@ -419,7 +425,8 @@ Luigi.setConfig({
{
pathSegment: 'overview',
label: 'Overview',
viewUrl: '/sampleapp.html#/overview'
viewUrl: '/sampleapp.html#/overview',
navCollapse: true
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be fine for me to leave it, but then please add some left margin to the headline in the content area
in the content area

Copy link
Contributor

@bszwarc bszwarc left a comment

Choose a reason for hiding this comment

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

Approved.

@jesusreal jesusreal merged commit 1842d50 into SAP:master Dec 4, 2018
@parostatkiem-zz parostatkiem-zz deleted the navCollapsed-feature branch March 11, 2019 09:39
stanleychh pushed a commit to stanleychh/luigi that referenced this pull request Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement navCollapsed feature
5 participants