提交 c12da8cc 编写于 作者: B bolu

Merge pull request #4 from kubernetes/folders

Define source code folder structure with sample app
// Copyright 2015 Google Inc.
//
// 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.
/** @ngInject */
export function config($logProvider) {
$logProvider.debugEnabled(true);
}
<!doctype html>
<html ng-app="kubernetesConsole" ng-strict-di>
<head>
<meta charset="utf-8">
<title>Kubernetes Console</title>
<meta name="viewport" content="width=device-width">
<!-- build:css console/vendor.css -->
<!-- bower:css -->
<!-- Bower CSS dependencies are populated here (dev build) and compiled
into vendor.css (prod build). -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:css console/app.css -->
<!-- inject:css -->
<!-- Application css files are populated here (dev build) and compiled
into app.css (prod build). -->
<!-- endinject -->
<!-- endbuild -->
</head>
<body>
<!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser.
Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your
experience.</p>
<![endif]-->
<div ng-viewport ng-controller="RouterController"></div>
<!-- build:js console/vendor.js -->
<!-- bower:js -->
<!-- Bower JS dependencies are populated here (dev build) and compiled
into vendor.js (prod build). -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:js console/app.js -->
<!-- inject:js -->
<!-- Application JS files are populated here. -->
<!-- endinject -->
<!-- inject:partials -->
<!-- Angular templates are automatically converted to JS and inserted here (prod build). -->
<!-- endinject -->
<!-- endbuild -->
</body>
</html>
// Copyright 2015 Google Inc.
//
// 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.
/**
* @fileoverview Entry point module to the application. Loads and configures other modules needed
* to bootstrap the application
*/
import { config } from './index.config';
import { routerConfig, RouterController } from './index.route';
import { runBlock } from './index.run';
import { MainController } from './main/main.controller';
export default angular.module(
'kubernetesConsole',
['ngAnimate', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ngNewRouter', 'ngMaterial'])
.config(config)
.config(routerConfig)
.run(runBlock)
.controller('RouterController', RouterController)
.controller('MainController', MainController);
// Copyright 2015 Google Inc.
//
// 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.
/** @ngInject */
export function routerConfig($componentLoaderProvider) {
$componentLoaderProvider.setTemplateMapping(function(name) {
return `${ name }/${ name }.html`;
});
}
export class RouterController {
/** @ngInject */
constructor($router) {
var router = $router;
router['config']([
{ path: '/', component: 'main' }
]);
}
}
// Copyright 2015 Google Inc.
//
// 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.
/** @ngInject */
export function runBlock ($log) {
$log.debug('runBlock end');
}
// Copyright 2015 Google Inc.
//
// 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.
body {
border: 1px solid red;
}
// Copyright 2015 Google Inc.
//
// 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.
export class MainController {
/** @ngInject */
constructor() {
this.testValue = 7;
}
/** @ngInject */
activate($timeout) {
$timeout(() => {
this.foo = 'bar';
}, 4000);
}
}
<div layout="vertical" layout-fill>
<md-content>
<header>
Hello world!
</header>
<section class="jumbotron">
<h1>'Allo, 'Allo!</h1>
<p class="lead">
<img src="assets/images/yeoman.png" alt="I'm Yeoman"><br>
</p>
</section>
</md-content>
</div>
// Copyright 2015 Google Inc.
//
// 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.
body {
background-color: gray;
}
// Copyright 2015 Google Inc.
//
// 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 {MainController} from 'main/main.controller';
describe('Main controller', () => {
let vm;
beforeEach(() => {
vm = new MainController();
});
it('should do something', () => {
expect(vm.testValue).toEqual(7);
});
});
// Copyright 2015 Google Inc.
//
// 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.
/**
* @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
*/
export class MainPage {
constructor() {
this.jumbEl = element(by.css('.jumbotron'));
this.h1El = this.jumbEl.element(by.css('h1'));
}
};
// Copyright 2015 Google Inc.
//
// 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 {MainPage} from './main.po';
describe('The main view', function () {
var page;
beforeEach(function () {
browser.get('/index.html');
page = new MainPage();
});
it('should do something', function() {
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册