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

mgr/dashboard: Color variables for color codes #22695

Merged
merged 1 commit into from Jul 25, 2018
Merged

Conversation

a2batic
Copy link
Contributor

@a2batic a2batic commented Jun 25, 2018

Assign variables to colors present in css files
Changed navigation icons padding because the notification dropdown was going out of window.
Fixes: http://tracker.ceph.com/issues/24575
Signed-off-by: Kanika Murarka kmurarka@redhat.com

Copy link
Contributor

@tspmelo tspmelo left a comment

Choose a reason for hiding this comment

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

Now that we have a centralized file for color, I notice that we have a lot of whites and greys that look the same.

Would it be possible to reduce that? maybe 3 of each?

@@ -1,3 +1,5 @@
@import '../../../../defaults';
Copy link
Contributor

Choose a reason for hiding this comment

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

This import is not being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, will remove it.

@@ -30,11 +30,6 @@
CSS Fix
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the colors in this file should also be extracted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@@ -63,7 +63,7 @@
}
.input-group {
float: right;
border-left: 1px solid rgba(0,0,0,.09);
border-left: $border-color-white;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we extract the whole rule or just the color?
Do you think we will need to change the border size and texture when customizing the template?
If we extracted just the color we might be able to reduce the number of color variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, it is better to assign variable just to color.

@a2batic
Copy link
Contributor Author

a2batic commented Jun 26, 2018

@tspmelo, ack, will reduce the colors by eliminating similar shades.

/*Table Component*/
$color-off-white: #f5f5f5;
$color-mild-white: #f6f6f6;
$border-color-white: 1px solid rgba(0,0,0,.09);
Copy link
Member

Choose a reason for hiding this comment

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

I think you should split that and set the border style in the table component scss.

Copy link
Member

Choose a reason for hiding this comment

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

This is nice step to put all color literals into a single place, but pushing things a bit further: what about using a color naming scheme that describe the meaning/intention of the element colored instead of simply describing the color shade?

Let me put an example: instead of color-solid-red, what about color-health-error?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me. But i would like to see something like this to make it really really simple:

$color-solid-red: #FF0000;
$color-health-error: $color-solid-red;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

$color-light-white: #f9f9f9;
$color-solid-white: #fafafa;
$color-gallery-gray: #ededed;
$border-color-gray: 1px solid #d1d1d1;
Copy link
Member

Choose a reason for hiding this comment

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

I think you should split that and set the border style in the table component scss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@a2batic a2batic force-pushed the scss branch 2 times, most recently from 5901e9f to 2f41a4a Compare July 5, 2018 07:28
@a2batic a2batic changed the title [WIP] mgr/dashboard: Color variables for color codes mgr/dashboard: Color variables for color codes Jul 5, 2018
@a2batic a2batic added DNM and removed DNM labels Jul 5, 2018
@callithea
Copy link
Member

jenkins test make check

@@ -62,26 +64,25 @@ export class HealthComponent implements OnInit, OnDestroy {

preparePoolUsage(chart, data) {
const colors = [
Copy link
Member

Choose a reason for hiding this comment

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

Why not using a colour generator/random colours? Even better if it copes with color blindness (8% population affecting).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I will take a look.

@@ -0,0 +1,4 @@
form .input-group-addon {
color: #a2a2a2 !important;
Copy link
Member

Choose a reason for hiding this comment

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

Why adding a literal color here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to remove it. Will replace it.

Copy link
Member

@epuertat epuertat left a comment

Choose a reason for hiding this comment

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

Nice job. Looks almost perfect. Just a few comments and the colour palette generator suggestion. Thanks.

@@ -0,0 +1,195 @@
/* Branding */
.navbar-openattic {
Copy link
Member

Choose a reason for hiding this comment

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

Since you're removing openattic specific namings, why leaving this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, will change this.

@@ -1,1144 +0,0 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Have you removed this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this file and copied all important and global classes and styles to styles.scss file.

@a2batic a2batic added the DNM label Jul 5, 2018
@a2batic a2batic force-pushed the scss branch 2 times, most recently from 757e309 to 480273b Compare July 10, 2018 06:44
@a2batic a2batic removed the DNM label Jul 10, 2018
@a2batic
Copy link
Contributor Author

a2batic commented Jul 10, 2018

The doughnut chart now looks this this :
screenshot from 2018-07-10 12-56-42

Copy link
Member

@epuertat epuertat left a comment

Choose a reason for hiding this comment

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

Please just check my comments, but this looks overall good to me!

@import 'defaults';
$fa-font-path: "../node_modules/fork-awesome/fonts";
@import "../node_modules/fork-awesome/scss/fork-awesome";
@import 'src/app/core/navigation/navigation.module';
Copy link
Member

Choose a reason for hiding this comment

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

I'd try to either move that CSS code back here or leave it as a component CSS one, but not both ways, as I find it might be confusing. Try the suggestion by @alfonsomthd to change the view encapsulation.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not common practice to create .scss files for modules.

If there is no parent component where you can add this rules, I would suggest you do what we did for the popover styles: create a styles/navigation.scss file and import it in every component you need it.

"node_modules/chart.js/dist/Chart.bundle.js"
"node_modules/angular/angular.js",
"node_modules/chart.js/dist/Chart.bundle.js",
"node_modules/angular-chart.js/dist/angular-chart.js"
Copy link
Member

Choose a reason for hiding this comment

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

Let's go with this one and we then may try with a more advanced color schemer.

@@ -69,6 +69,7 @@
"@types/jasminewd2": "2.0.3",
"@types/jest": "23.1.2",
"@types/node": "8.10.20",
"angular-chart.js": "^1.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please be careful when adding new dependencies.

  • This package is targetted at Angular.js and is not supported by the current version of Angular.
  • We already have a package that wraps Chart.js for Angular, ng2-charts.
  • When adding a new dependency please remove the ^ and ~ from the version.
  • Since this package would have been used in the final version of the dashboard, it should have been added to the dependencies section, the devDependencies section is specific for packages that are used during the dev steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

"node_modules/chart.js/dist/Chart.bundle.js"
"node_modules/angular/angular.js",
"node_modules/chart.js/dist/Chart.bundle.js",
"node_modules/angular-chart.js/dist/angular-chart.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be reverted.
Please read the reason in my previous comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

@@ -1,11 +1,11 @@
<div class="chart-container">
<canvas baseChart
#chartCanvas
class="chart chart-doughnut"
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed. We are already defining the chart using the chartType attribute.


/* Navbar */
margin-bottom: 0;
background: $color-navbar-bg;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems @import '../../../../defaults'; is missing.

background-image: -webkit-linear-gradient(top,#fafafa 0,#ededed 100%);
background-image: -o-linear-gradient(top,#fafafa 0,#ededed 100%);
background-image: linear-gradient(to bottom,#fafafa 0,#ededed 100%);
background-color: red;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use a variable here?


.modal-header {
@include hf;
border-radius: 5px 5px 0 0;
}

.modal-footer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this rule not being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didnt see it being used anywhere, also, when I removed it as well, the modal remained unaffected.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually necessary.
You will need to add the ::ng-deep, so it can be applied.
You will notice the color of the background will change.

@import 'defaults';
$fa-font-path: "../node_modules/fork-awesome/fonts";
@import "../node_modules/fork-awesome/scss/fork-awesome";
@import 'src/app/core/navigation/navigation.module';
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not common practice to create .scss files for modules.

If there is no parent component where you can add this rules, I would suggest you do what we did for the popover styles: create a styles/navigation.scss file and import it in every component you need it.

@a2batic a2batic force-pushed the scss branch 3 times, most recently from bb26f1c to 3b8e324 Compare July 11, 2018 17:20
@tspmelo
Copy link
Contributor

tspmelo commented Jul 11, 2018

Found a few places that need fix:

  • Table header have the wrong style
  • Dropdown from the notifications have problem with icons

@a2batic
Copy link
Contributor Author

a2batic commented Jul 14, 2018

@tspmelo, Corrected the styles for the following :-

screenshot from 2018-07-14 11-10-16
screenshot from 2018-07-14 11-10-00

@a2batic
Copy link
Contributor Author

a2batic commented Jul 14, 2018

jenkins test make check

@a2batic a2batic force-pushed the scss branch 7 times, most recently from 4abbfa3 to 208f88d Compare July 21, 2018 01:04
Copy link
Contributor

@ricardoasmarques ricardoasmarques left a comment

Choose a reason for hiding this comment

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

You removed the margin-right-sm class from styles.scss, and because of that you are missing the following fix: #22759

Copy link
Contributor

@ricardoasmarques ricardoasmarques left a comment

Choose a reason for hiding this comment

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

lgtm

margin-left: 5px;
}

// awesome-bootstrap-checkbox + ForkAwesome
Copy link
Contributor

Choose a reason for hiding this comment

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

This rules are required for displaying the awesome-checkbox icons.
You can try it in the login page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@@ -15,3 +15,7 @@ table.ceph-chartbox {
height: 120px;
width: 120px;
}

::ng-deep .nav-tabs {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a global rule.
We also use this in other pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@@ -0,0 +1,10 @@
.osd-modal {
margin: 10px 0px;
Copy link
Contributor

@tspmelo tspmelo Jul 24, 2018

Choose a reason for hiding this comment

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

You could remove both this rules and just keep the .oa-hr-small.
The others are already taken care of by bootstrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack


.modal-header {
@include hf;
border-radius: 5px 5px 0 0;
}

.modal-footer {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually necessary.
You will need to add the ::ng-deep, so it can be applied.
You will notice the color of the background will change.

@tspmelo
Copy link
Contributor

tspmelo commented Jul 24, 2018

You are missing the <> before and after your email in the commit message.

font-weight: normal;
font-style: normal;
}
/*For Opera browser*/
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems Opera is no longer a problem. I'm guessing since they are now using the same render as Chrome.
This can be replaced by:

/* For awesome-bootstrap-checkbox */
.checkbox input[type='checkbox']:checked + label:after {
  font-family: $font_family_1;
}
/*******/

Also, please don't use tabs, we use 2 spaces for indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

Assign variables to colors present in css files
Changed navigation icons padding because the notification dropdown was going out of window.
Fixes: http://tracker.ceph.com/issues/24575
Signed-off-by: Kanika Murarka <kmurarka@redhat.com>
@LenzGr LenzGr merged commit f0f8a0a into ceph:master Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants