1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Merge pull request #1396 from marshmalien/fix/1342-css-gridify-lists

Fix alignment of list action icons and invalid item bar
This commit is contained in:
Marliana Lara 2018-04-20 09:03:49 -04:00 committed by GitHub
commit 8d6bd2f3a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 84 deletions

View File

@ -24,6 +24,7 @@
header-link="{{ vm.getLink(job) }}" header-link="{{ vm.getLink(job) }}"
header-tag="{{ vm.jobTypes[job.type] }}"> header-tag="{{ vm.jobTypes[job.type] }}">
</at-row-item> </at-row-item>
<div class="at-Row--inline">
<at-row-item <at-row-item
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_STARTED') }}" label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_STARTED') }}"
value="{{ job.started | longDate }}" value="{{ job.started | longDate }}"
@ -34,6 +35,7 @@
value="{{ job.finished | longDate }}" value="{{ job.finished | longDate }}"
inline="true"> inline="true">
</at-row-item> </at-row-item>
</div>
<at-row-item <at-row-item
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_WORKFLOW_JOB') }}" label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_WORKFLOW_JOB') }}"
value="{{ job.summary_fields.source_workflow_job.name }}" value="{{ job.summary_fields.source_workflow_job.name }}"
@ -64,7 +66,7 @@
tag-values="job.summary_fields.credentials" tag-values="job.summary_fields.credentials"
tags-are-creds="true"> tags-are-creds="true">
</at-row-item> </at-row-item>
<labels-list class="LabelList" show-delete="false" is-row-item="true"> <labels-list class="LabelList" show-delete="false" is-row-item="true" state="job">
</labels-list> </labels-list>
</div> </div>
<div class="at-Row-actions"> <div class="at-Row-actions">

View File

@ -83,7 +83,7 @@
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_RAN') }}" label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_RAN') }}"
value="{{ vm.getLastRan(template) }}"> value="{{ vm.getLastRan(template) }}">
</at-row-item> </at-row-item>
<labels-list class="LabelList" show-delete="false" is-row-item="true"> <labels-list class="LabelList" show-delete="false" is-row-item="true" state="template">
</labels-list> </labels-list>
</div> </div>
<div class="at-Row-actions"> <div class="at-Row-actions">

View File

