提交 e657a9a3 编写于 作者: P Piotr Bryk

Merge pull request #217 from bryk/styling

Style replica set list page
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
} }
$subhead-font-size-base: rem(1.6) !default; $subhead-font-size-base: rem(1.6) !default;
$body-font-size-base: rem(1.4) !default;
$caption-font-size-base: rem(1.2) !default;
$primary: #326de6; $primary: #326de6;
$delicate: #aaa; $delicate: #aaa;
...@@ -30,6 +32,11 @@ $emphasis: #000; ...@@ -30,6 +32,11 @@ $emphasis: #000;
$content-background: #fff; $content-background: #fff;
// TODO(bryk): Get those variables from Angular Material scss files. // TODO(bryk): Get those variables from Angular Material scss files.
$foreground-1: rgba(0, 0, 0, .87);
$foreground-2: rgba(0, 0, 0, .54);
$title-font-weight: 400;
$layout-breakpoint-lg: 1280px; $layout-breakpoint-lg: 1280px;
$whiteframe-shadow-1dp: 0 1px 3px 0 rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12); $whiteframe-shadow-1dp: 0 1px 3px 0 rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12);
$baseline-grid: 8px; $baseline-grid: 8px;
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import middleEllipsisFilter from './middleellipsis_filter';
/**
* Module containing common filters for the application.
*/
export default angular.module(
'kubernetesDashboard.common.flters',
[
'ngMaterial',
])
.filter('middleEllipsis', middleEllipsisFilter);
...@@ -15,34 +15,33 @@ limitations under the License. ...@@ -15,34 +15,33 @@ limitations under the License.
--> -->
<md-menu> <md-menu>
<md-button ng-click="ctrl.openMenu($mdOpenMenu, $event)" class="kd-replicaset-card-logs">Logs</md-button> <md-button ng-click="ctrl.openMenu($mdOpenMenu, $event)" class="kd-replicaset-card-logs-button">Logs</md-button>
<md-menu-content width="6"> <md-menu-content>
<md-menu-item class="kd-menu-logs-md-menu-item"> <md-menu-item class="kd-menu-logs-md-menu-item">
<div flex="33">Logs</div> <div>Logs</div>
</md-menu-item> </md-menu-item>
<md-menu-item class="kd-menu-logs-md-menu-item"> <md-menu-item class="kd-menu-logs-md-menu-item">
<div flex class="kd-menu-logs-item-header">Pod</div> <div class="kd-menu-logs-item-header kd-menu-logs-item-pods">Pod</div>
<div flex="50" class="kd-menu-logs-item-header">Running since</div> <div class="kd-menu-logs-item-header kd-menu-logs-item-since">Running since</div>
<div flex class="kd-menu-logs-item-header">Prior restart</div> <div class="kd-menu-logs-item-header kd-menu-logs-item-prior">Prior restart</div>
</md-menu-item> </md-menu-item>
<md-menu-item ng-repeat="pod in ctrl.replicaSetPodsList" class="kd-menu-logs-md-menu-item"> <md-menu-item ng-repeat="pod in ::ctrl.replicaSetPodsList" class="kd-menu-logs-md-menu-item">
<div flex class="kd-menu-logs-item">{{pod.name | middleEllipsis:10}}</div> <div class="kd-menu-logs-item kd-menu-logs-item-pods">
<div flex="50" class="kd-menu-logs-item" ng-if="ctrl.podContainerExists(pod)"> {{::(pod.name | middleEllipsis:10)}}
<a ng-href="{{::ctrl.getLogsHref(pod.name, pod.podContainers[0].name)}}"> </div>
{{pod.startTime}}<i <div class="kd-menu-logs-item kd-menu-logs-item-since">
<a ng-href="{{::ctrl.getLogsHref(pod.name, pod.podContainers[0].name)}}"
ng-if="::ctrl.podContainerExists(pod)">
{{pod.startTime | date:"short"}}<i
class="material-icons kd-menu-logs-link-icon">open_in_new</i> class="material-icons kd-menu-logs-link-icon">open_in_new</i>
</a> </a>
<span ng-if="::!ctrl.podContainerExists(pod)">-</span>
</div> </div>
<div flex="50" class="kd-menu-logs-item" ng-if="!ctrl.podContainerExists(pod)"> <div class="kd-menu-logs-item kd-menu-logs-item-prior">
- <a ng-if="::ctrl.podContainersRestarted(pod)">
</div>
<div flex class="kd-menu-logs-item" ng-if="ctrl.podContainersRestarted(pod)">
<a>
Logs<i class="material-icons kd-menu-logs-link-icon">open_in_new</i> Logs<i class="material-icons kd-menu-logs-link-icon">open_in_new</i>
</a> </a>
</div> <span ng-if="::!ctrl.podContainersRestarted(pod)">-</span>
<div flex class="kd-menu-logs-item" ng-if="!ctrl.podContainersRestarted(pod)">
-
</div> </div>
</md-menu-item> </md-menu-item>
</md-menu-content> </md-menu-content>
......
...@@ -16,24 +16,28 @@ limitations under the License. ...@@ -16,24 +16,28 @@ limitations under the License.
<md-card class="kd-replicaset-card"> <md-card class="kd-replicaset-card">
<md-card-content> <md-card-content>
<div layout="row" layout-align="space-between center"> <div layout="column">
<div flex layout="column"> <div flex layout="row" layout-align="space-between center"
<a ng-href="{{::ctrl.getReplicaSetDetailHref()}}" flex> class="kd-replicaset-card-title-row">
{{::ctrl.replicaSet.name}} <h3 class="md-title kd-replicaset-card-title">
</a> <a ng-href="{{::ctrl.getReplicaSetDetailHref()}}" class="kd-replicaset-card-name" flex>
<div flex class="md-caption"> {{::ctrl.replicaSet.name}}
<span ng-repeat="(label, value) in ::ctrl.replicaSet.labels" </a>
class="kd-replicaset-card-label"> </h3>
{{::label}}:{{::value}}
</span> <md-button class="md-icon-button kd-replicaset-card-menu-button">
</div> <md-icon md-font-library="material-icons">more_vert</md-icon>
</md-button>
</div>
<div flex class="md-caption">
<span ng-repeat="(label, value) in ::ctrl.replicaSet.labels"
class="kd-replicaset-card-label">
{{::label}}:{{::value}}
</span>
</div> </div>
<md-button class="md-icon-button">
<md-icon md-font-library="material-icons">more_vert</md-icon>
</md-button>
</div> </div>
<div class="md-caption"> <div class="md-caption">
<div layout="row"> <div layout="row" layout-align="center end">
<span flex="60"> <span flex="60">
{{::ctrl.replicaSet.podsRunning}} pods running, {{::ctrl.replicaSet.podsPending}} pending {{::ctrl.replicaSet.podsRunning}} pods running, {{::ctrl.replicaSet.podsPending}} pending
</span> </span>
...@@ -41,33 +45,34 @@ limitations under the License. ...@@ -41,33 +45,34 @@ limitations under the License.
replica-set-name="::ctrl.replicaSet.name"> replica-set-name="::ctrl.replicaSet.name">
</logs-menu> </logs-menu>
</div> </div>
<hr class="kd-replicaset-card-divider"></hr> <md-divider class="kd-replicaset-card-divider"></md-divider>
<div layout="row" layout-wrap> <div layout="row" layout-wrap>
<div ng-if="::ctrl.replicaSet.description" flex="100" layout="column" <div ng-if="::ctrl.replicaSet.description" flex="100" layout="column"
class="kd-replicaset-card-section"> class="kd-replicaset-card-section">
<span flex>Description</span> <span flex class="kd-replicaset-card-section-title">Description</span>
<div flex> <div flex>
{{::ctrl.replicaSet.description}} {{::ctrl.replicaSet.description}}
</div> </div>
</div> </div>
<div flex="60" layout="column" class="kd-replicaset-card-section"> <div flex="60" layout="column" class="kd-replicaset-card-section">
<span flex>Image</span> <span flex class="kd-replicaset-card-section-title">Image</span>
<div flex> <div flex>
<div ng-repeat="image in ::ctrl.replicaSet.containerImages track by $index" <div ng-repeat="image in ::ctrl.replicaSet.containerImages track by $index"
class="kd-replicaset-card-section-image"> class="kd-replicaset-card-section-image">
{{::image}} <md-tooltip>{{::image}}</md-tooltip>
{{::(image | middleEllipsis:32)}}
</div> </div>
</div> </div>
</div> </div>
<div flex="40" layout="column" class="kd-replicaset-card-section"> <div flex="40" layout="column" class="kd-replicaset-card-section">
<span flex="initial">Creation time</span> <span flex="initial" class="kd-replicaset-card-section-title">Creation time</span>
<span flex>{{::ctrl.replicaSet.creationTime}}</span> <span flex>{{::(ctrl.replicaSet.creationTime | date:'short')}}</span>
</div> </div>
<div flex="60" layout="column" class="kd-replicaset-card-section"> <div flex="60" layout="column" class="kd-replicaset-card-section">
<span flex="initial">Internal Endpoint</span> <span flex="initial" class="kd-replicaset-card-section-title">Internal Endpoint</span>
<div flex> <div flex>
<div ng-repeat="endpoint in ::ctrl.replicaSet.internalEndpoints track by $index"> <div ng-repeat="endpoint in ::ctrl.replicaSet.internalEndpoints track by $index">
<kd-service-endpoint endpoint="::endpoint"></kd-service-endpoint> <kd-service-endpoint endpoint="::endpoint"></kd-service-endpoint>
...@@ -79,7 +84,7 @@ limitations under the License. ...@@ -79,7 +84,7 @@ limitations under the License.
</div> </div>
<div flex="40" layout="column" class="kd-replicaset-card-section"> <div flex="40" layout="column" class="kd-replicaset-card-section">
<span flex="initial">External Endpoint</span> <span flex="initial" class="kd-replicaset-card-section-title">External Endpoint</span>
<div flex> <div flex>
<div ng-repeat="endpoint in ::ctrl.replicaSet.externalEndpoints track by $index"> <div ng-repeat="endpoint in ::ctrl.replicaSet.externalEndpoints track by $index">
<kd-service-endpoint endpoint="::endpoint"></kd-service-endpoint> <kd-service-endpoint endpoint="::endpoint"></kd-service-endpoint>
......
...@@ -19,37 +19,53 @@ ...@@ -19,37 +19,53 @@
width: ($layout-breakpoint-lg - (2 * $baseline-grid) * 2) / 3; width: ($layout-breakpoint-lg - (2 * $baseline-grid) * 2) / 3;
} }
// This override button style to make it look like a link. .kd-replicaset-card-name {
.kd-replicaset-card-logs {
border-radius: inherit;
color: inherit; color: inherit;
font-size: inherit; display: inline-block;
font-weight: inherit; font-weight: $title-font-weight;
line-height: 0;
margin: inherit;
min-height: inherit;
min-width: inherit;
padding: inherit;
text-decoration: none; text-decoration: none;
text-transform: inherit; }
&:after { .kd-replicaset-card-title {
content: '\25BC'; margin: 0;
} }
.kd-replicaset-card-title-row {
margin-top: -$baseline-grid - 2px;
} }
.kd-replicaset-card-divider { .kd-replicaset-card-divider {
border: 0; margin-top: $baseline-grid;
border-top: 1px solid; }
// This override button style to make it look like a link.
.md-button {
&.kd-replicaset-card-logs-button {
font-size: inherit;
font-weight: inherit;
line-height: 0;
margin: 0;
min-height: inherit;
min-width: inherit;
padding: $baseline-grid 0;
text-decoration: none;
text-transform: inherit;
&:after {
content: ' \25BE';
}
}
} }
.kd-replicaset-card-section { .kd-replicaset-card-section {
margin-top: 2 * $baseline-grid; margin-top: 2 * $baseline-grid;
} }
.kd-replicaset-card-section-title {
color: $foreground-2;
}
.kd-replicaset-card-section-image { .kd-replicaset-card-section-image {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
...@@ -57,24 +73,32 @@ ...@@ -57,24 +73,32 @@
margin-right: 2 * $baseline-grid; margin-right: 2 * $baseline-grid;
} }
.kd-menu-logs-md-menu-item {
height: 30px;
min-height: 30px;
}
.kd-menu-logs-item-header { .kd-menu-logs-item-header {
color: $muted; box-sizing: inherit;
font-size: .8em; color: $foreground-2;
font-size: $body-font-size-base;
white-space: nowrap; white-space: nowrap;
} }
.kd-menu-logs-item { .kd-menu-logs-item {
font-size: .8em; box-sizing: inherit;
overflow: hidden; font-size: $body-font-size-base;
white-space: nowrap; white-space: nowrap;
} }
.kd-menu-logs-item-pods {
width: 10 * $baseline-grid;
}
.kd-menu-logs-item-prior {
width: 10 * $baseline-grid;
}
.kd-menu-logs-item-since {
width: 15 * $baseline-grid;
}
.kd-menu-logs-link-icon { .kd-menu-logs-link-icon {
font-size: 1em; font-size: $subhead-font-size-base;
margin-left: $baseline-grid; margin-left: $baseline-grid;
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import stateConfig from './replicasetlist_stateconfig'; import stateConfig from './replicasetlist_stateconfig';
import logsMenuDirective from './logsmenu_directive'; import logsMenuDirective from './logsmenu_directive';
import middleEllipsisFilter from 'common/filters/middleellipsis_filter'; import filtersModule from 'common/filters/filters_module';
import replicaSetCardDirective from './replicasetcard_directive'; import replicaSetCardDirective from './replicasetcard_directive';
import replicaSetDetailModule from 'replicasetdetail/replicasetdetail_module'; import replicaSetDetailModule from 'replicasetdetail/replicasetdetail_module';
import replicaSetListContainer from './replicasetlistcontainer_directive'; import replicaSetListContainer from './replicasetlistcontainer_directive';
...@@ -31,9 +31,9 @@ export default angular.module( ...@@ -31,9 +31,9 @@ export default angular.module(
'ngResource', 'ngResource',
'ui.router', 'ui.router',
replicaSetDetailModule.name, replicaSetDetailModule.name,
filtersModule.name,
]) ])
.config(stateConfig) .config(stateConfig)
.filter('middleEllipsis', middleEllipsisFilter)
.directive('logsMenu', logsMenuDirective) .directive('logsMenu', logsMenuDirective)
.directive('kdReplicaSetListContainer', replicaSetListContainer) .directive('kdReplicaSetListContainer', replicaSetListContainer)
.directive('kdReplicaSetCard', replicaSetCardDirective); .directive('kdReplicaSetCard', replicaSetCardDirective);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册