提交 b3f71086 编写于 作者: P Przemek Więch

Merge pull request #43 from kubernetes/add-service-and-zerostate-views

Add service list and zero state views
......@@ -4,7 +4,7 @@
// 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
// 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,
......
......@@ -4,7 +4,7 @@
// 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
// 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,
......
<!--
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-content>
<md-toolbar>
<div class="md-toolbar-tools">
......
......@@ -4,7 +4,7 @@
// 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
// 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,
......@@ -22,5 +22,6 @@ export default angular.module(
'kubernetesDashboard.chrome',
[
'ngMaterial',
'ui.router',
])
.directive('chrome', chromeDirective);
......@@ -4,7 +4,7 @@
// 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
// 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,
......
// Copyright 2015 Google Inc.
// 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
// 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,
......
<!--
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.
-->
<!doctype html>
<html ng-app="kubernetesDashboard">
<!-- TODO(bryk): Add ng-strict-di setting for production builds. -->
......
// Copyright 2015 Google Inc.
// 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
// 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,
......@@ -17,9 +17,10 @@
* to bootstrap the application.
*/
import chromeModule from './chrome/chrome.module';
import mainModule from './main/main.module';
import indexConfig from './index.config';
import routeConfig from './index.route';
import serviceListModule from './servicelist/servicelist.module';
import zerostateModule from './zerostate/zerostate.module';
export default angular.module(
......@@ -33,7 +34,8 @@ export default angular.module(
'ngSanitize',
'ui.router',
chromeModule.name,
mainModule.name,
serviceListModule.name,
zerostateModule.name,
])
.config(indexConfig)
.config(routeConfig);
// Copyright 2015 Google Inc.
// 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
// 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,
......
// Copyright 2015 Google Inc.
// 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
// 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,
......
<div layout="vertical" layout-fill>
<header>
Page content goes here.
</header>
</div>
// Copyright 2015 Google Inc.
// 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
// 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,
......@@ -12,14 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
* Controller for the service list view.
*
* @final
*/
export default class MainPage {
export default class ServiceListController {
constructor() {
this.header = element(by.css('header'));
/** @export {!Array<string>} */
this.testServices = ['srvc1', 'srvc2'];
}
}
<!--
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.
-->
<div layout="vertical" layout-fill>
<header>
Service page. {{ctrl.testServices}}
</header>
</div>
// 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 stateConfig from './servicelist.state';
/**
* Angular module for the service list view.
*
* The view shows services running in the cluster and allows to manage them.
*/
export default angular.module(
'kubernetesDashboard.serviceList',
[
'ui.router',
])
.config(stateConfig);
// 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 ServiceListController from './servicelist.controller';
/**
* Configures states for the service view.
*
* @param {!ui.router.$stateProvider} $stateProvider
* @ngInject
*/
export default function stateConfig($stateProvider) {
$stateProvider.state('servicelist', {
url: '/servicelist',
templateUrl: 'servicelist/servicelist.html',
controller: ServiceListController,
controllerAs: 'ctrl',
});
}
......@@ -4,7 +4,7 @@
// 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
// 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,
......@@ -13,13 +13,18 @@
// limitations under the License.
export default class MainController {
/**
* Controller for the zero state view.
*
* @final
*/
export default class ZeroStateController {
/**
* @param {!angular.$timeout} $timeout
* @ngInject
*/
constructor($timeout) {
/** @export */
/** @export {number} */
this.testValue = 7;
$timeout(() => {
......
<!--
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.
-->
<div layout="vertical" layout-fill>
<header>
Zero state page. <a ui-sref="servicelist">Go to services page</a>
</header>
</div>
// 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 stateConfig from './zerostate.state';
/**
* Angular module for the zero state view.
*
* The view is active on the first launch of the application and is used for onboarding new users.
*/
export default angular.module(
'kubernetesDashboard.zerostate',
[
'ui.router',
])
.config(stateConfig);
......@@ -4,7 +4,7 @@
// 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
// 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,
......@@ -12,18 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import MainController from './main.controller';
import ZeroStateController from './zerostate.controller';
/**
* Configures states for the zero state view.
*
* @param {!ui.router.$stateProvider} $stateProvider
* @ngInject
*/
export default function stateConfig($stateProvider) {
$stateProvider.state('main', {
$stateProvider.state('zero', {
url: '/',
templateUrl: 'main/main.html',
controller: MainController,
templateUrl: 'zerostate/zerostate.html',
controller: ZeroStateController,
controllerAs: 'ctrl',
});
}
{
"env": {
"jasmine": true,
}
},
"globals": {
// Define missing global Angular variables.
"inject": true,
"module": true,
},
}
// Copyright 2015 Google Inc.
// 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
// 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,
......@@ -12,18 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import ZerostateController from 'zerostate/zerostate.controller';
import {MainController} from 'main/main.controller';
describe('Main controller', () => {
let vm;
beforeEach(() => {
vm = new MainController();
});
beforeEach(inject(($timeout) => {
vm = new ZerostateController($timeout);
}));
it('should do something', () => {
expect(vm.testValue).toEqual(7);
});
});
......@@ -4,7 +4,7 @@
// 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
// 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,
......@@ -12,8 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import stateConfig from './main.state';
export default angular.module('kubernetesDashboard.main', [])
.config(stateConfig);
export default class ZeroStatePageObject {
constructor() {
this.header = element(by.css('header'));
}
}
// Copyright 2015 Google Inc.
// 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
// 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,
......@@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import MainPage from './main.po';
import PageObject from './zerostate.po';
describe('The main view', function () {
describe('Zero state view', function () {
let page;
beforeEach(function () {
browser.get('/index.html');
page = new MainPage();
page = new PageObject();
});
it('should do something', function() {
expect(page.header.getText()).toBe('Page content goes here.');
expect(page.header.getText()).toContain('page');
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册