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 column list options #4170

Merged
merged 31 commits into from Oct 9, 2018
Merged

Conversation

trickreich
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets fixes --
Related issues/PRs --
License MIT
Documentation PR --

What's in this PR?

Add column list options to datagrid.

Why?

User needs to select and sort the visible columns in the datagrid.

@trickreich trickreich changed the title WIP: Add column list options Add column list options Oct 3, 2018
@trickreich trickreich requested a review from danrot October 3, 2018 13:57
@trickreich trickreich added Bug Error or unexpected behavior of already existing functionality Feature New functionality not yet included in Sulu and removed Bug Error or unexpected behavior of already existing functionality labels Oct 3, 2018
@trickreich trickreich added this to the Release 2.0 milestone Oct 3, 2018
color: $fontColor;
cursor: pointer;
font-size: 12px;
margin-bottom: 13px;
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually rounded the margin values to even values, didn't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never heard of that..

cursor: pointer;
font-size: 12px;
margin-bottom: 13px;
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Has no effect on my machine, and messing with position when unnecessary often results in hard do maintain code...

@@ -58,3 +58,35 @@ The buttons can also be used in combination with an icon.
Add something
</Button>
```

The prob `showDropdownIcon` displays a drop down icon on the right side.
Copy link
Contributor

Choose a reason for hiding this comment

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

prop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

?

Copy link
Contributor

Choose a reason for hiding this comment

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

You have written prob instead of prop


.dropdown-icon {
left: auto;
right: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't that easy to understand where the position attribute came from. I think I would not make this class dependent on the button-icon class, which means only setting one of both. To extract what they have in common you could still use a selector like .button-icon, .dropdown-icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is changed.

schemaKey: string,
label: string,
visibility: 'always' | 'yes' | 'no',
onChange: (schemaKey: string, visibility: 'yes' | 'no') => void,
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't we always have the value (in that case visibility) as the first parameter? Would keep it that way, in order for it to be more consistent.

const page = observable.box();
const datagridStore = new DatagridStore('snippets', {page});
const datagridStore = new DatagridStore('snippets', 'datagrid_test', {page});
datagridStore.schema = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't the schema set with the promise above? Why does it have to be set twice in this test?

type: 'string',
visibility: 'always',
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This test got very bloated, because this schema is added to every single test. Wouldn't it be enough to have different visibility only in one test, and in all others we use the minimum? Maybe even only the id, if that works?

Then it would be much less work to update if the schema changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is changed

const webspace = userStore.getPersistentSetting(USER_SETTING_WEBSPACE);
static getDerivedRouteAttributes(route, attributes) {
const webspace = attributes.webspace ? attributes.webspace :
userStore.getPersistentSetting(USER_SETTING_WEBSPACE);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we have to split it, there should be an own line for everything and move the operators in front of the line:

const webspace = attributes.webspace
    ? attributes.webspace
    : userStore.getPersistentSetting(USER_SETTING_WEBSPACE);

@@ -109,7 +113,12 @@ class WebspaceOverview extends React.Component<ViewProps> {
router.bind('webspace', this.webspace);
apiOptions.webspace = this.webspace;

this.datagridStore = new DatagridStore('pages', observableOptions, apiOptions);
this.datagridStore = new DatagridStore(
'pages',
Copy link
Contributor

Choose a reason for hiding this comment

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

If you introduce a constant we should also use it here 😉

const Datagrid = require('../Datagrid').default;
const userStore = require('../../../stores/UserStore');
const DatagridStore = require('../../../containers/Datagrid').DatagridStore;
DatagridStore.getActiveSetting = jest.fn();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you make this a class in the mock of this test as in one of the tests below?

@danrot danrot merged commit fec2a76 into sulu:develop Oct 9, 2018
@trickreich trickreich deleted the feature/column-list-options branch October 9, 2018 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality not yet included in Sulu
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants