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

Merge branch 'master' into validation-for-namespace

......@@ -52,3 +52,4 @@ before_script:
# This simplifies initial set up and provides a very consistent build and test environment.
- docker pull golang:1.4
script: ./node_modules/.bin/gulp check:create-cluster
after_script: ./node_modules/.bin/gulp coverage-codecov-upload
......@@ -85,6 +85,7 @@ export default {
backendTmpSrc: path.join(basePath, '.tmp/backend/src/github.com/kubernetes/dashboard'),
bowerComponents: path.join(basePath, 'bower_components'),
build: path.join(basePath, 'build'),
coverageReport: path.join(basePath, 'coverage/lcov'),
deploySrc: path.join(basePath, 'src/app/deploy'),
dist: path.join(basePath, 'dist'),
distPublic: path.join(basePath, 'dist/public'),
......
......@@ -68,13 +68,22 @@ module.exports = function(config) {
},
},
reporters: ['progress'],
reporters: ['progress', 'coverage'],
coverageReporter: {
dir: 'coverage/',
reporters: [
{type: 'html', subdir: 'html'},
{type: 'lcovonly', subdir: 'lcov'},
],
},
preprocessors: {}, // This field is filled with values later.
plugins: [
'karma-chrome-launcher',
'karma-jasmine',
'karma-coverage',
'karma-ng-html2js-preprocessor',
'karma-sourcemap-loader',
'karma-browserify',
......@@ -87,6 +96,9 @@ module.exports = function(config) {
// Make 'import ...' statements relative to the following paths.
paths: [conf.paths.frontendSrc, conf.paths.frontendTest],
transform: [
// Browserify transform for the istanbul code coverage tool. Isparta istrumenter for ES6
// code coverage. TODO(floreks): try to make import work instead of require
['browserify-istanbul', {'instrumenter': require('isparta')}],
// Transform ES6 code into ES5 so that browsers can digest it.
['babelify', {'presets': ['es2015']}],
],
......
......@@ -15,6 +15,7 @@
/**
* @fileoverview Gulp tasks for unit and integration tests.
*/
import codecov from 'gulp-codecov.io';
import gulp from 'gulp';
import gulpProtractor from 'gulp-protractor';
import karma from 'karma';
......@@ -71,6 +72,16 @@ function runProtractorTests(doneFn) {
*/
gulp.task('test', ['frontend-test', 'backend-test']);
/**
* Execute gulp-codecov task and uploads generated
* coverage report to http://codecov.io. Should be used only
* by external CI tools, as gulp-codecov plugin is already designed to work
* with them. Does not work locally.
*/
gulp.task('coverage-codecov-upload', function() {
gulp.src(path.join(conf.paths.coverageReport, 'lcov.info')).pipe(codecov());
});
/**
* Runs once all unit tests of the frontend application.
*/
......
......@@ -24,9 +24,6 @@ limitations under the License.
<span>kubernetes</span>
</h2>
<span flex></span>
<md-button class="md-icon-button">
<md-icon md-font-library="material-icons">more_vert</md-icon>
</md-button>
</div>
</md-toolbar>
<div ng-transclude></div>
......
......@@ -19,15 +19,11 @@
export default function config($mdThemingProvider) {
// Create a color palette that uses Kubernetes colors.
let kubernetesColorPaletteName = 'kubernetesColorPalette';
let kubernetesAccentPaletteName = 'kubernetesAccentPallete';
let kubernetesColorPalette = $mdThemingProvider.extendPalette('blue', {
'500': '326de6',
});
// Use the palette as default one.
$mdThemingProvider.definePalette(kubernetesColorPaletteName, kubernetesColorPalette);
$mdThemingProvider.definePalette(kubernetesAccentPaletteName, kubernetesColorPalette);
$mdThemingProvider.theme('default')
.primaryPalette(kubernetesColorPaletteName)
.accentPalette(kubernetesAccentPaletteName);
$mdThemingProvider.theme('default').primaryPalette(kubernetesColorPaletteName);
}
// 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.
// 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 '../../assets/styles/color_variables';
......
......@@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<md-button class="md-fab kd-replicaset-deploy" ng-click="ctrl.redirectToDeployPage()">
<md-icon class="material-icons">add</md-icon>
</md-button>
<div layout="row" layout-wrap layout-margin layout-align="center center">
<div ng-repeat="replicaSet in ::ctrl.replicaSets">
<kd-replica-set-card replica-set="::replicaSet"></kd-replica-set-card>
......
// 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.
.md-fab {
&.kd-replicaset-deploy {
position: absolute;
right: 5px;
top: 28px;
}
}
......@@ -19,11 +19,21 @@
*/
export default class ReplicaSetListController {
/**
* @param {!ui.router.$state} $state
* @param {!backendApi.ReplicaSetList} replicaSets
* @ngInject
*/
constructor(replicaSets) {
constructor($state, replicaSets) {
/** @export {!Array<!backendApi.ReplicaSet>} */
this.replicaSets = replicaSets.replicaSets;
/** @private {!ui.router.$state} */
this.state_ = $state;
}
/**
* TODO(floreks): Should be changed to state variable. Related issue #153.
* @export
*/
redirectToDeployPage() { this.state_.go('deploy'); }
}
......@@ -82,4 +82,15 @@ describe('Replica Set Detail controller', () => {
expect(log.error).toHaveBeenCalled();
expect(mdDialog.hide).toHaveBeenCalled();
});
it('should close the dialog on cancel', () => {
// given
spyOn(mdDialog, 'cancel');
// when
ctrl.cancel();
// then
expect(mdDialog.cancel).toHaveBeenCalled();
});
});
// 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 ReplicaSetListController from 'replicasetlist/replicasetlist_controller';
import replicaSetListModule from 'replicasetlist/replicasetlist_module';
describe('Replica set list controller', () => {
/**
* @type {!ReplicaSetListController}
*/
let ctrl;
/** @type {!ui.router.$state} */
let state;
beforeEach(() => {
angular.mock.module(replicaSetListModule.name);
angular.mock.inject(($controller, $state) => {
state = $state;
ctrl = $controller(ReplicaSetListController, {replicaSets: {replicaSets: []}});
});
});
it('should change state to deploy view on plus button click', () => {
// given
spyOn(state, 'go');
// when
ctrl.redirectToDeployPage();
// then
expect(state.go).toHaveBeenCalledWith('deploy');
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册