Merge pull request #560 from jaredevantabor/ui-router

Switching ngRouter for uiRouter
This commit is contained in:
jaredevantabor
2016-01-06 10:43:50 -05:00
145 changed files with 11644 additions and 1827 deletions

View File

@@ -0,0 +1,44 @@
{
"name": "angular-breadcrumb",
"description": "AngularJS module that generates a breadcrumb from ui-router's states",
"version": "0.4.1",
"main": "release/angular-breadcrumb.js",
"ignore": [
"sample",
"src",
"test",
".bowerrc",
".coveralls.yml",
".gitignore",
".jshintrc",
".travis.yml",
"gruntfile.js",
"bower.json",
"karma.conf.js",
"libpeerconnection.log",
"package.json",
"README.md"
],
"dependencies": {
"angular": ">=1.0.8",
"angular-ui-router": ">=0.2.0"
},
"devDependencies": {
"bootstrap": "~2.3.2",
"angular-ui-bootstrap-bower": "~0.8.0",
"underscore": "~1.5.1",
"angular-mocks": ">=1.0.8",
"angular-sanitize": ">=1.0.8"
},
"homepage": "https://github.com/ncuillery/angular-breadcrumb",
"_release": "0.4.1",
"_resolution": {
"type": "version",
"tag": "v0.4.1",
"commit": "b291e06f4010ebebbb41ea2c14e73e236aa70930"
},
"_source": "git://github.com/ncuillery/angular-breadcrumb.git",
"_target": "~0.4.1",
"_originalSource": "angular-breadcrumb",
"_direct": true
}

View File

@@ -0,0 +1,16 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@@ -0,0 +1,15 @@
sample
src
test
.idea
bower_components
coverage
testDependencies
.bowerrc
.coveralls.yml
.gitignore
.jshintrc
.travis.yml
gruntfile.js
karma.conf.js
libpeerconnection.log

View File

@@ -0,0 +1,151 @@
<a name="0.4.1"></a>
### 0.4.1 (2015-08-09)
#### Features
* add the scope-based ncyBreadcrumbIgnore flag ([934c5523](http://github.com/ncuillery/angular-breadcrumb/commit/934c5523208a9615d7cfa3abcb397bbe131332ac), closes [#42](http://github.com/ncuillery/angular-breadcrumb/issues/42), [#62](http://github.com/ncuillery/angular-breadcrumb/issues/42))
<a name="0.4.0"></a>
### 0.4.0 (2015-05-17)
#### Bug Fixes
* **$breadcrumb:** Handle parents provided by StateObject references ([f4288d37](http://github.com/ncuillery/angular-breadcrumb/commit/f4288d375fd1090ffec1d67e85c6300d74d86d37), closes [#82](http://github.com/ncuillery/angular-breadcrumb/issues/82))
* **ncyBreadcrumb:**
* Prevent memory leak when label is a binding ([264e10f6](http://github.com/ncuillery/angular-breadcrumb/commit/264e10f680e1bbb8d1e00cf500de39cac4222cfd), closes [#88](http://github.com/ncuillery/angular-breadcrumb/issues/88))
* Removed trailing spaces from breadcrumb items([bc276ed5](http://github.com/ncuillery/angular-breadcrumb/commit/bc276ed5351a586d4a6dc83ada0687e6ca485344), closes [#77](http://github.com/ncuillery/angular-breadcrumb/issues/77))
#### Features
* Add force to ncyBreadcrumb options ([31125a38](http://github.com/ncuillery/angular-breadcrumb/commit/31125a386d706dd76df807b3b02e1fccea38fb59), closes [#77](http://github.com/ncuillery/angular-breadcrumb/issues/78))
* **ncyBreadcrumbText:** Add ncyBreadcrumbText directive ([82b2b443](http://github.com/ncuillery/angular-breadcrumb/commit/82b2b443fab220cd9ac7d3a8c90c1edc4291e54a), closes [#71](http://github.com/ncuillery/angular-breadcrumb/issues/71), [#83](http://github.com/ncuillery/angular-breadcrumb/issues/83))
<a name="0.3.3"></a>
### 0.3.3 (2014-12-16)
#### Bug Fixes
* **ncyBreadcrumb:** define `$$templates` with var instead of attaching it to `window` ([c35c9d25](http://github.com/ncuillery/angular-breadcrumb/commit/c35c9d255b5e2585d225a961d1efdb51d18f6a55), closes [#55](http://github.com/ncuillery/angular-breadcrumb/issues/55))
<a name="0.3.2"></a>
### 0.3.2 (2014-11-15)
* **npm:** nothing, it's only a blank release due to a network problem during the last `npm publish` (f...ing npm doesn't allow a republish with the same version number [npm-registry-couchapp#148](https://github.com/npm/npm-registry-couchapp/issues/148)).
<a name="0.3.1"></a>
### 0.3.1 (2014-11-15)
#### Bug Fixes
* **npm:** update package.json after (unclean) npm publish ([ab8161c2](http://github.com/ncuillery/angular-breadcrumb/commit/ab8161c25f98613f725b5e5ff8fe147acd60b365), closes [#52](http://github.com/ncuillery/angular-breadcrumb/issues/52))
* **sample:** Send correct url params for the room link in booking view ([876de49a](http://github.com/ncuillery/angular-breadcrumb/commit/876de49a9c5d6e2d75714a606238e9041ed49baf))
<a name="0.3.0"></a>
## 0.3.0 (2014-10-29)
#### Bug Fixes
* organize state-level options in `ncyBreadcrumb` key instead of `data` ([1ea436d3](http://github.com/ncuillery/angular-breadcrumb/commit/1ea436d3f6d5470b7ae3e71e71259dbd2422bc00), closes [#30](http://github.com/ncuillery/angular-breadcrumb/issues/30))
* curly braces appearing on title of sample app ([855e76cb](http://github.com/ncuillery/angular-breadcrumb/commit/855e76cb33fda607fa3caa230564b77b48262c40))
#### Features
* Add a global option to include abstract states ([6f0461ea](http://github.com/ncuillery/angular-breadcrumb/commit/6f0461ea7db36d8e10c29ed10de1f1c08d215a19), closes [#35](http://github.com/ncuillery/angular-breadcrumb/issues/35), [#28](http://github.com/ncuillery/angular-breadcrumb/issues/28))
* **$breadcrumb:**
* Support url params when using `ncyBreadcrumb.parent` property ([55730045](http://github.com/ncuillery/angular-breadcrumb/commit/55730045dcf3b4fb1048c67f1e18953505563ed4), closes [#46](http://github.com/ncuillery/angular-breadcrumb/issues/46))
* add the customization of the parent state with a function ([ada09015](http://github.com/ncuillery/angular-breadcrumb/commit/ada09015c49f05a94349dabf078f1ed621811aaa), closes [#32](http://github.com/ncuillery/angular-breadcrumb/issues/32))
* **ncyBreadcrumbLast:** Add a new directive rendering the last step ([1eef24fb](http://github.com/ncuillery/angular-breadcrumb/commit/1eef24fbe862a1e3308181c38f50755843cf4426), closes [#37](http://github.com/ncuillery/angular-breadcrumb/issues/37))
#### Breaking Changes
* state-level options has been moved under the custom key
`ncyBreadcrumb` in state's configuration.
To migrate the code follow the example below:
```
// Before
$stateProvider.state('A', {
url: '/a',
data: {
ncyBreadcrumbLabel: 'State A'
}
});
```
```
// After
$stateProvider.state('A', {
url: '/a',
ncyBreadcrumb: {
label: 'State A'
}
});
```
See [API reference](https://github.com/ncuillery/angular-breadcrumb/wiki/API-Reference) for more informations.
([1ea436d3](http://github.com/ncuillery/angular-breadcrumb/commit/1ea436d3f6d5470b7ae3e71e71259dbd2422bc00))
<a name="0.2.3"></a>
### 0.2.3 (2014-07-26)
#### Bug Fixes
* **$breadcrumb:** use `$stateParams` in case of unhierarchical states ([1c3c05e0](http://github.com/ncuillery/angular-breadcrumb/commit/1c3c05e0acac191fe2e76db2ef18da339caefaaa), closes [#29](http://github.com/ncuillery/angular-breadcrumb/issues/29))
<a name="0.2.2"></a>
### 0.2.2 (2014-06-23)
#### Bug Fixes
* catch the `$viewContentLoaded` earlier ([bb47dd54](http://github.com/ncuillery/angular-breadcrumb/commit/bb47dd54deb5efc579ccb9b1575e686803dee1c5), closes [#14](http://github.com/ncuillery/angular-breadcrumb/issues/14))
* **sample:**
* make the CRU(D) about rooms working ([3ca89ec7](http://github.com/ncuillery/angular-breadcrumb/commit/3ca89ec771fd20dc4ab2d733612bdcfb96ced703))
* prevent direct URL access to a day disabled in the datepicker ([95236916](http://github.com/ncuillery/angular-breadcrumb/commit/95236916e00b19464a3dfe3584ef1b18da9ffb25), closes [#17](http://github.com/ncuillery/angular-breadcrumb/issues/17))
* use the same variable in the datepicker and from url params for state `booking.day` ([646f7060](http://github.com/ncuillery/angular-breadcrumb/commit/646f70607e494f0e5e3c2483ed69f689684b2742), closes [#16](http://github.com/ncuillery/angular-breadcrumb/issues/16))
#### Features
* **ncyBreadcrumb:** watch every expression founded in labels ([1363515e](http://github.com/ncuillery/angular-breadcrumb/commit/1363515e20977ce2f39a1f5e5e1d701f0d7af296), closes [#20](http://github.com/ncuillery/angular-breadcrumb/issues/20))
<a name="0.2.1"></a>
### 0.2.1 (2014-05-16)
#### Bug Fixes
* **$breadcrumb:** check if a state has a parent when looking for an inheritated property ([77e668b5](http://github.com/ncuillery/angular-breadcrumb/commit/77e668b5eb759570a64c2a885e81580953af3201), closes [#11](http://github.com/ncuillery/angular-breadcrumb/issues/11))
<a name="0.2.0"></a>
### 0.2.0 (2014-05-08)
#### Bug Fixes
* **$breadcrumb:** remove abstract states from breadcrumb ([8a06c5ab](http://github.com/ncuillery/angular-breadcrumb/commit/8a06c5abce749027d48f7309d1aabea1e447dfd5), closes [#8](http://github.com/ncuillery/angular-breadcrumb/issues/8))
* **ncyBreadcrumb:** display the correct breadcrumb in case of direct access ([e1f455ba](http://github.com/ncuillery/angular-breadcrumb/commit/e1f455ba4def97d3fc76b53772867b5f9daf4232), closes [#10](http://github.com/ncuillery/angular-breadcrumb/issues/10))
#### Features
* **$breadcrumb:**
* add a configuration property for skipping a state in the breadcrumb ([dd255d90](http://github.com/ncuillery/angular-breadcrumb/commit/dd255d906c4231f44b48f066d4db197a9c6b9e27), closes [#9](http://github.com/ncuillery/angular-breadcrumb/issues/9))
* allow chain of states customization ([028e493a](http://github.com/ncuillery/angular-breadcrumb/commit/028e493a1ebcae5ae60b8a9d42b949262000d7df), closes [#7](http://github.com/ncuillery/angular-breadcrumb/issues/7))
* **ncyBreadcrumb:** add 'Element' declaration style '<ncy-breadcrumb />' ([b51441ea](http://github.com/ncuillery/angular-breadcrumb/commit/b51441eafb1659b782fea1f8668c7f455e1d6b4d))

View File

@@ -0,0 +1,52 @@
# Contributing to angular-breadcrumb
I am very glad to see this project living with PR from contributors who trust in it. Here is some guidelines to keep the contributions useful and efficient.
## Development hints
### Installation
- Checkout the repository
- Run `npm install`
- Run `bower install`
### Test running
This module uses the classic AngularJS stack with:
- Karma (test runner)
- Jasmine (assertion framework)
- angular-mocks (AngularJS module for testing)
Run the test with the grunt task `grunt test`. It runs the tests with different versions of AngularJS.
### Test developing
Tests are build around modules with a specific `$stateProvider` configuration:
- [Basic configuration](https://github.com/ncuillery/angular-breadcrumb/blob/master/test/mock/test-modules.js#L6): Basic definitions (no template, no controller)
- [Interpolation configuration](https://github.com/ncuillery/angular-breadcrumb/blob/master/test/mock/test-modules.js#L21): States with bindings in `ncyBreadcrumbLabel`
- [HTML configuration](https://github.com/ncuillery/angular-breadcrumb/blob/master/test/mock/test-modules.js#L36): States with HTML in `ncyBreadcrumbLabel`
- [Sample configuration](https://github.com/ncuillery/angular-breadcrumb/blob/master/test/mock/test-modules.js#L41): Bridge towards the sample app configuration for using in tests
- [UI-router's configuration](https://github.com/ncuillery/angular-breadcrumb/blob/master/test/mock/test-ui-router-sample.js#L9): Clone of the UI-router sample app (complemented with breadcrumb configuration)
Theses modules are loaded by Karma and they are available in test specifications.
Specifications are generally related to the directive `ncyBreadcrumb` or the service `$breadcrumb`.
### Sample
If you are not familiar with JS testing. You can run the [sample](http://ncuillery.github.io/angular-breadcrumb/#/sample) locally for testing purposes by using `grunt sample`. Sources are live-reloaded after each changes.
## Submitting a Pull Request
- Fork the [repository](https://github.com/ncuillery/angular-breadcrumb/)
- Make your changes in a new git branch following the coding rules below.
- Run the grunt default task (by typing `grunt` or `grunt default`): it will run the tests and build the module in `dist` directory)
- Commit the changes (including the `dist` directory) by using the commit conventions explained below.
- Push and make the PR
## Coding rules
- When making changes on the source file, please check that your changes are covered by the tests. If not, create a new test case.
## Commit conventions
angular-breadcrumb uses the same strict conventions as AngularJS and UI-router. These conventions are explained [here](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines).
It is very important to fit these conventions especially for types `fix` and `feature` which are used by the CHANGELOG.md generation (it uses the [grunt-conventional-changelog](https://github.com/btford/grunt-conventional-changelog)).

View File

@@ -0,0 +1,258 @@
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
headerDev: '/*! <%= pkg.name %> - v<%= pkg.version %>-dev-<%= grunt.template.today("yyyy-mm-dd") %>\n',
headerRelease: '/*! <%= pkg.name %> - v<%= pkg.version %>\n',
banner: '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
concat: {
dev: {
options: {
banner: '<%= headerDev %><%= banner %>\n(function (window, angular, undefined) {\n',
footer: '})(window, window.angular);\n',
stripBanners: true
},
src: ['src/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
},
release: {
options: {
banner: '<%= headerRelease %><%= banner %>\n(function (window, angular, undefined) {\n',
footer: '})(window, window.angular);\n',
stripBanners: true
},
src: ['src/<%= pkg.name %>.js'],
dest: 'release/<%= pkg.name %>.js'
}
},
uglify: {
dev: {
options: {
banner: '<%= headerDev %><%= banner %>'
},
src: '<%= concat.dev.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
},
release: {
options: {
banner: '<%= headerRelease %><%= banner %>'
},
src: '<%= concat.release.dest %>',
dest: 'release/<%= pkg.name %>.min.js'
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
sources: {
options: {
jshintrc: 'src/.jshintrc'
},
src: ['src/**/*.js']
},
test: {
src: ['test/**/*.js']
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
sources: {
files: '<%= jshint.sources.src %>',
tasks: ['jshint:sources', 'karma']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'karma']
},
sample: {
options: {
livereload: LIVERELOAD_PORT
},
tasks: 'copy:breadcrumb',
files: [
'sample/*.{css,js,html}',
'sample/controllers/*.{css,js,html}',
'sample/views/*.{css,js,html}',
'src/*.js'
]
}
},
copy: {
breadcrumb: {
files: [
{
flatten: true,
expand: true,
src: [
'src/angular-breadcrumb.js'
],
dest: 'sample/asset/'
}
]
},
asset: {
files: [
{
flatten: true,
expand: true,
src: [
'dist/angular-breadcrumb.js',
'bower_components/angular/angular.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js',
'bower_components/bootstrap/docs/assets/css/bootstrap.css',
'bower_components/underscore/underscore.js'
],
dest: 'sample/asset/'
}
]
},
img: {
files: [
{
flatten: true,
expand: true,
src: [
'bower_components/bootstrap.css/img/glyphicons-halflings.png'
],
dest: 'sample/img/'
}
]
}
},
connect: {
options: {
port: 9000,
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
lrSnippet,
mountFolder(connect, 'sample')
];
}
}
}
},
open: {
server: {
url: 'http://localhost:<%= connect.options.port %>/index.html'
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ['pkg']
}
},
clean: {
release: ["sample/*.zip"],
test: ["testDependencies/*"]
},
compress: {
release: {
options: {
archive: 'sample/<%= pkg.name %>-<%= pkg.version %>.zip'
},
files: [
{expand: true, cwd: 'release/', src: ['*.js']}
]
}
},
replace: {
release: {
src: ['sample/views/home.html'],
overwrite: true,
replacements: [{
from: /angular-breadcrumb-[0-9]+\.[0-9]+\.[0-9]+\.zip/g,
to: "angular-breadcrumb-<%= pkg.version %>.zip"
},
{
from: /\([0-9]+\.[0-9]+\.[0-9]+\)/g,
to: "(<%= pkg.version %>)"
}]
}
},
shell: {
testMinimal: {
command: 'bower install angular#=1.0.8 angular-mocks#=1.0.8 angular-sanitize#=1.0.8 angular-ui-router#=0.2.0 --config.directory=. --config.cwd=testDependencies'
},
test1dot2: {
command: 'bower install angular#=1.2.18 angular-mocks#=1.2.18 angular-sanitize#=1.2.18 angular-ui-router#=0.2.15 --config.directory=. --config.cwd=testDependencies'
},
testLatest: {
command: 'bower install angular angular-mocks angular-sanitize angular-ui-router --config.directory=. --config.cwd=testDependencies'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('test', ['jshint', 'testMin', 'test1dot2', 'testLatest']);
grunt.registerTask('testMin', ['clean:test', 'shell:testMinimal', 'karma']);
grunt.registerTask('test1dot2', ['clean:test', 'shell:test1dot2', 'karma']);
grunt.registerTask('testLatest', ['clean:test', 'shell:testLatest', 'karma']);
grunt.registerTask('default', ['test', 'concat:dev', 'uglify:dev']);
grunt.registerTask('sample', ['concat:dev', 'copy:asset', 'copy:img', 'connect:livereload', 'open', 'watch']);
grunt.registerTask('release-prepare', 'Update all files for a release', function(target) {
if(!target) {
target = 'patch';
}
grunt.task.run(
'bump-only:' + target, // Version update
'test', // Tests
'concat:release', // Concat with release banner
'uglify:release', // Minify with release banner
'changelog', // Changelog update
'clean:release', // Delete old version download file
'compress:release', // New version download file
'replace:release' // Update version in download button (link & label)
);
});
};

View File

@@ -0,0 +1,24 @@
The MIT License
Copyright (c) 2013 Nicolas Cuillery
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,33 @@
{
"name": "angular-breadcrumb",
"description": "AngularJS module that generates a breadcrumb from ui-router's states",
"version": "0.4.1",
"main": "release/angular-breadcrumb.js",
"ignore": [
"sample",
"src",
"test",
".bowerrc",
".coveralls.yml",
".gitignore",
".jshintrc",
".travis.yml",
"gruntfile.js",
"bower.json",
"karma.conf.js",
"libpeerconnection.log",
"package.json",
"README.md"
],
"dependencies": {
"angular": ">=1.0.8",
"angular-ui-router": ">=0.2.0"
},
"devDependencies": {
"bootstrap": "~2.3.2",
"angular-ui-bootstrap-bower": "~0.8.0",
"underscore": "~1.5.1",
"angular-mocks": ">=1.0.8",
"angular-sanitize": ">=1.0.8"
}
}

View File

@@ -0,0 +1,369 @@
/*! angular-breadcrumb - v0.4.0-dev-2015-08-07
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
(function (window, angular, undefined) {
'use strict';
function isAOlderThanB(scopeA, scopeB) {
if(angular.equals(scopeA.length, scopeB.length)) {
return scopeA > scopeB;
} else {
return scopeA.length > scopeB.length;
}
}
function parseStateRef(ref) {
var parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
if (!parsed || parsed.length !== 4) { throw new Error("Invalid state ref '" + ref + "'"); }
return { state: parsed[1], paramExpr: parsed[3] || null };
}
function $Breadcrumb() {
var $$options = {
prefixStateName: null,
template: 'bootstrap3',
templateUrl: null,
includeAbstract : false
};
this.setOptions = function(options) {
angular.extend($$options, options);
};
this.$get = ['$state', '$stateParams', '$rootScope', function($state, $stateParams, $rootScope) {
var $lastViewScope = $rootScope;
// Early catch of $viewContentLoaded event
$rootScope.$on('$viewContentLoaded', function (event) {
// With nested views, the event occur several times, in "wrong" order
if(!event.targetScope.ncyBreadcrumbIgnore &&
isAOlderThanB(event.targetScope.$id, $lastViewScope.$id)) {
$lastViewScope = event.targetScope;
}
});
// Get the parent state
var $$parentState = function(state) {
// Check if state has explicit parent OR we try guess parent from its name
var parent = state.parent || (/^(.+)\.[^.]+$/.exec(state.name) || [])[1];
var isObjectParent = typeof parent === "object";
// if parent is a object reference, then extract the name
return isObjectParent ? parent.name : parent;
};
// Add the state in the chain if not already in and if not abstract
var $$addStateInChain = function(chain, stateRef) {
var conf,
parentParams,
ref = parseStateRef(stateRef),
force = false,
skip = false;
for(var i=0, l=chain.length; i<l; i+=1) {
if (chain[i].name === ref.state) {
return;
}
}
conf = $state.get(ref.state);
// Get breadcrumb options
if(conf.ncyBreadcrumb) {
if(conf.ncyBreadcrumb.force){ force = true; }
if(conf.ncyBreadcrumb.skip){ skip = true; }
}
if((!conf.abstract || $$options.includeAbstract || force) && !skip) {
if(ref.paramExpr) {
parentParams = $lastViewScope.$eval(ref.paramExpr);
}
conf.ncyBreadcrumbLink = $state.href(ref.state, parentParams || $stateParams || {});
chain.unshift(conf);
}
};
// Get the state for the parent step in the breadcrumb
var $$breadcrumbParentState = function(stateRef) {
var ref = parseStateRef(stateRef),
conf = $state.get(ref.state);
if(conf.ncyBreadcrumb && conf.ncyBreadcrumb.parent) {
// Handle the "parent" property of the breadcrumb, override the parent/child relation of the state
var isFunction = typeof conf.ncyBreadcrumb.parent === 'function';
var parentStateRef = isFunction ? conf.ncyBreadcrumb.parent($lastViewScope) : conf.ncyBreadcrumb.parent;
if(parentStateRef) {
return parentStateRef;
}
}
return $$parentState(conf);
};
return {
getTemplate: function(templates) {
if($$options.templateUrl) {
// templateUrl takes precedence over template
return null;
} else if(templates[$$options.template]) {
// Predefined templates (bootstrap, ...)
return templates[$$options.template];
} else {
return $$options.template;
}
},
getTemplateUrl: function() {
return $$options.templateUrl;
},
getStatesChain: function(exitOnFirst) { // Deliberately undocumented param, see getLastStep
var chain = [];
// From current state to the root
for(var stateRef = $state.$current.self.name; stateRef; stateRef=$$breadcrumbParentState(stateRef)) {
$$addStateInChain(chain, stateRef);
if(exitOnFirst && chain.length) {
return chain;
}
}
// Prefix state treatment
if($$options.prefixStateName) {
$$addStateInChain(chain, $$options.prefixStateName);
}
return chain;
},
getLastStep: function() {
var chain = this.getStatesChain(true);
return chain.length ? chain[0] : undefined;
},
$getLastViewScope: function() {
return $lastViewScope;
}
};
}];
}
var getExpression = function(interpolationFunction) {
if(interpolationFunction.expressions) {
return interpolationFunction.expressions;
} else {
var expressions = [];
angular.forEach(interpolationFunction.parts, function(part) {
if(angular.isFunction(part)) {
expressions.push(part.exp);
}
});
return expressions;
}
};
var registerWatchers = function(labelWatcherArray, interpolationFunction, viewScope, step) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function() {
step.ncyBreadcrumbLabel = interpolationFunction(viewScope);
});
labelWatcherArray.push(watcher);
});
};
var deregisterWatchers = function(labelWatcherArray) {
angular.forEach(labelWatcherArray, function(deregisterWatch) {
deregisterWatch();
});
};
function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
var $$templates = {
bootstrap2: '<ul class="breadcrumb">' +
'<li ng-repeat="step in steps" ng-switch="$last || !!step.abstract" ng-class="{active: $last}">' +
'<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
'<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
'<span class="divider" ng-hide="$last">/</span>' +
'</li>' +
'</ul>',
bootstrap3: '<ol class="breadcrumb">' +
'<li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract">' +
'<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
'<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
'</li>' +
'</ol>'
};
return {
restrict: 'AE',
replace: true,
scope: {},
template: $breadcrumb.getTemplate($$templates),
templateUrl: $breadcrumb.getTemplateUrl(),
link: {
post: function postLink(scope) {
var labelWatchers = [];
var renderBreadcrumb = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
var parseLabel = $interpolate(step.ncyBreadcrumb.label);
step.ncyBreadcrumbLabel = parseLabel(viewScope);
// Watcher for further viewScope updates
registerWatchers(labelWatchers, parseLabel, viewScope, step);
} else {
step.ncyBreadcrumbLabel = step.name;
}
});
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderBreadcrumb();
}
});
// View(s) may be already loaded while the directive's linking
renderBreadcrumb();
}
}
};
}
BreadcrumbDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
return {
restrict: 'A',
scope: {},
template: '{{ncyBreadcrumbLabel}}',
compile: function(cElement, cAttrs) {
// Override the default template if ncyBreadcrumbLast has a value
var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbLast);
if(template) {
cElement.html(template);
}
return {
post: function postLink(scope) {
var labelWatchers = [];
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
scope.ncyBreadcrumbLink = lastStep.ncyBreadcrumbLink;
if (lastStep.ncyBreadcrumb && lastStep.ncyBreadcrumb.label) {
var parseLabel = $interpolate(lastStep.ncyBreadcrumb.label);
scope.ncyBreadcrumbLabel = parseLabel(viewScope);
// Watcher for further viewScope updates
// Tricky last arg: the last step is the entire scope of the directive !
registerWatchers(labelWatchers, parseLabel, viewScope, scope);
} else {
scope.ncyBreadcrumbLabel = lastStep.name;
}
}
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderLabel();
}
});
// View(s) may be already loaded while the directive's linking
renderLabel();
}
};
}
};
}
BreadcrumbLastDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
return {
restrict: 'A',
scope: {},
template: '{{ncyBreadcrumbChain}}',
compile: function(cElement, cAttrs) {
// Override the default template if ncyBreadcrumbText has a value
var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbText);
if(template) {
cElement.html(template);
}
var separator = cElement.attr(cAttrs.$attr.ncyBreadcrumbTextSeparator) || ' / ';
return {
post: function postLink(scope) {
var labelWatchers = [];
var registerWatchersText = function(labelWatcherArray, interpolationFunction, viewScope) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function(newValue, oldValue) {
if (newValue !== oldValue) {
renderLabel();
}
});
labelWatcherArray.push(watcher);
});
};
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
angular.forEach(steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
var parseLabel = $interpolate(step.ncyBreadcrumb.label);
combinedLabels.push(parseLabel(viewScope));
// Watcher for further viewScope updates
registerWatchersText(labelWatchers, parseLabel, viewScope);
} else {
combinedLabels.push(step.name);
}
});
scope.ncyBreadcrumbChain = combinedLabels.join(separator);
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderLabel();
}
});
// View(s) may be already loaded while the directive's linking
renderLabel();
}
};
}
};
}
BreadcrumbTextDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
angular.module('ncy-angular-breadcrumb', ['ui.router.state'])
.provider('$breadcrumb', $Breadcrumb)
.directive('ncyBreadcrumb', BreadcrumbDirective)
.directive('ncyBreadcrumbLast', BreadcrumbLastDirective)
.directive('ncyBreadcrumbText', BreadcrumbTextDirective);
})(window, window.angular);

View File

@@ -0,0 +1,4 @@
/*! angular-breadcrumb - v0.4.0-dev-2015-08-07
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
!function(a,b,c){"use strict";function d(a,c){return b.equals(a.length,c.length)?a>c:a.length>c.length}function e(a){var b=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!b||4!==b.length)throw new Error("Invalid state ref '"+a+"'");return{state:b[1],paramExpr:b[3]||null}}function f(){var a={prefixStateName:null,template:"bootstrap3",templateUrl:null,includeAbstract:!1};this.setOptions=function(c){b.extend(a,c)},this.$get=["$state","$stateParams","$rootScope",function(b,f,g){var h=g;g.$on("$viewContentLoaded",function(a){!a.targetScope.ncyBreadcrumbIgnore&&d(a.targetScope.$id,h.$id)&&(h=a.targetScope)});var i=function(a){var b=a.parent||(/^(.+)\.[^.]+$/.exec(a.name)||[])[1],c="object"==typeof b;return c?b.name:b},j=function(c,d){for(var g,i,j=e(d),k=!1,l=!1,m=0,n=c.length;n>m;m+=1)if(c[m].name===j.state)return;g=b.get(j.state),g.ncyBreadcrumb&&(g.ncyBreadcrumb.force&&(k=!0),g.ncyBreadcrumb.skip&&(l=!0)),g["abstract"]&&!a.includeAbstract&&!k||l||(j.paramExpr&&(i=h.$eval(j.paramExpr)),g.ncyBreadcrumbLink=b.href(j.state,i||f||{}),c.unshift(g))},k=function(a){var c=e(a),d=b.get(c.state);if(d.ncyBreadcrumb&&d.ncyBreadcrumb.parent){var f="function"==typeof d.ncyBreadcrumb.parent,g=f?d.ncyBreadcrumb.parent(h):d.ncyBreadcrumb.parent;if(g)return g}return i(d)};return{getTemplate:function(b){return a.templateUrl?null:b[a.template]?b[a.template]:a.template},getTemplateUrl:function(){return a.templateUrl},getStatesChain:function(c){for(var d=[],e=b.$current.self.name;e;e=k(e))if(j(d,e),c&&d.length)return d;return a.prefixStateName&&j(d,a.prefixStateName),d},getLastStep:function(){var a=this.getStatesChain(!0);return a.length?a[0]:c},$getLastViewScope:function(){return h}}}]}function g(a,c,d){var e={bootstrap2:'<ul class="breadcrumb"><li ng-repeat="step in steps" ng-switch="$last || !!step.abstract" ng-class="{active: $last}"><a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a><span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span><span class="divider" ng-hide="$last">/</span></li></ul>',bootstrap3:'<ol class="breadcrumb"><li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract"><a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a><span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span></li></ol>'};return{restrict:"AE",replace:!0,scope:{},template:c.getTemplate(e),templateUrl:c.getTemplateUrl(),link:{post:function(e){var f=[],g=function(){l(f),f=[];var d=c.$getLastViewScope();e.steps=c.getStatesChain(),b.forEach(e.steps,function(b){if(b.ncyBreadcrumb&&b.ncyBreadcrumb.label){var c=a(b.ncyBreadcrumb.label);b.ncyBreadcrumbLabel=c(d),k(f,c,d,b)}else b.ncyBreadcrumbLabel=b.name})};d.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||g()}),g()}}}}function h(a,b,c){return{restrict:"A",scope:{},template:"{{ncyBreadcrumbLabel}}",compile:function(d,e){var f=d.attr(e.$attr.ncyBreadcrumbLast);return f&&d.html(f),{post:function(d){var e=[],f=function(){l(e),e=[];var c=b.$getLastViewScope(),f=b.getLastStep();if(f)if(d.ncyBreadcrumbLink=f.ncyBreadcrumbLink,f.ncyBreadcrumb&&f.ncyBreadcrumb.label){var g=a(f.ncyBreadcrumb.label);d.ncyBreadcrumbLabel=g(c),k(e,g,c,d)}else d.ncyBreadcrumbLabel=f.name};c.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||f()}),f()}}}}}function i(a,c,d){return{restrict:"A",scope:{},template:"{{ncyBreadcrumbChain}}",compile:function(e,f){var g=e.attr(f.$attr.ncyBreadcrumbText);g&&e.html(g);var h=e.attr(f.$attr.ncyBreadcrumbTextSeparator)||" / ";return{post:function(e){var f=[],g=function(a,c,d){b.forEach(j(c),function(b){var c=d.$watch(b,function(a,b){a!==b&&i()});a.push(c)})},i=function(){l(f),f=[];var d=c.$getLastViewScope(),i=c.getStatesChain(),j=[];b.forEach(i,function(b){if(b.ncyBreadcrumb&&b.ncyBreadcrumb.label){var c=a(b.ncyBreadcrumb.label);j.push(c(d)),g(f,c,d)}else j.push(b.name)}),e.ncyBreadcrumbChain=j.join(h)};d.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||i()}),i()}}}}}var j=function(a){if(a.expressions)return a.expressions;var c=[];return b.forEach(a.parts,function(a){b.isFunction(a)&&c.push(a.exp)}),c},k=function(a,c,d,e){b.forEach(j(c),function(b){var f=d.$watch(b,function(){e.ncyBreadcrumbLabel=c(d)});a.push(f)})},l=function(a){b.forEach(a,function(a){a()})};g.$inject=["$interpolate","$breadcrumb","$rootScope"],h.$inject=["$interpolate","$breadcrumb","$rootScope"],i.$inject=["$interpolate","$breadcrumb","$rootScope"],b.module("ncy-angular-breadcrumb",["ui.router.state"]).provider("$breadcrumb",f).directive("ncyBreadcrumb",g).directive("ncyBreadcrumbLast",h).directive("ncyBreadcrumbText",i)}(window,window.angular);

View File

@@ -0,0 +1,369 @@
/*! angular-breadcrumb - v0.4.1
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
(function (window, angular, undefined) {
'use strict';
function isAOlderThanB(scopeA, scopeB) {
if(angular.equals(scopeA.length, scopeB.length)) {
return scopeA > scopeB;
} else {
return scopeA.length > scopeB.length;
}
}
function parseStateRef(ref) {
var parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
if (!parsed || parsed.length !== 4) { throw new Error("Invalid state ref '" + ref + "'"); }
return { state: parsed[1], paramExpr: parsed[3] || null };
}
function $Breadcrumb() {
var $$options = {
prefixStateName: null,
template: 'bootstrap3',
templateUrl: null,
includeAbstract : false
};
this.setOptions = function(options) {
angular.extend($$options, options);
};
this.$get = ['$state', '$stateParams', '$rootScope', function($state, $stateParams, $rootScope) {
var $lastViewScope = $rootScope;
// Early catch of $viewContentLoaded event
$rootScope.$on('$viewContentLoaded', function (event) {
// With nested views, the event occur several times, in "wrong" order
if(!event.targetScope.ncyBreadcrumbIgnore &&
isAOlderThanB(event.targetScope.$id, $lastViewScope.$id)) {
$lastViewScope = event.targetScope;
}
});
// Get the parent state
var $$parentState = function(state) {
// Check if state has explicit parent OR we try guess parent from its name
var parent = state.parent || (/^(.+)\.[^.]+$/.exec(state.name) || [])[1];
var isObjectParent = typeof parent === "object";
// if parent is a object reference, then extract the name
return isObjectParent ? parent.name : parent;
};
// Add the state in the chain if not already in and if not abstract
var $$addStateInChain = function(chain, stateRef) {
var conf,
parentParams,
ref = parseStateRef(stateRef),
force = false,
skip = false;
for(var i=0, l=chain.length; i<l; i+=1) {
if (chain[i].name === ref.state) {
return;
}
}
conf = $state.get(ref.state);
// Get breadcrumb options
if(conf.ncyBreadcrumb) {
if(conf.ncyBreadcrumb.force){ force = true; }
if(conf.ncyBreadcrumb.skip){ skip = true; }
}
if((!conf.abstract || $$options.includeAbstract || force) && !skip) {
if(ref.paramExpr) {
parentParams = $lastViewScope.$eval(ref.paramExpr);
}
conf.ncyBreadcrumbLink = $state.href(ref.state, parentParams || $stateParams || {});
chain.unshift(conf);
}
};
// Get the state for the parent step in the breadcrumb
var $$breadcrumbParentState = function(stateRef) {
var ref = parseStateRef(stateRef),
conf = $state.get(ref.state);
if(conf.ncyBreadcrumb && conf.ncyBreadcrumb.parent) {
// Handle the "parent" property of the breadcrumb, override the parent/child relation of the state
var isFunction = typeof conf.ncyBreadcrumb.parent === 'function';
var parentStateRef = isFunction ? conf.ncyBreadcrumb.parent($lastViewScope) : conf.ncyBreadcrumb.parent;
if(parentStateRef) {
return parentStateRef;
}
}
return $$parentState(conf);
};
return {
getTemplate: function(templates) {
if($$options.templateUrl) {
// templateUrl takes precedence over template
return null;
} else if(templates[$$options.template]) {
// Predefined templates (bootstrap, ...)
return templates[$$options.template];
} else {
return $$options.template;
}
},
getTemplateUrl: function() {
return $$options.templateUrl;
},
getStatesChain: function(exitOnFirst) { // Deliberately undocumented param, see getLastStep
var chain = [];
// From current state to the root
for(var stateRef = $state.$current.self.name; stateRef; stateRef=$$breadcrumbParentState(stateRef)) {
$$addStateInChain(chain, stateRef);
if(exitOnFirst && chain.length) {
return chain;
}
}
// Prefix state treatment
if($$options.prefixStateName) {
$$addStateInChain(chain, $$options.prefixStateName);
}
return chain;
},
getLastStep: function() {
var chain = this.getStatesChain(true);
return chain.length ? chain[0] : undefined;
},
$getLastViewScope: function() {
return $lastViewScope;
}
};
}];
}
var getExpression = function(interpolationFunction) {
if(interpolationFunction.expressions) {
return interpolationFunction.expressions;
} else {
var expressions = [];
angular.forEach(interpolationFunction.parts, function(part) {
if(angular.isFunction(part)) {
expressions.push(part.exp);
}
});
return expressions;
}
};
var registerWatchers = function(labelWatcherArray, interpolationFunction, viewScope, step) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function() {
step.ncyBreadcrumbLabel = interpolationFunction(viewScope);
});
labelWatcherArray.push(watcher);
});
};
var deregisterWatchers = function(labelWatcherArray) {
angular.forEach(labelWatcherArray, function(deregisterWatch) {
deregisterWatch();
});
};
function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
var $$templates = {
bootstrap2: '<ul class="breadcrumb">' +
'<li ng-repeat="step in steps" ng-switch="$last || !!step.abstract" ng-class="{active: $last}">' +
'<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
'<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
'<span class="divider" ng-hide="$last">/</span>' +
'</li>' +
'</ul>',
bootstrap3: '<ol class="breadcrumb">' +
'<li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract">' +
'<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
'<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
'</li>' +
'</ol>'
};
return {
restrict: 'AE',
replace: true,
scope: {},
template: $breadcrumb.getTemplate($$templates),
templateUrl: $breadcrumb.getTemplateUrl(),
link: {
post: function postLink(scope) {
var labelWatchers = [];
var renderBreadcrumb = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
var parseLabel = $interpolate(step.ncyBreadcrumb.label);
step.ncyBreadcrumbLabel = parseLabel(viewScope);
// Watcher for further viewScope updates
registerWatchers(labelWatchers, parseLabel, viewScope, step);
} else {
step.ncyBreadcrumbLabel = step.name;
}
});
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderBreadcrumb();
}
});
// View(s) may be already loaded while the directive's linking
renderBreadcrumb();
}
}
};
}
BreadcrumbDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
return {
restrict: 'A',
scope: {},
template: '{{ncyBreadcrumbLabel}}',
compile: function(cElement, cAttrs) {
// Override the default template if ncyBreadcrumbLast has a value
var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbLast);
if(template) {
cElement.html(template);
}
return {
post: function postLink(scope) {
var labelWatchers = [];
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
scope.ncyBreadcrumbLink = lastStep.ncyBreadcrumbLink;
if (lastStep.ncyBreadcrumb && lastStep.ncyBreadcrumb.label) {
var parseLabel = $interpolate(lastStep.ncyBreadcrumb.label);
scope.ncyBreadcrumbLabel = parseLabel(viewScope);
// Watcher for further viewScope updates
// Tricky last arg: the last step is the entire scope of the directive !
registerWatchers(labelWatchers, parseLabel, viewScope, scope);
} else {
scope.ncyBreadcrumbLabel = lastStep.name;
}
}
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderLabel();
}
});
// View(s) may be already loaded while the directive's linking
renderLabel();
}
};
}
};
}
BreadcrumbLastDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
return {
restrict: 'A',
scope: {},
template: '{{ncyBreadcrumbChain}}',
compile: function(cElement, cAttrs) {
// Override the default template if ncyBreadcrumbText has a value
var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbText);
if(template) {
cElement.html(template);
}
var separator = cElement.attr(cAttrs.$attr.ncyBreadcrumbTextSeparator) || ' / ';
return {
post: function postLink(scope) {
var labelWatchers = [];
var registerWatchersText = function(labelWatcherArray, interpolationFunction, viewScope) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function(newValue, oldValue) {
if (newValue !== oldValue) {
renderLabel();
}
});
labelWatcherArray.push(watcher);
});
};
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];
var viewScope = $breadcrumb.$getLastViewScope();
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
angular.forEach(steps, function (step) {
if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
var parseLabel = $interpolate(step.ncyBreadcrumb.label);
combinedLabels.push(parseLabel(viewScope));
// Watcher for further viewScope updates
registerWatchersText(labelWatchers, parseLabel, viewScope);
} else {
combinedLabels.push(step.name);
}
});
scope.ncyBreadcrumbChain = combinedLabels.join(separator);
};
$rootScope.$on('$viewContentLoaded', function (event) {
if(!event.targetScope.ncyBreadcrumbIgnore) {
renderLabel();
}
});
// View(s) may be already loaded while the directive's linking
renderLabel();
}
};
}
};
}
BreadcrumbTextDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
angular.module('ncy-angular-breadcrumb', ['ui.router.state'])
.provider('$breadcrumb', $Breadcrumb)
.directive('ncyBreadcrumb', BreadcrumbDirective)
.directive('ncyBreadcrumbLast', BreadcrumbLastDirective)
.directive('ncyBreadcrumbText', BreadcrumbTextDirective);
})(window, window.angular);

View File

@@ -0,0 +1,4 @@
/*! angular-breadcrumb - v0.4.1
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
!function(a,b,c){"use strict";function d(a,c){return b.equals(a.length,c.length)?a>c:a.length>c.length}function e(a){var b=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!b||4!==b.length)throw new Error("Invalid state ref '"+a+"'");return{state:b[1],paramExpr:b[3]||null}}function f(){var a={prefixStateName:null,template:"bootstrap3",templateUrl:null,includeAbstract:!1};this.setOptions=function(c){b.extend(a,c)},this.$get=["$state","$stateParams","$rootScope",function(b,f,g){var h=g;g.$on("$viewContentLoaded",function(a){!a.targetScope.ncyBreadcrumbIgnore&&d(a.targetScope.$id,h.$id)&&(h=a.targetScope)});var i=function(a){var b=a.parent||(/^(.+)\.[^.]+$/.exec(a.name)||[])[1],c="object"==typeof b;return c?b.name:b},j=function(c,d){for(var g,i,j=e(d),k=!1,l=!1,m=0,n=c.length;n>m;m+=1)if(c[m].name===j.state)return;g=b.get(j.state),g.ncyBreadcrumb&&(g.ncyBreadcrumb.force&&(k=!0),g.ncyBreadcrumb.skip&&(l=!0)),g["abstract"]&&!a.includeAbstract&&!k||l||(j.paramExpr&&(i=h.$eval(j.paramExpr)),g.ncyBreadcrumbLink=b.href(j.state,i||f||{}),c.unshift(g))},k=function(a){var c=e(a),d=b.get(c.state);if(d.ncyBreadcrumb&&d.ncyBreadcrumb.parent){var f="function"==typeof d.ncyBreadcrumb.parent,g=f?d.ncyBreadcrumb.parent(h):d.ncyBreadcrumb.parent;if(g)return g}return i(d)};return{getTemplate:function(b){return a.templateUrl?null:b[a.template]?b[a.template]:a.template},getTemplateUrl:function(){return a.templateUrl},getStatesChain:function(c){for(var d=[],e=b.$current.self.name;e;e=k(e))if(j(d,e),c&&d.length)return d;return a.prefixStateName&&j(d,a.prefixStateName),d},getLastStep:function(){var a=this.getStatesChain(!0);return a.length?a[0]:c},$getLastViewScope:function(){return h}}}]}function g(a,c,d){var e={bootstrap2:'<ul class="breadcrumb"><li ng-repeat="step in steps" ng-switch="$last || !!step.abstract" ng-class="{active: $last}"><a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a><span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span><span class="divider" ng-hide="$last">/</span></li></ul>',bootstrap3:'<ol class="breadcrumb"><li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract"><a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a><span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span></li></ol>'};return{restrict:"AE",replace:!0,scope:{},template:c.getTemplate(e),templateUrl:c.getTemplateUrl(),link:{post:function(e){var f=[],g=function(){l(f),f=[];var d=c.$getLastViewScope();e.steps=c.getStatesChain(),b.forEach(e.steps,function(b){if(b.ncyBreadcrumb&&b.ncyBreadcrumb.label){var c=a(b.ncyBreadcrumb.label);b.ncyBreadcrumbLabel=c(d),k(f,c,d,b)}else b.ncyBreadcrumbLabel=b.name})};d.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||g()}),g()}}}}function h(a,b,c){return{restrict:"A",scope:{},template:"{{ncyBreadcrumbLabel}}",compile:function(d,e){var f=d.attr(e.$attr.ncyBreadcrumbLast);return f&&d.html(f),{post:function(d){var e=[],f=function(){l(e),e=[];var c=b.$getLastViewScope(),f=b.getLastStep();if(f)if(d.ncyBreadcrumbLink=f.ncyBreadcrumbLink,f.ncyBreadcrumb&&f.ncyBreadcrumb.label){var g=a(f.ncyBreadcrumb.label);d.ncyBreadcrumbLabel=g(c),k(e,g,c,d)}else d.ncyBreadcrumbLabel=f.name};c.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||f()}),f()}}}}}function i(a,c,d){return{restrict:"A",scope:{},template:"{{ncyBreadcrumbChain}}",compile:function(e,f){var g=e.attr(f.$attr.ncyBreadcrumbText);g&&e.html(g);var h=e.attr(f.$attr.ncyBreadcrumbTextSeparator)||" / ";return{post:function(e){var f=[],g=function(a,c,d){b.forEach(j(c),function(b){var c=d.$watch(b,function(a,b){a!==b&&i()});a.push(c)})},i=function(){l(f),f=[];var d=c.$getLastViewScope(),i=c.getStatesChain(),j=[];b.forEach(i,function(b){if(b.ncyBreadcrumb&&b.ncyBreadcrumb.label){var c=a(b.ncyBreadcrumb.label);j.push(c(d)),g(f,c,d)}else j.push(b.name)}),e.ncyBreadcrumbChain=j.join(h)};d.$on("$viewContentLoaded",function(a){a.targetScope.ncyBreadcrumbIgnore||i()}),i()}}}}}var j=function(a){if(a.expressions)return a.expressions;var c=[];return b.forEach(a.parts,function(a){b.isFunction(a)&&c.push(a.exp)}),c},k=function(a,c,d,e){b.forEach(j(c),function(b){var f=d.$watch(b,function(){e.ncyBreadcrumbLabel=c(d)});a.push(f)})},l=function(a){b.forEach(a,function(a){a()})};g.$inject=["$interpolate","$breadcrumb","$rootScope"],h.$inject=["$interpolate","$breadcrumb","$rootScope"],i.$inject=["$interpolate","$breadcrumb","$rootScope"],b.module("ncy-angular-breadcrumb",["ui.router.state"]).provider("$breadcrumb",f).directive("ncyBreadcrumb",g).directive("ncyBreadcrumbLast",h).directive("ncyBreadcrumbText",i)}(window,window.angular);

View File

@@ -0,0 +1,34 @@
{
"name": "angular-ui-router",
"version": "0.2.15",
"main": "./release/angular-ui-router.js",
"dependencies": {
"angular": ">= 1.0.8"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"component.json",
"package.json",
"lib",
"config",
"sample",
"test",
"tests",
"ngdoc_assets",
"Gruntfile.js",
"files.js"
],
"homepage": "https://github.com/angular-ui/ui-router",
"_release": "0.2.15",
"_resolution": {
"type": "version",
"tag": "0.2.15",
"commit": "805e69bae319e922e4d3265b7ef565058aaff850"
},
"_source": "git://github.com/angular-ui/ui-router.git",
"_target": "~0.2.15",
"_originalSource": "angular-ui-router",
"_direct": true
}

View File

@@ -0,0 +1,228 @@
<a name="0.2.14"></a>
### 0.2.14 (2015-04-23)
#### Bug Fixes
* **$StateRefDirective:** resolve missing support for svg anchor elements #1667 ([0149a7bb](https://github.com/angular-ui/ui-router/commit/0149a7bb38b7af99388a1ad7cc9909a7b7c4439d))
* **$urlMatcherFactory:**
* regex params should respect case-sensitivity ([1e10519f](https://github.com/angular-ui/ui-router/commit/1e10519f3be6bbf0cefdcce623cd2ade06e649e5), closes [#1671](https://github.com/angular-ui/ui-router/issues/1671))
* unquote all dashes from array params ([06664d33](https://github.com/angular-ui/ui-router/commit/06664d330f882390655dcfa83e10276110d0d0fa))
* add Type.$normalize function ([b0c6aa23](https://github.com/angular-ui/ui-router/commit/b0c6aa2350fdd3ce8483144774adc12f5a72b7e9))
* make optional params regex grouping optional ([06f73794](https://github.com/angular-ui/ui-router/commit/06f737945e83e668d09cfc3bcffd04a500ff1963), closes [#1576](https://github.com/angular-ui/ui-router/issues/1576))
* **$state:** allow about.*.** glob patterns ([e39b27a2](https://github.com/angular-ui/ui-router/commit/e39b27a2cb7d88525c446a041f9fbf1553202010))
* **uiSref:**
* use Object's toString instead of Window's toString ([2aa7f4d1](https://github.com/angular-ui/ui-router/commit/2aa7f4d139dbd5b9fcc4afdcf2ab6642c87f5671))
* add absolute to allowed transition options ([ae1b3c4e](https://github.com/angular-ui/ui-router/commit/ae1b3c4eedc37983400d830895afb50457c63af4))
* **uiSrefActive:** Apply active classes on lazy loaded states ([f0ddbe7b](https://github.com/angular-ui/ui-router/commit/f0ddbe7b4a91daf279c3b7d0cee732bb1f3be5b4))
* **uiView:** add `$element` to locals for view controller ([db68914c](https://github.com/angular-ui/ui-router/commit/db68914cd6c821e7dec8155bd33142a3a97f5453))
#### Features
* **$state:**
* support URLs with #fragments ([3da0a170](https://github.com/angular-ui/ui-router/commit/3da0a17069e27598c0f9d9164e104dd5ce05cdc6))
* inject resolve params into controllerProvider ([b380c223](https://github.com/angular-ui/ui-router/commit/b380c223fe12e2fde7582c0d6b1ed7b15a23579b), closes [#1131](https://github.com/angular-ui/ui-router/issues/1131))
* added 'state' to state reload method (feat no.1612) - modiefied options.reload ([b8f04575](https://github.com/angular-ui/ui-router/commit/b8f04575a8557035c1858c4d5c8dbde3e1855aaa))
* broadcast $stateChangeCancel event when event.preventDefault() is called in $sta ([ecefb758](https://github.com/angular-ui/ui-router/commit/ecefb758cb445e41620b62a272aafa3638613d7a))
* **$uiViewScroll:** change function to return promise ([c2a9a311](https://github.com/angular-ui/ui-router/commit/c2a9a311388bb212e5a2e820536d1d739f829ccd), closes [#1702](https://github.com/angular-ui/ui-router/issues/1702))
* **uiSrefActive:** Added support for multiple nested uiSref directives ([b1844948](https://github.com/angular-ui/ui-router/commit/b18449481d152b50705abfce2493a444eb059fa5))
<a name="0.2.13"></a>
### 0.2.13 (2014-11-20)
This release primarily fixes issues reported against 0.2.12
#### Bug Fixes
* **$state:** fix $state.includes/.is to apply param types before comparisions fix(uiSref): ma ([19715d15](https://github.com/angular-ui/ui-router/commit/19715d15e3cbfff724519e9febedd05b49c75baa), closes [#1513](https://github.com/angular-ui/ui-router/issues/1513))
* Avoid re-synchronizing from url after .transitionTo ([b267ecd3](https://github.com/angular-ui/ui-router/commit/b267ecd348e5c415233573ef95ebdbd051875f52), closes [#1573](https://github.com/angular-ui/ui-router/issues/1573))
* **$urlMatcherFactory:**
* Built-in date type uses local time zone ([d726bedc](https://github.com/angular-ui/ui-router/commit/d726bedcbb5f70a5660addf43fd52ec730790293))
* make date type fn check .is before running ([aa94ce3b](https://github.com/angular-ui/ui-router/commit/aa94ce3b86632ad05301530a2213099da73a3dc0), closes [#1564](https://github.com/angular-ui/ui-router/issues/1564))
* early binding of array handler bypasses type resolution ([ada4bc27](https://github.com/angular-ui/ui-router/commit/ada4bc27df5eff3ba3ab0de94a09bd91b0f7a28c))
* add 'any' Type for non-encoding non-url params ([3bfd75ab](https://github.com/angular-ui/ui-router/commit/3bfd75ab445ee2f1dd55275465059ed116b10b27), closes [#1562](https://github.com/angular-ui/ui-router/issues/1562))
* fix encoding slashes in params ([0c983a08](https://github.com/angular-ui/ui-router/commit/0c983a08e2947f999683571477debd73038e95cf), closes [#1119](https://github.com/angular-ui/ui-router/issues/1119))
* fix mixed path/query params ordering problem ([a479fbd0](https://github.com/angular-ui/ui-router/commit/a479fbd0b8eb393a94320973e5b9a62d83912ee2), closes [#1543](https://github.com/angular-ui/ui-router/issues/1543))
* **ArrayType:**
* specify empty array mapping corner case ([74aa6091](https://github.com/angular-ui/ui-router/commit/74aa60917e996b0b4e27bbb4eb88c3c03832021d), closes [#1511](https://github.com/angular-ui/ui-router/issues/1511))
* fix .equals for array types ([5e6783b7](https://github.com/angular-ui/ui-router/commit/5e6783b77af9a90ddff154f990b43dbb17eeda6e), closes [#1538](https://github.com/angular-ui/ui-router/issues/1538))
* **Param:** fix default value shorthand declaration ([831d812a](https://github.com/angular-ui/ui-router/commit/831d812a524524c71f0ee1c9afaf0487a5a66230), closes [#1554](https://github.com/angular-ui/ui-router/issues/1554))
* **common:** fixed the _.filter clone to not create sparse arrays ([750f5cf5](https://github.com/angular-ui/ui-router/commit/750f5cf5fd91f9ada96f39e50d39aceb2caf22b6), closes [#1563](https://github.com/angular-ui/ui-router/issues/1563))
* **ie8:** fix calls to indexOf and filter ([dcb31b84](https://github.com/angular-ui/ui-router/commit/dcb31b843391b3e61dee4de13f368c109541813e), closes [#1556](https://github.com/angular-ui/ui-router/issues/1556))
#### Features
* add json parameter Type ([027f1fcf](https://github.com/angular-ui/ui-router/commit/027f1fcf9c0916cea651e88981345da6f9ff214a))
<a name="0.2.12"></a>
### 0.2.12 (2014-11-13)
#### Bug Fixes
* **$resolve:** use resolve fn result, not parent resolved value of same name ([67f5e00c](https://github.com/angular-ui/ui-router/commit/67f5e00cc9aa006ce3fe6cde9dff261c28eab70a), closes [#1317], [#1353])
* **$state:**
* populate default params in .transitionTo. ([3f60fbe6](https://github.com/angular-ui/ui-router/commit/3f60fbe6d65ebeca8d97952c05aa1d269f1b7ba1), closes [#1396])
* reload() now reinvokes controllers ([73443420](https://github.com/angular-ui/ui-router/commit/7344342018847902594dc1fc62d30a5c30f01763), closes [#582])
* do not emit $viewContentLoading if notify: false ([74255feb](https://github.com/angular-ui/ui-router/commit/74255febdf48ae082a02ca1e735165f2c369a463), closes [#1387](https://github.com/angular-ui/ui-router/issues/1387))
* register states at config-time ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))
* handle parent.name when parent is obj ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))
* **$urlMatcherFactory:**
* register types at config ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a), closes [#1476])
* made path params default value "" for backwards compat ([8f998e71](https://github.com/angular-ui/ui-router/commit/8f998e71e43a0b31293331c981f5db0f0097b8ba))
* Pre-replace certain param values for better mapping ([6374a3e2](https://github.com/angular-ui/ui-router/commit/6374a3e29ab932014a7c77d2e1ab884cc841a2e3))
* fixed ParamSet.$$keys() ordering ([9136fecb](https://github.com/angular-ui/ui-router/commit/9136fecbc2bfd4fda748a9914f0225a46c933860))
* empty string policy now respected in Param.value() ([db12c85c](https://github.com/angular-ui/ui-router/commit/db12c85c16f2d105415f9bbbdeb11863f64728e0))
* "string" type now encodes/decodes slashes ([3045e415](https://github.com/angular-ui/ui-router/commit/3045e41577a8b8b8afc6039f42adddf5f3c061ec), closes [#1119])
* allow arrays in both path and query params ([fdd2f2c1](https://github.com/angular-ui/ui-router/commit/fdd2f2c191c4a67c874fdb9ec9a34f8dde9ad180), closes [#1073], [#1045], [#1486], [#1394])
* typed params in search ([8d4cab69](https://github.com/angular-ui/ui-router/commit/8d4cab69dd67058e1a716892cc37b7d80a57037f), closes [#1488](https://github.com/angular-ui/ui-router/issues/1488))
* no longer generate unroutable urls ([cb9fd9d8](https://github.com/angular-ui/ui-router/commit/cb9fd9d8943cb26c7223f6990db29c82ae8740f8), closes [#1487](https://github.com/angular-ui/ui-router/issues/1487))
* handle optional parameter followed by required parameter in url format. ([efc72106](https://github.com/angular-ui/ui-router/commit/efc72106ddcc4774b48ea176a505ef9e95193b41))
* default to parameter string coersion. ([13a468a7](https://github.com/angular-ui/ui-router/commit/13a468a7d54c2fb0751b94c0c1841d580b71e6dc), closes [#1414](https://github.com/angular-ui/ui-router/issues/1414))
* concat respects strictMode/caseInsensitive ([dd72e103](https://github.com/angular-ui/ui-router/commit/dd72e103edb342d9cf802816fe127e1bbd68fd5f), closes [#1395])
* **ui-sref:**
* Allow sref state options to take a scope object ([b5f7b596](https://github.com/angular-ui/ui-router/commit/b5f7b59692ce4933e2d63eb5df3f50a4ba68ccc0))
* replace raw href modification with attrs. ([08c96782](https://github.com/angular-ui/ui-router/commit/08c96782faf881b0c7ab00afc233ee6729548fa0))
* nagivate to state when url is "" fix($state.href): generate href for state with ([656b5aab](https://github.com/angular-ui/ui-router/commit/656b5aab906e5749db9b5a080c6a83b95f50fd91), closes [#1363](https://github.com/angular-ui/ui-router/issues/1363))
* Check that state is defined in isMatch() ([92aebc75](https://github.com/angular-ui/ui-router/commit/92aebc7520f88babdc6e266536086e07263514c3), closes [#1314](https://github.com/angular-ui/ui-router/issues/1314), [#1332](https://github.com/angular-ui/ui-router/issues/1332))
* **uiView:**
* allow inteprolated ui-view names ([81f6a19a](https://github.com/angular-ui/ui-router/commit/81f6a19a432dac9198fd33243855bfd3b4fea8c0), closes [#1324](https://github.com/angular-ui/ui-router/issues/1324))
* Made anim work with angular 1.3 ([c3bb7ad9](https://github.com/angular-ui/ui-router/commit/c3bb7ad903da1e1f3c91019cfd255be8489ff4ef), closes [#1367](https://github.com/angular-ui/ui-router/issues/1367), [#1345](https://github.com/angular-ui/ui-router/issues/1345))
* **urlRouter:** html5Mode accepts an object from angular v1.3.0-rc.3 ([7fea1e9d](https://github.com/angular-ui/ui-router/commit/7fea1e9d0d8c6e09cc6c895ecb93d4221e9adf48))
* **stateFilters:** mark state filters as stateful. ([a00b353e](https://github.com/angular-ui/ui-router/commit/a00b353e3036f64a81245c4e7898646ba218f833), closes [#1479])
* **ui-router:** re-add IE8 compatibility for map/filter/keys ([8ce69d9f](https://github.com/angular-ui/ui-router/commit/8ce69d9f7c886888ab53eca7e53536f36b428aae), closes [#1518], [#1383])
* **package:** point 'main' to a valid filename ([ac903350](https://github.com/angular-ui/ui-router/commit/ac9033501debb63364539d91fbf3a0cba4579f8e))
* **travis:** make CI build faster ([0531de05](https://github.com/angular-ui/ui-router/commit/0531de052e414a8d839fbb4e7635e923e94865b3))
#### Features
##### Default and Typed params
This release includes a lot of bug fixes around default/optional and typed parameters. As such, 0.2.12 is the first release where we recommend those features be used.
* **$state:**
* add state params validation ([b1379e6a](https://github.com/angular-ui/ui-router/commit/b1379e6a4d38f7ed7436e05873932d7c279af578), closes [#1433](https://github.com/angular-ui/ui-router/issues/1433))
* is/includes/get work on relative stateOrName ([232e94b3](https://github.com/angular-ui/ui-router/commit/232e94b3c2ca2c764bb9510046e4b61690c87852))
* .reload() returns state transition promise ([639e0565](https://github.com/angular-ui/ui-router/commit/639e0565dece9d5544cc93b3eee6e11c99bd7373))
* **$templateFactory:** request templateURL as text/html ([ccd60769](https://github.com/angular-ui/ui-router/commit/ccd6076904a4b801d77b47f6e2de4c06ce9962f8), closes [#1287])
* **$urlMatcherFactory:** Made a Params and ParamSet class ([0cc1e6cc](https://github.com/angular-ui/ui-router/commit/0cc1e6cc461a4640618e2bb594566551c54834e2))
<a name="0.2.11"></a>
### 0.2.11 (2014-08-26)
#### Bug Fixes
* **$resolve:** Resolves only inherit from immediate parent fixes #702 ([df34e20c](https://github.com/angular-ui/ui-router/commit/df34e20c576299e7a3c8bd4ebc68d42341c0ace9))
* **$state:**
* change $state.href default options.inherit to true ([deea695f](https://github.com/angular-ui/ui-router/commit/deea695f5cacc55de351ab985144fd233c02a769))
* sanity-check state lookups ([456fd5ae](https://github.com/angular-ui/ui-router/commit/456fd5aec9ea507518927bfabd62b4afad4cf714), closes [#980](https://github.com/angular-ui/ui-router/issues/980))
* didn't comply to inherit parameter ([09836781](https://github.com/angular-ui/ui-router/commit/09836781f126c1c485b06551eb9cfd4fa0f45c35))
* allow view content loading broadcast ([7b78edee](https://github.com/angular-ui/ui-router/commit/7b78edeeb52a74abf4d3f00f79534033d5a08d1a))
* **$urlMatcherFactory:**
* detect injected functions ([91f75ae6](https://github.com/angular-ui/ui-router/commit/91f75ae66c4d129f6f69e53bd547594e9661f5d5))
* syntax ([1ebed370](https://github.com/angular-ui/ui-router/commit/1ebed37069bae8614d41541d56521f5c45f703f3))
* **UrlMatcher:**
* query param function defaults ([f9c20530](https://github.com/angular-ui/ui-router/commit/f9c205304f10d8a4ebe7efe9025e642016479a51))
* don't decode default values ([63607bdb](https://github.com/angular-ui/ui-router/commit/63607bdbbcb432d3fb37856a1cb3da0cd496804e))
* **travis:** update Node version to fix build ([d6b95ef2](https://github.com/angular-ui/ui-router/commit/d6b95ef23d9dacb4eba08897f5190a0bcddb3a48))
* **uiSref:**
* Generate an href for states with a blank url. closes #1293 ([691745b1](https://github.com/angular-ui/ui-router/commit/691745b12fa05d3700dd28f0c8d25f8a105074ad))
* should inherit params by default ([b973dad1](https://github.com/angular-ui/ui-router/commit/b973dad155ad09a7975e1476bd096f7b2c758eeb))
* cancel transition if preventDefault() has been called ([2e6d9167](https://github.com/angular-ui/ui-router/commit/2e6d9167d3afbfbca6427e53e012f94fb5fb8022))
* **uiView:** Fixed infinite loop when is called .go() from a controller. ([e13988b8](https://github.com/angular-ui/ui-router/commit/e13988b8cd6231d75c78876ee9d012cc87f4a8d9), closes [#1194](https://github.com/angular-ui/ui-router/issues/1194))
* **docs:**
* Fixed link to milestones ([6c0ae500](https://github.com/angular-ui/ui-router/commit/6c0ae500cc238ea9fc95adcc15415c55fc9e1f33))
* fix bug in decorator example ([4bd00af5](https://github.com/angular-ui/ui-router/commit/4bd00af50b8b88a49d1545a76290731cb8e0feb1))
* Removed an incorrect semi-colon ([af97cef8](https://github.com/angular-ui/ui-router/commit/af97cef8b967f2e32177e539ef41450dca131a7d))
* Explain return value of rule as function ([5e887890](https://github.com/angular-ui/ui-router/commit/5e8878900a6ffe59a81aed531a3925e34a297377))
#### Features
* **$state:**
* allow parameters to pass unharmed ([8939d057](https://github.com/angular-ui/ui-router/commit/8939d0572ab1316e458ef016317ecff53131a822))
* **BREAKING CHANGE**: state parameters are no longer automatically coerced to strings, and unspecified parameter values are now set to undefined rather than null.
* allow prevent syncUrl on failure ([753060b9](https://github.com/angular-ui/ui-router/commit/753060b910d5d2da600a6fa0757976e401c33172))
* **typescript:** Add typescript definitions for component builds ([521ceb3f](https://github.com/angular-ui/ui-router/commit/521ceb3fd7850646422f411921e21ce5e7d82e0f))
* **uiSref:** extend syntax for ui-sref ([71cad3d6](https://github.com/angular-ui/ui-router/commit/71cad3d636508b5a9fe004775ad1f1adc0c80c3e))
* **uiSrefActive:**
* Also activate for child states. ([bf163ad6](https://github.com/angular-ui/ui-router/commit/bf163ad6ce176ce28792696c8302d7cdf5c05a01), closes [#818](https://github.com/angular-ui/ui-router/issues/818))
* **BREAKING CHANGE** Since ui-sref-active now activates even when child states are active you may need to swap out your ui-sref-active with ui-sref-active-eq, thought typically we think devs want the auto inheritance.
* uiSrefActiveEq: new directive with old ui-sref-active behavior
* **$urlRouter:**
* defer URL change interception ([c72d8ce1](https://github.com/angular-ui/ui-router/commit/c72d8ce11916d0ac22c81b409c9e61d7048554d7))
* force URLs to have valid params ([d48505cd](https://github.com/angular-ui/ui-router/commit/d48505cd328d83e39d5706e085ba319715f999a6))
* abstract $location handling ([08b4636b](https://github.com/angular-ui/ui-router/commit/08b4636b294611f08db35f00641eb5211686fb50))
* **$urlMatcherFactory:**
* fail on bad parameters ([d8f124c1](https://github.com/angular-ui/ui-router/commit/d8f124c10d00c7e5dde88c602d966db261aea221))
* date type support ([b7f074ff](https://github.com/angular-ui/ui-router/commit/b7f074ff65ca150a3cdbda4d5ad6cb17107300eb))
* implement type support ([450b1f0e](https://github.com/angular-ui/ui-router/commit/450b1f0e8e03c738174ff967f688b9a6373290f4))
* **UrlMatcher:**
* handle query string arrays ([9cf764ef](https://github.com/angular-ui/ui-router/commit/9cf764efab45fa9309368688d535ddf6e96d6449), closes [#373](https://github.com/angular-ui/ui-router/issues/373))
* injectable functions as defaults ([00966ecd](https://github.com/angular-ui/ui-router/commit/00966ecd91fb745846039160cab707bfca8b3bec))
* default values & type decoding for query params ([a472b301](https://github.com/angular-ui/ui-router/commit/a472b301389fbe84d1c1fa9f24852b492a569d11))
* allow shorthand definitions ([5b724304](https://github.com/angular-ui/ui-router/commit/5b7243049793505e44b6608ea09878c37c95b1f5))
* validates whole interface ([32b27db1](https://github.com/angular-ui/ui-router/commit/32b27db173722e9194ef1d5c0ea7d93f25a98d11))
* implement non-strict matching ([a3e21366](https://github.com/angular-ui/ui-router/commit/a3e21366bee0475c9795a1ec76f70eec41c5b4e3))
* add per-param config support ([07b3029f](https://github.com/angular-ui/ui-router/commit/07b3029f4d409cf955780113df92e36401b47580))
* **BREAKING CHANGE**: the `params` option in state configurations must now be an object keyed by parameter name.
### 0.2.10 (2014-03-12)
#### Bug Fixes
* **$state:** use $browser.baseHref() when generating urls with .href() ([cbcc8488](https://github.com/angular-ui/ui-router/commit/cbcc84887d6b6d35258adabb97c714cd9c1e272d))
* **bower.json:** JS files should not be ignored ([ccdab193](https://github.com/angular-ui/ui-router/commit/ccdab193315f304eb3be5f5b97c47a926c79263e))
* **dev:** karma:background task is missing, can't run grunt:dev. ([d9f7b898](https://github.com/angular-ui/ui-router/commit/d9f7b898e8e3abb8c846b0faa16a382913d7b22b))
* **sample:** Contacts menu button not staying active when navigating to detail states. Need t ([2fcb8443](https://github.com/angular-ui/ui-router/commit/2fcb84437cb43ade12682a92b764f13cac77dfe7))
* **uiSref:** support mock-clicks/events with no data ([717d3ff7](https://github.com/angular-ui/ui-router/commit/717d3ff7d0ba72d239892dee562b401cdf90e418))
* **uiView:**
* Do NOT autoscroll when autoscroll attr is missing ([affe5bd7](https://github.com/angular-ui/ui-router/commit/affe5bd785cdc3f02b7a9f64a52e3900386ec3a0), closes [#807](https://github.com/angular-ui/ui-router/issues/807))
* Refactoring uiView directive to copy ngView logic ([548fab6a](https://github.com/angular-ui/ui-router/commit/548fab6ab9debc9904c5865c8bc68b4fc3271dd0), closes [#857](https://github.com/angular-ui/ui-router/issues/857), [#552](https://github.com/angular-ui/ui-router/issues/552))
#### Features
* **$state:** includes() allows glob patterns for state matching. ([2d5f6b37](https://github.com/angular-ui/ui-router/commit/2d5f6b37191a3135f4a6d9e8f344c54edcdc065b))
* **UrlMatcher:** Add support for case insensitive url matching ([642d5247](https://github.com/angular-ui/ui-router/commit/642d524799f604811e680331002feec7199a1fb5))
* **uiSref:** add support for transition options ([2ed7a728](https://github.com/angular-ui/ui-router/commit/2ed7a728cee6854b38501fbc1df6139d3de5b28a))
* **uiView:** add controllerAs config with function ([1ee7334a](https://github.com/angular-ui/ui-router/commit/1ee7334a73efeccc9b95340e315cdfd59944762d))
### 0.2.9 (2014-01-17)
This release is identical to 0.2.8. 0.2.8 was re-tagged in git to fix a problem with bower.
### 0.2.8 (2014-01-16)
#### Bug Fixes
* **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))
* **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))
* **bower.json:** fixes bower.json ([eed3cc4d](https://github.com/angular-ui/ui-router/commit/eed3cc4d4dfef1d3ef84b9fd063127538ebf59d3))
* **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))
* **uiView:**
* autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))
* don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))
* test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))
* it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))
#### Features
* **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))
* **uiView:**
* merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))
* cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))

View File

@@ -0,0 +1,65 @@
# Report an Issue
Help us make UI-Router better! If you think you might have found a bug, or some other weirdness, start by making sure
it hasn't already been reported. You can [search through existing issues](https://github.com/angular-ui/ui-router/search?q=wat%3F&type=Issues)
to see if someone's reported one similar to yours.
If not, then [create a plunkr](http://bit.ly/UIR-Plunk) that demonstrates the problem (try to use as little code
as possible: the more minimalist, the faster we can debug it).
Next, [create a new issue](https://github.com/angular-ui/ui-router/issues/new) that briefly explains the problem,
and provides a bit of background as to the circumstances that triggered it. Don't forget to include the link to
that plunkr you created!
**Note**: If you're unsure how a feature is used, or are encountering some unexpected behavior that you aren't sure
is a bug, it's best to talk it out on
[StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) before reporting it. This
keeps development streamlined, and helps us focus on building great software.
Issues only! |
-------------|
Please keep in mind that the issue tracker is for *issues*. Please do *not* post an issue if you need help or support. Instead, see one of the above-mentioned forums or [IRC](irc://irc.freenode.net/#angularjs). |
####Purple Labels
A purple label means that **you** need to take some further action.
- ![Not Actionable - Need Info](http://angular-ui.github.io/ui-router/images/notactionable.png): Your issue is not specific enough, or there is no clear action that we can take. Please clarify and refine your issue.
- ![Plunkr Please](http://angular-ui.github.io/ui-router/images/plunkrplease.png): Please [create a plunkr](http://bit.ly/UIR-Plunk)
- ![StackOverflow](http://angular-ui.github.io/ui-router/images/stackoverflow.png): We suspect your issue is really a help request, or could be answered by the community. Please ask your question on [StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router). If you determine that is an actual issue, please explain why.
If your issue gets labeled with purple label, no further action will be taken until you respond to the label appropriately.
# Contribute
**(1)** See the **[Developing](#developing)** section below, to get the development version of UI-Router up and running on your local machine.
**(2)** Check out the [roadmap](https://github.com/angular-ui/ui-router/milestones) to see where the project is headed, and if your feature idea fits with where we're headed.
**(3)** If you're not sure, [open an RFC](https://github.com/angular-ui/ui-router/issues/new?title=RFC:%20My%20idea) to get some feedback on your idea.
**(4)** Finally, commit some code and open a pull request. Code & commits should abide by the following rules:
- *Always* have test coverage for new features (or regression tests for bug fixes), and *never* break existing tests
- Commits should represent one logical change each; if a feature goes through multiple iterations, squash your commits down to one
- Make sure to follow the [Angular commit message format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) so your change will appear in the changelog of the next release.
- Changes should always respect the coding style of the project
# Developing
UI-Router uses <code>grunt >= 0.4.x</code>. Make sure to upgrade your environment and read the
[Migration Guide](http://gruntjs.com/upgrading-from-0.3-to-0.4).
Dependencies for building from source and running tests:
* [grunt-cli](https://github.com/gruntjs/grunt-cli) - run: `$ npm install -g grunt-cli`
* Then, install the development dependencies by running `$ npm install` from the project directory
There are a number of targets in the gruntfile that are used to generating different builds:
* `grunt`: Perform a normal build, runs jshint and karma tests
* `grunt build`: Perform a normal build
* `grunt dist`: Perform a clean build and generate documentation
* `grunt dev`: Run dev server (sample app) and watch for changes, builds and runs karma tests on changes.

View File

@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2015 The AngularUI Team, Karsten Sperling
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,245 @@
# AngularUI Router &nbsp;[![Build Status](https://travis-ci.org/angular-ui/ui-router.svg?branch=master)](https://travis-ci.org/angular-ui/ui-router)
#### The de-facto solution to flexible routing with nested views
---
**[Download 0.2.15](http://angular-ui.github.io/ui-router/release/angular-ui-router.js)** (or **[Minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js)**) **|**
**[Guide](https://github.com/angular-ui/ui-router/wiki) |**
**[API](http://angular-ui.github.io/ui-router/site) |**
**[Sample](http://angular-ui.github.com/ui-router/sample/) ([Src](https://github.com/angular-ui/ui-router/tree/gh-pages/sample)) |**
**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions) |**
**[Resources](#resources) |**
**[Report an Issue](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#report-an-issue) |**
**[Contribute](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#contribute) |**
**[Help!](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) |**
**[Discuss](https://groups.google.com/forum/#!categories/angular-ui/router)**
---
AngularUI Router is a routing framework for [AngularJS](http://angularjs.org), which allows you to organize the
parts of your interface into a [*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine). Unlike the
[`$route` service](http://docs.angularjs.org/api/ngRoute.$route) in the Angular ngRoute module, which is organized around URL
routes, UI-Router is organized around [*states*](https://github.com/angular-ui/ui-router/wiki),
which may optionally have routes, as well as other behavior, attached.
States are bound to *named*, *nested* and *parallel views*, allowing you to powerfully manage your application's interface.
Check out the sample app: http://angular-ui.github.io/ui-router/sample/
-
**Note:** *UI-Router is under active development. As such, while this library is well-tested, the API may change. Consider using it in production applications only if you're comfortable following a changelog and updating your usage accordingly.*
## Get Started
**(1)** Get UI-Router in one of the following ways:
- clone & [build](CONTRIBUTING.md#developing) this repository
- [download the release](http://angular-ui.github.io/ui-router/release/angular-ui-router.js) (or [minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js))
- [link to cdn](http://cdnjs.com/libraries/angular-ui-router)
- via **[jspm](http://jspm.io/)**: by running `$ jspm install angular-ui-router` from your console
- or via **[npm](https://www.npmjs.org/)**: by running `$ npm install angular-ui-router` from your console
- or via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console
- or via **[Component](https://github.com/component/component)**: by running `$ component install angular-ui/ui-router` from your console
**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself (For Component users: ignore this step)
**(3)** Add `'ui.router'` to your main module's list of dependencies (For Component users: replace `'ui.router'` with `require('angular-ui-router')`)
When you're done, your setup should look similar to the following:
>
```html
<!doctype html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<script>
var myApp = angular.module('myApp', ['ui.router']);
// For Component users, it should look like this:
// var myApp = angular.module('myApp', [require('angular-ui-router')]);
</script>
...
</head>
<body>
...
</body>
</html>
```
### [Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)
The majority of UI-Router's power is in its ability to nest states & views.
**(1)** First, follow the [setup](#get-started) instructions detailed above.
**(2)** Then, add a [`ui-view` directive](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-view) to the `<body />` of your app.
>
```html
<!-- index.html -->
<body>
<div ui-view></div>
<!-- We'll also add some navigation: -->
<a ui-sref="state1">State 1</a>
<a ui-sref="state2">State 2</a>
</body>
```
**(3)** You'll notice we also added some links with [`ui-sref` directives](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref). In addition to managing state transitions, this directive auto-generates the `href` attribute of the `<a />` element it's attached to, if the corresponding state has a URL. Next we'll add some templates. These will plug into the `ui-view` within `index.html`. Notice that they have their own `ui-view` as well! That is the key to nesting states and views.
>
```html
<!-- partials/state1.html -->
<h1>State 1</h1>
<hr/>
<a ui-sref="state1.list">Show List</a>
<div ui-view></div>
```
```html
<!-- partials/state2.html -->
<h1>State 2</h1>
<hr/>
<a ui-sref="state2.list">Show List</a>
<div ui-view></div>
```
**(4)** Next, we'll add some child templates. *These* will get plugged into the `ui-view` of their parent state templates.
>
```html
<!-- partials/state1.list.html -->
<h3>List of State 1 Items</h3>
<ul>
<li ng-repeat="item in items">{{ item }}</li>
</ul>
```
>
```html
<!-- partials/state2.list.html -->
<h3>List of State 2 Things</h3>
<ul>
<li ng-repeat="thing in things">{{ thing }}</li>
</ul>
```
**(5)** Finally, we'll wire it all up with `$stateProvider`. Set up your states in the module config, as in the following:
>
```javascript
myApp.config(function($stateProvider, $urlRouterProvider) {
//
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/state1");
//
// Now set up the states
$stateProvider
.state('state1', {
url: "/state1",
templateUrl: "partials/state1.html"
})
.state('state1.list', {
url: "/list",
templateUrl: "partials/state1.list.html",
controller: function($scope) {
$scope.items = ["A", "List", "Of", "Items"];
}
})
.state('state2', {
url: "/state2",
templateUrl: "partials/state2.html"
})
.state('state2.list', {
url: "/list",
templateUrl: "partials/state2.list.html",
controller: function($scope) {
$scope.things = ["A", "Set", "Of", "Things"];
}
});
});
```
**(6)** See this quick start example in action.
>**[Go to Quick Start Plunker for Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)**
**(7)** This only scratches the surface
>**[Dive Deeper!](https://github.com/angular-ui/ui-router/wiki)**
### [Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)
Another great feature is the ability to have multiple `ui-view`s view per template.
**Pro Tip:** *While multiple parallel views are a powerful feature, you'll often be able to manage your
interfaces more effectively by nesting your views, and pairing those views with nested states.*
**(1)** Follow the [setup](#get-started) instructions detailed above.
**(2)** Add one or more `ui-view` to your app, give them names.
>
```html
<!-- index.html -->
<body>
<div ui-view="viewA"></div>
<div ui-view="viewB"></div>
<!-- Also a way to navigate -->
<a ui-sref="route1">Route 1</a>
<a ui-sref="route2">Route 2</a>
</body>
```
**(3)** Set up your states in the module config:
>
```javascript
myApp.config(function($stateProvider) {
$stateProvider
.state('index', {
url: "",
views: {
"viewA": { template: "index.viewA" },
"viewB": { template: "index.viewB" }
}
})
.state('route1', {
url: "/route1",
views: {
"viewA": { template: "route1.viewA" },
"viewB": { template: "route1.viewB" }
}
})
.state('route2', {
url: "/route2",
views: {
"viewA": { template: "route2.viewA" },
"viewB": { template: "route2.viewB" }
}
})
});
```
**(4)** See this quick start example in action.
>**[Go to Quick Start Plunker for Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)**
## Resources
* [In-Depth Guide](https://github.com/angular-ui/ui-router/wiki)
* [API Reference](http://angular-ui.github.io/ui-router/site)
* [Sample App](http://angular-ui.github.com/ui-router/sample/) ([Source](https://github.com/angular-ui/ui-router/tree/gh-pages/sample))
* [FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)
* [Slides comparing ngRoute to ui-router](http://slid.es/timkindberg/ui-router#/)
* [UI-Router Extras / Addons](http://christopherthielen.github.io/ui-router-extras/#/home) (@christopherthielen)
### Videos
* [Introduction Video](https://egghead.io/lessons/angularjs-introduction-ui-router) (egghead.io)
* [Tim Kindberg on Angular UI-Router](https://www.youtube.com/watch?v=lBqiZSemrqg)
* [Activating States](https://egghead.io/lessons/angularjs-ui-router-activating-states) (egghead.io)
* [Learn Angular.js using UI-Router](http://youtu.be/QETUuZ27N0w) (LearnCode.academy)
## Reporting issues and Contributing
Please read our [Contributor guidelines](CONTRIBUTING.md) before reporting an issue or creating a pull request.

View File

@@ -0,0 +1,126 @@
// Type definitions for Angular JS 1.1.5+ (ui.router module)
// Project: https://github.com/angular-ui/ui-router
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module ng.ui {
interface IState {
name?: string;
template?: string;
templateUrl?: any; // string || () => string
templateProvider?: any; // () => string || IPromise<string>
controller?: any;
controllerAs?: string;
controllerProvider?: any;
resolve?: {};
url?: string;
params?: any;
views?: {};
abstract?: boolean;
onEnter?: (...args: any[]) => void;
onExit?: (...args: any[]) => void;
data?: any;
reloadOnSearch?: boolean;
}
interface ITypedState<T> extends IState {
data?: T;
}
interface IStateProvider extends IServiceProvider {
state(name: string, config: IState): IStateProvider;
state(config: IState): IStateProvider;
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
}
interface IUrlMatcher {
concat(pattern: string): IUrlMatcher;
exec(path: string, searchParams: {}): {};
parameters(): string[];
format(values: {}): string;
}
interface IUrlMatcherFactory {
compile(pattern: string): IUrlMatcher;
isMatcher(o: any): boolean;
}
interface IUrlRouterProvider extends IServiceProvider {
when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
when(whenPath: string, handler: Function): IUrlRouterProvider;
when(whenPath: string, handler: any[]): IUrlRouterProvider;
when(whenPath: string, toPath: string): IUrlRouterProvider;
otherwise(handler: Function): IUrlRouterProvider;
otherwise(handler: any[]): IUrlRouterProvider;
otherwise(path: string): IUrlRouterProvider;
rule(handler: Function): IUrlRouterProvider;
rule(handler: any[]): IUrlRouterProvider;
}
interface IStateOptions {
location?: any;
inherit?: boolean;
relative?: IState;
notify?: boolean;
reload?: boolean;
}
interface IHrefOptions {
lossy?: boolean;
inherit?: boolean;
relative?: IState;
absolute?: boolean;
}
interface IStateService {
go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
includes(state: string, params?: {}): boolean;
is(state:string, params?: {}): boolean;
is(state: IState, params?: {}): boolean;
href(state: IState, params?: {}, options?: IHrefOptions): string;
href(state: string, params?: {}, options?: IHrefOptions): string;
get(state: string): IState;
get(): IState[];
current: IState;
params: any;
reload(): void;
}
interface IStateParamsService {
[key: string]: any;
}
interface IStateParams {
[key: string]: any;
}
interface IUrlRouterService {
/*
* Triggers an update; the same update that happens when the address bar
* url changes, aka $locationChangeSuccess.
*
* This method is useful when you need to use preventDefault() on the
* $locationChangeSuccess event, perform some custom logic (route protection,
* auth, config, redirection, etc) and then finally proceed with the transition
* by calling $urlRouter.sync().
*
*/
sync(): void;
}
interface IUiViewScrollProvider {
/*
* Reverts back to using the core $anchorScroll service for scrolling
* based on the url anchor.
*/
useAnchorScroll(): void;
}
}

View File

@@ -0,0 +1,23 @@
{
"name": "angular-ui-router",
"version": "0.2.15",
"main": "./release/angular-ui-router.js",
"dependencies": {
"angular": ">= 1.0.8"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"component.json",
"package.json",
"lib",
"config",
"sample",
"test",
"tests",
"ngdoc_assets",
"Gruntfile.js",
"files.js"
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,292 @@
/*jshint globalstrict:true*/
/*global angular:false*/
'use strict';
var isDefined = angular.isDefined,
isFunction = angular.isFunction,
isString = angular.isString,
isObject = angular.isObject,
isArray = angular.isArray,
forEach = angular.forEach,
extend = angular.extend,
copy = angular.copy;
function inherit(parent, extra) {
return extend(new (extend(function() {}, { prototype: parent }))(), extra);
}
function merge(dst) {
forEach(arguments, function(obj) {
if (obj !== dst) {
forEach(obj, function(value, key) {
if (!dst.hasOwnProperty(key)) dst[key] = value;
});
}
});
return dst;
}
/**
* Finds the common ancestor path between two states.
*
* @param {Object} first The first state.
* @param {Object} second The second state.
* @return {Array} Returns an array of state names in descending order, not including the root.
*/
function ancestors(first, second) {
var path = [];
for (var n in first.path) {
if (first.path[n] !== second.path[n]) break;
path.push(first.path[n]);
}
return path;
}
/**
* IE8-safe wrapper for `Object.keys()`.
*
* @param {Object} object A JavaScript object.
* @return {Array} Returns the keys of the object as an array.
*/
function objectKeys(object) {
if (Object.keys) {
return Object.keys(object);
}
var result = [];
forEach(object, function(val, key) {
result.push(key);
});
return result;
}
/**
* IE8-safe wrapper for `Array.prototype.indexOf()`.
*
* @param {Array} array A JavaScript array.
* @param {*} value A value to search the array for.
* @return {Number} Returns the array index value of `value`, or `-1` if not present.
*/
function indexOf(array, value) {
if (Array.prototype.indexOf) {
return array.indexOf(value, Number(arguments[2]) || 0);
}
var len = array.length >>> 0, from = Number(arguments[2]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0) from += len;
for (; from < len; from++) {
if (from in array && array[from] === value) return from;
}
return -1;
}
/**
* Merges a set of parameters with all parameters inherited between the common parents of the
* current state and a given destination state.
*
* @param {Object} currentParams The value of the current state parameters ($stateParams).
* @param {Object} newParams The set of parameters which will be composited with inherited params.
* @param {Object} $current Internal definition of object representing the current state.
* @param {Object} $to Internal definition of object representing state to transition to.
*/
function inheritParams(currentParams, newParams, $current, $to) {
var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
for (var i in parents) {
if (!parents[i].params) continue;
parentParams = objectKeys(parents[i].params);
if (!parentParams.length) continue;
for (var j in parentParams) {
if (indexOf(inheritList, parentParams[j]) >= 0) continue;
inheritList.push(parentParams[j]);
inherited[parentParams[j]] = currentParams[parentParams[j]];
}
}
return extend({}, inherited, newParams);
}
/**
* Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
*
* @param {Object} a The first object.
* @param {Object} b The second object.
* @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
* it defaults to the list of keys in `a`.
* @return {Boolean} Returns `true` if the keys match, otherwise `false`.
*/
function equalForKeys(a, b, keys) {
if (!keys) {
keys = [];
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
}
for (var i=0; i<keys.length; i++) {
var k = keys[i];
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
}
return true;
}
/**
* Returns the subset of an object, based on a list of keys.
*
* @param {Array} keys
* @param {Object} values
* @return {Boolean} Returns a subset of `values`.
*/
function filterByKeys(keys, values) {
var filtered = {};
forEach(keys, function (name) {
filtered[name] = values[name];
});
return filtered;
}
// like _.indexBy
// when you know that your index values will be unique, or you want last-one-in to win
function indexBy(array, propName) {
var result = {};
forEach(array, function(item) {
result[item[propName]] = item;
});
return result;
}
// extracted from underscore.js
// Return a copy of the object only containing the whitelisted properties.
function pick(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
forEach(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
}
// extracted from underscore.js
// Return a copy of the object omitting the blacklisted properties.
function omit(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
for (var key in obj) {
if (indexOf(keys, key) == -1) copy[key] = obj[key];
}
return copy;
}
function pluck(collection, key) {
var result = isArray(collection) ? [] : {};
forEach(collection, function(val, i) {
result[i] = isFunction(key) ? key(val) : val[key];
});
return result;
}
function filter(collection, callback) {
var array = isArray(collection);
var result = array ? [] : {};
forEach(collection, function(val, i) {
if (callback(val, i)) {
result[array ? result.length : i] = val;
}
});
return result;
}
function map(collection, callback) {
var result = isArray(collection) ? [] : {};
forEach(collection, function(val, i) {
result[i] = callback(val, i);
});
return result;
}
/**
* @ngdoc overview
* @name ui.router.util
*
* @description
* # ui.router.util sub-module
*
* This module is a dependency of other sub-modules. Do not include this module as a dependency
* in your angular app (use {@link ui.router} module instead).
*
*/
angular.module('ui.router.util', ['ng']);
/**
* @ngdoc overview
* @name ui.router.router
*
* @requires ui.router.util
*
* @description
* # ui.router.router sub-module
*
* This module is a dependency of other sub-modules. Do not include this module as a dependency
* in your angular app (use {@link ui.router} module instead).
*/
angular.module('ui.router.router', ['ui.router.util']);
/**
* @ngdoc overview
* @name ui.router.state
*
* @requires ui.router.router
* @requires ui.router.util
*
* @description
* # ui.router.state sub-module
*
* This module is a dependency of the main ui.router module. Do not include this module as a dependency
* in your angular app (use {@link ui.router} module instead).
*
*/
angular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);
/**
* @ngdoc overview
* @name ui.router
*
* @requires ui.router.state
*
* @description
* # ui.router
*
* ## The main module for ui.router
* There are several sub-modules included with the ui.router module, however only this module is needed
* as a dependency within your angular app. The other modules are for organization purposes.
*
* The modules are:
* * ui.router - the main "umbrella" module
* * ui.router.router -
*
* *You'll need to include **only** this module as the dependency within your angular app.*
*
* <pre>
* <!doctype html>
* <html ng-app="myApp">
* <head>
* <script src="js/angular.js"></script>
* <!-- Include the ui-router script -->
* <script src="js/angular-ui-router.min.js"></script>
* <script>
* // ...and add 'ui.router' as a dependency
* var myApp = angular.module('myApp', ['ui.router']);
* </script>
* </head>
* <body>
* </body>
* </html>
* </pre>
*/
angular.module('ui.router', ['ui.router.state']);
angular.module('ui.router.compat', ['ui.router']);

View File

@@ -0,0 +1,252 @@
/**
* @ngdoc object
* @name ui.router.util.$resolve
*
* @requires $q
* @requires $injector
*
* @description
* Manages resolution of (acyclic) graphs of promises.
*/
$Resolve.$inject = ['$q', '$injector'];
function $Resolve( $q, $injector) {
var VISIT_IN_PROGRESS = 1,
VISIT_DONE = 2,
NOTHING = {},
NO_DEPENDENCIES = [],
NO_LOCALS = NOTHING,
NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });
/**
* @ngdoc function
* @name ui.router.util.$resolve#study
* @methodOf ui.router.util.$resolve
*
* @description
* Studies a set of invocables that are likely to be used multiple times.
* <pre>
* $resolve.study(invocables)(locals, parent, self)
* </pre>
* is equivalent to
* <pre>
* $resolve.resolve(invocables, locals, parent, self)
* </pre>
* but the former is more efficient (in fact `resolve` just calls `study`
* internally).
*
* @param {object} invocables Invocable objects
* @return {function} a function to pass in locals, parent and self
*/
this.study = function (invocables) {
if (!isObject(invocables)) throw new Error("'invocables' must be an object");
var invocableKeys = objectKeys(invocables || {});
// Perform a topological sort of invocables to build an ordered plan
var plan = [], cycle = [], visited = {};
function visit(value, key) {
if (visited[key] === VISIT_DONE) return;
cycle.push(key);
if (visited[key] === VISIT_IN_PROGRESS) {
cycle.splice(0, indexOf(cycle, key));
throw new Error("Cyclic dependency: " + cycle.join(" -> "));
}
visited[key] = VISIT_IN_PROGRESS;
if (isString(value)) {
plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);
} else {
var params = $injector.annotate(value);
forEach(params, function (param) {
if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);
});
plan.push(key, value, params);
}
cycle.pop();
visited[key] = VISIT_DONE;
}
forEach(invocables, visit);
invocables = cycle = visited = null; // plan is all that's required
function isResolve(value) {
return isObject(value) && value.then && value.$$promises;
}
return function (locals, parent, self) {
if (isResolve(locals) && self === undefined) {
self = parent; parent = locals; locals = null;
}
if (!locals) locals = NO_LOCALS;
else if (!isObject(locals)) {
throw new Error("'locals' must be an object");
}
if (!parent) parent = NO_PARENT;
else if (!isResolve(parent)) {
throw new Error("'parent' must be a promise returned by $resolve.resolve()");
}
// To complete the overall resolution, we have to wait for the parent
// promise and for the promise for each invokable in our plan.
var resolution = $q.defer(),
result = resolution.promise,
promises = result.$$promises = {},
values = extend({}, locals),
wait = 1 + plan.length/3,
merged = false;
function done() {
// Merge parent values we haven't got yet and publish our own $$values
if (!--wait) {
if (!merged) merge(values, parent.$$values);
result.$$values = values;
result.$$promises = result.$$promises || true; // keep for isResolve()
delete result.$$inheritedValues;
resolution.resolve(values);
}
}
function fail(reason) {
result.$$failure = reason;
resolution.reject(reason);
}
// Short-circuit if parent has already failed
if (isDefined(parent.$$failure)) {
fail(parent.$$failure);
return result;
}
if (parent.$$inheritedValues) {
merge(values, omit(parent.$$inheritedValues, invocableKeys));
}
// Merge parent values if the parent has already resolved, or merge
// parent promises and wait if the parent resolve is still in progress.
extend(promises, parent.$$promises);
if (parent.$$values) {
merged = merge(values, omit(parent.$$values, invocableKeys));
result.$$inheritedValues = omit(parent.$$values, invocableKeys);
done();
} else {
if (parent.$$inheritedValues) {
result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);
}
parent.then(done, fail);
}
// Process each invocable in the plan, but ignore any where a local of the same name exists.
for (var i=0, ii=plan.length; i<ii; i+=3) {
if (locals.hasOwnProperty(plan[i])) done();
else invoke(plan[i], plan[i+1], plan[i+2]);
}
function invoke(key, invocable, params) {
// Create a deferred for this invocation. Failures will propagate to the resolution as well.
var invocation = $q.defer(), waitParams = 0;
function onfailure(reason) {
invocation.reject(reason);
fail(reason);
}
// Wait for any parameter that we have a promise for (either from parent or from this
// resolve; in that case study() will have made sure it's ordered before us in the plan).
forEach(params, function (dep) {
if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {
waitParams++;
promises[dep].then(function (result) {
values[dep] = result;
if (!(--waitParams)) proceed();
}, onfailure);
}
});
if (!waitParams) proceed();
function proceed() {
if (isDefined(result.$$failure)) return;
try {
invocation.resolve($injector.invoke(invocable, self, values));
invocation.promise.then(function (result) {
values[key] = result;
done();
}, onfailure);
} catch (e) {
onfailure(e);
}
}
// Publish promise synchronously; invocations further down in the plan may depend on it.
promises[key] = invocation.promise;
}
return result;
};
};
/**
* @ngdoc function
* @name ui.router.util.$resolve#resolve
* @methodOf ui.router.util.$resolve
*
* @description
* Resolves a set of invocables. An invocable is a function to be invoked via
* `$injector.invoke()`, and can have an arbitrary number of dependencies.
* An invocable can either return a value directly,
* or a `$q` promise. If a promise is returned it will be resolved and the
* resulting value will be used instead. Dependencies of invocables are resolved
* (in this order of precedence)
*
* - from the specified `locals`
* - from another invocable that is part of this `$resolve` call
* - from an invocable that is inherited from a `parent` call to `$resolve`
* (or recursively
* - from any ancestor `$resolve` of that parent).
*
* The return value of `$resolve` is a promise for an object that contains
* (in this order of precedence)
*
* - any `locals` (if specified)
* - the resolved return values of all injectables
* - any values inherited from a `parent` call to `$resolve` (if specified)
*
* The promise will resolve after the `parent` promise (if any) and all promises
* returned by injectables have been resolved. If any invocable
* (or `$injector.invoke`) throws an exception, or if a promise returned by an
* invocable is rejected, the `$resolve` promise is immediately rejected with the
* same error. A rejection of a `parent` promise (if specified) will likewise be
* propagated immediately. Once the `$resolve` promise has been rejected, no
* further invocables will be called.
*
* Cyclic dependencies between invocables are not permitted and will caues `$resolve`
* to throw an error. As a special case, an injectable can depend on a parameter
* with the same name as the injectable, which will be fulfilled from the `parent`
* injectable of the same name. This allows inherited values to be decorated.
* Note that in this case any other injectable in the same `$resolve` with the same
* dependency would see the decorated value, not the inherited value.
*
* Note that missing dependencies -- unlike cyclic dependencies -- will cause an
* (asynchronous) rejection of the `$resolve` promise rather than a (synchronous)
* exception.
*
* Invocables are invoked eagerly as soon as all dependencies are available.
* This is true even for dependencies inherited from a `parent` call to `$resolve`.
*
* As a special case, an invocable can be a string, in which case it is taken to
* be a service name to be passed to `$injector.get()`. This is supported primarily
* for backwards-compatibility with the `resolve` property of `$routeProvider`
* routes.
*
* @param {object} invocables functions to invoke or
* `$injector` services to fetch.
* @param {object} locals values to make available to the injectables
* @param {object} parent a promise returned by another call to `$resolve`.
* @param {object} self the `this` for the invoked methods
* @return {object} Promise for an object that contains the resolved return value
* of all invocables, as well as any inherited and local values.
*/
this.resolve = function (invocables, locals, parent, self) {
return this.study(invocables)(locals, parent, self);
};
}
angular.module('ui.router.util').service('$resolve', $Resolve);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,285 @@
function parseStateRef(ref, current) {
var preparsed = ref.match(/^\s*({[^}]*})\s*$/), parsed;
if (preparsed) ref = current + '(' + preparsed[1] + ')';
parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
return { state: parsed[1], paramExpr: parsed[3] || null };
}
function stateContext(el) {
var stateData = el.parent().inheritedData('$uiView');
if (stateData && stateData.state && stateData.state.name) {
return stateData.state;
}
}
/**
* @ngdoc directive
* @name ui.router.state.directive:ui-sref
*
* @requires ui.router.state.$state
* @requires $timeout
*
* @restrict A
*
* @description
* A directive that binds a link (`<a>` tag) to a state. If the state has an associated
* URL, the directive will automatically generate & update the `href` attribute via
* the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking
* the link will trigger a state transition with optional parameters.
*
* Also middle-clicking, right-clicking, and ctrl-clicking on the link will be
* handled natively by the browser.
*
* You can also use relative state paths within ui-sref, just like the relative
* paths passed to `$state.go()`. You just need to be aware that the path is relative
* to the state that the link lives in, in other words the state that loaded the
* template containing the link.
*
* You can specify options to pass to {@link ui.router.state.$state#go $state.go()}
* using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,
* and `reload`.
*
* @example
* Here's an example of how you'd use ui-sref and how it would compile. If you have the
* following template:
* <pre>
* <a ui-sref="home">Home</a> | <a ui-sref="about">About</a> | <a ui-sref="{page: 2}">Next page</a>
*
* <ul>
* <li ng-repeat="contact in contacts">
* <a ui-sref="contacts.detail({ id: contact.id })">{{ contact.name }}</a>
* </li>
* </ul>
* </pre>
*
* Then the compiled html would be (assuming Html5Mode is off and current state is contacts):
* <pre>
* <a href="#/home" ui-sref="home">Home</a> | <a href="#/about" ui-sref="about">About</a> | <a href="#/contacts?page=2" ui-sref="{page: 2}">Next page</a>
*
* <ul>
* <li ng-repeat="contact in contacts">
* <a href="#/contacts/1" ui-sref="contacts.detail({ id: contact.id })">Joe</a>
* </li>
* <li ng-repeat="contact in contacts">
* <a href="#/contacts/2" ui-sref="contacts.detail({ id: contact.id })">Alice</a>
* </li>
* <li ng-repeat="contact in contacts">
* <a href="#/contacts/3" ui-sref="contacts.detail({ id: contact.id })">Bob</a>
* </li>
* </ul>
*
* <a ui-sref="home" ui-sref-opts="{reload: true}">Home</a>
* </pre>
*
* @param {string} ui-sref 'stateName' can be any valid absolute or relative state
* @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}
*/
$StateRefDirective.$inject = ['$state', '$timeout'];
function $StateRefDirective($state, $timeout) {
var allowedOptions = ['location', 'inherit', 'reload', 'absolute'];
return {
restrict: 'A',
require: ['?^uiSrefActive', '?^uiSrefActiveEq'],
link: function(scope, element, attrs, uiSrefActive) {
var ref = parseStateRef(attrs.uiSref, $state.current.name);
var params = null, url = null, base = stateContext(element) || $state.$current;
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
var hrefKind = Object.prototype.toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
'xlink:href' : 'href';
var newHref = null, isAnchor = element.prop("tagName").toUpperCase() === "A";
var isForm = element[0].nodeName === "FORM";
var attr = isForm ? "action" : hrefKind, nav = true;
var options = { relative: base, inherit: true };
var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};
angular.forEach(allowedOptions, function(option) {
if (option in optionsOverride) {
options[option] = optionsOverride[option];
}
});
var update = function(newVal) {
if (newVal) params = angular.copy(newVal);
if (!nav) return;
newHref = $state.href(ref.state, params, options);
var activeDirective = uiSrefActive[1] || uiSrefActive[0];
if (activeDirective) {
activeDirective.$$addStateInfo(ref.state, params);
}
if (newHref === null) {
nav = false;
return false;
}
attrs.$set(attr, newHref);
};
if (ref.paramExpr) {
scope.$watch(ref.paramExpr, function(newVal, oldVal) {
if (newVal !== params) update(newVal);
}, true);
params = angular.copy(scope.$eval(ref.paramExpr));
}
update();
if (isForm) return;
element.bind("click", function(e) {
var button = e.which || e.button;
if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {
// HACK: This is to allow ng-clicks to be processed before the transition is initiated:
var transition = $timeout(function() {
$state.go(ref.state, params, options);
});
e.preventDefault();
// if the state has no URL, ignore one preventDefault from the <a> directive.
var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0;
e.preventDefault = function() {
if (ignorePreventDefaultCount-- <= 0)
$timeout.cancel(transition);
};
}
});
}
};
}
/**
* @ngdoc directive
* @name ui.router.state.directive:ui-sref-active
*
* @requires ui.router.state.$state
* @requires ui.router.state.$stateParams
* @requires $interpolate
*
* @restrict A
*
* @description
* A directive working alongside ui-sref to add classes to an element when the
* related ui-sref directive's state is active, and removing them when it is inactive.
* The primary use-case is to simplify the special appearance of navigation menus
* relying on `ui-sref`, by having the "active" state's menu button appear different,
* distinguishing it from the inactive menu items.
*
* ui-sref-active can live on the same element as ui-sref or on a parent element. The first
* ui-sref-active found at the same level or above the ui-sref will be used.
*
* Will activate when the ui-sref's target state or any child state is active. If you
* need to activate only when the ui-sref target state is active and *not* any of
* it's children, then you will use
* {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq}
*
* @example
* Given the following template:
* <pre>
* <ul>
* <li ui-sref-active="active" class="item">
* <a href ui-sref="app.user({user: 'bilbobaggins'})">@bilbobaggins</a>
* </li>
* </ul>
* </pre>
*
*
* When the app state is "app.user" (or any children states), and contains the state parameter "user" with value "bilbobaggins",
* the resulting HTML will appear as (note the 'active' class):
* <pre>
* <ul>
* <li ui-sref-active="active" class="item active">
* <a ui-sref="app.user({user: 'bilbobaggins'})" href="/users/bilbobaggins">@bilbobaggins</a>
* </li>
* </ul>
* </pre>
*
* The class name is interpolated **once** during the directives link time (any further changes to the
* interpolated value are ignored).
*
* Multiple classes may be specified in a space-separated format:
* <pre>
* <ul>
* <li ui-sref-active='class1 class2 class3'>
* <a ui-sref="app.user">link</a>
* </li>
* </ul>
* </pre>
*/
/**
* @ngdoc directive
* @name ui.router.state.directive:ui-sref-active-eq
*
* @requires ui.router.state.$state
* @requires ui.router.state.$stateParams
* @requires $interpolate
*
* @restrict A
*
* @description
* The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate
* when the exact target state used in the `ui-sref` is active; no child states.
*
*/
$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];
function $StateRefActiveDirective($state, $stateParams, $interpolate) {
return {
restrict: "A",
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
var states = [], activeClass;
// There probably isn't much point in $observing this
// uiSrefActive and uiSrefActiveEq share the same directive object with some
// slight difference in logic routing
activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);
// Allow uiSref to communicate with uiSrefActive[Equals]
this.$$addStateInfo = function (newState, newParams) {
var state = $state.get(newState, stateContext($element));
states.push({
state: state || { name: newState },
params: newParams
});
update();
};
$scope.$on('$stateChangeSuccess', update);
// Update route state
function update() {
if (anyMatch()) {
$element.addClass(activeClass);
} else {
$element.removeClass(activeClass);
}
}
function anyMatch() {
for (var i = 0; i < states.length; i++) {
if (isMatch(states[i].state, states[i].params)) {
return true;
}
}
return false;
}
function isMatch(state, params) {
if (typeof $attrs.uiSrefActiveEq !== 'undefined') {
return $state.is(state.name, params);
} else {
return $state.includes(state.name, params);
}
}
}]
};
}
angular.module('ui.router.state')
.directive('uiSref', $StateRefDirective)
.directive('uiSrefActive', $StateRefActiveDirective)
.directive('uiSrefActiveEq', $StateRefActiveDirective);

View File

@@ -0,0 +1,39 @@
/**
* @ngdoc filter
* @name ui.router.state.filter:isState
*
* @requires ui.router.state.$state
*
* @description
* Translates to {@link ui.router.state.$state#methods_is $state.is("stateName")}.
*/
$IsStateFilter.$inject = ['$state'];
function $IsStateFilter($state) {
var isFilter = function (state) {
return $state.is(state);
};
isFilter.$stateful = true;
return isFilter;
}
/**
* @ngdoc filter
* @name ui.router.state.filter:includedByState
*
* @requires ui.router.state.$state
*
* @description
* Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.
*/
$IncludedByStateFilter.$inject = ['$state'];
function $IncludedByStateFilter($state) {
var includesFilter = function (state) {
return $state.includes(state);
};
includesFilter.$stateful = true;
return includesFilter;
}
angular.module('ui.router.state')
.filter('isState', $IsStateFilter)
.filter('includedByState', $IncludedByStateFilter);

View File

@@ -0,0 +1,110 @@
/**
* @ngdoc object
* @name ui.router.util.$templateFactory
*
* @requires $http
* @requires $templateCache
* @requires $injector
*
* @description
* Service. Manages loading of templates.
*/
$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];
function $TemplateFactory( $http, $templateCache, $injector) {
/**
* @ngdoc function
* @name ui.router.util.$templateFactory#fromConfig
* @methodOf ui.router.util.$templateFactory
*
* @description
* Creates a template from a configuration object.
*
* @param {object} config Configuration object for which to load a template.
* The following properties are search in the specified order, and the first one
* that is defined is used to create the template:
*
* @param {string|object} config.template html string template or function to
* load via {@link ui.router.util.$templateFactory#fromString fromString}.
* @param {string|object} config.templateUrl url to load or a function returning
* the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.
* @param {Function} config.templateProvider function to invoke via
* {@link ui.router.util.$templateFactory#fromProvider fromProvider}.
* @param {object} params Parameters to pass to the template function.
* @param {object} locals Locals to pass to `invoke` if the template is loaded
* via a `templateProvider`. Defaults to `{ params: params }`.
*
* @return {string|object} The template html as a string, or a promise for
* that string,or `null` if no template is configured.
*/
this.fromConfig = function (config, params, locals) {
return (
isDefined(config.template) ? this.fromString(config.template, params) :
isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :
isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :
null
);
};
/**
* @ngdoc function
* @name ui.router.util.$templateFactory#fromString
* @methodOf ui.router.util.$templateFactory
*
* @description
* Creates a template from a string or a function returning a string.
*
* @param {string|object} template html template as a string or function that
* returns an html template as a string.
* @param {object} params Parameters to pass to the template function.
*
* @return {string|object} The template html as a string, or a promise for that
* string.
*/
this.fromString = function (template, params) {
return isFunction(template) ? template(params) : template;
};
/**
* @ngdoc function
* @name ui.router.util.$templateFactory#fromUrl
* @methodOf ui.router.util.$templateFactory
*
* @description
* Loads a template from the a URL via `$http` and `$templateCache`.
*
* @param {string|Function} url url of the template to load, or a function
* that returns a url.
* @param {Object} params Parameters to pass to the url function.
* @return {string|Promise.<string>} The template html as a string, or a promise
* for that string.
*/
this.fromUrl = function (url, params) {
if (isFunction(url)) url = url(params);
if (url == null) return null;
else return $http
.get(url, { cache: $templateCache, headers: { Accept: 'text/html' }})
.then(function(response) { return response.data; });
};
/**
* @ngdoc function
* @name ui.router.util.$templateFactory#fromProvider
* @methodOf ui.router.util.$templateFactory
*
* @description
* Creates a template by invoking an injectable provider function.
*
* @param {Function} provider Function to invoke via `$injector.invoke`
* @param {Object} params Parameters for the template.
* @param {Object} locals Locals to pass to `invoke`. Defaults to
* `{ params: params }`.
* @return {string|Promise.<string>} The template html as a string, or a promise
* for that string.
*/
this.fromProvider = function (provider, params, locals) {
return $injector.invoke(provider, null, locals || { params: params });
};
}
angular.module('ui.router.util').service('$templateFactory', $TemplateFactory);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,427 @@
/**
* @ngdoc object
* @name ui.router.router.$urlRouterProvider
*
* @requires ui.router.util.$urlMatcherFactoryProvider
* @requires $locationProvider
*
* @description
* `$urlRouterProvider` has the responsibility of watching `$location`.
* When `$location` changes it runs through a list of rules one by one until a
* match is found. `$urlRouterProvider` is used behind the scenes anytime you specify
* a url in a state configuration. All urls are compiled into a UrlMatcher object.
*
* There are several methods on `$urlRouterProvider` that make it useful to use directly
* in your module config.
*/
$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider'];
function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
var rules = [], otherwise = null, interceptDeferred = false, listener;
// Returns a string that is a prefix of all strings matching the RegExp
function regExpPrefix(re) {
var prefix = /^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(re.source);
return (prefix != null) ? prefix[1].replace(/\\(.)/g, "$1") : '';
}
// Interpolates matched values into a String.replace()-style pattern
function interpolate(pattern, match) {
return pattern.replace(/\$(\$|\d{1,2})/, function (m, what) {
return match[what === '$' ? 0 : Number(what)];
});
}
/**
* @ngdoc function
* @name ui.router.router.$urlRouterProvider#rule
* @methodOf ui.router.router.$urlRouterProvider
*
* @description
* Defines rules that are used by `$urlRouterProvider` to find matches for
* specific URLs.
*
* @example
* <pre>
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // Here's an example of how you might allow case insensitive urls
* $urlRouterProvider.rule(function ($injector, $location) {
* var path = $location.path(),
* normalized = path.toLowerCase();
*
* if (path !== normalized) {
* return normalized;
* }
* });
* });
* </pre>
*
* @param {object} rule Handler function that takes `$injector` and `$location`
* services as arguments. You can use them to return a valid path as a string.
*
* @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance
*/
this.rule = function (rule) {
if (!isFunction(rule)) throw new Error("'rule' must be a function");
rules.push(rule);
return this;
};
/**
* @ngdoc object
* @name ui.router.router.$urlRouterProvider#otherwise
* @methodOf ui.router.router.$urlRouterProvider
*
* @description
* Defines a path that is used when an invalid route is requested.
*
* @example
* <pre>
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // if the path doesn't match any of the urls you configured
* // otherwise will take care of routing the user to the
* // specified url
* $urlRouterProvider.otherwise('/index');
*
* // Example of using function rule as param
* $urlRouterProvider.otherwise(function ($injector, $location) {
* return '/a/valid/url';
* });
* });
* </pre>
*
* @param {string|object} rule The url path you want to redirect to or a function
* rule that returns the url path. The function version is passed two params:
* `$injector` and `$location` services, and must return a url string.
*
* @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance
*/
this.otherwise = function (rule) {
if (isString(rule)) {
var redirect = rule;
rule = function () { return redirect; };
}
else if (!isFunction(rule)) throw new Error("'rule' must be a function");
otherwise = rule;
return this;
};
function handleIfMatch($injector, handler, match) {
if (!match) return false;
var result = $injector.invoke(handler, handler, { $match: match });
return isDefined(result) ? result : true;
}
/**
* @ngdoc function
* @name ui.router.router.$urlRouterProvider#when
* @methodOf ui.router.router.$urlRouterProvider
*
* @description
* Registers a handler for a given url matching. if handle is a string, it is
* treated as a redirect, and is interpolated according to the syntax of match
* (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).
*
* If the handler is a function, it is injectable. It gets invoked if `$location`
* matches. You have the option of inject the match object as `$match`.
*
* The handler can return
*
* - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`
* will continue trying to find another one that matches.
* - **string** which is treated as a redirect and passed to `$location.url()`
* - **void** or any **truthy** value tells `$urlRouter` that the url was handled.
*
* @example
* <pre>
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* $urlRouterProvider.when($state.url, function ($match, $stateParams) {
* if ($state.$current.navigable !== state ||
* !equalForKeys($match, $stateParams) {
* $state.transitionTo(state, $match, false);
* }
* });
* });
* </pre>
*
* @param {string|object} what The incoming path that you want to redirect.
* @param {string|object} handler The path you want to redirect your user to.
*/
this.when = function (what, handler) {
var redirect, handlerIsString = isString(handler);
if (isString(what)) what = $urlMatcherFactory.compile(what);
if (!handlerIsString && !isFunction(handler) && !isArray(handler))
throw new Error("invalid 'handler' in when()");
var strategies = {
matcher: function (what, handler) {
if (handlerIsString) {
redirect = $urlMatcherFactory.compile(handler);
handler = ['$match', function ($match) { return redirect.format($match); }];
}
return extend(function ($injector, $location) {
return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));
}, {
prefix: isString(what.prefix) ? what.prefix : ''
});
},
regex: function (what, handler) {
if (what.global || what.sticky) throw new Error("when() RegExp must not be global or sticky");
if (handlerIsString) {
redirect = handler;
handler = ['$match', function ($match) { return interpolate(redirect, $match); }];
}
return extend(function ($injector, $location) {
return handleIfMatch($injector, handler, what.exec($location.path()));
}, {
prefix: regExpPrefix(what)
});
}
};
var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };
for (var n in check) {
if (check[n]) return this.rule(strategies[n](what, handler));
}
throw new Error("invalid 'what' in when()");
};
/**
* @ngdoc function
* @name ui.router.router.$urlRouterProvider#deferIntercept
* @methodOf ui.router.router.$urlRouterProvider
*
* @description
* Disables (or enables) deferring location change interception.
*
* If you wish to customize the behavior of syncing the URL (for example, if you wish to
* defer a transition but maintain the current URL), call this method at configuration time.
* Then, at run time, call `$urlRouter.listen()` after you have configured your own
* `$locationChangeSuccess` event handler.
*
* @example
* <pre>
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
*
* // Prevent $urlRouter from automatically intercepting URL changes;
* // this allows you to configure custom behavior in between
* // location changes and route synchronization:
* $urlRouterProvider.deferIntercept();
*
* }).run(function ($rootScope, $urlRouter, UserService) {
*
* $rootScope.$on('$locationChangeSuccess', function(e) {
* // UserService is an example service for managing user state
* if (UserService.isLoggedIn()) return;
*
* // Prevent $urlRouter's default handler from firing
* e.preventDefault();
*
* UserService.handleLogin().then(function() {
* // Once the user has logged in, sync the current URL
* // to the router:
* $urlRouter.sync();
* });
* });
*
* // Configures $urlRouter's listener *after* your custom listener
* $urlRouter.listen();
* });
* </pre>
*
* @param {boolean} defer Indicates whether to defer location change interception. Passing
no parameter is equivalent to `true`.
*/
this.deferIntercept = function (defer) {
if (defer === undefined) defer = true;
interceptDeferred = defer;
};
/**
* @ngdoc object
* @name ui.router.router.$urlRouter
*
* @requires $location
* @requires $rootScope
* @requires $injector
* @requires $browser
*
* @description
*
*/
this.$get = $get;
$get.$inject = ['$location', '$rootScope', '$injector', '$browser'];
function $get( $location, $rootScope, $injector, $browser) {
var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;
function appendBasePath(url, isHtml5, absolute) {
if (baseHref === '/') return url;
if (isHtml5) return baseHref.slice(0, -1) + url;
if (absolute) return baseHref.slice(1) + url;
return url;
}
// TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree
function update(evt) {
if (evt && evt.defaultPrevented) return;
var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl;
lastPushedUrl = undefined;
// TODO: Re-implement this in 1.0 for https://github.com/angular-ui/ui-router/issues/1573
//if (ignoreUpdate) return true;
function check(rule) {
var handled = rule($injector, $location);
if (!handled) return false;
if (isString(handled)) $location.replace().url(handled);
return true;
}
var n = rules.length, i;
for (i = 0; i < n; i++) {
if (check(rules[i])) return;
}
// always check otherwise last to allow dynamic updates to the set of rules
if (otherwise) check(otherwise);
}
function listen() {
listener = listener || $rootScope.$on('$locationChangeSuccess', update);
return listener;
}
if (!interceptDeferred) listen();
return {
/**
* @ngdoc function
* @name ui.router.router.$urlRouter#sync
* @methodOf ui.router.router.$urlRouter
*
* @description
* Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.
* This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,
* perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed
* with the transition by calling `$urlRouter.sync()`.
*
* @example
* <pre>
* angular.module('app', ['ui.router'])
* .run(function($rootScope, $urlRouter) {
* $rootScope.$on('$locationChangeSuccess', function(evt) {
* // Halt state change from even starting
* evt.preventDefault();
* // Perform custom logic
* var meetsRequirement = ...
* // Continue with the update and state transition if logic allows
* if (meetsRequirement) $urlRouter.sync();
* });
* });
* </pre>
*/
sync: function() {
update();
},
listen: function() {
return listen();
},
update: function(read) {
if (read) {
location = $location.url();
return;
}
if ($location.url() === location) return;
$location.url(location);
$location.replace();
},
push: function(urlMatcher, params, options) {
var url = urlMatcher.format(params || {});
// Handle the special hash param, if needed
if (url !== null && params && params['#']) {
url += '#' + params['#'];
}
$location.url(url);
lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined;
if (options && options.replace) $location.replace();
},
/**
* @ngdoc function
* @name ui.router.router.$urlRouter#href
* @methodOf ui.router.router.$urlRouter
*
* @description
* A URL generation method that returns the compiled URL for a given
* {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.
*
* @example
* <pre>
* $bob = $urlRouter.href(new UrlMatcher("/about/:person"), {
* person: "bob"
* });
* // $bob == "/about/bob";
* </pre>
*
* @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.
* @param {object=} params An object of parameter values to fill the matcher's required parameters.
* @param {object=} options Options object. The options are:
*
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
*
* @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
*/
href: function(urlMatcher, params, options) {
if (!urlMatcher.validates(params)) return null;
var isHtml5 = $locationProvider.html5Mode();
if (angular.isObject(isHtml5)) {
isHtml5 = isHtml5.enabled;
}
var url = urlMatcher.format(params);
options = options || {};
if (!isHtml5 && url !== null) {
url = "#" + $locationProvider.hashPrefix() + url;
}
// Handle special hash param, if needed
if (url !== null && params && params['#']) {
url += '#' + params['#'];
}
url = appendBasePath(url, isHtml5, options.absolute);
if (!options.absolute || !url) {
return url;
}
var slash = (!isHtml5 && url ? '/' : ''), port = $location.port();
port = (port === 80 || port === 443 ? '' : ':' + port);
return [$location.protocol(), '://', $location.host(), port, slash, url].join('');
}
};
}
}
angular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);

View File

@@ -0,0 +1,71 @@
$ViewProvider.$inject = [];
function $ViewProvider() {
this.$get = $get;
/**
* @ngdoc object
* @name ui.router.state.$view
*
* @requires ui.router.util.$templateFactory
* @requires $rootScope
*
* @description
*
*/
$get.$inject = ['$rootScope', '$templateFactory'];
function $get( $rootScope, $templateFactory) {
return {
// $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })
/**
* @ngdoc function
* @name ui.router.state.$view#load
* @methodOf ui.router.state.$view
*
* @description
*
* @param {string} name name
* @param {object} options option object.
*/
load: function load(name, options) {
var result, defaults = {
template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}
};
options = extend(defaults, options);
if (options.view) {
result = $templateFactory.fromConfig(options.view, options.params, options.locals);
}
if (result && options.notify) {
/**
* @ngdoc event
* @name ui.router.state.$state#$viewContentLoading
* @eventOf ui.router.state.$view
* @eventType broadcast on root scope
* @description
*
* Fired once the view **begins loading**, *before* the DOM is rendered.
*
* @param {Object} event Event object.
* @param {Object} viewConfig The view config properties (template, controller, etc).
*
* @example
*
* <pre>
* $scope.$on('$viewContentLoading',
* function(event, viewConfig){
* // Access to all the view config properties.
* // and one special property 'targetView'
* // viewConfig.targetView
* });
* </pre>
*/
$rootScope.$broadcast('$viewContentLoading', options);
}
return result;
}
};
}
}
angular.module('ui.router.state').provider('$view', $ViewProvider);

View File

@@ -0,0 +1,303 @@
/**
* @ngdoc directive
* @name ui.router.state.directive:ui-view
*
* @requires ui.router.state.$state
* @requires $compile
* @requires $controller
* @requires $injector
* @requires ui.router.state.$uiViewScroll
* @requires $document
*
* @restrict ECA
*
* @description
* The ui-view directive tells $state where to place your templates.
*
* @param {string=} name A view name. The name should be unique amongst the other views in the
* same state. You can have views of the same name that live in different states.
*
* @param {string=} autoscroll It allows you to set the scroll behavior of the browser window
* when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
* scroll ui-view elements into view when they are populated during a state activation.
*
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
*
* @param {string=} onload Expression to evaluate whenever the view updates.
*
* @example
* A view can be unnamed or named.
* <pre>
* <!-- Unnamed -->
* <div ui-view></div>
*
* <!-- Named -->
* <div ui-view="viewName"></div>
* </pre>
*
* You can only have one unnamed view within any template (or root html). If you are only using a
* single view and it is unnamed then you can populate it like so:
* <pre>
* <div ui-view></div>
* $stateProvider.state("home", {
* template: "<h1>HELLO!</h1>"
* })
* </pre>
*
* The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
* config property, by name, in this case an empty name:
* <pre>
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* </pre>
*
* But typically you'll only use the views property if you name your view or have more than one view
* in the same template. There's not really a compelling reason to name a view if its the only one,
* but you could if you wanted, like so:
* <pre>
* <div ui-view="main"></div>
* </pre>
* <pre>
* $stateProvider.state("home", {
* views: {
* "main": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* </pre>
*
* Really though, you'll use views to set up multiple views:
* <pre>
* <div ui-view></div>
* <div ui-view="chart"></div>
* <div ui-view="data"></div>
* </pre>
*
* <pre>
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* },
* "chart": {
* template: "<chart_thing/>"
* },
* "data": {
* template: "<data_thing/>"
* }
* }
* })
* </pre>
*
* Examples for `autoscroll`:
*
* <pre>
* <!-- If autoscroll present with no expression,
* then scroll ui-view into view -->
* <ui-view autoscroll/>
*
* <!-- If autoscroll present with valid expression,
* then scroll ui-view into view if expression evaluates to true -->
* <ui-view autoscroll='true'/>
* <ui-view autoscroll='false'/>
* <ui-view autoscroll='scopeVariable'/>
* </pre>
*/
$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];
function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate) {
function getService() {
return ($injector.has) ? function(service) {
return $injector.has(service) ? $injector.get(service) : null;
} : function(service) {
try {
return $injector.get(service);
} catch (e) {
return null;
}
};
}
var service = getService(),
$animator = service('$animator'),
$animate = service('$animate');
// Returns a set of DOM manipulation functions based on which Angular version
// it should use
function getRenderer(attrs, scope) {
var statics = function() {
return {
enter: function (element, target, cb) { target.after(element); cb(); },
leave: function (element, cb) { element.remove(); cb(); }
};
};
if ($animate) {
return {
enter: function(element, target, cb) {
var promise = $animate.enter(element, null, target, cb);
if (promise && promise.then) promise.then(cb);
},
leave: function(element, cb) {
var promise = $animate.leave(element, cb);
if (promise && promise.then) promise.then(cb);
}
};
}
if ($animator) {
var animate = $animator && $animator(scope, attrs);
return {
enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },
leave: function(element, cb) { animate.leave(element); cb(); }
};
}
return statics();
}
var directive = {
restrict: 'ECA',
terminal: true,
priority: 400,
transclude: 'element',
compile: function (tElement, tAttrs, $transclude) {
return function (scope, $element, attrs) {
var previousEl, currentEl, currentScope, latestLocals,
onloadExp = attrs.onload || '',
autoScrollExp = attrs.autoscroll,
renderer = getRenderer(attrs, scope);
scope.$on('$stateChangeSuccess', function() {
updateView(false);
});
scope.$on('$viewContentLoading', function() {
updateView(false);
});
updateView(true);
function cleanupLastView() {
if (previousEl) {
previousEl.remove();
previousEl = null;
}
if (currentScope) {
currentScope.$destroy();
currentScope = null;
}
if (currentEl) {
renderer.leave(currentEl, function() {
previousEl = null;
});
previousEl = currentEl;
currentEl = null;
}
}
function updateView(firstTime) {
var newScope,
name = getUiViewName(scope, attrs, $element, $interpolate),
previousLocals = name && $state.$current && $state.$current.locals[name];
if (!firstTime && previousLocals === latestLocals) return; // nothing to do
newScope = scope.$new();
latestLocals = $state.$current.locals[name];
var clone = $transclude(newScope, function(clone) {
renderer.enter(clone, $element, function onUiViewEnter() {
if(currentScope) {
currentScope.$emit('$viewContentAnimationEnded');
}
if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {
$uiViewScroll(clone);
}
});
cleanupLastView();
});
currentEl = clone;
currentScope = newScope;
/**
* @ngdoc event
* @name ui.router.state.directive:ui-view#$viewContentLoaded
* @eventOf ui.router.state.directive:ui-view
* @eventType emits on ui-view directive scope
* @description *
* Fired once the view is **loaded**, *after* the DOM is rendered.
*
* @param {Object} event Event object.
*/
currentScope.$emit('$viewContentLoaded');
currentScope.$eval(onloadExp);
}
};
}
};
return directive;
}
$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate'];
function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate) {
return {
restrict: 'ECA',
priority: -400,
compile: function (tElement) {
var initial = tElement.html();
return function (scope, $element, attrs) {
var current = $state.$current,
name = getUiViewName(scope, attrs, $element, $interpolate),
locals = current && current.locals[name];
if (! locals) {
return;
}
$element.data('$uiView', { name: name, state: locals.$$state });
$element.html(locals.$template ? locals.$template : initial);
var link = $compile($element.contents());
if (locals.$$controller) {
locals.$scope = scope;
locals.$element = $element;
var controller = $controller(locals.$$controller, locals);
if (locals.$$controllerAs) {
scope[locals.$$controllerAs] = controller;
}
$element.data('$ngControllerController', controller);
$element.children().data('$ngControllerController', controller);
}
link(scope);
};
}
};
}
/**
* Shared ui-view code for both directives:
* Given scope, element, and its attributes, return the view's name
*/
function getUiViewName(scope, attrs, element, $interpolate) {
var name = $interpolate(attrs.uiView || attrs.name || '')(scope);
var inherited = element.inheritedData('$uiView');
return name.indexOf('@') >= 0 ? name : (name + '@' + (inherited ? inherited.state.name : ''));
}
angular.module('ui.router.state').directive('uiView', $ViewDirective);
angular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);

View File

@@ -0,0 +1,52 @@
/**
* @ngdoc object
* @name ui.router.state.$uiViewScrollProvider
*
* @description
* Provider that returns the {@link ui.router.state.$uiViewScroll} service function.
*/
function $ViewScrollProvider() {
var useAnchorScroll = false;
/**
* @ngdoc function
* @name ui.router.state.$uiViewScrollProvider#useAnchorScroll
* @methodOf ui.router.state.$uiViewScrollProvider
*
* @description
* Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for
* scrolling based on the url anchor.
*/
this.useAnchorScroll = function () {
useAnchorScroll = true;
};
/**
* @ngdoc object
* @name ui.router.state.$uiViewScroll
*
* @requires $anchorScroll
* @requires $timeout
*
* @description
* When called with a jqLite element, it scrolls the element into view (after a
* `$timeout` so the DOM has time to refresh).
*
* If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,
* this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.
*/
this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {
if (useAnchorScroll) {
return $anchorScroll;
}
return function ($element) {
return $timeout(function () {
$element[0].scrollIntoView();
}, 0, false);
};
}];
}
angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);

View File

@@ -9,7 +9,7 @@
* @name controllers.function:Adhoc
* @description This controller controls the adhoc form creation, command launching and navigating to standard out after command has been succesfully ran.
*/
function adhocController($q, $scope, $rootScope, $location, $routeParams,
function adhocController($q, $scope, $rootScope, $location, $stateParams,
CheckPasswords, PromptForPasswords, CreateLaunchDialog, adhocForm,
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
KindChange, LookUpInit, CredentialList, Empty, Wait) {
@@ -31,7 +31,7 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
};
};
var id = $routeParams.inventory_id,
var id = $stateParams.inventory_id,
urls = privateFn.setAvailableUrls(),
hostPattern = $rootScope.hostPatterns || "all";
@@ -72,23 +72,6 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
}
};
privateFn.getInventoryNameForBreadcrumbs = function(url) {
Rest.setUrl(url);
var promise = Rest.get();
promise.then(function (response) {
$scope.inv_name = response.data.name;
});
promise.catch(function (response) {
ProcessErrors($rootScope, response.data, response.status, null, {
hdr: 'Error!',
msg: 'Failed to get inventory name. GET returned status: ' +
response.status });
$location.path("/inventories/");
});
return promise;
};
// set the arguments help to watch on change of the module
privateFn.instantiateArgumentHelp = function() {
$scope.$watch('module_name', function(val) {
@@ -167,9 +150,6 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
// put the inventory id on scope for the partial to use
$scope.inv_id = id;
// get the inventory name
privateFn.getInventoryNameForBreadcrumbs(urls.inventoryUrl);
// set the arguments help to watch on change of the module
privateFn.instantiateArgumentHelp();
@@ -199,7 +179,7 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
// launch the job with the provided form data
$scope.launchJob = function () {
var adhocUrl = GetBasePath('inventory') + $routeParams.inventory_id +
var adhocUrl = GetBasePath('inventory') + $stateParams.inventory_id +
'/ad_hoc_commands/', fld, data={}, html;
html = '<form class="ng-valid ng-valid-required" ' +
@@ -243,7 +223,7 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
}
// Launch the adhoc job
Rest.setUrl(GetBasePath('inventory') +
$routeParams.inventory_id + '/ad_hoc_commands/');
$stateParams.inventory_id + '/ad_hoc_commands/');
Rest.post(data)
.success(function (data) {
Wait('stop');
@@ -310,7 +290,7 @@ function adhocController($q, $scope, $rootScope, $location, $routeParams,
}
export default ['$q', '$scope', '$rootScope', '$location', '$routeParams',
export default ['$q', '$scope', '$rootScope', '$location', '$stateParams',
'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'adhocForm',
'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath',
'GetChoices', 'KindChange', 'LookUpInit', 'CredentialList', 'Empty', 'Wait',

View File

@@ -1,8 +1,3 @@
<breadcrumbs>
<breadcrumb path="/inventories" title="Inventories"></breadcrumb>
<breadcrumb path="/inventories/{{inv_id}}/manage" title="{{inv_name}}"></breadcrumb>
<breadcrumb path="/inventories/{{inv_id}}/adhoc" title="Run Command"></breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="credentials">
<div ng-cloak id="htmlTemplate">
</div>

View File

@@ -2,11 +2,9 @@ import route from './adhoc.route';
import adhocController from './adhoc.controller';
import form from './adhoc.form';
export default angular.module('adhoc', ["ngRoute"])
export default angular.module('adhoc', [])
.controller('adhocController', adhocController)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}])
.factory('adhocForm', form);

View File

@@ -31,9 +31,6 @@ import systemTracking from './system-tracking/main';
import inventoryScripts from './inventory-scripts/main';
import permissions from './permissions/main';
import managementJobs from './management-jobs/main';
import routeExtensions from './shared/route-extensions/main';
import breadcrumbs from './shared/breadcrumbs/main';
// modules
import setupMenu from './setup-menu/main';
@@ -78,13 +75,10 @@ __deferLoadIfEnabled();
var tower = angular.module('Tower', [
// 'ngAnimate',
'ngRoute',
'ngSanitize',
'ngCookies',
RestServices.name,
routeExtensions.name,
browserData.name,
breadcrumbs.name,
systemTracking.name,
inventoryScripts.name,
permissions.name,
@@ -185,7 +179,9 @@ var tower = angular.module('Tower', [
'PortalJobsListDefinition',
'features',
'longDateFilter',
'pendolytics'
'pendolytics',
'ui.router',
'ncy-angular-breadcrumb',
])
.constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/')
@@ -195,14 +191,74 @@ var tower = angular.module('Tower', [
.config(['$pendolyticsProvider', function($pendolyticsProvider) {
$pendolyticsProvider.doNotAutoStart();
}])
.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
.config(['$stateProvider', '$urlRouterProvider', '$breadcrumbProvider',
function ($stateProvider, $urlRouterProvider, $breadcrumbProvider) {
when('/jobs', {
name: 'jobs',
$breadcrumbProvider.setOptions({
templateUrl: urlPrefix + 'partials/breadcrumb.html'
});
// $urlRouterProvider.otherwise("/home");
$urlRouterProvider.otherwise(function($injector){
var $state = $injector.get("$state");
$state.go('dashboard');
});
$stateProvider.
state('dashboard', {
url: '/home',
templateUrl: urlPrefix + 'partials/home.html',
controller: Home,
ncyBreadcrumb: {
label: "DASHBOARD"
},
resolve: {
graphData: ['$q', 'jobStatusGraphData', 'FeaturesService', function($q, jobStatusGraphData, FeaturesService) {
return $q.all({
jobStatus: jobStatusGraphData.get("month", "all"),
features: FeaturesService.get()
});
}]
}
}).
state('dashboardGroups', {
url: '/home/groups',
templateUrl: urlPrefix + 'partials/subhome.html',
controller: HomeGroups,
ncyBreadcrumb: {
parent: 'dashboard',
label: "GROUPS"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
}
}).
state('dashboardHosts', {
url: '/home/hosts?has_active_failures',
templateUrl: urlPrefix + 'partials/subhome.html',
controller: HomeHosts,
ncyBreadcrumb: {
parent: 'dashboard',
label: "HOSTS"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
}
}).
state('jobs', {
url: '/jobs',
templateUrl: urlPrefix + 'partials/jobs.html',
controller: JobsListController,
ncyBreadcrumb: {
label: "JOBS"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -210,10 +266,13 @@ var tower = angular.module('Tower', [
}
}).
when('/portal', {
name: 'portal',
state('portal', {
url: '/portal',
templateUrl: urlPrefix + 'partials/portal.html',
controller: PortalController,
ncyBreadcrumb: {
label: "PORTAL"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -221,10 +280,14 @@ var tower = angular.module('Tower', [
}
}).
when('/jobs/:id', {
name: 'jobDetail',
state('jobDetail', {
url: '/jobs/:id',
templateUrl: urlPrefix + 'partials/job_detail.html',
controller: JobDetailController,
ncyBreadcrumb: {
parent: 'jobs',
label: "{{ job.id }} - {{ job.name }}"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -244,10 +307,14 @@ var tower = angular.module('Tower', [
}
}).
when('/jobs/:id/stdout', {
name: 'jobsStdout',
state('jobsStdout', {
url: '/jobs/:id/stdout',
templateUrl: urlPrefix + 'partials/job_stdout.html',
controller: JobStdoutController,
ncyBreadcrumb: {
parent: 'jobDetail',
label: "STANDARD OUT"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -267,8 +334,8 @@ var tower = angular.module('Tower', [
}
}).
when('/ad_hoc_commands/:id', {
name: 'adHocJobStdout',
state('adHocJobStdout', {
url: '/ad_hoc_commands/:id',
templateUrl: urlPrefix + 'partials/job_stdout_adhoc.html',
controller: JobStdoutController,
resolve: {
@@ -290,10 +357,13 @@ var tower = angular.module('Tower', [
}
}).
when('/job_templates', {
name: 'jobTemplates',
state('jobTemplates', {
url: '/job_templates',
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: JobTemplatesList,
ncyBreadcrumb: {
label: "JOB TEMPLATES"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -301,10 +371,14 @@ var tower = angular.module('Tower', [
}
}).
when('/job_templates/add', {
name: 'jobTemplateAdd',
state('jobTemplateAdd', {
url: '/job_templates/add',
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: JobTemplatesAdd,
ncyBreadcrumb: {
parent: "jobTemplates",
label: "CREATE JOB TEMPLATE"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -312,8 +386,8 @@ var tower = angular.module('Tower', [
}
}).
when('/job_templates/:template_id', {
name: 'jobTemplateEdit',
state('jobTemplateEdit', {
url: '/job_templates/:template_id',
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: JobTemplatesEdit,
resolve: {
@@ -323,8 +397,8 @@ var tower = angular.module('Tower', [
}
}).
when('/job_templates/:id/schedules', {
name: 'jobTemplateSchedules',
state('jobTemplateSchedules', {
url: '/job_templates/:id/schedules',
templateUrl: urlPrefix + 'partials/schedule_detail.html',
controller: ScheduleEditController,
resolve: {
@@ -334,10 +408,13 @@ var tower = angular.module('Tower', [
}
}).
when('/projects', {
name: 'projects',
state('projects', {
url: '/projects',
templateUrl: urlPrefix + 'partials/projects.html',
controller: ProjectsList,
ncyBreadcrumb: {
label: "PROJECTS"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -345,10 +422,14 @@ var tower = angular.module('Tower', [
}
}).
when('/projects/add', {
name: 'projectAdd',
templateUrl: urlPrefix + 'partials/projects.html',
state('projects.add', {
url: '/add',
templateUrl: urlPrefix + 'partials/projects.add.html',
controller: ProjectsAdd,
ncyBreadcrumb: {
parent: "projects",
label: "CREATE PROJECT"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -356,8 +437,8 @@ var tower = angular.module('Tower', [
}
}).
when('/projects/:id', {
name: 'projectEdit',
state('projects.edit', {
url: '/:id',
templateUrl: urlPrefix + 'partials/projects.html',
controller: ProjectsEdit,
resolve: {
@@ -367,8 +448,8 @@ var tower = angular.module('Tower', [
}
}).
when('/projects/:id/schedules', {
name: 'projectSchedules',
state('projectSchedules', {
url: '/projects/:id/schedules',
templateUrl: urlPrefix + 'partials/schedule_detail.html',
controller: ScheduleEditController,
resolve: {
@@ -378,8 +459,8 @@ var tower = angular.module('Tower', [
}
}).
when('/projects/:project_id/organizations', {
name: 'projectOrganizations',
state('projectOrganizations', {
url: '/projects/:project_id/organizations',
templateUrl: urlPrefix + 'partials/projects.html',
controller: OrganizationsList,
resolve: {
@@ -389,8 +470,8 @@ var tower = angular.module('Tower', [
}
}).
when('/projects/:project_id/organizations/add', {
name: 'projectOrganizationAdd',
state('projectOrganizationAdd', {
url: '/projects/:project_id/organizations/add',
templateUrl: urlPrefix + 'partials/projects.html',
controller: OrganizationsAdd,
resolve: {
@@ -400,10 +481,13 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories', {
name: 'inventories',
state('inventories', {
url: '/inventories',
templateUrl: urlPrefix + 'partials/inventories.html',
controller: InventoriesList,
ncyBreadcrumb: {
label: "INVENTORIES"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -411,10 +495,14 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories/add', {
name: 'inventoryAdd',
state('inventories.add', {
url: '/add',
templateUrl: urlPrefix + 'partials/inventories.html',
controller: InventoriesAdd,
ncyBreadcrumb: {
parent: "inventories",
label: "CREATE INVENTORY"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -422,8 +510,8 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories/:inventory_id', {
name: 'inventoryEdit',
state('inventories.edit', {
url: '/:inventory_id',
templateUrl: urlPrefix + 'partials/inventories.html',
controller: InventoriesEdit,
resolve: {
@@ -433,8 +521,8 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories/:inventory_id/job_templates/add', {
name: 'inventoryJobTemplateAdd',
state('inventoryJobTemplateAdd', {
url: '/inventories/:inventory_id/job_templates/add',
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: JobTemplatesAdd,
resolve: {
@@ -444,12 +532,8 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories/:inventory_id/job_templates/', {
redirectTo: '/inventories/:inventory_id'
}).
when('/inventories/:inventory_id/job_templates/:template_id', {
name: 'inventoryJobTemplateEdit',
state('inventoryJobTemplateEdit', {
url: '/inventories/:inventory_id/job_templates/:template_id',
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: JobTemplatesEdit,
resolve: {
@@ -459,8 +543,8 @@ var tower = angular.module('Tower', [
}
}).
when('/inventories/:inventory_id/manage', {
name: 'inventoryManage',
state('inventoryManage', {
url: '/inventories/:inventory_id/manage?groups',
templateUrl: urlPrefix + 'partials/inventory-manage.html',
controller: InventoriesManage,
resolve: {
@@ -470,10 +554,14 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations', {
name: 'organizations',
state('organizations', {
url: '/organizations',
templateUrl: urlPrefix + 'partials/organizations.html',
controller: OrganizationsList,
ncyBreadcrumb: {
parent: "setup",
label: "ORGANIZATIONS"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -481,10 +569,14 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/add', {
name: 'organizationAdd',
state('organizationsAdd', {
url: '/organization/add',
templateUrl: urlPrefix + 'partials/organizations.html',
controller: OrganizationsAdd,
ncyBreadcrumb: {
parent: "organizations",
label: "CREATE ORGANIZATION"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -492,8 +584,8 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/:organization_id', {
name: 'organizationEdit',
state('organizationEdit', {
url: '/organizations/:organization_id',
templateUrl: urlPrefix + 'partials/organizations.html',
controller: OrganizationsEdit,
resolve: {
@@ -503,8 +595,8 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/:organization_id/admins', {
name: 'organizationAdmins',
state('organizationAdmins', {
url: '/organizations/:organization_id/admins',
templateUrl: urlPrefix + 'partials/organizations.html',
controller: AdminsList,
resolve: {
@@ -514,8 +606,8 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/:organization_id/users', {
name: 'organizationUsers',
state('organizationUsers', {
url:'/organizations/:organization_id/users',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersList,
resolve: {
@@ -525,8 +617,8 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/:organization_id/users/add', {
name: 'organizationUserAdd',
state('organizationUserAdd', {
url: '/organizations/:organization_id/users/add',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersAdd,
resolve: {
@@ -536,8 +628,8 @@ var tower = angular.module('Tower', [
}
}).
when('/organizations/:organization_id/users/:user_id', {
name: 'organizationUserEdit',
state('organizationUserEdit', {
url: '/organizations/:organization_id/users/:user_id',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersEdit,
resolve: {
@@ -547,10 +639,14 @@ var tower = angular.module('Tower', [
}
}).
when('/teams', {
name: 'teams',
state('teams', {
url: '/teams',
templateUrl: urlPrefix + 'partials/teams.html',
controller: TeamsList,
ncyBreadcrumb: {
parent: 'setup',
label: 'TEAMS'
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -558,10 +654,14 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/add', {
name: 'teamsAdd',
state('teamsAdd', {
url: '/teams/add',
templateUrl: urlPrefix + 'partials/teams.html',
controller: TeamsAdd,
ncyBreadcrumb: {
parent: "teams",
label: "CREATE TEAM"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -569,8 +669,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id', {
name: 'teamEdit',
state('teamEdit', {
url: '/teams/:team_id',
templateUrl: urlPrefix + 'partials/teams.html',
controller: TeamsEdit,
resolve: {
@@ -580,8 +680,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/users', {
name: 'teamUsers',
state('teamUsers', {
url: '/teams/:team_id/users',
templateUrl: urlPrefix + 'partials/teams.html',
controller: UsersList,
resolve: {
@@ -591,8 +691,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/users/:user_id', {
name: 'teamUserEdit',
state('teamUserEdit', {
url: '/teams/:team_id/users/:user_id',
templateUrl: urlPrefix + 'partials/teams.html',
controller: UsersEdit,
resolve: {
@@ -602,8 +702,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/projects', {
name: 'teamProjects',
state('teamProjects', {
url: '/teams/:team_id/projects',
templateUrl: urlPrefix + 'partials/teams.html',
controller: ProjectsList,
resolve: {
@@ -613,8 +713,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/projects/add', {
name: 'teamProjectAdd',
state('teamProjectAdd', {
url: '/teams/:team_id/projects/add',
templateUrl: urlPrefix + 'partials/teams.html',
controller: ProjectsAdd,
resolve: {
@@ -624,8 +724,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/projects/:project_id', {
name: 'teamProjectEdit',
state('teamProjectEdit', {
url: '/teams/:team_id/projects/:project_id',
templateUrl: urlPrefix + 'partials/teams.html',
controller: ProjectsEdit,
resolve: {
@@ -635,8 +735,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/credentials', {
name: 'teamCredentials',
state('teamCredentials', {
url: '/teams/:team_id/credentials',
templateUrl: urlPrefix + 'partials/teams.html',
controller: CredentialsList,
resolve: {
@@ -646,8 +746,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/credentials/add', {
name: 'teamCredentialAdd',
state('teamCredentialAdd', {
url: '/teams/:team_id/credentials/add',
templateUrl: urlPrefix + 'partials/teams.html',
controller: CredentialsAdd,
resolve: {
@@ -657,8 +757,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:team_id/credentials/:credential_id', {
name: 'teamCredentialEdit',
state('teamCredentialEdit', {
url: '/teams/:team_id/credentials/:credential_id',
templateUrl: urlPrefix + 'partials/teams.html',
controller: CredentialsEdit,
resolve: {
@@ -668,10 +768,14 @@ var tower = angular.module('Tower', [
}
}).
when('/credentials', {
name: 'credentials',
state('credentials', {
url: '/credentials',
templateUrl: urlPrefix + 'partials/credentials.html',
controller: CredentialsList,
ncyBreadcrumb: {
parent: 'setup',
label: 'CREDENTIALS'
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -679,10 +783,14 @@ var tower = angular.module('Tower', [
}
}).
when('/credentials/add', {
name: 'credentialAdd',
state('credentialAdd', {
url: '/credentials/add',
templateUrl: urlPrefix + 'partials/credentials.html',
controller: CredentialsAdd,
ncyBreadcrumb: {
parent: "credentials",
label: "CREATE CREDENTIAL"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -690,8 +798,8 @@ var tower = angular.module('Tower', [
}
}).
when('/credentials/:credential_id', {
name: 'credentialEdit',
state('credentialEdit', {
url: '/credentials/:credential_id',
templateUrl: urlPrefix + 'partials/credentials.html',
controller: CredentialsEdit,
resolve: {
@@ -701,10 +809,14 @@ var tower = angular.module('Tower', [
}
}).
when('/users', {
name: 'users',
state('users', {
url: '/users',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersList,
ncyBreadcrumb: {
parent: 'setup',
label: 'USERS'
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -712,10 +824,14 @@ var tower = angular.module('Tower', [
}
}).
when('/users/add', {
name: 'userAdd',
state('userAdd', {
url: '/users/add',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersAdd,
ncyBreadcrumb: {
parent: "users",
label: "CREATE USER"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -723,8 +839,8 @@ var tower = angular.module('Tower', [
}
}).
when('/users/:user_id', {
name: 'userEdit',
state('userEdit', {
url: '/users/:user_id',
templateUrl: urlPrefix + 'partials/users.html',
controller: UsersEdit,
resolve: {
@@ -734,8 +850,8 @@ var tower = angular.module('Tower', [
}
}).
when('/users/:user_id/credentials', {
name: 'userCredentials',
state('userCredentials', {
url: '/users/:user_id/credentials',
templateUrl: urlPrefix + 'partials/users.html',
controller: CredentialsList,
resolve: {
@@ -745,8 +861,8 @@ var tower = angular.module('Tower', [
}
}).
when('/users/:user_id/credentials/add', {
name: 'userCredentialAdd',
state('userCredentialAdd', {
url: '/users/:user_id/credentials/add',
templateUrl: urlPrefix + 'partials/teams.html',
controller: CredentialsAdd,
resolve: {
@@ -756,8 +872,8 @@ var tower = angular.module('Tower', [
}
}).
when('/teams/:user_id/credentials/:credential_id', {
name: 'teamUserCredentialEdit',
state('teamUserCredentialEdit', {
url: '/teams/:user_id/credentials/:credential_id',
templateUrl: urlPrefix + 'partials/teams.html',
controller: CredentialsEdit,
resolve: {
@@ -767,46 +883,14 @@ var tower = angular.module('Tower', [
}
}).
when('/home', {
name: 'dashboard',
templateUrl: urlPrefix + 'partials/home.html',
controller: Home,
resolve: {
graphData: ['$q', 'jobStatusGraphData', 'FeaturesService', function($q, jobStatusGraphData, FeaturesService) {
return $q.all({
jobStatus: jobStatusGraphData.get("month", "all"),
features: FeaturesService.get()
});
}]
}
}).
when('/home/groups', {
name: 'dashboardGroups',
templateUrl: urlPrefix + 'partials/subhome.html',
controller: HomeGroups,
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
}
}).
when('/home/hosts', {
name: 'dashboardHosts',
templateUrl: urlPrefix + 'partials/subhome.html',
controller: HomeHosts,
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
}
}).
when('/license', {
name: 'license',
state('license', {
url: '/license',
templateUrl: urlPrefix + 'partials/license.html',
controller: LicenseController,
ncyBreadcrumb: {
parent: 'setup',
label: 'LICENSE'
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
@@ -814,14 +898,13 @@ var tower = angular.module('Tower', [
}
}).
when('/sockets', {
name: 'sockets',
state('sockets', {
url: '/sockets',
templateUrl: urlPrefix + 'partials/sockets.html',
controller: SocketsController
}).
otherwise({
redirectTo: '/home'
controller: SocketsController,
ncyBreadcrumb: {
label: 'SOCKETS'
}
});
}
])
@@ -885,7 +968,6 @@ var tower = angular.module('Tower', [
$rootScope.removeConfigReady = $rootScope.$on('ConfigReady', function() {
LoadBasePaths();
$rootScope.breadcrumbs = [];
$rootScope.crumbCache = [];
if ($rootScope.removeOpenSocket) {
@@ -966,7 +1048,7 @@ var tower = angular.module('Tower', [
},2000);
});
$rootScope.$on("$routeChangeStart", function (event, next, prev) {
$rootScope.$on("$stateChangeStart", function (event, next, nextParams, prev) {
// this line removes the query params attached to a route
if(prev && prev.$$route &&
prev.$$route.name === 'systemTracking'){
@@ -1027,7 +1109,7 @@ var tower = angular.module('Tower', [
} else {
// If browser refresh, set the user_is_superuser value
$rootScope.user_is_superuser = Authorization.getUserInfo('is_superuser');
// when the user refreshes we want to open the socket, except if the user is on the login page, which should happen after the user logs in (see the AuthService module for that call to OpenSocket)
// state the user refreshes we want to open the socket, except if the user is on the login page, which should happen after the user logs in (see the AuthService module for that call to OpenSocket)
if(!_.contains($location.$$url, '/login')){
Timer.init().then(function(timer){
$rootScope.sessionTimer = timer;
@@ -1068,7 +1150,7 @@ var tower = angular.module('Tower', [
if (!$AnsibleConfig) {
// create a promise that will resolve when $AnsibleConfig is loaded
// create a promise that will resolve state $AnsibleConfig is loaded
$rootScope.loginConfig = $q.defer();
}

View File

@@ -39,6 +39,29 @@
flex: initial;
}
.BreadCrumb > ol {
padding: 0px 20px;
list-style: none;
background-color: #FFFFFF;
border-radius: 4px;
line-height: 40px;
}
.BreadCrumb > ol > li {
display: inline-block;
color: #B7B7B7;
}
.BreadCrumb > ol > li + li:before {
content: "/";
padding: 0 5px;
color: #B7B7B7;
}
.BreadCrumb > ol > li > .active {
color: #123123;
}
@breadcrumb-breakpoint: 900px;
@media screen and (max-width: @breadcrumb-breakpoint) {

View File

@@ -1,7 +1,7 @@
/* jshint unused: vars */
export default
[ 'templateUrl', '$route', function(templateUrl, $route) {
[ 'templateUrl', '$state', function(templateUrl, $state) {
return {
restrict: 'E',
templateUrl: templateUrl('bread-crumb/bread-crumb'),
@@ -10,11 +10,11 @@ export default
scope.toggleActivityStreamActive = function(){
scope.activityStreamActive = !scope.activityStreamActive;
}
};
scope.isActive = function (path) {
if ($route.current && $route.current.regexp) {
return $route.current.regexp.test(path);
if ($state.current && $state.current.regexp) {
return $state.current.regexp.test(path);
}
return false;
};

View File

@@ -1,4 +1,5 @@
<div id="bread_crumb" class="BreadCrumb" ng-class="{'is-loggedOut' : !$root.current_user.username}">
<div ncy-breadcrumb></div>
<div class="BreadCrumb-menuLink"
id="bread_crumb_activity_stream"
aw-tool-tip="View Activity Stream"

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc overview
* @name controllers
@@ -21,16 +21,16 @@
*/
export function AdminsList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, AdminList, GenerateList, LoadBreadCrumbs,
export function AdminsList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, AdminList, GenerateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller, GetBasePath, SelectionInit) {
var list = AdminList,
defaultUrl = GetBasePath('organizations') + $routeParams.organization_id + '/users/',
defaultUrl = GetBasePath('organizations') + $stateParams.organization_id + '/users/',
generator = GenerateList,
mode = 'select',
url = GetBasePath('organizations') + $routeParams.organization_id + '/admins/';
url = GetBasePath('organizations') + $stateParams.organization_id + '/admins/';
generator.inject(AdminList, { mode: mode, scope: $scope, breadCrumbs: true });
generator.inject(AdminList, { mode: mode, scope: $scope });
SelectionInit({ scope: $scope, list: list, url: url, returnToCaller: 1 });
@@ -39,10 +39,8 @@ export function AdminsList($scope, $rootScope, $location, $log, $routeParams, Re
PaginateInit({ scope: $scope, list: list, url: defaultUrl });
$scope.search(list.iterator);
LoadBreadCrumbs();
}
AdminsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'AdminList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'GetBasePath', 'SelectionInit'
AdminsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'AdminList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'GetBasePath', 'SelectionInit'
];

View File

@@ -11,8 +11,8 @@
*/
export function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, CredentialList,
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
export function CredentialsList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, CredentialList,
GenerateList, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait, Stream) {
ClearScope();
@@ -26,12 +26,12 @@ export function CredentialsList($scope, $rootScope, $location, $log, $routeParam
mode = (base === 'credentials') ? 'edit' : 'select',
url;
view.inject(list, { mode: mode, scope: $scope, breadCrumbs:(($routeParams.user_id || $routeParams.team_id) ? true : false) });
view.inject(list, { mode: mode, scope: $scope });
$scope.selected = [];
$scope.credentialLoading = true;
url = GetBasePath(base) + ( (base === 'users') ? $routeParams.user_id + '/credentials/' : $routeParams.team_id + '/credentials/' );
url = GetBasePath(base) + ( (base === 'users') ? $stateParams.user_id + '/credentials/' : $stateParams.team_id + '/credentials/' );
if (mode === 'select') {
SelectionInit({ scope: $scope, list: list, url: url, returnToCaller: 1 });
@@ -124,14 +124,14 @@ export function CredentialsList($scope, $rootScope, $location, $log, $routeParam
};
}
CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'CredentialList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'GetChoices', 'Wait', 'Stream'
];
export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList,
export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $stateParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, ReturnToCaller, ClearScope, GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList,
GetBasePath, GetChoices, Empty, KindChange, OwnerChange, FormSave) {
ClearScope();
@@ -165,7 +165,7 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
LookUpInit({
scope: $scope,
form: form,
current_item: (!Empty($routeParams.user_id)) ? $routeParams.user_id : null,
current_item: (!Empty($stateParams.user_id)) ? $stateParams.user_id : null,
list: UserList,
field: 'user',
input_type: 'radio',
@@ -175,19 +175,19 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
LookUpInit({
scope: $scope,
form: form,
current_item: (!Empty($routeParams.team_id)) ? $routeParams.team_id : null,
current_item: (!Empty($stateParams.team_id)) ? $stateParams.team_id : null,
list: TeamList,
field: 'team',
input_type: 'radio',
autopopulateLookup: false
});
if (!Empty($routeParams.user_id)) {
if (!Empty($stateParams.user_id)) {
// Get the username based on incoming route
$scope.owner = 'user';
$scope.user = $routeParams.user_id;
$scope.user = $stateParams.user_id;
OwnerChange({ scope: $scope });
url = GetBasePath('users') + $routeParams.user_id + '/';
url = GetBasePath('users') + $stateParams.user_id + '/';
Rest.setUrl(url);
Rest.get()
.success(function (data) {
@@ -196,12 +196,12 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user. GET status: ' + status });
});
} else if (!Empty($routeParams.team_id)) {
} else if (!Empty($stateParams.team_id)) {
// Get the username based on incoming route
$scope.owner = 'team';
$scope.team = $routeParams.team_id;
$scope.team = $stateParams.team_id;
OwnerChange({ scope: $scope });
url = GetBasePath('teams') + $routeParams.team_id + '/';
url = GetBasePath('teams') + $stateParams.team_id + '/';
Rest.setUrl(url);
Rest.get()
.success(function (data) {
@@ -293,14 +293,14 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
}
CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'SearchInit', 'PaginateInit',
CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'CredentialForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList', 'SearchInit', 'PaginateInit',
'LookUpInit', 'UserList', 'TeamList', 'GetBasePath', 'GetChoices', 'Empty', 'KindChange', 'OwnerChange', 'FormSave'
];
export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices,
export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices,
KindChange, UserList, TeamList, LookUpInit, Empty, OwnerChange, FormSave, Stream, Wait) {
ClearScope();
@@ -310,7 +310,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
form = CredentialForm,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.credential_id;
id = $stateParams.credential_id;
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
@@ -473,7 +473,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
})
.error(function (data, status) {
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
msg: 'Failed to retrieve Credential: ' + $routeParams.id + '. GET status: ' + status });
msg: 'Failed to retrieve Credential: ' + $stateParams.id + '. GET status: ' + status });
});
});
@@ -530,13 +530,13 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
// Related set: Add button
$scope.add = function (set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/add');
$location.path('/' + base + '/' + $stateParams.id + '/' + set + '/add');
};
// Related set: Edit button
$scope.edit = function (set, id) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
$location.path('/' + base + '/' + $stateParams.id + '/' + set + '/' + id);
};
// Related set: Delete button
@@ -611,8 +611,8 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
}
CredentialsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit',
CredentialsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'CredentialForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit',
'ReturnToCaller', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices', 'KindChange', 'UserList', 'TeamList', 'LookUpInit',
'Empty', 'OwnerChange', 'FormSave', 'Stream', 'Wait'
];

View File

@@ -21,7 +21,7 @@
*
*/
export function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait,
export function Home($scope, $compile, $stateParams, $rootScope, $location, $log, Wait,
ClearScope, Stream, Rest, GetBasePath, ProcessErrors, $window, graphData){
ClearScope('home');
@@ -144,7 +144,7 @@ export function Home($scope, $compile, $routeParams, $rootScope, $location, $log
$scope.refresh();
}
Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait',
Home.$inject = ['$scope', '$compile', '$stateParams', '$rootScope', '$location', '$log','Wait',
'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', '$window', 'graphData'
];
@@ -156,7 +156,7 @@ Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location',
* @description This controls the 'home/groups' page that is loaded from the dashboard
*
*/
export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $location, $routeParams, LogViewer, HomeGroupList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $location, $stateParams, LogViewer, HomeGroupList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
GetBasePath, SearchInit, PaginateInit, FormatDate, GetHostsStatusMsg, GetSyncStatusMsg, ViewUpdateStatus, Stream, GroupsEdit, Wait,
Alert, Rest, Empty, InventoryUpdate, Find, GroupsCancelUpdate, Store) {
@@ -170,7 +170,7 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
modal_scope = $scope.$new(),
opt, PreviousSearchParams;
generator.inject(list, { mode: 'edit', scope: scope, breadCrumbs: true });
generator.inject(list, { mode: 'edit', scope: scope });
function ellipsis(a) {
if (a.length > 20) {
@@ -257,31 +257,31 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
});
// Process search params
if ($routeParams.name) {
if ($stateParams.name) {
scope[list.iterator + 'InputDisable'] = false;
scope[list.iterator + 'SearchValue'] = $routeParams.name;
scope[list.iterator + 'SearchValue'] = $stateParams.name;
scope[list.iterator + 'SearchField'] = 'name';
scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
scope[list.iterator + 'SearchSelectValue'] = null;
}
if ($routeParams.id) {
if ($stateParams.id) {
scope[list.iterator + 'InputDisable'] = false;
scope[list.iterator + 'SearchValue'] = $routeParams.id;
scope[list.iterator + 'SearchValue'] = $stateParams.id;
scope[list.iterator + 'SearchField'] = 'id';
scope[list.iterator + 'SearchFieldLabel'] = list.fields.id.label;
scope[list.iterator + 'SearchSelectValue'] = null;
}
if ($routeParams.has_active_failures) {
if ($stateParams.has_active_failures) {
scope[list.iterator + 'InputDisable'] = true;
scope[list.iterator + 'SearchValue'] = $routeParams.has_active_failures;
scope[list.iterator + 'SearchValue'] = $stateParams.has_active_failures;
scope[list.iterator + 'SearchField'] = 'has_active_failures';
scope[list.iterator + 'SearchFieldLabel'] = list.fields.has_active_failures.label;
scope[list.iterator + 'SearchSelectValue'] = ($routeParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 };
scope[list.iterator + 'SearchSelectValue'] = ($stateParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 };
}
if ($routeParams.status && !$routeParams.source) {
if ($stateParams.status && !$stateParams.source) {
scope[list.iterator + 'SearchField'] = 'last_update_failed';
scope[list.iterator + 'SearchFieldLabel'] = list.fields.last_update_failed.label;
scope[list.iterator + 'SelectShow'] = false;
@@ -292,31 +292,31 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
//scope[list.iterator + 'SearchSelectOpts'] = list.fields.status.searchOptions;
//scope[list.iterator + 'SearchFieldLabel'] = list.fields.status.label.replace(/<br\>/g, ' ');
//for (opt in list.fields.status.searchOptions) {
// if (list.fields.status.searchOptions[opt].value === $routeParams.status) {
// if (list.fields.status.searchOptions[opt].value === $stateParams.status) {
// scope[list.iterator + 'SearchSelectValue'] = list.fields.status.searchOptions[opt];
// break;
// }
//}
}
if ($routeParams.source) {
if ($stateParams.source) {
scope[list.iterator + 'SearchField'] = 'source';
scope[list.iterator + 'SelectShow'] = true;
scope[list.iterator + 'SearchSelectOpts'] = list.fields.source.searchOptions;
scope[list.iterator + 'SearchFieldLabel'] = list.fields.source.label.replace(/<br\>/g, ' ');
for (opt in list.fields.source.searchOptions) {
if (list.fields.source.searchOptions[opt].value === $routeParams.source) {
if (list.fields.source.searchOptions[opt].value === $stateParams.source) {
scope[list.iterator + 'SearchSelectValue'] = list.fields.source.searchOptions[opt];
break;
}
}
if ($routeParams.status) {
scope[list.iterator + 'ExtraParms'] = 'inventory_source__status__icontains=' + $routeParams.status;
if ($stateParams.status) {
scope[list.iterator + 'ExtraParms'] = 'inventory_source__status__icontains=' + $stateParams.status;
}
}
if ($routeParams.has_external_source) {
if ($stateParams.has_external_source) {
scope[list.iterator + 'SearchField'] = 'has_external_source';
scope[list.iterator + 'SearchValue'] = list.fields.has_external_source.searchValue;
scope[list.iterator + 'InputDisable'] = true;
@@ -324,9 +324,9 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
scope[list.iterator + 'SearchFieldLabel'] = list.fields.has_external_source.label;
}
if ($routeParams.inventory_source__id) {
if ($stateParams.inventory_source__id) {
scope[list.iterator + 'SearchField'] = 'inventory_source';
scope[list.iterator + 'SearchValue'] = $routeParams.inventory_source__id;
scope[list.iterator + 'SearchValue'] = $stateParams.inventory_source__id;
scope[list.iterator + 'SearchFieldLabel'] = 'Source ID';
}
@@ -334,8 +334,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
scope.$emit('WatchUpdateStatus'); // Start watching for live updates
LoadBreadCrumbs();
if ($rootScope.removeJobStatusChange) {
$rootScope.removeJobStatusChange();
}
@@ -579,7 +577,7 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
}
HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$location', '$routeParams', 'LogViewer', 'HomeGroupList', 'generateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$location', '$stateParams', 'LogViewer', 'HomeGroupList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'GetHostsStatusMsg', 'GetSyncStatusMsg', 'ViewUpdateStatus',
'Stream', 'GroupsEdit', 'Wait', 'Alert', 'Rest', 'Empty', 'InventoryUpdate', 'Find', 'GroupsCancelUpdate', 'Store', 'Socket'
];
@@ -592,7 +590,7 @@ HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$l
*
*/
export function HomeHosts($scope, $location, $routeParams, HomeHostList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
export function HomeHosts($scope, $location, $stateParams, HomeHostList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
GetBasePath, SearchInit, PaginateInit, FormatDate, SetStatus, ToggleHostEnabled, HostsEdit, Stream, Find, ShowJobSummary, ViewJob) {
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
@@ -615,7 +613,7 @@ export function HomeHosts($scope, $location, $routeParams, HomeHostList, Generat
});
}
generator.inject(list, { mode: 'edit', scope: $scope, breadCrumbs: true });
generator.inject(list, { mode: 'edit', scope: $scope });
});
@@ -633,33 +631,31 @@ export function HomeHosts($scope, $location, $routeParams, HomeHostList, Generat
});
// Process search params
if ($routeParams.name) {
if ($stateParams.name) {
$scope[HomeHostList.iterator + 'InputDisable'] = false;
$scope[HomeHostList.iterator + 'SearchValue'] = $routeParams.name;
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.name;
$scope[HomeHostList.iterator + 'SearchField'] = 'name';
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.name.label;
}
if ($routeParams.id) {
if ($stateParams.id) {
$scope[HomeHostList.iterator + 'InputDisable'] = false;
$scope[HomeHostList.iterator + 'SearchValue'] = $routeParams.id;
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.id;
$scope[HomeHostList.iterator + 'SearchField'] = 'id';
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.id.label;
$scope[HomeHostList.iterator + 'SearchSelectValue'] = null;
}
if ($routeParams.has_active_failures) {
if ($stateParams.has_active_failures) {
$scope[HomeHostList.iterator + 'InputDisable'] = true;
$scope[HomeHostList.iterator + 'SearchValue'] = $routeParams.has_active_failures;
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.has_active_failures;
$scope[HomeHostList.iterator + 'SearchField'] = 'has_active_failures';
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = HomeHostList.fields.has_active_failures.label;
$scope[HomeHostList.iterator + 'SearchSelectValue'] = ($routeParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 };
$scope[HomeHostList.iterator + 'SearchSelectValue'] = ($stateParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 };
}
$scope.search(list.iterator);
LoadBreadCrumbs();
$scope.refreshHosts = function() {
$scope.search(list.iterator);
};
@@ -708,7 +704,7 @@ export function HomeHosts($scope, $location, $routeParams, HomeHostList, Generat
}
HomeHosts.$inject = ['$scope', '$location', '$routeParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
HomeHosts.$inject = ['$scope', '$location', '$stateParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'SetStatus', 'ToggleHostEnabled', 'HostsEdit', 'Stream',
'Find', 'ShowJobSummary', 'ViewJob'
];

View File

@@ -13,10 +13,10 @@
import '../job-templates/main';
export function InventoriesList($scope, $rootScope, $location, $log,
$routeParams, $compile, $filter, sanitizeFilter, Rest, Alert, InventoryList, generateList,
LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
$stateParams, $compile, $filter, sanitizeFilter, Rest, Alert, InventoryList, generateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath, Wait, Stream,
EditInventoryProperties, Find, Empty, LogViewer) {
EditInventoryProperties, Find, Empty, LogViewer, $state) {
var list = InventoryList,
defaultUrl = GetBasePath('inventory'),
@@ -80,42 +80,42 @@ export function InventoriesList($scope, $rootScope, $location, $log,
url: defaultUrl
});
if ($routeParams.name) {
if ($stateParams.name) {
$scope[InventoryList.iterator + 'InputDisable'] = false;
$scope[InventoryList.iterator + 'SearchValue'] = $routeParams.name;
$scope[InventoryList.iterator + 'SearchValue'] = $stateParams.name;
$scope[InventoryList.iterator + 'SearchField'] = 'name';
$scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields.name.label;
$scope[InventoryList.iterator + 'SearchSelectValue'] = null;
}
if ($routeParams.has_active_failures) {
if ($stateParams.has_active_failures) {
$scope[InventoryList.iterator + 'InputDisable'] = true;
$scope[InventoryList.iterator + 'SearchValue'] = $routeParams.has_active_failures;
$scope[InventoryList.iterator + 'SearchValue'] = $stateParams.has_active_failures;
$scope[InventoryList.iterator + 'SearchField'] = 'has_active_failures';
$scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields.has_active_failures.label;
$scope[InventoryList.iterator + 'SearchSelectValue'] = ($routeParams.has_active_failures === 'true') ? {
$scope[InventoryList.iterator + 'SearchSelectValue'] = ($stateParams.has_active_failures === 'true') ? {
value: 1
} : {
value: 0
};
}
if ($routeParams.has_inventory_sources) {
if ($stateParams.has_inventory_sources) {
$scope[InventoryList.iterator + 'InputDisable'] = true;
$scope[InventoryList.iterator + 'SearchValue'] = $routeParams.has_inventory_sources;
$scope[InventoryList.iterator + 'SearchValue'] = $stateParams.has_inventory_sources;
$scope[InventoryList.iterator + 'SearchField'] = 'has_inventory_sources';
$scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields.has_inventory_sources.label;
$scope[InventoryList.iterator + 'SearchSelectValue'] = ($routeParams.has_inventory_sources === 'true') ? {
$scope[InventoryList.iterator + 'SearchSelectValue'] = ($stateParams.has_inventory_sources === 'true') ? {
value: 1
} : {
value: 0
};
}
if ($routeParams.inventory_sources_with_failures) {
if ($stateParams.inventory_sources_with_failures) {
// pass a value of true, however this field actually contains an integer value
$scope[InventoryList.iterator + 'InputDisable'] = true;
$scope[InventoryList.iterator + 'SearchValue'] = $routeParams.inventory_sources_with_failures;
$scope[InventoryList.iterator + 'SearchValue'] = $stateParams.inventory_sources_with_failures;
$scope[InventoryList.iterator + 'SearchField'] = 'inventory_sources_with_failures';
$scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields.inventory_sources_with_failures.label;
$scope[InventoryList.iterator + 'SearchType'] = 'gtzero';
@@ -123,8 +123,6 @@ export function InventoriesList($scope, $rootScope, $location, $log,
$scope.search(list.iterator);
LoadBreadCrumbs();
if ($scope.removePostRefresh) {
$scope.removePostRefresh();
}
@@ -312,11 +310,11 @@ export function InventoriesList($scope, $rootScope, $location, $log,
};
$scope.addInventory = function () {
$location.path($location.path() + '/add');
$state.go('inventories.add');
};
$scope.editInventory = function (id) {
$location.path($location.path() + '/' + id);
$state.go('inventories.edit', {inventory_id: id});
};
$scope.manageInventory = function(id){
@@ -367,14 +365,14 @@ export function InventoriesList($scope, $rootScope, $location, $log,
};
}
InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', '$compile', '$filter', 'sanitizeFilter', 'Rest', 'Alert', 'InventoryList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'Wait', 'Stream', 'EditInventoryProperties', 'Find', 'Empty', 'LogViewer'
InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', '$compile', '$filter', 'sanitizeFilter', 'Rest', 'Alert', 'InventoryList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'Wait', 'Stream', 'EditInventoryProperties', 'Find', 'Empty', 'LogViewer', '$state'
];
export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest,
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $stateParams, InventoryForm, GenerateForm, Rest,
Alert, ProcessErrors, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON) {
ClearScope();
@@ -388,10 +386,9 @@ export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $r
form.formLabelSize = null;
form.formFieldSize = null;
generator.inject(form, { mode: 'add', related: false, scope: $scope, breadcrumbs: true });
generator.inject(form, { mode: 'add', related: false, scope: $scope });
generator.reset();
LoadBreadCrumbs();
$scope.parseType = 'yaml';
ParseTypeChange({
@@ -404,7 +401,7 @@ export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $r
LookUpInit({
scope: $scope,
form: form,
current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null,
current_item: ($stateParams.organization_id) ? $stateParams.organization_id : null,
list: OrganizationList,
field: 'organization',
input_type: 'radio'
@@ -452,13 +449,13 @@ export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $r
};
}
InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit',
InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'InventoryForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit',
'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON'
];
export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest,
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $stateParams, InventoryForm, GenerateForm, Rest,
Alert, ProcessErrors, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, Stream, RelatedSearchInit, RelatedPaginateInit,
Prompt, PlaybookRun, CreateDialog, deleteJobTemplate) {
@@ -468,7 +465,7 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
var defaultUrl = GetBasePath('inventory'),
form = InventoryForm(),
generator = GenerateForm,
inventory_id = $routeParams.inventory_id,
inventory_id = $stateParams.inventory_id,
master = {},
fld, json_data, data,
relatedSets = {};
@@ -477,7 +474,7 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
form.formLabelSize = null;
form.formFieldSize = null;
$scope.inventory_id = inventory_id;
generator.inject(form, { mode: 'edit', related: true, scope: $scope, breadcrumbs: true });
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
@@ -533,11 +530,6 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
relatedSets: relatedSets
});
LoadBreadCrumbs({
path: $location.path(),
title: $scope.inventory_name
});
Wait('stop');
$scope.parseType = 'yaml';
ParseTypeChange({
@@ -783,8 +775,8 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
}
InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit',
InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'InventoryForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit',
'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', 'Stream', 'RelatedSearchInit', 'RelatedPaginateInit',
'Prompt', 'PlaybookRun', 'CreateDialog', 'deleteJobTemplate'
];
@@ -792,14 +784,14 @@ InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$lo
export function InventoriesManage ($log, $scope, $rootScope, $location,
$routeParams, $compile, generateList, ClearScope, Empty, Wait, Rest, Alert,
LoadBreadCrumbs, GetBasePath, ProcessErrors, Breadcrumbs, InventoryGroups,
$state, $compile, generateList, ClearScope, Empty, Wait, Rest, Alert,
GetBasePath, ProcessErrors, InventoryGroups,
InjectHosts, Find, HostsReload, SearchInit, PaginateInit, GetSyncStatusMsg,
GetHostsStatusMsg, GroupsEdit, InventoryUpdate, GroupsCancelUpdate,
ViewUpdateStatus, GroupsDelete, Store, HostsEdit, HostsDelete,
EditInventoryProperties, ToggleHostEnabled, Stream, ShowJobSummary,
InventoryGroupsHelp, HelpDialog, ViewJob,
GroupsCopy, HostsCopy, transitionTo) {
GroupsCopy, HostsCopy, $stateParams) {
var PreviousSearchParams,
url,
@@ -807,18 +799,6 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
ClearScope();
$scope.group_breadcrumbs = [{
name: '',
id: 0,
description: '',
show: true,
ngicon: null,
has_children: false,
related: {},
active_class: 'active',
show_failures: false
}];
// TODO: only display adhoc button if the user has permission to use it.
// TODO: figure out how to get the action-list partial to update so that
// the tooltip can be changed based off things being selected or not.
@@ -861,9 +841,14 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
});
$scope.systemTracking = function() {
transitionTo('systemTracking',
var hostIds = _.map($scope.hostsSelectedItems, function(x){
return x.id;
});
$state.transitionTo('systemTracking',
{ inventory: $scope.inventory,
hosts: $scope.hostsSelectedItems
inventoryId: $scope.inventory.id,
hosts: $scope.hostsSelectedItems,
hostIds: hostIds
});
};
@@ -938,24 +923,12 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.removeInventoryLoaded();
}
$scope.removeInventoryLoaded = $scope.$on('InventoryLoaded', function() {
var e, rows;
LoadBreadCrumbs({
path: $location.path(),
title: '{{ inventory.name }}'
});
$scope.group_breadcrumbs[0].name = $scope.inventory.name;
// Build page breadcrumbs
e = angular.element(document.getElementById('breadcrumbs'));
e.html(Breadcrumbs({ list: InventoryGroups, mode: 'edit' }));
$compile(e)($scope);
var rows;
// Add groups view
generateList.inject(InventoryGroups, {
mode: 'edit',
id: 'group-list-container',
breadCrumbs: false,
searchSize: 'col-lg-6 col-md-6 col-sm-6',
scope: $scope
});
@@ -1040,7 +1013,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
});
// Load Inventory
url = GetBasePath('inventory') + $routeParams.inventory_id + '/';
url = GetBasePath('inventory') + $stateParams.inventory_id + '/';
Rest.setUrl(url);
Rest.get()
.success(function (data) {
@@ -1048,7 +1021,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.$emit('InventoryLoaded');
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve inventory: ' + $routeParams.inventory_id +
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve inventory: ' + $stateParams.inventory_id +
' GET returned status: ' + status });
});
@@ -1092,15 +1065,6 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.search(InventoryGroups.iterator, null, true, false, true);
}
function setActiveGroupBreadcrumb() {
$scope.group_breadcrumbs.forEach(function(crumb, idx) {
$scope.group_breadcrumbs[idx].active_class = '';
});
$scope.group_breadcrumbs[$scope.group_breadcrumbs.length - 1].active_class = 'active';
$scope.refreshHostsOnGroupRefresh = true;
$scope.selected_group_id = ($scope.group_breadcrumbs[$scope.group_breadcrumbs.length - 1].id === 0) ? null : $scope.group_breadcrumbs[$scope.group_breadcrumbs.length - 1].id;
}
$scope.refreshHosts = function() {
HostsReload({
scope: hostScope,
@@ -1132,32 +1096,16 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
};
$scope.groupSelect = function(id) {
var group = Find({ list: $scope.groups, key: 'id', val: id });
$scope.group_breadcrumbs.push(group);
setActiveGroupBreadcrumb();
var groups = [], group = Find({ list: $scope.groups, key: 'id', val: id });
if($state.params.groups){
groups.push($state.params.groups);
}
groups.push(group.id);
groups = groups.join();
$state.transitionTo('inventoryManage', {inventory_id: $state.params.inventory_id, groups: groups}, { notify: false });
loadGroups(group.related.children, group.id);
};
$scope.breadcrumbGroupSelect = function(id) {
var i, url;
$scope.group_breadcrumbs.every(function(crumb, idx) {
if (crumb.id === id) {
i = idx;
return false;
}
return true;
});
$scope.group_breadcrumbs = $scope.group_breadcrumbs.slice(0,i + 1);
if (id > 0) {
url = $scope.group_breadcrumbs[$scope.group_breadcrumbs.length - 1].related.children;
}
else {
url = $scope.inventory.related.root_groups;
}
setActiveGroupBreadcrumb();
loadGroups(url);
};
$scope.createGroup = function () {
PreviousSearchParams = Store('group_current_search_params');
GroupsEdit({
@@ -1304,13 +1252,6 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.showGroupActivity = function () {
var url, title, group;
if ($scope.selected_group_id) {
$scope.group_breadcrumbs.every(function(crumb) {
if (crumb.id === $scope.selected_group_id) {
group = crumb;
return false;
}
return true;
});
url = GetBasePath('activity_stream') + '?group__id=' + $scope.selected_group_id;
title = 'Showing all activities for group ' + group.name;
} else {
@@ -1401,13 +1342,13 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
InventoriesManage.$inject = ['$log', '$scope', '$rootScope', '$location',
'$routeParams', '$compile', 'generateList', 'ClearScope', 'Empty', 'Wait',
'Rest', 'Alert', 'LoadBreadCrumbs', 'GetBasePath', 'ProcessErrors',
'Breadcrumbs', 'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload',
'$state', '$compile', 'generateList', 'ClearScope', 'Empty', 'Wait',
'Rest', 'Alert', 'GetBasePath', 'ProcessErrors',
'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload',
'SearchInit', 'PaginateInit', 'GetSyncStatusMsg', 'GetHostsStatusMsg',
'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus',
'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete',
'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary',
'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'GroupsCopy',
'HostsCopy', 'transitionTo'
'HostsCopy', '$stateParams'
];

View File

@@ -11,13 +11,13 @@
*/
export function JobDetailController ($location, $rootScope, $filter, $scope, $compile, $routeParams, $log, ClearScope, Breadcrumbs, LoadBreadCrumbs, GetBasePath, Wait, Rest,
export function JobDetailController ($location, $rootScope, $filter, $scope, $compile, $stateParams, $log, ClearScope, GetBasePath, Wait, Rest,
ProcessErrors, SelectPlay, SelectTask, Socket, GetElapsed, DrawGraph, LoadHostSummary, ReloadHostSummaryList, JobIsFinished, SetTaskStyles, DigestEvent,
UpdateDOM, EventViewer, DeleteJob, PlaybookRun, HostEventsViewer, LoadPlays, LoadTasks, LoadHosts, HostsEdit, ParseVariableString, GetChoices, fieldChoices, fieldLabels, EditSchedule) {
ClearScope();
var job_id = $routeParams.id,
var job_id = $stateParams.id,
scope = $scope,
api_complete = false,
refresh_count = 0,
@@ -793,7 +793,7 @@ export function JobDetailController ($location, $rootScope, $filter, $scope, $co
})
.error(function(data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET returned: ' + status });
msg: 'Failed to retrieve job: ' + $stateParams.id + '. GET returned: ' + status });
});
});
@@ -848,7 +848,7 @@ export function JobDetailController ($location, $rootScope, $filter, $scope, $co
//$('#tasks-table-detail').mCustomScrollbar("update");
$('#hosts-table-detail').height(150);
//$('#hosts-table-detail').mCustomScrollbar("update");
height = $(window).height() - $('#main-menu-container .navbar').outerHeight() - $('#breadcrumb-container').outerHeight() -
height = $(window).height() - $('#main-menu-container .navbar').outerHeight() -
$('#job-detail-container').outerHeight() - $('#job-detail-footer').outerHeight() - 20;
if (height > 15) {
// there's a bunch of white space at the bottom, let's use it
@@ -1435,7 +1435,7 @@ export function JobDetailController ($location, $rootScope, $filter, $scope, $co
});
}
JobDetailController.$inject = [ '$location', '$rootScope', '$filter', '$scope', '$compile', '$routeParams', '$log', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'GetBasePath',
JobDetailController.$inject = [ '$location', '$rootScope', '$filter', '$scope', '$compile', '$stateParams', '$log', 'ClearScope', 'GetBasePath',
'Wait', 'Rest', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed', 'DrawGraph', 'LoadHostSummary', 'ReloadHostSummaryList',
'JobIsFinished', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'EventViewer', 'DeleteJob', 'PlaybookRun', 'HostEventsViewer', 'LoadPlays', 'LoadTasks',
'LoadHosts', 'HostsEdit', 'ParseVariableString', 'GetChoices', 'fieldChoices', 'fieldLabels', 'EditSchedule'

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:JobEvent
@@ -11,19 +11,19 @@
*/
export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobEventList, GenerateList,
LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, LookUpInit, ToggleChildren,
export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log, $stateParams, Rest, Alert, JobEventList, GenerateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, LookUpInit, ToggleChildren,
FormatDate, EventView, Refresh, Wait) {
ClearScope();
var list = JobEventList,
defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_events/', //?parent__isnull=1';
defaultUrl = GetBasePath('jobs') + $stateParams.id + '/job_events/', //?parent__isnull=1';
generator = GenerateList,
page;
list.base = $location.path();
$scope.job_id = $routeParams.id;
$scope.job_id = $stateParams.id;
$rootScope.flashMessage = null;
$scope.selected = [];
$scope.expand = true; //on load, automatically expand all nodes
@@ -182,15 +182,6 @@ export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log
.success(function (data) {
$scope.job_status = data.status;
$scope.job_name = data.summary_fields.job_template.name;
LoadBreadCrumbs({
path: '/job_events/' + $scope.job_id,
title: $scope.job_id + ' - ' + data.summary_fields.job_template.name,
altPath: '/jobs'
});
$rootScope.breadcrumbs = [{
path: '/jobs',
title: $scope.job_id + ' - ' + data.summary_fields.job_template.name,
}];
$scope.$emit('SetHostLinks', data.inventory);
})
.error(function (data, status) {
@@ -207,7 +198,7 @@ export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log
url: defaultUrl
});
page = ($routeParams.page) ? parseInt($routeParams.page,10) - 1 : null;
page = ($stateParams.page) ? parseInt($stateParams.page,10) - 1 : null;
PaginateInit({
scope: $scope,
@@ -217,13 +208,13 @@ export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log
});
// Called from Inventories tab, host failed events link:
if ($routeParams.host) {
if ($stateParams.host) {
$scope[list.iterator + 'SearchField'] = 'host';
$scope[list.iterator + 'SearchValue'] = $routeParams.host;
$scope[list.iterator + 'SearchValue'] = $stateParams.host;
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.host.label;
}
$scope.search(list.iterator, $routeParams.page);
$scope.search(list.iterator, $stateParams.page);
$scope.toggle = function (id) {
ToggleChildren({
@@ -252,19 +243,19 @@ export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log
};
}
JobEventsList.$inject = ['$sce', '$filter', '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList',
'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
JobEventsList.$inject = ['$sce', '$filter', '$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'JobEventList',
'generateList', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'LookUpInit', 'ToggleChildren', 'FormatDate', 'EventView', 'Refresh', 'Wait'
];
export function JobEventsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobEventsForm, GenerateForm,
Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, GetBasePath, FormatDate, EventView, Wait) {
export function JobEventsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, JobEventsForm, GenerateForm,
Rest, Alert, ProcessErrors, ClearScope, GetBasePath, FormatDate, EventView, Wait) {
ClearScope();
var form = JobEventsForm,
generator = GenerateForm,
defaultUrl = GetBasePath('base') + 'job_events/' + $routeParams.event_id + '/';
defaultUrl = GetBasePath('base') + 'job_events/' + $stateParams.event_id + '/';
generator.inject(form, { mode: 'edit', related: true, scope: $scope});
generator.reset();
@@ -276,7 +267,6 @@ export function JobEventsEdit($scope, $rootScope, $compile, $location, $log, $ro
.success(function (data) {
var cDate, fld, n, rows;
$scope.event_display = data.event_display.replace(/^\u00a0*/g, '');
LoadBreadCrumbs({ path: '/jobs/' + $routeParams.job_id + '/job_events/' + $routeParams.event_id, title: $scope.event_display });
for (fld in form.fields) {
switch (fld) {
case 'status':
@@ -335,14 +325,14 @@ export function JobEventsEdit($scope, $rootScope, $compile, $location, $log, $ro
Wait('stop');
})
.error(function (data) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve host: ' + $routeParams.event_id +
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve host: ' + $stateParams.event_id +
'. GET status: ' + status });
});
$scope.navigateBack = function () {
var url = '/jobs/' + $routeParams.job_id + '/job_events';
if ($routeParams.page) {
url += '?page=' + $routeParams.page;
var url = '/jobs/' + $stateParams.job_id + '/job_events';
if ($stateParams.page) {
url += '?page=' + $stateParams.page;
}
$location.url(url);
};
@@ -355,6 +345,6 @@ export function JobEventsEdit($scope, $rootScope, $compile, $location, $log, $ro
}
JobEventsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobEventsForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath', 'FormatDate', 'EventView', 'Wait'
JobEventsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'JobEventsForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'FormatDate', 'EventView', 'Wait'
];

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:JobHosts
@@ -11,18 +11,18 @@
*/
export function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobHostList, GenerateList,
LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, Refresh,
export function JobHostSummaryList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, JobHostList, GenerateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, Refresh,
JobStatusToolTip) {
ClearScope();
var list = JobHostList,
defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_host_summaries/',
defaultUrl = GetBasePath('jobs') + $stateParams.id + '/job_host_summaries/',
view = GenerateList,
inventory;
$scope.job_id = $routeParams.id;
$scope.job_id = $stateParams.id;
$scope.host_id = null;
// After a refresh, populate any needed summary field values on each row
@@ -72,9 +72,9 @@ export function JobHostSummaryList($scope, $rootScope, $location, $log, $routePa
});
// Called from Inventories tab, host failed events link:
if ($routeParams.host_name) {
if ($stateParams.host_name) {
$scope[list.iterator + 'SearchField'] = 'host';
$scope[list.iterator + 'SearchValue'] = $routeParams.host_name;
$scope[list.iterator + 'SearchValue'] = $stateParams.host_name;
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.host.label;
}
$scope.search(list.iterator);
@@ -84,15 +84,6 @@ export function JobHostSummaryList($scope, $rootScope, $location, $log, $routePa
Rest.get()
.success(function (data) {
inventory = data.inventory;
LoadBreadCrumbs({
path: '/job_host_summaries/' + $scope.job_id,
title: $scope.job_id + ' - ' + data.summary_fields.job_template.name,
altPath: '/jobs'
});
$rootScope.breadcrumbs = [{
path: '/jobs',
title: $scope.job_id + ' - ' + data.summary_fields.job_template.name,
}];
$scope.job_status = data.status;
$scope.$emit('JobReady');
})
@@ -121,7 +112,7 @@ export function JobHostSummaryList($scope, $rootScope, $location, $log, $routePa
}
JobHostSummaryList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList',
'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
JobHostSummaryList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'JobHostList',
'generateList', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'Refresh', 'JobStatusToolTip', 'Wait'
];

View File

@@ -11,11 +11,11 @@
*/
export function JobStdoutController ($location, $log, $rootScope, $scope, $compile, $routeParams, ClearScope, GetBasePath, Wait, Rest, ProcessErrors) {
export function JobStdoutController ($location, $log, $rootScope, $scope, $compile, $stateParams, ClearScope, GetBasePath, Wait, Rest, ProcessErrors) {
ClearScope();
var job_id = $routeParams.id,
var job_id = $stateParams.id,
api_complete = false,
stdout_url,
current_range,
@@ -281,4 +281,4 @@ export function JobStdoutController ($location, $log, $rootScope, $scope, $compi
}
JobStdoutController.$inject = [ '$location', '$log', '$rootScope', '$scope', '$compile', '$routeParams', 'ClearScope', 'GetBasePath', 'Wait', 'Rest', 'ProcessErrors'];
JobStdoutController.$inject = [ '$location', '$log', '$rootScope', '$scope', '$compile', '$stateParams', 'ClearScope', 'GetBasePath', 'Wait', 'Rest', 'ProcessErrors'];

View File

@@ -11,8 +11,8 @@
*/
export function JobTemplatesList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobTemplateList,
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors,
export function JobTemplatesList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, JobTemplateList,
GenerateList, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors,
GetBasePath, JobTemplateForm, CredentialList, LookUpInit, PlaybookRun, Wait, Stream, CreateDialog, $compile) {
ClearScope();
@@ -48,16 +48,14 @@ export function JobTemplatesList($scope, $rootScope, $location, $log, $routePara
});
// Called from Inventories tab, host failed events link:
if ($routeParams.name) {
if ($stateParams.name) {
$scope[list.iterator + 'SearchField'] = 'name';
$scope[list.iterator + 'SearchValue'] = $routeParams.name;
$scope[list.iterator + 'SearchValue'] = $stateParams.name;
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
}
$scope.search(list.iterator);
LoadBreadCrumbs();
$scope.showActivity = function () {
@@ -237,14 +235,14 @@ export function JobTemplatesList($scope, $rootScope, $location, $log, $routePara
};
}
JobTemplatesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobTemplateList',
'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
JobTemplatesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'JobTemplateList',
'generateList', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
'ProcessErrors', 'GetBasePath', 'JobTemplateForm', 'CredentialList', 'LookUpInit',
'PlaybookRun', 'Wait', 'Stream', 'CreateDialog' , '$compile'
];
export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GetBasePath,
export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location, $log, $stateParams, JobTemplateForm,
GenerateForm, Rest, Alert, ProcessErrors, ReturnToCaller, ClearScope, GetBasePath,
InventoryList, CredentialList, ProjectList, LookUpInit, md5Setup, ParseTypeChange, Wait, Empty, ToJSON,
CallbackHelpInit, SurveyControllerInit, Prompt, GetChoices) {
@@ -263,7 +261,7 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location
CallbackHelpInit({ scope: $scope });
$scope.can_edit = true;
generator.inject(form, { mode: 'add', related: false, scope: $scope, breadcrumbs: true });
generator.inject(form, { mode: 'add', related: false, scope: $scope });
callback = function() {
// Make sure the form controller knows there was a change
@@ -277,7 +275,6 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location
$scope.allow_callbacks = false;
generator.reset();
LoadBreadCrumbs();
md5Setup({
scope: $scope,
@@ -289,7 +286,7 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location
LookUpInit({
scope: $scope,
form: form,
current_item: ($routeParams.inventory_id !== undefined) ? $routeParams.inventory_id : null,
current_item: ($stateParams.inventory_id !== undefined) ? $stateParams.inventory_id : null,
list: InventoryList,
field: 'inventory',
input_type: "radio"
@@ -353,13 +350,13 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location
// if you're getting to the form from the scan job section on inventories,
// set the job type select to be scan
if ($routeParams.inventory_id) {
if ($stateParams.inventory_id) {
// This means that the job template form was accessed via inventory prop's
// This also means the job is a scan job.
$scope.job_type.value = 'scan';
$scope.jobTypeChange();
$scope.inventory = $routeParams.inventory_id;
Rest.setUrl(GetBasePath('inventory') + $routeParams.inventory_id + '/');
$scope.inventory = $stateParams.inventory_id;
Rest.setUrl(GetBasePath('inventory') + $stateParams.inventory_id + '/');
Rest.get()
.success(function (data) {
$scope.inventory_name = data.name;
@@ -659,15 +656,15 @@ export function JobTemplatesAdd($filter, $scope, $rootScope, $compile, $location
};
}
JobTemplatesAdd.$inject = ['$filter', '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
JobTemplatesAdd.$inject = ['$filter', '$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
'md5Setup', 'ParseTypeChange', 'Wait', 'Empty', 'ToJSON', 'CallbackHelpInit', 'initSurvey', 'Prompt', 'GetChoices'
];
export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest,
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $location, $log, $stateParams, JobTemplateForm, GenerateForm, Rest,
Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate,
Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate,
GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit, PlaybookRun, SurveyControllerInit){
@@ -679,7 +676,7 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
form = JobTemplateForm(),
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.template_id,
id = $stateParams.template_id,
relatedSets = {},
checkSCMStatus, getPlaybooks, callback,
choicesCount = 0;
@@ -688,7 +685,7 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
CallbackHelpInit({ scope: $scope });
SchedulesList.well = false;
generator.inject(form, { mode: 'edit', related: true, scope: $scope, breadcrumbs: true });
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
$scope.mode = 'edit';
$scope.parseType = 'yaml';
$scope.showJobType = false;
@@ -955,7 +952,7 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
.error(function (data, status) {
ProcessErrors($scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to retrieve job template: ' + $routeParams.template_id + '. GET status: ' + status
msg: 'Failed to retrieve job template: ' + $stateParams.template_id + '. GET status: ' + status
});
});
});
@@ -1161,7 +1158,7 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
// Related set: Add button
$scope.add = function (set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.template_id + '/' + set);
$location.path('/' + base + '/' + $stateParams.template_id + '/' + set);
};
// Related set: Edit button
@@ -1223,7 +1220,7 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
.error(function (data, status) {
ProcessErrors($scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to retrieve save survey_enabled: ' + $routeParams.template_id + '. GET status: ' + status
msg: 'Failed to retrieve save survey_enabled: ' + $stateParams.template_id + '. GET status: ' + status
});
});
};
@@ -1231,8 +1228,8 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
}
JobTemplatesEdit.$inject = ['$filter', '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit',
JobTemplatesEdit.$inject = ['$filter', '$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit',
'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt',
'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices',

View File

@@ -11,8 +11,8 @@
*/
export function JobsListController ($rootScope, $log, $scope, $compile, $routeParams,
ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope,
export function JobsListController ($rootScope, $log, $scope, $compile, $stateParams,
ClearScope, LoadSchedulesScope,
LoadJobsScope, AllJobsList, ScheduledJobsList, GetChoices, GetBasePath, Wait) {
ClearScope();
@@ -23,10 +23,6 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
api_complete = false,
max_rows;
LoadBreadCrumbs();
if ($scope.removeListLoaded) {
$scope.removeListLoaded();
}
@@ -49,14 +45,14 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
if (AllJobsList.fields.type) {
AllJobsList.fields.type.searchOptions = $scope.type_choices;
}
if ($routeParams.status) {
if ($stateParams.status) {
search_params[AllJobsList.iterator + 'SearchField'] = 'status';
search_params[AllJobsList.iterator + 'SelectShow'] = true;
search_params[AllJobsList.iterator + 'SearchSelectOpts'] = AllJobsList.fields.status.searchOptions;
search_params[AllJobsList.iterator + 'SearchFieldLabel'] = AllJobsList.fields.status.label.replace(/<br\>/g,' ');
search_params[AllJobsList.iterator + 'SearchType'] = '';
for (opt in AllJobsList.fields.status.searchOptions) {
if (AllJobsList.fields.status.searchOptions[opt].value === $routeParams.status) {
if (AllJobsList.fields.status.searchOptions[opt].value === $stateParams.status) {
search_params[AllJobsList.iterator + 'SearchSelectValue'] = AllJobsList.fields.status.searchOptions[opt];
break;
}
@@ -185,6 +181,6 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
}
}
JobsListController.$inject = ['$rootScope', '$log', '$scope', '$compile', '$routeParams',
'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadSchedulesScope', 'LoadJobsScope',
JobsListController.$inject = ['$rootScope', '$log', '$scope', '$compile', '$stateParams',
'ClearScope', 'LoadSchedulesScope', 'LoadJobsScope',
'AllJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'Wait'];

View File

@@ -44,7 +44,7 @@ export function LicenseController(ClearScope, $location, $rootScope, $compile, $
delete self.form.fields.time_remaining;
}
html = generator.buildHTML(self.form, { mode: 'edit', showButtons: false, breadCrumbs: false });
html = generator.buildHTML(self.form, { mode: 'edit', showButtons: false });
return html;
};

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:Organizations
@@ -11,7 +11,7 @@
*/
export function OrganizationsList($routeParams, $scope, $rootScope, $location, $log, Rest, Alert, LoadBreadCrumbs, Prompt,
export function OrganizationsList($stateParams, $scope, $rootScope, $location, $log, Rest, Alert, Prompt,
GenerateList, OrganizationList, SearchInit, PaginateInit, ClearScope, ProcessErrors, GetBasePath, SelectionInit, Wait, Stream) {
ClearScope();
@@ -23,12 +23,11 @@ export function OrganizationsList($routeParams, $scope, $rootScope, $location, $
defaultUrl = GetBasePath('organizations'),
url;
generate.inject(OrganizationList, { mode: mode, scope: $scope, breadCrumbs:((mode === 'select') ? true : false) });
generate.inject(OrganizationList, { mode: mode, scope: $scope });
$rootScope.flashMessage = null;
LoadBreadCrumbs();
if (mode === 'select') {
url = GetBasePath('projects') + $routeParams.project_id + '/organizations/';
url = GetBasePath('projects') + $stateParams.project_id + '/organizations/';
SelectionInit({ scope: $scope, list: list, url: url, returnToCaller: 1 });
}
@@ -92,14 +91,14 @@ export function OrganizationsList($routeParams, $scope, $rootScope, $location, $
};
}
OrganizationsList.$inject = ['$routeParams', '$scope', '$rootScope', '$location', '$log', 'Rest', 'Alert', 'LoadBreadCrumbs', 'Prompt',
OrganizationsList.$inject = ['$stateParams', '$scope', '$rootScope', '$location', '$log', 'Rest', 'Alert', 'Prompt',
'generateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait',
'Stream'
];
export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, GetBasePath,
export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log, $stateParams, OrganizationForm,
GenerateForm, Rest, Alert, ProcessErrors, ClearScope, GetBasePath,
ReturnToCaller, Wait) {
ClearScope();
@@ -112,14 +111,12 @@ export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log,
generator.inject(form, { mode: 'add', related: false, scope: $scope});
generator.reset();
LoadBreadCrumbs();
// Save
$scope.formSave = function () {
generator.clearApiErrors();
Wait('start');
var url = GetBasePath(base);
url += (base !== 'organizations') ? $routeParams.project_id + '/organizations/' : '';
url += (base !== 'organizations') ? $stateParams.project_id + '/organizations/' : '';
Rest.setUrl(url);
Rest.post({ name: $scope.name, description: $scope.description })
.success(function (data) {
@@ -144,13 +141,13 @@ export function OrganizationsAdd($scope, $rootScope, $compile, $location, $log,
};
}
OrganizationsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath', 'ReturnToCaller', 'Wait'
OrganizationsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'OrganizationForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'ReturnToCaller', 'Wait'
];
export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm, GenerateForm, Rest,
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, Wait, Stream) {
export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, OrganizationForm, GenerateForm, Rest,
Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, Wait, Stream) {
ClearScope();
@@ -160,7 +157,7 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
defaultUrl = GetBasePath('organizations'),
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.organization_id,
id = $stateParams.organization_id,
relatedSets = {};
$scope.organization_id = id;
@@ -208,7 +205,7 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
})
.error(function (data, status) {
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
msg: 'Failed to retrieve organization: ' + $routeParams.id + '. GET status: ' + status });
msg: 'Failed to retrieve organization: ' + $stateParams.id + '. GET status: ' + status });
});
@@ -252,7 +249,7 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
// Related set: Add button
$scope.add = function (set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.organization_id + '/' + set);
$location.path('/' + base + '/' + $stateParams.organization_id + '/' + set);
};
// Related set: Edit button
@@ -267,7 +264,7 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
var action = function () {
Wait('start');
var url = defaultUrl + $routeParams.organization_id + '/' + set + '/';
var url = defaultUrl + $stateParams.organization_id + '/' + set + '/';
Rest.setUrl(url);
Rest.post({ id: itm_id, disassociate: 1 })
.success(function () {
@@ -290,7 +287,7 @@ export function OrganizationsEdit($scope, $rootScope, $compile, $location, $log,
};
}
OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath',
OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'OrganizationForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath',
'Wait', 'Stream'
];

View File

@@ -19,7 +19,7 @@
*
*
*/
export function PortalController($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, ClearScope, Stream, Rest, GetBasePath, ProcessErrors,
export function PortalController($scope, $compile, $stateParams, $rootScope, $location, $log, Wait, ClearScope, Stream, Rest, GetBasePath, ProcessErrors,
PortalJobsWidget, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){
ClearScope('portal');
@@ -39,7 +39,6 @@ export function PortalController($scope, $compile, $routeParams, $rootScope, $lo
id : 'portal-job-templates',
mode: 'edit',
scope: $scope,
breadCrumbs: false,
searchSize: 'col-lg-6 col-md-6'
});
@@ -138,6 +137,6 @@ export function PortalController($scope, $compile, $routeParams, $rootScope, $lo
}
PortalController.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors',
PortalController.$inject = ['$scope', '$compile', '$stateParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors',
'PortalJobsWidget', 'generateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun'
];

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:Projects
@@ -11,9 +11,11 @@
*/
export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList, GenerateList, LoadBreadCrumbs,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate,
Refresh, Wait, Stream, GetChoices, Empty, Find, LogViewer, GetProjectIcon, GetProjectToolTip, $filter) {
export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
Rest, Alert, ProjectList, GenerateList, Prompt, SearchInit,
PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath,
SelectionInit, ProjectUpdate, Refresh, Wait, Stream, GetChoices, Empty,
Find, LogViewer, GetProjectIcon, GetProjectToolTip, $filter, $state) {
ClearScope();
@@ -24,10 +26,10 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
view = GenerateList,
base = $location.path().replace(/^\//, '').split('/')[0],
mode = (base === 'projects') ? 'edit' : 'select',
url = (base === 'teams') ? GetBasePath('teams') + $routeParams.team_id + '/projects/' : defaultUrl,
url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl,
choiceCount = 0;
view.inject(list, { mode: mode, scope: $scope, breadCrumbs:(($routeParams.team_id) ? true : false)});
view.inject(list, { mode: mode, scope: $scope });
$rootScope.flashMessage = null;
$scope.projectLoading = true;
@@ -116,9 +118,9 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
list.fields.scm_type.searchOptions = $scope.project_scm_type_options;
list.fields.status.searchOptions = $scope.project_status_options;
if ($routeParams.scm_type && $routeParams.status) {
if ($stateParams.scm_type && $stateParams.status) {
// Request coming from home page. User wants all errors for an scm_type
defaultUrl += '?status=' + $routeParams.status;
defaultUrl += '?status=' + $stateParams.status;
}
SearchInit({
@@ -133,27 +135,27 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
url: defaultUrl
});
if ($routeParams.scm_type) {
if ($stateParams.scm_type) {
$scope[list.iterator + 'SearchType'] = '';
$scope[list.iterator + 'SearchField'] = 'scm_type';
$scope[list.iterator + 'SelectShow'] = true;
$scope[list.iterator + 'SearchSelectOpts'] = list.fields.scm_type.searchOptions;
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.scm_type.label.replace(/<br\>/g, ' ');
for (opt in list.fields.scm_type.searchOptions) {
if (list.fields.scm_type.searchOptions[opt].value === $routeParams.scm_type) {
if (list.fields.scm_type.searchOptions[opt].value === $stateParams.scm_type) {
$scope[list.iterator + 'SearchSelectValue'] = list.fields.scm_type.searchOptions[opt];
break;
}
}
} else if ($routeParams.status) {
} else if ($stateParams.status) {
$scope[list.iterator + 'SearchType'] = '';
$scope[list.iterator + 'SearchValue'] = $routeParams.status;
$scope[list.iterator + 'SearchValue'] = $stateParams.status;
$scope[list.iterator + 'SearchField'] = 'status';
$scope[list.iterator + 'SelectShow'] = true;
$scope[list.iterator + 'SearchFieldLabel'] = list.fields.status.label;
$scope[list.iterator + 'SearchSelectOpts'] = list.fields.status.searchOptions;
for (opt in list.fields.status.searchOptions) {
if (list.fields.status.searchOptions[opt].value === $routeParams.status) {
if (list.fields.status.searchOptions[opt].value === $stateParams.status) {
$scope[list.iterator + 'SearchSelectValue'] = list.fields.status.searchOptions[opt];
break;
}
@@ -190,18 +192,18 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
callback: 'choicesReadyProject'
});
LoadBreadCrumbs();
$scope.showActivity = function () {
Stream({ scope: $scope });
};
$scope.addProject = function () {
$location.path($location.path() + '/add');
// $location.path($location.path() + '/add');
$state.transitionTo('projects.add');
};
$scope.editProject = function (id) {
$location.path($location.path() + '/' + id);
// $location.path($location.path() + '/' + id);
$state.transitionTo('projects.edit', {id: id});
};
if ($scope.removeShowLogViewer) {
@@ -339,7 +341,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to get project failed. GET status: ' + status });
})
});
};
$scope.refresh = function () {
@@ -389,15 +391,15 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams,
};
}
ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'ProjectList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'ProjectUpdate', 'Refresh', 'Wait', 'Stream', 'GetChoices', 'Empty', 'Find',
'LogViewer', 'GetProjectIcon', 'GetProjectToolTip', '$filter'
'LogViewer', 'GetProjectIcon', 'GetProjectToolTip', '$filter', '$state'
];
export function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm, GenerateForm, Rest, Alert, ProcessErrors,
LoadBreadCrumbs, ClearScope, GetBasePath, ReturnToCaller, GetProjectPath, LookUpInit, OrganizationList,
export function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $stateParams, ProjectsForm, GenerateForm, Rest, Alert, ProcessErrors,
ClearScope, GetBasePath, ReturnToCaller, GetProjectPath, LookUpInit, OrganizationList,
CredentialList, GetChoices, DebugForm, Wait) {
ClearScope();
@@ -409,9 +411,8 @@ export function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $rout
defaultUrl = GetBasePath('projects'),
master = {};
generator.inject(form, { mode: 'add', related: false, scope: $scope, breadcrumbs: true });
generator.inject(form, { mode: 'add', related: false, scope: $scope });
generator.reset();
LoadBreadCrumbs();
GetProjectPath({ scope: $scope, master: master });
@@ -482,7 +483,7 @@ export function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $rout
delete data.local_path;
}
url = (base === 'teams') ? GetBasePath('teams') + $routeParams.team_id + '/projects/' : defaultUrl;
url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl;
Wait('start');
Rest.setUrl(url);
Rest.post(data)
@@ -535,15 +536,15 @@ export function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $rout
};
}
ProjectsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'ProjectsForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath',
ProjectsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'ProjectsForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath',
'ReturnToCaller', 'GetProjectPath', 'LookUpInit', 'OrganizationList', 'CredentialList', 'GetChoices',
'DebugForm', 'Wait'
];
export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, Prompt,
export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, ProjectsForm,
GenerateForm, Rest, Alert, ProcessErrors, RelatedSearchInit, RelatedPaginateInit, Prompt,
ClearScope, GetBasePath, ReturnToCaller, GetProjectPath, Authorization, CredentialList, LookUpInit, GetChoices,
Empty, DebugForm, Wait, Stream, SchedulesControllerInit, SchedulesListInit, SchedulesList, ProjectUpdate) {
@@ -552,18 +553,17 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $rou
// Inject dynamic view
var form = ProjectsForm(),
generator = GenerateForm,
defaultUrl = GetBasePath('projects') + $routeParams.id + '/',
defaultUrl = GetBasePath('projects') + $stateParams.id + '/',
base = $location.path().replace(/^\//, '').split('/')[0],
master = {}, i,
id = $routeParams.id,
id = $stateParams.id,
relatedSets = {};
SchedulesList.well = false;
generator.inject(form, {
mode: 'edit',
related: true,
scope: $scope,
breadcrumbs: true
scope: $scope
});
generator.reset();
@@ -641,7 +641,6 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $rou
Rest.get({ params: { id: id } })
.success(function (data) {
var fld, i;
LoadBreadCrumbs({ path: '/projects/' + id, title: data.name });
for (fld in form.fields) {
if (form.fields[fld].type === 'checkbox_group') {
for (i = 0; i < form.fields[fld].fields.length; i++) {
@@ -779,7 +778,7 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $rou
// Related set: Add button
$scope.add = function (set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set);
$location.path('/' + base + '/' + $stateParams.id + '/' + set);
};
// Related set: Edit button
@@ -841,8 +840,8 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $rou
};
}
ProjectsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'ProjectsForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ClearScope',
ProjectsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'ProjectsForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ClearScope',
'GetBasePath', 'ReturnToCaller', 'GetProjectPath', 'Authorization', 'CredentialList', 'LookUpInit', 'GetChoices', 'Empty',
'DebugForm', 'Wait', 'Stream', 'SchedulesControllerInit', 'SchedulesListInit', 'SchedulesList', 'ProjectUpdate'
];

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:Schedules
@@ -11,8 +11,8 @@
*/
export function ScheduleEditController($scope, $compile, $location, $routeParams, SchedulesList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, GetChoices, Stream) {
export function ScheduleEditController($scope, $compile, $location, $stateParams, SchedulesList, Rest, ProcessErrors, ReturnToCaller, ClearScope,
GetBasePath, Wait, Find, LoadDialogPartial, LoadSchedulesScope, GetChoices, Stream) {
ClearScope();
@@ -34,15 +34,6 @@ GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, Get
$scope.removeParentLoaded();
}
$scope.removeParentLoaded = $scope.$on('ParentLoaded', function() {
// Add breadcrumbs
LoadBreadCrumbs({
path: $location.path().replace(/\/schedules$/,''),
title: parentObject.name
});
e = angular.element(document.getElementById('breadcrumbs'));
e.html(Breadcrumbs({ list: SchedulesList, mode: 'edit' }));
$compile(e)($scope);
url += "schedules/";
SchedulesList.well = true;
LoadSchedulesScope({
@@ -61,7 +52,7 @@ GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, Get
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
// Load the parent object
id = $routeParams.id;
id = $stateParams.id;
url = GetBasePath(base) + id + '/';
Rest.setUrl(url);
Rest.get()
@@ -94,5 +85,5 @@ GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, Get
});
}
ScheduleEditController.$inject = [ '$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'Wait', 'Breadcrumbs', 'Find', 'LoadDialogPartial', 'LoadSchedulesScope', 'GetChoices', 'Stream' ];
ScheduleEditController.$inject = [ '$scope', '$compile', '$location', '$stateParams', 'SchedulesList', 'Rest', 'ProcessErrors', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'Wait', 'Find', 'LoadDialogPartial', 'LoadSchedulesScope', 'GetChoices', 'Stream' ];

View File

@@ -11,7 +11,7 @@
*/
export function TeamsList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, TeamList, GenerateList, LoadBreadCrumbs,
export function TeamsList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, TeamList, GenerateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, SetTeamListeners, GetBasePath, SelectionInit, Wait,
Stream) {
@@ -63,8 +63,6 @@ export function TeamsList($scope, $rootScope, $location, $log, $routeParams, Res
});
$scope.search(list.iterator);
LoadBreadCrumbs();
$scope.showActivity = function () {
Stream({ scope: $scope });
};
@@ -107,14 +105,14 @@ export function TeamsList($scope, $rootScope, $location, $log, $routeParams, Res
};
}
TeamsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'TeamList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
TeamsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'TeamList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'SetTeamListeners', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream'
];
export function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, GenerateForm,
Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList,
export function TeamsAdd($scope, $rootScope, $compile, $location, $log, $stateParams, TeamForm, GenerateForm,
Rest, Alert, ProcessErrors, ReturnToCaller, ClearScope, GenerateList,
OrganizationList, SearchInit, PaginateInit, GetBasePath, LookUpInit, Wait) {
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//$scope.
@@ -127,7 +125,6 @@ export function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routePa
$rootScope.flashMessage = null;
generator.reset();
LoadBreadCrumbs();
LookUpInit({
scope: $scope,
@@ -168,14 +165,14 @@ export function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routePa
};
}
TeamsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList',
TeamsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'TeamForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList',
'OrganizationList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'LookUpInit', 'Wait'
];
export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, GenerateForm, Rest, Alert, ProcessErrors,
LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, GetBasePath, CheckAccess,
export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $stateParams, TeamForm, GenerateForm, Rest, Alert, ProcessErrors,
RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, GetBasePath, CheckAccess,
OrganizationList, Wait, Stream, fieldChoices, fieldLabels, permissionsSearchSelect) {
ClearScope();
@@ -185,7 +182,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
form = TeamForm,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.team_id,
id = $stateParams.team_id,
relatedSets = {};
$scope.permission_label = {};
@@ -290,7 +287,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
Wait('stop');
})
.error(function (data, status) {
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve team: ' + $routeParams.team_id +
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve team: ' + $stateParams.team_id +
'. GET status: ' + status });
Wait('stop');
});
@@ -315,7 +312,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
generator.clearApiErrors();
Wait('start');
$rootScope.flashMessage = null;
Rest.setUrl(defaultUrl + $routeParams.team_id + '/');
Rest.setUrl(defaultUrl + $stateParams.team_id + '/');
for (fld in form.fields) {
data[fld] = $scope[fld];
}
@@ -334,7 +331,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
.error(function (data, status) {
Wait('stop');
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
msg: 'Failed to update team: ' + $routeParams.team_id + '. PUT status: ' + status });
msg: 'Failed to update team: ' + $stateParams.team_id + '. PUT status: ' + status });
});
};
@@ -352,12 +349,12 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
$rootScope.flashMessage = null;
if (set === 'permissions') {
if ($scope.PermissionAddAllowed) {
$location.path('/' + base + '/' + $routeParams.team_id + '/' + set + '/add');
$location.path('/' + base + '/' + $stateParams.team_id + '/' + set + '/add');
} else {
Alert('Access Denied', 'You do not have access to this function. Please contact your system administrator.');
}
} else {
$location.path('/' + base + '/' + $routeParams.team_id + '/' + set);
$location.path('/' + base + '/' + $stateParams.team_id + '/' + set);
}
};
@@ -365,7 +362,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
$scope.edit = function (set, id) {
$rootScope.flashMessage = null;
if (set === 'permissions') {
$location.path('/' + base + '/' + $routeParams.team_id + '/' + set + '/' + id);
$location.path('/' + base + '/' + $stateParams.team_id + '/' + set + '/' + id);
} else {
$location.path('/' + set + '/' + id);
}
@@ -395,7 +392,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
Alert('Access Denied', 'You do not have access to this function. Please contact your system administrator.');
}
} else {
url = defaultUrl + $routeParams.team_id + '/' + set + '/';
url = defaultUrl + $stateParams.team_id + '/' + set + '/';
Rest.setUrl(url);
Rest.post({ id: itm_id, disassociate: 1 })
.success(function () {
@@ -418,7 +415,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
};
}
TeamsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit',
TeamsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'TeamForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit',
'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt', 'GetBasePath', 'CheckAccess', 'OrganizationList', 'Wait', 'Stream', 'fieldChoices', 'fieldLabels', 'permissionsSearchSelect'
];

View File

@@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name controllers.function:Users
@@ -11,7 +11,7 @@
*/
export function UsersList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, UserList, GenerateList, LoadBreadCrumbs,
export function UsersList($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, UserList, GenerateList,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit, Wait, Stream) {
ClearScope();
@@ -21,10 +21,10 @@ export function UsersList($scope, $rootScope, $location, $log, $routeParams, Res
generator = GenerateList,
base = $location.path().replace(/^\//, '').split('/')[0],
mode = (base === 'users') ? 'edit' : 'select',
url = (base === 'organizations') ? GetBasePath('organizations') + $routeParams.organization_id + '/users/' :
GetBasePath('teams') + $routeParams.team_id + '/users/';
url = (base === 'organizations') ? GetBasePath('organizations') + $stateParams.organization_id + '/users/' :
GetBasePath('teams') + $stateParams.team_id + '/users/';
generator.inject(UserList, { mode: mode, scope: $scope, breadCrumbs:(($routeParams.organization_id || $routeParams.team_id) ? true : false) });
generator.inject(UserList, { mode: mode, scope: $scope });
$scope.selected = [];
@@ -55,8 +55,6 @@ export function UsersList($scope, $rootScope, $location, $log, $routeParams, Res
});
$scope.search(list.iterator);
LoadBreadCrumbs();
$scope.showActivity = function () {
Stream({ scope: $scope });
};
@@ -97,14 +95,14 @@ export function UsersList($scope, $rootScope, $location, $log, $routeParams, Res
};
}
UsersList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'generateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
UsersList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'UserList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'Wait', 'Stream'
];
export function UsersAdd($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm, GenerateForm, Rest, Alert, ProcessErrors,
LoadBreadCrumbs, ReturnToCaller, ClearScope, GetBasePath, LookUpInit, OrganizationList, ResetForm, Wait) {
export function UsersAdd($scope, $rootScope, $compile, $location, $log, $stateParams, UserForm, GenerateForm, Rest, Alert, ProcessErrors,
ReturnToCaller, ClearScope, GetBasePath, LookUpInit, OrganizationList, ResetForm, Wait) {
ClearScope();
@@ -123,22 +121,20 @@ export function UsersAdd($scope, $rootScope, $compile, $location, $log, $routePa
generator.reset();
LoadBreadCrumbs();
// Configure the lookup dialog. If we're adding a user through the Organizations tab,
// default the Organization value.
LookUpInit({
scope: $scope,
form: form,
current_item: ($routeParams.organization_id !== undefined) ? $routeParams.organization_id : null,
current_item: ($stateParams.organization_id !== undefined) ? $stateParams.organization_id : null,
list: OrganizationList,
field: 'organization',
input_type: 'radio'
});
if ($routeParams.organization_id) {
$scope.organization = $routeParams.organization_id;
Rest.setUrl(GetBasePath('organizations') + $routeParams.organization_id + '/');
if ($stateParams.organization_id) {
$scope.organization = $stateParams.organization_id;
Rest.setUrl(GetBasePath('organizations') + $stateParams.organization_id + '/');
Rest.get()
.success(function (data) {
$scope.organization_name = data.name;
@@ -201,14 +197,14 @@ export function UsersAdd($scope, $rootScope, $compile, $location, $log, $routePa
};
}
UsersAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'LookUpInit',
UsersAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'UserForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'LookUpInit',
'OrganizationList', 'ResetForm', 'Wait'
];
export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm, GenerateForm, Rest, Alert,
ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, GetBasePath,
export function UsersEdit($scope, $rootScope, $compile, $location, $log, $stateParams, UserForm, GenerateForm, Rest, Alert,
ProcessErrors, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, GetBasePath,
Prompt, CheckAccess, ResetForm, Wait, Stream, fieldChoices, fieldLabels, permissionsSearchSelect) {
ClearScope();
@@ -218,7 +214,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
form = UserForm,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.user_id,
id = $stateParams.user_id,
relatedSets = {};
$scope.permission_label = {};
@@ -324,7 +320,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' +
$routeParams.id + '. GET status: ' + status });
$stateParams.id + '. GET status: ' + status });
});
$scope.getPermissionText = function () {
@@ -368,7 +364,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
}
})
.error(function (data, status) {
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update users: ' + $routeParams.id +
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update users: ' + $stateParams.id +
'. PUT status: ' + status });
});
}
@@ -402,12 +398,12 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
$rootScope.flashMessage = null;
if (set === 'permissions') {
if ($scope.PermissionAddAllowed) {
$location.path('/' + base + '/' + $routeParams.user_id + '/' + set + '/add');
$location.path('/' + base + '/' + $stateParams.user_id + '/' + set + '/add');
} else {
Alert('Access Denied', 'You do not have access to this function. Please contact your system administrator.');
}
} else {
$location.path('/' + base + '/' + $routeParams.user_id + '/' + set);
$location.path('/' + base + '/' + $stateParams.user_id + '/' + set);
}
};
@@ -415,7 +411,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
$scope.edit = function (set, id) {
$rootScope.flashMessage = null;
if (set === 'permissions') {
$location.path('/users/' + $routeParams.user_id + '/permissions/' + id);
$location.path('/users/' + $stateParams.user_id + '/permissions/' + id);
} else {
$location.path('/' + set + '/' + id);
}
@@ -445,7 +441,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
Alert('Access Denied', 'You do not have access to this function. Please contact your system administrator.');
}
} else {
url = defaultUrl + $routeParams.user_id + '/' + set + '/';
url = defaultUrl + $stateParams.user_id + '/' + set + '/';
Rest.setUrl(url);
Rest.post({
id: itm_id,
@@ -527,7 +523,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
});
}
UsersEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope',
UsersEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$stateParams', 'UserForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'Prompt', 'CheckAccess', 'ResetForm', 'Wait', 'Stream', 'fieldChoices', 'fieldLabels', 'permissionsSearchSelect'
];

View File

@@ -53,11 +53,11 @@ export default
*
*/
// Submit request to run an adhoc comamand
.factory('AdhocRun', ['$location','$routeParams', 'LaunchJob',
.factory('AdhocRun', ['$location','$stateParams', 'LaunchJob',
'PromptForPasswords', 'Rest', 'GetBasePath', 'Alert', 'ProcessErrors',
'Wait', 'Empty', 'PromptForCredential', 'PromptForVars',
'PromptForSurvey' , 'CreateLaunchDialog',
function ($location, $routeParams, LaunchJob, PromptForPasswords,
function ($location, $stateParams, LaunchJob, PromptForPasswords,
Rest, GetBasePath, Alert, ProcessErrors, Wait, Empty,
PromptForCredential, PromptForVars, PromptForSurvey,
CreateLaunchDialog) {

View File

@@ -13,9 +13,9 @@
export default
angular.module('EventsHelper', ['RestServices', 'Utilities', 'JobEventDataDefinition', 'JobEventsFormDefinition'])
.factory('EventView', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm',
.factory('EventView', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'JobEventDataForm', 'Empty', 'JobEventsForm',
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
function ($rootScope, $location, $log, $stateParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
FormatDate, JobEventDataForm, Empty, JobEventsForm) {
return function (params) {

View File

@@ -459,7 +459,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
GenerateList.inject(list, {
mode: 'edit',
id: 'schedules-list',
breadCrumbs: false,
searchSize: 'col-lg-6 col-md-5 col-sm-5 col-xs-5',
scope: schedule_scope
});
@@ -707,11 +706,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
* TODO: Document
*
*/
.factory('GroupsEdit', ['$filter', '$rootScope', '$location', '$log', '$routeParams', '$compile', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
.factory('GroupsEdit', ['$filter', '$rootScope', '$location', '$log', '$stateParams', '$compile', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'SetNodeName', 'ParseTypeChange', 'GetSourceTypeOptions', 'InventoryUpdate',
'LookUpInit', 'Empty', 'Wait', 'GetChoices', 'UpdateGroup', 'SourceChange', 'Find',
'ParseVariableString', 'ToJSON', 'GroupsScheduleListInit', 'SourceForm', 'SetSchedulesInnerDialogSize', 'CreateSelect2',
function ($filter, $rootScope, $location, $log, $routeParams, $compile, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
function ($filter, $rootScope, $location, $log, $stateParams, $compile, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, SetNodeName, ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, LookUpInit, Empty, Wait,
GetChoices, UpdateGroup, SourceChange, Find, ParseVariableString, ToJSON, GroupsScheduleListInit,
SourceForm, SetSchedulesInnerDialogSize, CreateSelect2) {
@@ -751,9 +750,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
$compile(elem)(modal_scope);
var form_scope =
generator.inject(GroupForm, { mode: mode, id: 'properties-tab', breadCrumbs: false, related: false, scope: properties_scope });
generator.inject(GroupForm, { mode: mode, id: 'properties-tab', related: false, scope: properties_scope });
var source_form_scope =
generator.inject(SourceForm, { mode: mode, id: 'sources-tab', breadCrumbs: false, related: false, scope: sources_scope });
generator.inject(SourceForm, { mode: mode, id: 'sources-tab', related: false, scope: sources_scope });
//generator.reset();
@@ -1426,9 +1425,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
* Set's up the process for deleting a group from an inventory page
*
*/
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', 'BuildTree', 'Find', 'CreateDialog',
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
function ($rootScope, $location, $log, $stateParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, Wait, BuildTree, Find, CreateDialog) {
return function (params) {
@@ -1994,9 +1993,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
* TODO: Document
*
*/
.factory('ShowUpdateStatus', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm',
.factory('ShowUpdateStatus', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventoryStatusForm', 'Wait',
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
function ($rootScope, $location, $log, $stateParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
FormatDate, InventoryStatusForm, Wait) {
return function (params) {
@@ -2026,7 +2025,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
scope = generator.inject(form, {
mode: 'edit',
id: 'form-container',
breadCrumbs: false,
related: false
});

View File

@@ -170,9 +170,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
};
}])
.factory('HostsReload', [ '$routeParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait',
.factory('HostsReload', [ '$stateParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait',
'SetHostStatus', 'SetStatus', 'ApplyEllipsis',
function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus, SetStatus,
function($stateParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus, SetStatus,
ApplyEllipsis) {
return function(params) {
@@ -209,9 +209,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
SearchInit({ scope: scope, set: 'hosts', list: list, url: url });
PaginateInit({ scope: scope, list: list, url: url, pageSize: pageSize });
if ($routeParams.host_name) {
if ($stateParams.host_name) {
scope[list.iterator + 'InputDisable'] = false;
scope[list.iterator + 'SearchValue'] = $routeParams.host_name;
scope[list.iterator + 'SearchValue'] = $stateParams.host_name;
scope[list.iterator + 'SearchField'] = 'name';
scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
scope[list.iterator + 'SearchSelectValue'] = null;
@@ -240,7 +240,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
generator = GenerateList;
// Inject the list html
generator.inject(InventoryHosts, { scope: host_scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
generator.inject(InventoryHosts, { scope: host_scope, mode: 'edit', id: 'hosts-container', searchSize: 'col-lg-6 col-md-6 col-sm-6' });
// Load data
HostsReload({ scope: host_scope, group_id: group_id, inventory_id: inventory_id, parent_scope: group_scope, pageSize: pageSize });
@@ -288,9 +288,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
};
}])
.factory('HostsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'generateList',
.factory('HostsList', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'HostList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'HostsAdd', 'HostsReload', 'SelectionInit',
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostList, GenerateList, Prompt, SearchInit,
function($rootScope, $location, $log, $stateParams, Rest, Alert, HostList, GenerateList, Prompt, SearchInit,
PaginateInit, ProcessErrors, GetBasePath, HostsAdd, HostsReload, SelectionInit) {
return function(params) {
@@ -308,7 +308,6 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
scope = generator.inject(list, {
id: 'form-modal-body',
mode: 'select',
breadCrumbs: false,
selectButton: false
});
@@ -349,9 +348,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
}])
.factory('HostsCreate', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
.factory('HostsCreate', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'ToJSON',
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
function($rootScope, $location, $log, $stateParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, HostsReload, ParseTypeChange, Wait, ToJSON) {
return function(params) {
@@ -447,10 +446,10 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
}])
.factory('HostsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
.factory('HostsEdit', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'Find', 'SetStatus', 'ApplyEllipsis',
'ToJSON', 'ParseVariableString', 'CreateDialog', 'TextareaResize',
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
function($rootScope, $location, $log, $stateParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, HostsReload, ParseTypeChange, Wait, Find, SetStatus, ApplyEllipsis, ToJSON,
ParseVariableString, CreateDialog, TextareaResize) {
return function(params) {
@@ -470,7 +469,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
buttons, url, form_scope;
form_scope =
generator.inject(HostForm, { mode: 'edit', id: 'host-modal-dialog', breadCrumbs: false, related: false, scope: scope });
generator.inject(HostForm, { mode: 'edit', id: 'host-modal-dialog', related: false, scope: scope });
generator.reset();
buttons = [{
@@ -680,8 +679,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
}])
.factory('HostsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'Wait',
function($rootScope, $location, $log, $routeParams, Rest, Alert, Prompt, ProcessErrors, GetBasePath, HostsReload, Wait) {
.factory('HostsDelete', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'Wait',
function($rootScope, $location, $log, $stateParams, Rest, Alert, Prompt, ProcessErrors, GetBasePath, HostsReload, Wait) {
return function(params) {
// Remove the selected host from the current group by disassociating
@@ -983,9 +982,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
};
}])
.factory('EditHostGroups', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm', 'Prompt',
.factory('EditHostGroups', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'GenerateForm', 'Prompt',
'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait',
function($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath, HostsReload,
function($rootScope, $location, $log, $stateParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath, HostsReload,
ParseTypeChange, Wait) {
return function(params) {

View File

@@ -469,9 +469,9 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
}])
.factory('PromptForVars', ['$compile', 'Rest', 'GetBasePath', 'TextareaResize', 'CreateLaunchDialog', 'GenerateForm', 'JobVarsPromptForm', 'Wait',
'ParseVariableString', 'ToJSON', 'ProcessErrors', '$routeParams' ,
'ParseVariableString', 'ToJSON', 'ProcessErrors', '$stateParams' ,
function($compile, Rest, GetBasePath, TextareaResize,CreateLaunchDialog, GenerateForm, JobVarsPromptForm, Wait,
ParseVariableString, ToJSON, ProcessErrors, $routeParams) {
ParseVariableString, ToJSON, ProcessErrors, $stateParams) {
return function(params) {
var
// parent_scope = params.scope,
@@ -513,16 +513,16 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
})
.error(function (data, status) {
ProcessErrors(scope, data, status, { hdr: 'Error!',
msg: 'Failed to retrieve organization: ' + $routeParams.id + '. GET status: ' + status });
msg: 'Failed to retrieve organization: ' + $stateParams.id + '. GET status: ' + status });
});
};
}])
.factory('PromptForSurvey', ['$filter', '$compile', 'Wait', 'Alert', 'CredentialForm', 'CreateLaunchDialog', 'GetBasePath', 'Rest' , 'Empty',
'GenerateForm', 'ProcessErrors', '$routeParams' ,
'GenerateForm', 'ProcessErrors', '$stateParams' ,
function($filter, $compile, Wait, Alert, CredentialForm, CreateLaunchDialog, GetBasePath, Rest, Empty,
GenerateForm, ProcessErrors, $routeParams) {
GenerateForm, ProcessErrors, $stateParams) {
return function(params) {
var html = params.html || "",
id= params.id,
@@ -698,16 +698,16 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
})
.error(function (data, status) {
ProcessErrors(scope, data, status, { hdr: 'Error!',
msg: 'Failed to retrieve organization: ' + $routeParams.id + '. GET status: ' + status });
msg: 'Failed to retrieve organization: ' + $stateParams.id + '. GET status: ' + status });
});
};
}])
.factory('CheckPasswords', ['$compile', 'Rest', 'GetBasePath', 'TextareaResize', 'CreateLaunchDialog', 'GenerateForm', 'JobVarsPromptForm', 'Wait',
'ParseVariableString', 'ToJSON', 'ProcessErrors', '$routeParams', 'Empty',
'ParseVariableString', 'ToJSON', 'ProcessErrors', '$stateParams', 'Empty',
function($compile, Rest, GetBasePath, TextareaResize,CreateLaunchDialog, GenerateForm, JobVarsPromptForm, Wait,
ParseVariableString, ToJSON, ProcessErrors, $routeParams, Empty) {
ParseVariableString, ToJSON, ProcessErrors, $stateParams, Empty) {
return function(params) {
var scope = params.scope,
callback = params.callback,
@@ -752,9 +752,9 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
*
*/
// Submit request to run a playbook
.factory('PlaybookRun', ['$location','$routeParams', 'LaunchJob', 'PromptForPasswords', 'Rest', 'GetBasePath', 'Alert', 'ProcessErrors', 'Wait', 'Empty',
.factory('PlaybookRun', ['$location','$stateParams', 'LaunchJob', 'PromptForPasswords', 'Rest', 'GetBasePath', 'Alert', 'ProcessErrors', 'Wait', 'Empty',
'PromptForCredential', 'PromptForVars', 'PromptForSurvey' , 'CreateLaunchDialog',
function ($location, $routeParams, LaunchJob, PromptForPasswords, Rest, GetBasePath, Alert, ProcessErrors, Wait, Empty,
function ($location, $stateParams, LaunchJob, PromptForPasswords, Rest, GetBasePath, Alert, ProcessErrors, Wait, Empty,
PromptForCredential, PromptForVars, PromptForSurvey, CreateLaunchDialog) {
return function (params) {
var //parent_scope = params.scope,

View File

@@ -18,9 +18,9 @@ angular.module('JobTemplatesHelper', ['Utilities'])
*
*/
.factory('CallbackHelpInit', ['$location', 'GetBasePath', 'Rest', 'JobTemplateForm', 'GenerateForm', '$routeParams', 'LoadBreadCrumbs', 'ProcessErrors', 'ParseTypeChange',
.factory('CallbackHelpInit', ['$location', 'GetBasePath', 'Rest', 'JobTemplateForm', 'GenerateForm', '$stateParams', 'ProcessErrors', 'ParseTypeChange',
'ParseVariableString', 'Empty', 'LookUpInit', 'InventoryList', 'CredentialList','ProjectList', 'RelatedSearchInit', 'RelatedPaginateInit', 'Wait',
function($location, GetBasePath, Rest, JobTemplateForm, GenerateForm, $routeParams, LoadBreadCrumbs, ProcessErrors,ParseTypeChange,
function($location, GetBasePath, Rest, JobTemplateForm, GenerateForm, $stateParams, ProcessErrors,ParseTypeChange,
ParseVariableString, Empty, LookUpInit, InventoryList, CredentialList, ProjectList, RelatedSearchInit, RelatedPaginateInit, Wait) {
return function(params) {
@@ -31,7 +31,7 @@ angular.module('JobTemplatesHelper', ['Utilities'])
// loadingFinishedCount = 0,
// base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.template_id,
id = $stateParams.template_id,
relatedSets = {};
// checkSCMStatus, getPlaybooks, callback,
// choicesCount = 0;
@@ -77,7 +77,6 @@ angular.module('JobTemplatesHelper', ['Utilities'])
Rest.get()
.success(function (data) {
var fld, i;
LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name });
for (fld in form.fields) {
if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) {
if (form.fields[fld].type === 'select') {
@@ -192,7 +191,7 @@ angular.module('JobTemplatesHelper', ['Utilities'])
.error(function (data, status) {
ProcessErrors(scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to retrieve job template: ' + $routeParams.template_id + '. GET status: ' + status
msg: 'Failed to retrieve job template: ' + $stateParams.template_id + '. GET status: ' + status
});
});
};

View File

@@ -193,7 +193,7 @@ export default
$('#inventory-modal-container').empty().append(html);
scope = generator.inject(form, { mode: 'edit', id: 'form-container', breadCrumbs: false, related: false });
scope = generator.inject(form, { mode: 'edit', id: 'form-container', related: false });
// Set modal dimensions based on viewport width
ww = $(document).width();
@@ -369,8 +369,8 @@ export default
* Called from JobsList controller to load each section or list on the page
*
*/
.factory('LoadJobsScope', ['$routeParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'generateList', 'JobsControllerInit', 'JobsListUpdate', 'SearchWidget',
function($routeParams, $location, $compile, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate, SearchWidget) {
.factory('LoadJobsScope', ['$stateParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'generateList', 'JobsControllerInit', 'JobsListUpdate', 'SearchWidget',
function($stateParams, $location, $compile, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate, SearchWidget) {
return function(params) {
var parent_scope = params.parent_scope,
scope = params.scope,
@@ -395,7 +395,6 @@ export default
GenerateList.inject(list, {
mode: 'edit',
id: id,
breadCrumbs: false,
scope: scope,
showSearch: false
});
@@ -429,9 +428,9 @@ export default
});
if (base === 'jobs' && list.name === 'all_jobs') {
if ($routeParams.id__int) {
if ($stateParams.id__int) {
scope[list.iterator + 'SearchField'] = 'id';
scope[list.iterator + 'SearchValue'] = $routeParams.id__int;
scope[list.iterator + 'SearchValue'] = $stateParams.id__int;
scope[list.iterator + 'SearchFieldLabel'] = 'Job ID';
}
}

View File

@@ -144,7 +144,7 @@ export default
html += "</div>";
if (IsAdmin()) {
html += GenerateForm.buildHTML(LicenseUpdateForm, { mode: 'edit', showButtons:((includeFormButton) ? true : false), breadCrumbs: false });
html += GenerateForm.buildHTML(LicenseUpdateForm, { mode: 'edit', showButtons:((includeFormButton) ? true : false) });
}
html += "</div>";

View File

@@ -236,9 +236,9 @@ export default
};
}])
.factory('AddSchedule', ['$location', '$routeParams', 'SchedulerInit', 'ShowSchedulerModal', 'Wait', 'GetBasePath', 'Empty',
.factory('AddSchedule', ['$location', '$stateParams', 'SchedulerInit', 'ShowSchedulerModal', 'Wait', 'GetBasePath', 'Empty',
'SchedulePost',
function($location, $routeParams, SchedulerInit, ShowSchedulerModal, Wait, GetBasePath, Empty, SchedulePost) {
function($location, $stateParams, SchedulerInit, ShowSchedulerModal, Wait, GetBasePath, Empty, SchedulePost) {
return function(params) {
var scope = params.scope,
callback= params.callback,
@@ -246,14 +246,14 @@ export default
url = GetBasePath(base),
scheduler;
if (!Empty($routeParams.template_id)) {
url += $routeParams.template_id + '/schedules/';
if (!Empty($stateParams.template_id)) {
url += $stateParams.template_id + '/schedules/';
}
else if (!Empty($routeParams.id)) {
url += $routeParams.id + '/schedules/';
else if (!Empty($stateParams.id)) {
url += $stateParams.id + '/schedules/';
}
else if (!Empty($routeParams.management_job)) {
url += $routeParams.management_job + '/schedules/';
else if (!Empty($stateParams.management_job)) {
url += $stateParams.management_job + '/schedules/';
if(scope.management_job.id === 4){
scope.isFactCleanup = true;
scope.keep_unit_choices = [{
@@ -690,9 +690,9 @@ export default
* Called from a controller to setup the scope for a schedules list
*
*/
.factory('LoadSchedulesScope', ['$compile', '$location', '$routeParams','SearchInit', 'PaginateInit', 'generateList', 'SchedulesControllerInit',
.factory('LoadSchedulesScope', ['$compile', '$location', '$stateParams','SearchInit', 'PaginateInit', 'generateList', 'SchedulesControllerInit',
'SchedulesListInit',
function($compile, $location, $routeParams, SearchInit, PaginateInit, GenerateList, SchedulesControllerInit, SchedulesListInit) {
function($compile, $location, $stateParams, SearchInit, PaginateInit, GenerateList, SchedulesControllerInit, SchedulesListInit) {
return function(params) {
var parent_scope = params.parent_scope,
scope = params.scope,
@@ -707,7 +707,6 @@ export default
GenerateList.inject(list, {
mode: 'edit',
id: id,
breadCrumbs: false,
scope: scope,
searchSize: (searchSize) ? searchSize : 'col-lg-6 col-md-6 col-sm-6 col-xs-12',
showSearch: true
@@ -746,9 +745,9 @@ export default
parent_scope.$emit('listLoaded');
});
if ($routeParams.id__int) {
if ($stateParams.id__int) {
scope[list.iterator + 'SearchField'] = 'id';
scope[list.iterator + 'SearchValue'] = $routeParams.id__int;
scope[list.iterator + 'SearchValue'] = $stateParams.id__int;
scope[list.iterator + 'SearchFieldLabel'] = 'ID';
}

View File

@@ -106,7 +106,6 @@ export default
showButtons: false,
showActions: false,
id: 'inventory-edit-modal-dialog',
breadCrumbs: false,
related: false,
scope: scope
});

View File

@@ -8,12 +8,12 @@ export default
[ '$compile','SchedulerInit', 'Rest', 'Wait',
'inventoryScriptsFormObject', 'ProcessErrors', 'GetBasePath', 'Empty',
'GenerateForm', 'SearchInit' , 'PaginateInit',
'LookUpInit', 'OrganizationList', '$scope', 'transitionTo',
'LookUpInit', 'OrganizationList', '$scope', '$state',
function(
$compile, SchedulerInit, Rest, Wait,
inventoryScriptsFormObject, ProcessErrors, GetBasePath, Empty,
GenerateForm, SearchInit, PaginateInit,
LookUpInit, OrganizationList, $scope, transitionTo
LookUpInit, OrganizationList, $scope, $state
) {
var scope = $scope,
generator = GenerateForm,
@@ -48,7 +48,7 @@ export default
script: scope.script
})
.success(function () {
transitionTo('inventoryScriptsList');
$state.transitionTo('inventoryScriptsList');
Wait('stop');
})

View File

@@ -1,12 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/inventory_scripts" title="Inventory Scripts"></breadcrumb>
<breadcrumb
path="/inventory_scripts/add"
title="Create Inventory Script">
</breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="inventory_scripts_add">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -15,5 +15,9 @@ export default {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
},
ncyBreadcrumb: {
parent: 'inventoryScriptsList',
label: 'CREATE INVENTORY SCRIPT'
}
};

View File

@@ -10,8 +10,6 @@ import controller from './add.controller';
export default
angular.module('inventoryScriptsAdd', [])
.controller('inventoryScriptsAddController', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}]);

View File

@@ -9,13 +9,13 @@ export default
'inventoryScriptsFormObject', 'ProcessErrors', 'GetBasePath',
'GenerateForm', 'SearchInit' , 'PaginateInit',
'LookUpInit', 'OrganizationList', 'inventory_script',
'$scope', 'transitionTo',
'$scope', '$state',
function(
Rest, Wait,
inventoryScriptsFormObject, ProcessErrors, GetBasePath,
GenerateForm, SearchInit, PaginateInit,
LookUpInit, OrganizationList, inventory_script,
$scope, transitionTo
$scope, $state
) {
var generator = GenerateForm,
id = inventory_script.id,
@@ -27,7 +27,6 @@ export default
generator.inject(form, {
mode: 'edit' ,
scope:$scope,
breadCrumbs: true,
related: false,
activityStream: false
});
@@ -80,7 +79,7 @@ export default
script: $scope.script
})
.success(function () {
transitionTo('inventoryScriptsList');
$state.transitionTo('inventoryScriptsList');
Wait('stop');
})

View File

@@ -1,9 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/inventory_scripts" title="Inventory Scripts"></breadcrumb>
<breadcrumb path="/inventory_scripts/{{inventory_script.id}}" title="{{inventory_script.name}}" current="true"></breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="inventory_scripts_edit">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -8,25 +8,27 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
export default {
name: 'inventoryScriptsEdit',
route: '/inventory_scripts/:inventory_script',
route: '/inventory_scripts/:inventory_script_id',
templateUrl: templateUrl('inventory-scripts/edit/edit'),
controller: 'inventoryScriptsEditController',
params: {inventory_script: null},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}],
inventory_script:
[ '$route',
[ '$state',
'$stateParams',
'$q',
'Rest',
'GetBasePath',
'ProcessErrors',
function($route, $q, rest, getBasePath, ProcessErrors) {
if ($route.current.hasModelKey('inventory_script')) {
return $q.when($route.current.params.model.inventory_script);
function($state, $stateParams, $q, rest, getBasePath, ProcessErrors) {
if ($stateParams.inventory_script) {
return $q.when($stateParams.inventory_script);
}
var inventoryScriptId = $route.current.params.inventory_script;
var inventoryScriptId = $stateParams.inventory_script_id;
var url = getBasePath('inventory_scripts') + inventoryScriptId + '/';
rest.setUrl(url);

View File

@@ -10,8 +10,6 @@ import controller from './edit.controller';
export default
angular.module('inventoryScriptsEdit', [])
.controller('inventoryScriptsEditController', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}]);

View File

@@ -7,11 +7,11 @@
export default
[ '$rootScope','Wait', 'generateList', 'inventoryScriptsListObject',
'GetBasePath' , 'SearchInit' , 'PaginateInit',
'Rest' , 'ProcessErrors', 'Prompt', 'transitionTo', 'Stream',
'Rest' , 'ProcessErrors', 'Prompt', '$state', 'Stream',
function(
$rootScope,Wait, GenerateList, inventoryScriptsListObject,
GetBasePath, SearchInit, PaginateInit,
Rest, ProcessErrors, Prompt, transitionTo, Stream
Rest, ProcessErrors, Prompt, $state, Stream
) {
var scope = $rootScope.$new(),
defaultUrl = GetBasePath('inventory_scripts'),
@@ -38,7 +38,8 @@ export default
scope.search(list.iterator);
scope.editCustomInv = function(){
transitionTo('inventoryScriptsEdit', {
$state.transitionTo('inventoryScriptsEdit',{
inventory_script_id: this.inventory_script.id,
inventory_script: this.inventory_script
});
};
@@ -73,7 +74,7 @@ export default
};
scope.addCustomInv = function(){
transitionTo('inventoryScriptsAdd');
$state.transitionTo('inventoryScriptsAdd');
};
}

View File

@@ -1,8 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/inventory_scripts" title="Inventory Scripts"></breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="inventory_scripts">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -15,5 +15,9 @@ export default {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
},
ncyBreadcrumb: {
parent: 'setup',
label: 'INVENTORY SCRIPTS'
}
};

View File

@@ -10,8 +10,6 @@ import controller from './list.controller';
export default
angular.module('inventoryScriptsList', [])
.controller('inventoryScriptsListController', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
}]);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}]);

View File

@@ -77,7 +77,7 @@ export default
}
scope.removeGenerateForm = scope.$on('GenerateForm', function() {
tmpVar = scope.mode;
GenerateForm.inject(form, { id: 'question_'+index, mode: 'edit' , related: false, scope:scope, breadCrumbs: false});
GenerateForm.inject(form, { id: 'question_'+index, mode: 'edit' , related: false, scope:scope });
scope.mode = tmpVar;
scope.$emit('FillQuestionForm');
});

View File

@@ -19,7 +19,6 @@ export default
name: 'survey_question',
well: true,
twoColumns: true,
breadcrumbs: false,
fields: {
question_name: {

View File

@@ -1,5 +1,5 @@
export default
function AddFactory($location, $routeParams, ShowSurveyModal, Wait) {
function AddFactory($location, $stateParams, ShowSurveyModal, Wait) {
return function(params) {
var scope = params.scope;
@@ -19,7 +19,7 @@ export default
AddFactory.$inject =
[ '$location',
'$routeParams',
'$stateParams',
'showSurvey',
'Wait'
];

View File

@@ -1,5 +1,5 @@
export default
function EditFactory($routeParams, SchedulerInit, ShowSurveyModal, Wait, Rest, ProcessErrors, GetBasePath, GenerateForm,
function EditFactory($stateParams, SchedulerInit, ShowSurveyModal, Wait, Rest, ProcessErrors, GetBasePath, GenerateForm,
Empty, AddSurvey) {
return function(params) {
var scope = params.scope,
@@ -66,7 +66,7 @@ export default
EditFactory.$inject =
[ '$routeParams',
[ '$stateParams',
'SchedulerInit',
'showSurvey',
'Wait',

View File

@@ -63,7 +63,7 @@ export default
scope.addQuestion = function(){
var tmpMode = scope.mode;
GenerateForm.inject(form, { id:'new_question', mode: 'add' , scope: scope, related: false, breadCrumbs: false});
GenerateForm.inject(form, { id:'new_question', mode: 'add' , scope: scope, related: false});
scope.mode = tmpMode;
scope.required = true; //set the required checkbox to true via the ngmodel attached to scope.required.
scope.text_min = null;

View File

@@ -22,9 +22,9 @@
* @description
*/
export default
['$rootScope', '$cookieStore', 'transitionTo', 'CreateDialog', 'Authorization',
['$rootScope', '$cookieStore', 'CreateDialog', 'Authorization',
'Store', '$interval', '$location', '$q',
function ($rootScope, $cookieStore, transitionTo, CreateDialog, Authorization,
function ($rootScope, $cookieStore, CreateDialog, Authorization,
Store, $interval, $location, $q) {
return {

View File

@@ -15,5 +15,9 @@ export default {
Authorization.logout();
}
$(".LoginModal-dialog").remove();
}]
}],
ncyBreadcrumb: {
skip: true
}
};

View File

@@ -13,5 +13,8 @@ export default {
Authorization.logout();
$location.path('/login');
}],
ncyBreadcrumb: {
skip: true
},
templateUrl: '/static/partials/blank.html'
};

View File

@@ -12,11 +12,7 @@ import logoutRoute from './logout.route';
export default
angular.module('login', [authentication.name, loginModal.name])
.config(['$routeProvider', function($routeProvider) {
var url = loginRoute.route;
delete loginRoute.route;
$routeProvider.when(url, loginRoute);
url = logoutRoute.route;
delete logoutRoute.route;
$routeProvider.when(url, logoutRoute);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(loginRoute);
$stateExtender.addState(logoutRoute);
}]);

View File

@@ -11,12 +11,12 @@ export default
'GetBasePath' , 'SearchInit' , 'PaginateInit',
'SchedulesList',
'Rest' , 'ProcessErrors', 'managementJobsListObject', '$rootScope',
'transitionTo', 'Stream',
'$state', 'Stream',
function( Wait, $location, $compile, CreateDialog, GenerateList,
GetBasePath, SearchInit, PaginateInit,
SchedulesList,
Rest, ProcessErrors, managementJobsListObject, $rootScope,
transitionTo, Stream) {
$state, Stream) {
var scope = $rootScope.$new(),
parent_scope = scope,
@@ -251,8 +251,9 @@ export default
};
scope.configureSchedule = function() {
transitionTo('managementJobsSchedule', {
management_job: this.configure_job
$state.transitionTo('managementJobsSchedule', {
management_job: this.configure_job,
management_job_id: this.configure_job.id
});
};

View File

@@ -1,8 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/management_jobs" title="Management Jobs" current='true'></breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="management_jobs">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -15,5 +15,9 @@ export default {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
}
},
ncyBreadcrumb: {
parent: 'setup',
label: 'MANAGEMENT JOBS'
},
};

View File

@@ -10,8 +10,6 @@ import controller from './list.controller';
export default
angular.module('managementJobsList', [])
.controller('managementJobsListController', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}]);

View File

@@ -10,8 +10,6 @@ import controller from './schedule.controller';
export default
angular.module('managementJobsSchedule', [])
.controller('managementJobsScheduleController', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
delete route.route;
$routeProvider.when(url, route);
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route);
}]);

View File

@@ -11,10 +11,10 @@
*/
export default [
'$scope', '$location', '$routeParams', 'SchedulesList', 'Rest',
'$scope', '$location', '$stateParams', 'SchedulesList', 'Rest',
'ProcessErrors', 'GetBasePath', 'Wait','LoadSchedulesScope', 'GetChoices',
'Stream', 'management_job', '$rootScope',
function($scope, $location, $routeParams, SchedulesList, Rest,
function($scope, $location, $stateParams, SchedulesList, Rest,
ProcessErrors, GetBasePath, Wait, LoadSchedulesScope, GetChoices,
Stream, management_job, $rootScope) {
var base, id, url, parentObject;
@@ -58,7 +58,7 @@ export default [
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
// Load the parent object
id = $routeParams.management_job;
id = $stateParams.management_job_id;
url = GetBasePath('system_job_templates') + id + '/';
Rest.setUrl(url);
Rest.get()

View File

@@ -1,9 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/management_jobs" title="{{management_job.name}}"></breadcrumb>
<breadcrumb path="/management_jobs/{{management_job.id}}" title="Schedules" current='true'></breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="management_jobs_schedule">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -8,25 +8,26 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
export default {
name: 'managementJobsSchedule',
route: '/management_jobs/:management_job/schedules',
route: '/management_jobs/:management_job_id/schedules',
templateUrl: templateUrl('management-jobs/schedule/schedule'),
controller: 'managementJobsScheduleController',
params: {management_job: null},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}],
management_job:
[ '$route',
[ '$stateParams',
'$q',
'Rest',
'GetBasePath',
'ProcessErrors',
function($route, $q, rest, getBasePath, ProcessErrors) {
if ($route.current.hasModelKey('management_job')) {
return $q.when($route.current.params.model.management_job);
function($stateParams, $q, rest, getBasePath, ProcessErrors) {
if ($stateParams.management_job) {
return $q.when($stateParams.management_job);
}
var managementJobId = $route.current.params.management_job;
var managementJobId = $stateParams.management_job_id;
var url = getBasePath('system_job_templates') + managementJobId + '/';
rest.setUrl(url);

View File

@@ -0,0 +1,8 @@
<ol>
<li ng-repeat="step in steps | limitTo:(steps.length-1)">
<a href="{{step.ncyBreadcrumbLink}}" ng-bind-html="step.ncyBreadcrumbLabel"></a>
</li>
<li ng-repeat="step in steps | limitTo:-1" class="active">
<span ng-bind-html="step.ncyBreadcrumbLabel"></span>
</li>
</ol>

View File

@@ -1,18 +1,3 @@
<breadcrumbs>
<breadcrumb path="/setup" title="Setup"></breadcrumb>
<breadcrumb path="/credentials" title="Credentials"></breadcrumb>
<breadcrumb
path="/credentials/add"
title="Create Credential"
ng-if="mode == 'add'">
</breadcrumb>
<breadcrumb
path="/credentials/{{id}}"
title="{{credential_name}}"
ng-if="id">
</breadcrumb>
</breadcrumbs>
<div class="tab-pane" id="credentials">
<div ng-cloak id="htmlTemplate"></div>
</div>

View File

@@ -1,4 +1,5 @@
<div class="tab-pane" id="inventories">
<div ui-view></div>
<div ng-cloak id="htmlTemplate"></div>
<div id="inventory-edit-modal-dialog"></div>
<div id="scan-jobs-list" style="padding-top:40px"></div>

View File

@@ -0,0 +1,14 @@
<div class="tab-pane" id="inventories-add">
<div ng-cloak id="htmlTemplate"></div>
<div id="inventory-edit-modal-dialog"></div>
<div id="scan-jobs-list" style="padding-top:40px"></div>
<div ng-include="'/static/partials/logviewer.html'"></div>
<div id="copy-job-modal" style="display:none">
<form name="copy_form" id="copy_form">
What would you like to name the copy of job template <b><span id=job_name></span></b>?<br>
<input id="new_copy_name" name="new_copy_name" ng-model ="new_copy_name" ng-required="true" class="form-control ng-pristine ng-invalid-required ng-invalid" style="margin-top:10px;">
<div class="error survey_error ng-hide" ng-show="copy_form.new_copy_name.$dirty && copy_form.new_copy_name.$error.required">Please enter a name for this job template copy.</div></input>
</form>
</div>
</div>

View File

@@ -1,12 +1,6 @@
<div class="tab-pane" id="inventory_edit">
<div ng-cloak id="htmlTemplate">
<ul class="ansible-breadcrumb" id="#breadcrumbs">
<li><a href="#/inventories">Inventories</a></li>
<!-- <li><a href = "#/inventories/{{inventory.id}}">{{inventory.name}}</a><li> -->
<li ng-repeat="group_breadcrumb in group_breadcrumbs" ng-class="group_breadcrumb.active_class"><a href="" ng-click="breadcrumbGroupSelect(group_breadcrumb.id)">{{ group_breadcrumb.name }}</a></li>
</ul>
<div class="row">
<div id="groups-container" class="col-lg-6">
<div id="group-list-container"></div>

Some files were not shown because too many files have changed in this diff Show More