consul/ui-v2/app/styles/components/tabular-collection.scss

223 lines
6.5 KiB
SCSS

@import './dom-recycling-table/index';
table.dom-recycling {
@extend %dom-recycling-table;
}
/* project specific */
%dom-recycling-table tbody {
/* tbodys are all absolute so,*/
/* make room for the header */
top: 29px !important;
/* Make room for the header, plus 20px for a margin on the bottom */
width: 100%;
}
%dom-recycling-table caption ~ tbody {
/* tbodys are all absolute so,*/
/* make room for the header */
top: 57px !important;
/* Make room for the header, plus 20px for a margin on the bottom */
}
/* TODO: putting this here is less than ideal */
/* but this is another area where I am specifically */
/* targetting table-like things. This is now a prime */
/* area for a bit of refactoring/reorganizing */
/* Every type of 'row' is given a placeholder which */
/* can apply to all th's and td's in the table */
/* (the placeholders refer to a tf so `> *` will get you */
/* both th and td).
/* Next, all the below calculations let you fix a width of */
/* any number of cells, then size the remaining cells */
/* using: */
/* calc(<100% divided by number of non-fixed width cells> - <sum of widths of fixed cells divided by number of non-fixed width cells>) */
table tr > *:nth-last-child(2):first-child,
table tr > *:nth-last-child(2):first-child ~ * {
width: calc(100% / 2);
}
table tr > *:nth-last-child(3):first-child,
table tr > *:nth-last-child(3):first-child ~ * {
width: calc(100% / 3);
}
table tr > *:nth-last-child(4):first-child,
table tr > *:nth-last-child(4):first-child ~ * {
width: calc(100% / 4);
}
table tr > *:nth-last-child(5):first-child,
table tr > *:nth-last-child(5):first-child ~ * {
width: calc(100% / 5);
}
table.has-actions tr > .actions {
@extend %table-actions;
}
table.has-actions tr > *:nth-last-child(2):first-child,
table.has-actions tr > *:nth-last-child(2):first-child ~ * {
width: calc(100% - 60px);
}
table.has-actions tr > *:nth-last-child(3):first-child,
table.has-actions tr > *:nth-last-child(3):first-child ~ * {
width: calc(50% - 30px);
}
table.has-actions tr > *:nth-last-child(4):first-child,
table.has-actions tr > *:nth-last-child(4):first-child ~ * {
width: calc(33% - 20px);
}
table.has-actions tr > *:nth-last-child(5):first-child,
table.has-actions tr > *:nth-last-child(5):first-child ~ * {
width: calc(25% - 15px);
}
/*TODO: trs only live in tables, get rid of table */
html.template-service.template-list main table tr {
@extend %services-row;
}
html.template-nspace.has-acls.template-list main table tr {
@extend %with-acls-nspaces-row;
}
html.template-nspace:not(.has-acls).template-list main table tr {
@extend %nspaces-row;
}
html.template-service.template-show #instances table tr {
@extend %instances-row;
}
html.template-token.template-list main table tr {
@extend %tokens-row;
}
html.template-role.template-list main table tr {
@extend %roles-row;
}
html.template-policy.template-edit [role='dialog'] table tr,
html.template-policy.template-edit main table tr,
html.template-role.template-edit [role='dialog'] table tr,
html.template-role.template-edit main table.token-list tr {
@extend %tokens-minimal-row;
}
html.template-token.template-list main table tr td.me,
html.template-token.template-list main table tr td.me ~ td,
html.template-token.template-list main table tr th {
@extend %tokens-your-row;
}
html.template-node.template-show main table.sessions tr {
@extend %node-sessions-row;
}
html.template-instance.template-show main table.exposedpaths tr {
@extend %instance-paths-row;
}
// this will get auto calculated later in tabular-collection.js
// keeping this here for reference
// %services-row > * {
// (100% / 2) - (160px / 2)
// width: calc(50% - 160px);
// }
%services-row > *:nth-child(2) {
width: 100px;
}
%services-row > * {
width: auto;
}
%instances-row > * {
width: calc(100% / 5);
}
// instance-paths are for exposed paths
// we make the columns that need as much space as possible
// as wide as possible so 50% each minus enough room
// for the 3 port columns - we probably need a max of 55px
// for each port column so 55 * 3 = 165
// so column 1 and 5 are 50% - 165 each
// the 3 remaining columns split the 165 thats left between them
%instance-paths-row > *:nth-child(1),
%instance-paths-row > *:nth-child(5) {
width: calc(50% - 165px) !important;
}
%instance-paths-row > *:nth-child(2),
%instance-paths-row > *:nth-child(3),
%instance-paths-row > *:nth-child(4) {
width: 110px !important;
}
%tokens-row > *:first-child,
%tokens-minimal-row > *:not(last-child),
%tokens-row > *:nth-child(2),
%tokens-your-row:nth-last-child(2) {
width: 120px;
}
%tokens-row > *:nth-child(3) {
width: calc(30% - 150px);
}
%tokens-row > *:nth-child(4) {
width: calc(70% - 150px);
}
%tokens-your-row:nth-child(4) {
width: calc(70% - 270px) !important;
}
%tokens-row > *:last-child {
@extend %table-actions;
}
%tokens-minimal-row > *:last-child {
width: calc(100% - 240px) !important;
}
%roles-row > *:nth-child(1),
%roles-row > *:nth-child(2),
%with-acls-nspaces-row > *:nth-child(1),
%with-acls-nspaces-row > *:nth-child(2) {
width: calc(22% - 20px) !important;
}
%with-acls-nspaces-row > *:nth-child(3),
%roles-row > *:nth-child(3) {
width: calc(56% - 20px) !important;
}
%nspaces-row > *:nth-child(1) {
width: 30%;
}
%nspaces-row > *:nth-child(2) {
width: calc(70% - 60px);
}
@media #{$--horizontal-session-list} {
%node-sessions-row > * {
// (100% / 7) - (300px / 6) - (120px / 6)
width: calc(14.2857% - 50px - 20px);
}
%node-sessions-row > *:nth-child(2) {
width: 300px;
}
%node-sessions-row > *:nth-last-child(1) {
width: 120px;
}
}
@media #{$--lt-horizontal-session-list} {
%node-sessions-row > * {
// (100% / 2) - (300px / 2) - (120px / 2)
width: calc(50% - 150px - 60px);
}
%node-sessions-row > *:nth-child(2) {
width: 300px;
}
%node-sessions-row > *:nth-last-child(1) {
width: 120px;
}
%node-sessions-row > *:nth-child(3),
%node-sessions-row > *:nth-child(4),
%node-sessions-row > *:nth-child(5),
%node-sessions-row > *:nth-child(6) {
display: none;
}
}
@media #{$--lt-medium-table} {
/* Token > Policies */
/* Token > Your Token */
html.template-token.template-list tr > :nth-child(2),
html.template-token.template-list tr > :nth-child(4),
html.template-token.template-list tr th:nth-child(5),
html.template-token.template-list main table tr td.me ~ td:nth-of-type(5) {
display: none;
}
html.template-service.template-show #instances tr > :nth-child(3) {
display: none;
}
%instances-row > * {
width: calc(100% / 4);
}
}