@ -1,6 +1,4 @@
.at-LaunchTemplate { .at-LaunchTemplate {
margin-left: 15px;
&--button { &--button {
font-size: 16px; font-size: 16px;
height: 30px; height: 30px;
@ -8,8 +6,9 @@
color: #848992; color: #848992;
background-color: inherit; background-color: inherit;
border: none; border: none;
border-radius: 4px; border-radius: 5px;
} }
&--button:hover { &--button:hover {
background-color: @at-blue; background-color: @at-blue;
color: white; color: white;

View File

@ -68,12 +68,8 @@
} }
.at-Row { .at-Row {
display: flex; display: grid;
flex-direction: row; grid-template-columns: 10px 1fr;
justify-content: space-between;
align-items: center;
padding: @at-padding-list-row;
position: relative;
} }
.at-Row--active { .at-Row--active {
@ -86,15 +82,21 @@
border-left: @at-white solid 1px; border-left: @at-white solid 1px;
} }
.at-Row--active .at-Row-content {
margin-left: -5px;
}
.at-Row ~ .at-Row {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-top: @at-border-default-width solid @at-color-list-border;
}
.at-Row--invalid { .at-Row--invalid {
align-items: center; align-items: center;
background: @at-color-error; background: @at-color-error;
display: flex; display: flex;
height: 100%;
justify-content: center; justify-content: center;
left: 0;
position: absolute;
width: @at-space-2x;
.at-Popover { .at-Popover {
padding: 0; padding: 0;
@ -109,31 +111,15 @@
} }
} }
.at-Row ~ .at-Row { .at-Row-content {
border-top-left-radius: 0px; align-items: center;
border-top-right-radius: 0px;
border-top: @at-border-default-width solid @at-color-list-border;
}
.at-Row--rowLayout {
display: flex; display: flex;
flex-direction: row; flex-wrap: wrap;
grid-column-start: 2;
.at-RowItem { padding: @at-padding-list-row;
margin-right: @at-space-4x;
&-label {
width: auto;
}
}
} }
.at-RowStatus { .at-Row-toggle {
align-self: flex-start;
margin: 0 10px 0 0;
}
.at-Row-firstColumn {
margin-right: @at-space-4x; margin-right: @at-space-4x;
} }
@ -142,12 +128,12 @@
} }
.at-Row-items { .at-Row-items {
align-self: flex-start;
flex: 1; flex: 1;
} }
.at-RowItem { .at-RowItem {
display: flex; display: grid;
grid-template-columns: 120px 1fr;
align-items: center; align-items: center;
line-height: @at-height-list-row-item; line-height: @at-height-list-row-item;
} }
@ -157,6 +143,7 @@
} }
.at-RowItem--isHeader { .at-RowItem--isHeader {
display: flex;
color: @at-color-body-text; color: @at-color-body-text;
margin-bottom: @at-margin-bottom-list-header; margin-bottom: @at-margin-bottom-list-header;
line-height: @at-line-height-list-row-item-header; line-height: @at-line-height-list-row-item-header;
@ -172,6 +159,12 @@
.at-RowItem--labels { .at-RowItem--labels {
line-height: @at-line-height-list-row-item-labels; line-height: @at-line-height-list-row-item-labels;
display: flex;
flex-wrap: wrap;
* {
font-size: 10px;
}
} }
.at-RowItem-header { .at-RowItem-header {
@ -179,6 +172,7 @@
} }
.at-RowItem-tagContainer { .at-RowItem-tagContainer {
display: flex;
margin-left: @at-margin-left-list-row-item-tag-container; margin-left: @at-margin-left-list-row-item-tag-container;
} }
@ -211,8 +205,6 @@
.at-RowItem-label { .at-RowItem-label {
text-transform: uppercase; text-transform: uppercase;
width: auto;
width: @at-width-list-row-item-label;
color: @at-color-list-row-item-label; color: @at-color-list-row-item-label;
font-size: @at-font-size; font-size: @at-font-size;
} }
@ -281,6 +273,7 @@
@media screen and (max-width: @at-breakpoint-compact-list) { @media screen and (max-width: @at-breakpoint-compact-list) {
.at-Row-actions { .at-Row-actions {
flex-direction: column; flex-direction: column;
align-items: center;
} }
.at-RowAction { .at-RowAction {

View File

@ -2,5 +2,5 @@
<div class="at-Row--invalid" ng-show="invalid"> <div class="at-Row--invalid" ng-show="invalid">
<at-popover state="invalidTooltip"></at-popover> <at-popover state="invalidTooltip"></at-popover>
</div> </div>
<ng-transclude></ng-transclude> <div class="at-Row-content" ng-transclude></div>
</div> </div>

View File

@ -46,4 +46,8 @@ capacity-bar {
.Capacity-details--percentage { .Capacity-details--percentage {
width: 40px; width: 40px;
} }
&:only-child {
margin-right: 50px;
}
} }

View File

@ -35,7 +35,7 @@
<at-list results='vm.instances'> <at-list results='vm.instances'>
<at-row ng-repeat="instance in vm.instances" <at-row ng-repeat="instance in vm.instances"
ng-class="{'at-Row--active': (instance.id === vm.activeId)}"> ng-class="{'at-Row--active': (instance.id === vm.activeId)}">
<div class="at-Row-firstColumn"> <div class="at-Row-toggle">
<div class="ScheduleToggle" <div class="ScheduleToggle"
ng-class="{'is-on': instance.enabled}"> ng-class="{'is-on': instance.enabled}">
<button ng-show="instance.enabled" <button ng-show="instance.enabled"
@ -53,15 +53,14 @@
<div class="at-Row-items"> <div class="at-Row-items">
<at-row-item header-value="{{ instance.hostname }}"></at-row-item> <at-row-item header-value="{{ instance.hostname }}"></at-row-item>
<div class="at-Row--rowLayout">
<at-row-item <at-row-item
label-value="Running Jobs" label-value="Running Jobs"
label-state="instanceGroups.instanceJobs({instance_group_id: {{vm.instance_group_id}}, instance_id: {{instance.id}}})" label-state="instanceGroups.instanceJobs({instance_group_id: {{vm.instance_group_id}}, instance_id: {{instance.id}}})"
value="{{ instance.jobs_running }}" value="{{ instance.jobs_running }}"
inline="true"
badge="true"> badge="true">
</at-row-item> </at-row-item>
</div> </div>
</div>
<div class="at-Row-actions"> <div class="at-Row-actions">
<capacity-adjuster state="instance"></capacity-adjuster> <capacity-adjuster state="instance"></capacity-adjuster>

View File

@ -39,11 +39,12 @@
header-link="/#/instance_groups/{{ instance_group.id }}"> header-link="/#/instance_groups/{{ instance_group.id }}">
</at-row-item> </at-row-item>
<div class="at-Row--rowLayout"> <div class="at-Row--inline">
<at-row-item <at-row-item
label-value="Instances" label-value="Instances"
label-link="/#/instance_groups/{{ instance_group.id }}/instances" label-link="/#/instance_groups/{{ instance_group.id }}/instances"
value="{{ instance_group.instances }}" value="{{ instance_group.instances }}"
inline="true"
badge="true"> badge="true">
</at-row-item> </at-row-item>
@ -51,10 +52,10 @@
label-value="Running Jobs" label-value="Running Jobs"
label-link="/#/instance_groups/{{ instance_group.id }}/jobs" label-link="/#/instance_groups/{{ instance_group.id }}/jobs"
value="{{ instance_group.jobs_running }}" value="{{ instance_group.jobs_running }}"
inline="true"
badge="true"> badge="true">
</at-row-item> </at-row-item>
</div> </div>
</div> </div>
<div class="at-Row-actions"> <div class="at-Row-actions">

View File

@ -6,6 +6,9 @@
align-items: flex-start; align-items: flex-start;
} }
.LabelList-tagContainer {
height: fit-content;
}
.LabelList-tagContainer, .LabelList-tagContainer,
.LabelList-seeMoreLess { .LabelList-seeMoreLess {
@ -70,6 +73,7 @@
.LabelList-name { .LabelList-name {
flex: initial; flex: initial;
max-width: 100%; max-width: 100%;
word-break: break-word;
} }
.LabelList-tag--deletable > .LabelList-name { .LabelList-tag--deletable > .LabelList-name {

View File

@ -12,7 +12,9 @@ export default
function(templateUrl, Wait, Rest, GetBasePath, ProcessErrors, Prompt, $q, $filter, $state) { function(templateUrl, Wait, Rest, GetBasePath, ProcessErrors, Prompt, $q, $filter, $state) {
return { return {
restrict: 'E', restrict: 'E',
scope: false, scope: {
state: '='
},
templateUrl: templateUrl('templates/labels/labelsList'), templateUrl: templateUrl('templates/labels/labelsList'),
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
scope.showDelete = attrs.showDelete === 'true'; scope.showDelete = attrs.showDelete === 'true';
@ -33,7 +35,9 @@ export default
scope.seeMore = function () { scope.seeMore = function () {
var seeMoreResolve = $q.defer(); var seeMoreResolve = $q.defer();
Rest.setUrl(scope[scope.$parent.list.iterator].related.labels); if (scope.state) {
Rest.setUrl(scope.state.related.labels);
}
Rest.get() Rest.get()
.then(({data}) => { .then(({data}) => {
if (data.next) { if (data.next) {
@ -92,23 +96,16 @@ export default
}); });
}; };
if (scope.$parent.$parent.template) { if (_.has(scope.state, 'summary_fields.labels.results')) {
if (_.has(scope, '$parent.$parent.template.summary_fields.labels.results')) { scope.labels = scope.state.summary_fields.labels.results.slice(0, 5);
scope.labels = scope.$parent.$parent.template.summary_fields.labels.results.slice(0, 5); scope.count = scope.state.summary_fields.labels.count;
scope.count = scope.$parent.$parent.template.summary_fields.labels.count;
}
} else if (scope.$parent.$parent.job) {
if (_.has(scope, '$parent.$parent.job.summary_fields.labels.results')) {
scope.labels = scope.$parent.$parent.job.summary_fields.labels.results.slice(0, 5);
scope.count = scope.$parent.$parent.job.summary_fields.labels.count;
}
} else { } else {
scope.$watchCollection(scope.$parent.list.iterator, function() { scope.$watchCollection(scope.state, function() {
// To keep the array of labels fresh, we need to set up a watcher - otherwise, the // To keep the array of labels fresh, we need to set up a watcher - otherwise, the
// array will get set initially and then never be updated as labels are removed // array will get set initially and then never be updated as labels are removed
if (scope[scope.$parent.list.iterator].summary_fields.labels){ if (scope.state.summary_fields.labels){
scope.labels = scope[scope.$parent.list.iterator].summary_fields.labels.results.slice(0, 5); scope.labels = scope.state.summary_fields.labels.results.slice(0, 5);
scope.count = scope[scope.$parent.list.iterator].summary_fields.labels.count; scope.count = scope.state.summary_fields.labels.count;
} }
else{ else{
scope.labels = null; scope.labels = null;

View File

@ -12,10 +12,11 @@
ng-click="seeMore()" ng-if="!isRowItem">View More</div> ng-click="seeMore()" ng-if="!isRowItem">View More</div>
<div class="LabelList-seeMoreLess" ng-show="count > 5 && !seeMoreInactive" <div class="LabelList-seeMoreLess" ng-show="count > 5 && !seeMoreInactive"
ng-click="seeLess()" ng-if="!isRowItem">View Less</div> ng-click="seeLess()" ng-if="!isRowItem">View Less</div>
<div class="at-RowItem at-RowItem--labels" ng-show="count > 0" ng-if="isRowItem"> <div class="at-RowItem" ng-show="count > 0" ng-if="isRowItem">
<div class="at-RowItem-label"> <div class="at-RowItem-label">
Labels Labels
</div> </div>
<div class="at-RowItem--labels">
<div class="LabelList-tagContainer" ng-repeat="label in labels"> <div class="LabelList-tagContainer" ng-repeat="label in labels">
<div class="LabelList-tag" ng-class="{'LabelList-tag--deletable' : (showDelete && template.summary_fields.user_capabilities.edit)}"> <div class="LabelList-tag" ng-class="{'LabelList-tag--deletable' : (showDelete && template.summary_fields.user_capabilities.edit)}">
<span class="LabelList-name">{{ label.name }}</span> <span class="LabelList-name">{{ label.name }}</span>
@ -31,3 +32,4 @@
<div class="LabelList-seeMoreLess" ng-show="count > 5 && !seeMoreInactive" <div class="LabelList-seeMoreLess" ng-show="count > 5 && !seeMoreInactive"
ng-click="seeLess()">View Less</div> ng-click="seeLess()">View Less</div>
</div> </div>
</div>