Commit 85672049 authored by 魏国强's avatar 魏国强

Initial commit

parents
Pipeline #553 canceled with stages

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

* text=auto
## What changes were proposed in this pull request?
(Please fill in changes proposed in this fix)
## How was this patch tested?
(Please explain how this patch was tested. Ex: unit tests, manual tests)
(If this patch involves UI changes, please attach a screen-shot; otherwise, remove this)
Please review [Ambari Contributing Guide](https://cwiki.apache.org/confluence/display/AMBARI/How+to+Contribute) before opening a pull request.
\ No newline at end of file
.classpath
.project
.settings
.idea/
.iml/
.DS_Store
**/target/
/ambari-server/derby.log
/ambari-server/pass.txt
/ambari-web/npm-debug.log
/ambari-web/public/
/ambari-web/node_modules/
/ambari-web/node/
*.pyc
*.py~
**/*.iml
.hg
.hgignore
.hgtags
derby.log
pass.txt
ambari-agent/src/test/python/ambari_agent/dummy_files/current-stack
velocity.log*
ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil/build/
rebel.xml
rebel-remote.xml
out
createDDL.jdbc
/contrib/views/storm/src/main/resources/ui/node_modules/
/contrib/views/storm/src/main/resources/ui/public/
/contrib/views/storm/src/main/resources/ui/npm-debug.log
/dist
/build
ambari_python.egg-info
This diff is collapsed.
This diff is collapsed.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include ambari-common/src/main/python/ambari_commons/resources/*
include ambari-common/src/main/python/ambari_commons/libs/**/*.so
include ambari-common/src/main/python/pluggable_stack_definition/configs/*
Apache Ambari
Copyright 2011-2013 The Apache Software Foundation
This product includes software developed at The Apache Software
Foundation (http://www.apache.org/).
Component ambari-common/src/test/python/mock are under the following copyright:
Copyright (c) 2003-2012, Michael Foord
All rights reserved.
Component ambari-common/src/test/python/coilmq are under the following copyright:
Copyright 2009 Hans Lellelid
All rights reserved.
Resource management library derived from Kokki, which is under following copyright:
Copyright (c) 2009 Samuel Stauffer <samuel@descolada.com>
All rights reserved.
Jinja2, the templating library used by resource management library:
Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.
Some rights reserved.
This product includes Simplejson, library fast encoding and decoding of json. (https://github.com/simplejson/simplejson - MIT license)
Copyright (c) 2006 Bob Ippolito.
All rights reserved.
Ws4py, python library for websocket connectivity
Copyright (c) 2011-2016, Sylvain Hellegouarch
All rights reserved.
\ No newline at end of file
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
if [[ $# -eq 0 ]] ; then
echo 'Usage: copy-pluggable-stack-resources.sh <stack.distribution>'
exit 1
fi
resources_dir="../ambari-common/src/main/python/pluggable_stack_definition/resources/$1"
if [ ! -d $resources_dir ];
then
echo "No resources to copy for [ $1 ]"
exit 0
fi
echo "Copying pluggable stack resources for [ $1 ]"
if [ -f "$resources_dir/custom-admin-ui.css" ]
then
echo cp $resources_dir/custom-admin-ui.css src/main/resources/ui/admin-web/app/styles/custom-admin-ui.css
cp $resources_dir/custom-admin-ui.css src/main/resources/ui/admin-web/app/styles/custom-admin-ui.css
fi
\ No newline at end of file
This diff is collapsed.
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
powershell -File set-ambari-version.ps1 %* < NUL
\ No newline at end of file
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
$newVersion = $($args[0])
if ($newVersion -ne '${ambariVersion}')
{
"Setting Ambari version to $newVersion"
Get-Content src/main/resources/view.xml -ReadCount 1000 | %{$_ -replace "<version>.*</version>","<version>$newVersion</version>"} | Set-Content target/classes/view.xml
}
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
if [ "$1" != '${ambariVersion}' ]
then
echo "Setting Ambari version to $1"
sed "s/<version>.*<\/version>/<version>$1<\/version>/" src/main/resources/view.xml > target/classes/view.xml;
fi
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<assembly>
<id>empty</id>
<formats/>
</assembly>
{
"directory": "app/bower_components"
}
\ No newline at end of file
node_modules
public
.tmp
.sass-cache
app/bower_components
test/bower_components
heroku
/views
dist
node
\ No newline at end of file
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": false,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"angular": false
}
}
{
"items" : [
{
"Clusters" : {
"cluster_name" : "c1",
"version" : "HDP-2.2"
}
}
]
}
\ No newline at end of file
{
"items" : [
{
"Clusters" : {
"cluster_name" : "c1",
"provisioning_state" : "INSTALLED",
"version" : "HDP-2.2"
}
}
]
}
\ No newline at end of file
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/stack_versions?fields=*&ClusterStackVersions/repository_version=1",
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/stack_versions/1",
"ClusterStackVersions" : {
"cluster_name" : "c1",
"id" : 1,
"repository_version" : 1,
"stack" : "HDP",
"state" : "CURRENT",
"version" : "2.2",
"host_states" : {
"CURRENT" : [
"c6401.ambari.apache.org"
],
"INSTALLED" : [ ],
"INSTALLING" : [ ],
"INSTALL_FAILED" : [ ],
"UPGRADED" : [ ],
"UPGRADE_FAILED" : [ ],
"UPGRADING" : [ ]
}
},
"repository_versions" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/stack_versions/1/repository_versions/1",
"RepositoryVersions" : {
"id" : 1,
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
}
]
}
\ No newline at end of file
{
"items" : [
{
"PermissionInfo" : {
"permission_id" : 1
}
},
{
"PermissionInfo" : {
"permission_id" : 2
}
},
{
"PermissionInfo" : {
"permission_id" : 3
}
},
{
"PermissionInfo" : {
"permission_id" : 4
}
}
]
}
\ No newline at end of file
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks?fields=*",
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP",
"Stacks" : {
"stack_name" : "HDP"
},
"versions" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3.2",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3.2"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3.3",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3.3"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0.6",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0.6"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0.6.GlusterFS",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0.6.GlusterFS"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.1"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1.GlusterFS",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.1.GlusterFS"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
}
]
}
\ No newline at end of file
{
"items" : [
{
"OperatingSystems" : {
"os_type" : "redhat5",
"stack_name" : "HDP",
"stack_version" : "2.2"
},
"repositories" : [
{
"Repositories" : {
"os_type" : "redhat5",
"repo_id" : "HDP-2.2",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
},
{
"Repositories" : {
"os_type" : "redhat5",
"repo_id" : "HDP-UTILS-1.1.0.20",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
},
{
"OperatingSystems" : {
"os_type" : "redhat6",
"stack_name" : "HDP",
"stack_version" : "2.2"
},
"repositories" : [
{
"Repositories" : {
"os_type" : "redhat6",
"repo_id" : "HDP-2.2",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
},
{
"Repositories" : {
"os_type" : "redhat6",
"repo_id" : "HDP-UTILS-1.1.0.20",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
},
{
"OperatingSystems" : {
"os_type" : "suse11",
"stack_name" : "HDP",
"stack_version" : "2.2"
},
"repositories" : [
{
"Repositories" : {
"os_type" : "suse11",
"repo_id" : "HDP-2.2",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
},
{
"Repositories" : {
"os_type" : "suse11",
"repo_id" : "HDP-UTILS-1.1.0.20",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
},
{
"OperatingSystems" : {
"os_type" : "ubuntu12",
"stack_name" : "HDP",
"stack_version" : "2.2"
},
"repositories" : [
{
"Repositories" : {
"os_type" : "ubuntu12",
"repo_id" : "HDP-2.2",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
},
{
"Repositories" : {
"os_type" : "ubuntu12",
"repo_id" : "HDP-UTILS-1.1.0.20",
"stack_name" : "HDP",
"stack_version" : "2.2"
}
}
]
}
]
}
\ No newline at end of file
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions?fields=repository_versions/operatingSystems/repositories/*&repository_versions/RepositoryVersions/repository_version=2.3.6.0-3509",
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.3"
},
"repository_versions" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15",
"RepositoryVersions" : {
"id" : 15,
"repository_version" : "2.3.6.0-3509",
"stack_name" : "HDP",
"stack_version" : "2.3",
"type": "PATCH",
"release": {
"stack_id": "HDP-2.3",
"version": "2.3.6.0",
"build": "3509",
"compatible_with": "2.3.6.0-[1-9]",
"release_notes": "http://someurl"
},
"services": [
{
"name": "HDFS",
"display_name": "HDFS",
"versions": [
{
"version": "2.1.1",
"version_id": "10",
"components": [ "NAMENODE"]
}
]
},
{
"name": "HIVE",
"display_name": "Hive",
"versions": [
{
"version": "1.2.1"
}
]
},
{
"name": "ZOOKEEPER",
"display_name": "ZooKeeper",
"versions": [
{
"version": "3.4.5"
}
]
}
]
},
"operating_systems" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6",
"OperatingSystems" : {
"os_type" : "redhat6",
"repository_version_id" : 15,
"stack_name" : "HDP",
"stack_version" : "2.3"
},
"repositories" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.3.6.0-3509",
"Repositories" : {
"base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3509",
"default_base_url" : "",
"latest_base_url" : "",
"mirrors_list" : "",
"os_type" : "redhat6",
"repo_id" : "HDP-2.3.6.0-3509",
"repo_name" : "HDP",
"repository_version_id" : 15,
"stack_name" : "HDP",
"stack_version" : "2.3"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.3.6.0-3509",
"Repositories" : {
"base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6",
"default_base_url" : "",
"latest_base_url" : "",
"mirrors_list" : "",
"os_type" : "redhat6",
"repo_id" : "HDP-UTILS-2.3.6.0-3509",
"repo_name" : "HDP-UTILS",
"repository_version_id" : 15,
"stack_name" : "HDP",
"stack_version" : "2.3"
}
}
]
}
]
}
]
}
]
}
\ No newline at end of file
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks?fields=versions/repository_versions/RepositoryVersions",
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP",
"Stacks" : {
"stack_name" : "HDP"
},
"versions" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3.2",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3.2"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/1.3.3",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "1.3.3"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0.6",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0.6"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.0.6.GlusterFS",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.0.6.GlusterFS"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.1"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1.GlusterFS",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.1.GlusterFS"
},
"repository_versions" : [ ]
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2",
"Versions" : {
"stack_name" : "HDP",
"stack_version" : "2.2"
},
"repository_versions" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/1",
"RepositoryVersions" : {
"display_name" : "HDP-2.2",
"id" : 1,
"repository_version" : "2.2",
"stack_name" : "HDP",
"stack_version" : "2.2",
"upgrade_pack" : ""
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/5",
"RepositoryVersions" : {
"display_name" : "HDP-2.2.0.1-112",
"id" : 5,
"repository_version" : "2.2.0.1-112",
"stack_name" : "HDP",
"stack_version" : "2.2",
"upgrade_pack" : "upgrade-2.2"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/6",
"RepositoryVersions" : {
"display_name" : "HDP-2.2.0.1-113",
"id" : 6,
"repository_version" : "2.2.0.1-113",
"stack_name" : "HDP",
"stack_version" : "2.2",
"upgrade_pack" : "upgrade-2.2"
}
},
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/9",
"RepositoryVersions" : {
"display_name" : "HDP-2.2.1.1-111",
"id" : 9,
"repository_version" : "2.2.1.1-111",
"stack_name" : "HDP",
"stack_version" : "2.2",
"upgrade_pack" : "upgrade-2.2"
}
}
]
}
]
}
]
}
\ No newline at end of file
{
"items" : [
{
"ViewInfo" : {
"view_name" : "ADMIN_VIEW"
}
}
]
}
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Ambari</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="images/logo.png" type="image/x-icon">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/angular-bootstrap-toggle-switch/style/bootstrap3/angular-toggle-switch-bootstrap-3.css" />
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css"/>
<!-- endbower -->
<!-- endbuild -->
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
</head>
<body ng-app="ambariAdminConsole">
<!--[if lt IE 9]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div id="wrapper" ng-controller="AppCtrl">
<div ng-include="'views/sideNav.html'" ng-controller="SideNavCtrl"></div>
<div id="main">
<div id="top-nav">
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header navbar-nav">
<ol class="breadcrumb">
<li ng-repeat="breadcrumb in breadcrumbs" ng-class="$last && 'active'" ng-cloak>{{breadcrumb}}</li>
</ol>
</div>
<ul class="nav navbar-nav navbar-right">
<li>
<p class="navbar-text" ng-cloak>{{cluster.Clusters.cluster_name}}</p>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" ng-disabled="disabled" ng-cloak>
<i class="fa fa-user"></i>&nbsp;{{currentUser}}&nbsp;<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href ng-click="about()">{{'common.about' | translate}}</a></li>
<li role="separator" class="divider"></li>
<li><a href ng-click="signOut()">{{'common.signOut' | translate}}</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
<div class="container main-container">
<div class="row">
<div class="col-sm-12">
<ng-view></ng-view>
</div>
</div>
</div>
</div>
</div>
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/angular-bootstrap-toggle-switch/angular-toggle-switch.min.js"></script>
<script src="bower_components/angular-translate/angular-translate.min.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js scripts/plugins.js -->
<script src="bower_components/bootstrap/js/affix.js"></script>
<script src="bower_components/bootstrap/js/alert.js"></script>
<script src="bower_components/bootstrap/js/dropdown.js"></script>
<script src="bower_components/bootstrap/js/tooltip.js"></script>
<script src="bower_components/bootstrap/js/modal.js"></script>
<script src="bower_components/bootstrap/js/transition.js"></script>
<script src="bower_components/bootstrap/js/button.js"></script>
<script src="bower_components/bootstrap/js/popover.js"></script>
<script src="bower_components/bootstrap/js/carousel.js"></script>
<script src="bower_components/bootstrap/js/scrollspy.js"></script>
<script src="bower_components/bootstrap/js/collapse.js"></script>
<script src="bower_components/bootstrap/js/tab.js"></script>
<script src="scripts/theme/bootstrap-ambari.js"></script>
<!-- endbuild -->
<!-- build:js scripts/main.js -->
<script src="scripts/app.js"></script>
<script src="scripts/routes.js"></script>
<script src="scripts/i18n.config.js"></script>
<script src="scripts/controllers/clusters/ClusterInformationCtrl.js"></script>
<script src="scripts/controllers/AppCtrl.js"></script>
<script src="scripts/controllers/SideNavCtrl.js"></script>
<script src="scripts/controllers/authentication/AuthenticationMainCtrl.js"></script>
<script src="scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js"></script>
<script src="scripts/controllers/loginActivities/LoginMessageMainCtrl.js"></script>
<script src="scripts/controllers/loginActivities/HomeDirectoryCtrl.js"></script>
<script src="scripts/controllers/userManagement/UserManagementCtrl.js"></script>
<script src="scripts/controllers/userManagement/UserCreateCtrl.js"></script>
<script src="scripts/controllers/userManagement/UsersListCtrl.js"></script>
<script src="scripts/controllers/userManagement/UserEditCtrl.js"></script>
<script src="scripts/controllers/userManagement/GroupsListCtrl.js"></script>
<script src="scripts/controllers/userManagement/GroupCreateCtrl.js"></script>
<script src="scripts/controllers/userManagement/GroupEditCtrl.js"></script>
<script src="scripts/controllers/ambariViews/ViewsListCtrl.js"></script>
<script src="scripts/controllers/ambariViews/ViewsEditCtrl.js"></script>
<script src="scripts/controllers/ambariViews/ViewUrlCtrl.js"></script>
<script src="scripts/controllers/ambariViews/ViewUrlEditCtrl.js"></script>
<script src="scripts/controllers/ambariViews/CreateViewInstanceCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsCreateCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsListCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsEditCtrl.js"></script>
<script src="scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js"></script>
<script src="scripts/controllers/remoteClusters/RemoteClustersListCtrl.js"></script>
<script src="scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js"></script>
<script src="scripts/directives/linkToDir.js"></script>
<script src="scripts/directives/PasswordVerify.js"></script>
<script src="scripts/directives/disabledTooltip.js"></script>
<script src="scripts/directives/editableList.js"></script>
<script src="scripts/directives/comboSearch.js"></script>
<script src="scripts/services/Utility.js"></script>
<script src="scripts/services/UserConstants.js"></script>
<script src="scripts/services/User.js"></script>
<script src="scripts/services/Group.js"></script>
<script src="scripts/services/RemoteCluster.js"></script>
<script src="scripts/services/View.js"></script>
<script src="scripts/services/Cluster.js"></script>
<script src="scripts/services/Alert.js"></script>
<script src="scripts/services/PermissionLoader.js"></script>
<script src="scripts/services/PermissionsSaver.js"></script>
<script src="scripts/services/ConfirmationModal.js"></script>
<script src="scripts/services/DeregisterClusterModal.js"></script>
<script src="scripts/services/Auth.js"></script>
<script src="scripts/services/GetDifference.js"></script>
<script src="scripts/services/UnsavedDialog.js"></script>
<script src="scripts/services/Stack.js"></script>
<script src="scripts/services/AddRepositoryModal.js"></script>
<script src="scripts/services/AddVersionModal.js"></script>
<script src="scripts/services/RoleDetailsModal.js"></script>
<script src="scripts/services/Pagination.js"></script>
<script src="scripts/services/Filters.js"></script>
<!-- endbuild -->
</body>
</html>
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole', [
'ngRoute',
'ngAnimate',
'ui.bootstrap',
'restangular',
'toggle-switch',
'pascalprecht.translate'
])
.constant('Settings', {
siteRoot: '{proxy_root}/'.replace(/\{.+\}/g, ''),
baseUrl: '{proxy_root}/api/v1'.replace(/\{.+\}/g, ''),
testMode: false,
mockDataPrefix: 'assets/data/',
isLDAPConfigurationSupported: false,
isLoginActivitiesSupported: false,
maxStackTraceLength: 1000,
errorStorageSize: 500000,
minRowsToShowPagination: 10
})
.config(['RestangularProvider', '$httpProvider', '$provide', 'Settings', function(RestangularProvider, $httpProvider, $provide, Settings) {
// Config Ajax-module
RestangularProvider.setBaseUrl(Settings.baseUrl);
RestangularProvider.setDefaultHeaders({'X-Requested-By':'ambari'});
$httpProvider.defaults.headers.post['Content-Type'] = 'plain/text';
$httpProvider.defaults.headers.put['Content-Type'] = 'plain/text';
$httpProvider.defaults.headers.post['X-Requested-By'] = 'ambari';
$httpProvider.defaults.headers.put['X-Requested-By'] = 'ambari';
$httpProvider.defaults.headers.common['X-Requested-By'] = 'ambari';
$httpProvider.interceptors.push(['Settings', '$q', function(Settings, $q) {
return {
'request': function(config) {
if (Settings.testMode) {
if (config.method === 'GET') {
config.url = (config.mock) ? Settings.mockDataPrefix + config.mock : config.url;
} else {
config.method = "GET";
}
}
return config;
}
};
}]);
$httpProvider.interceptors.push(['$rootScope', '$q', function (scope, $q) {
function success(response) {
return response;
}
function error(response) {
if (response.status == 403) {
window.location = Settings.siteRoot;
return;
}
return $q.reject(response);
}
return function (promise) {
return promise.then(success, error);
}
}]);
$provide.factory('TimestampHttpInterceptor', [function($q) {
return {
request: function(config) {
if (config && config.method === 'GET' && config.url.indexOf('html') === -1) {
config.url += config.url.indexOf('?') < 0 ? '?' : '&';
config.url += '_=' + new Date().getTime();
}
return config || $q.when(config);
}
};
}]);
$httpProvider.interceptors.push('TimestampHttpInterceptor');
$provide.decorator('ngFormDirective', ['$delegate', function($delegate) {
var ngForm = $delegate[0], controller = ngForm.controller;
ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || '')(scope));
$injector.invoke(controller, this, {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);
$provide.decorator('ngModelDirective', ['$delegate', function($delegate) {
var ngModel = $delegate[0], controller = ngModel.controller;
ngModel.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || '')(scope));
$injector.invoke(controller, Object.setPrototypeOf(this, controller.prototype), {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);
$provide.decorator('formDirective', ['$delegate', function($delegate) {
var form = $delegate[0], controller = form.controller;
form.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || attrs.ngForm || '')(scope));
$injector.invoke(controller, Object.setPrototypeOf(this, controller.prototype), {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);
$provide.decorator('$exceptionHandler', ['$delegate', 'Utility', '$window', function ($delegate, Utility, $window) {
return function (error, cause) {
var ls = JSON.parse($window.localStorage.getItem('errors')) || {},
key = new Date().getTime(),
origin = $window.location.origin || ($window.location.protocol + '//' + $window.location.host),
pattern = new RegExp(origin + '/.*scripts', 'g'),
stackTrace = error && error.stack && error.stack.replace(pattern, '').substr(0, Settings.maxStackTraceLength),
file = error && error.fileName,
line = error && error.lineNumber,
col = error && error.columnNumber;
if (error && error.stack && (!file || !line || !col)) {
var patternText = '(' + $window.location.protocol + '//.*\\.js):(\\d+):(\\d+)',
details = error.stack.match(new RegExp(patternText));
file = file || (details && details [1]);
line = line || (details && Number(details [2]));
col = col || (details && Number(details [3]));
}
var val = {
file: file,
line: line,
col: col,
error: error.toString(),
stackTrace: stackTrace
};
//overwrite errors if storage full
if (JSON.stringify(ls).length > Settings.errorStorageSize) {
delete ls[Object.keys(ls).sort()[0]];
}
ls[key] = val;
var lsString = JSON.stringify(ls);
$window.localStorage.setItem('errors', lsString);
Utility.postUserPref('errors', ls);
$delegate(error, cause);
};
}]);
if (!Array.prototype.find) {
Array.prototype.find = function (callback, context) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
var list = Object(this),
length = list.length >>> 0,
value;
for (var i = 0; i < length; i++) {
value = list[i];
if (callback.call(context, value, i, list)) {
return value;
}
}
return undefined;
};
}
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('AppCtrl',['$scope','$rootScope', '$route', '$window','Auth', 'Alert', '$modal', 'Cluster', '$translate', '$http', 'Settings', 'Utility', '$q', function($scope, $rootScope, $route, $window, Auth, Alert, $modal, Cluster, $translate, $http, Settings, Utility, $q) {
var $t = $translate.instant;
$scope.signOut = function () {
Auth.signout().finally(function () {
$window.location.pathname = Settings.siteRoot;
});
};
//todo replace with breadcrumb service
$scope.$watch(function () {
return $route.current;
}, function (value) {
var breadcrumbs = [$t('common.admin')];
if (value && value.$$route && value.$$route.label) {
breadcrumbs.push(value.$$route.label);
}
$scope.breadcrumbs = breadcrumbs;
});
$scope.ambariVersion = null;
$rootScope.supports = {};
$rootScope.authDataLoad = $q.defer();
Utility.getUserPref('user-pref-' + Auth.getCurrentUser() + '-supports').then(function (data) {
$rootScope.supports = data.data ? data.data : {};
});
$http.get(Settings.baseUrl + '/users/' + Auth.getCurrentUser() + '/authorizations?fields=*')
.then(function (data) {
var auth = !!data.data && !!data.data.items ? data.data.items.map(function (a) {
return a.AuthorizationInfo.authorization_id;
}) : [],
canPersistData = auth.indexOf('CLUSTER.MANAGE_USER_PERSISTED_DATA') > -1;
$rootScope.authDataLoad.resolve(canPersistData);
if (auth.indexOf('AMBARI.RENAME_CLUSTER') == -1) {
$window.location = $rootScope.fromSiteRoot("/#/main/dashboard");
}
});
$scope.about = function () {
var ambariVersion = $scope.ambariVersion;
var modalInstance = $modal.open({
templateUrl: 'views/modals/AboutModal.html',
controller: ['$scope', function ($scope) {
$scope.ok = function () {
modalInstance.close();
};
$scope.ambariVersion = ambariVersion;
}]
});
};
$scope.currentUser = Auth.getCurrentUser();
$scope.cluster = null;
$scope.isLoaded = null;
function loadAmbariVersion() {
Cluster.getAmbariVersion().then(function (version) {
$scope.ambariVersion = version;
});
}
function loadClusterData() {
Cluster.getStatus().then(function (cluster) {
$rootScope.cluster = cluster;
$scope.cluster = cluster;
$scope.isLoaded = true;
if (cluster && cluster.Clusters.provisioning_state === 'INIT') {
setTimeout(loadClusterData, 1000);
}
}).catch(function (data) {
Alert.error($t('common.alerts.cannotLoadClusterStatus'), data.statusText);
});
}
loadClusterData();
loadAmbariVersion();
$scope.startInactiveTimeoutMonitoring = function (timeout) {
var TIME_OUT = timeout;
var active = true;
var lastActiveTime = Date.now();
var keepActive = function () {
if (active) {
lastActiveTime = Date.now();
}
};
$(window).bind('mousemove', keepActive);
$(window).bind('keypress', keepActive);
$(window).bind('click', keepActive);
var checkActiveness = function () {
var remainTime = TIME_OUT - (Date.now() - lastActiveTime);
if (remainTime < 0) {
active = false;
$(window).unbind('mousemove', keepActive);
$(window).unbind('keypress', keepActive);
$(window).unbind('click', keepActive);
clearInterval($rootScope.userActivityTimeoutInterval);
$scope.signOut();
} else if (remainTime < 60000 && !$rootScope.timeoutModal) {
$rootScope.timeoutModal = $modal.open({
templateUrl: 'views/modals/TimeoutWarning.html',
backdrop: false,
controller: ['$scope', 'Auth', function ($scope, Auth) {
$scope.remainTime = 60;
$scope.title = $t('main.autoLogOut');
$scope.primaryText = $t('main.controls.remainLoggedIn');
$scope.secondaryText = $t('main.controls.logOut');
$scope.remain = function () {
$rootScope.timeoutModal.close();
delete $rootScope.timeoutModal;
};
$scope.logout = function () {
$rootScope.timeoutModal.close();
delete $rootScope.timeoutModal;
Auth.signout().finally(function () {
$window.location.pathname = Settings.siteRoot;
});
};
$scope.countDown = function () {
$scope.remainTime--;
$scope.$apply();
if ($scope.remainTime == 0) {
Auth.signout().finally(function () {
$window.location.pathname = Settings.siteRoot;
});
}
};
setInterval($scope.countDown, 1000);
}]
});
}
};
$rootScope.userActivityTimeoutInterval = window.setInterval(checkActiveness, 1000);
};
// Send noop requests every 10 seconds just to keep backend session alive
$scope.startNoopPolling = function () {
$rootScope.noopPollingInterval = setInterval(Cluster.getAmbariTimeout, 10000);
};
if (!$rootScope.userActivityTimeoutInterval) {
Cluster.getAmbariTimeout().then(function (timeout) {
$rootScope.userTimeout = Number(timeout) * 1000;
if ($rootScope.userTimeout > 0)
$scope.startInactiveTimeoutMonitoring($rootScope.userTimeout);
});
}
if (!$rootScope.noopPollingInterval) {
$scope.startNoopPolling();
}
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('SideNavCtrl', ['$scope', '$location', 'ROUTES', '$rootScope', 'Stack', 'Settings', function($scope, $location, ROUTES, $rootScope, Stack, Settings) {
$scope.totalRepos = 0;
$scope.settings = Settings;
$scope.$watch(function() {
return $rootScope.cluster;
}, function() {
$scope.cluster = $rootScope.cluster;
}, true);
function loadRepos() {
Stack.allRepos().then(function (repos) {
$scope.totalRepos = repos.itemTotal;
});
}
function initNavigationBar () {
$('body').on('DOMNodeInserted', '.navigation-bar', function() {
$('.navigation-bar').navigationBar({
fitHeight: true,
collapseNavBarClass: 'fa-angle-double-left',
expandNavBarClass: 'fa-angle-double-right'
});
//initTooltips();
$('body').off('DOMNodeInserted', '.navigation-bar');
});
}
function initTooltips () {
$('[rel="tooltip"]').tooltip();
}
initNavigationBar();
loadRepos();
$scope.isActive = function(path) {
var route = ROUTES;
angular.forEach(path.split('.'), function(routeObj) {
route = route[routeObj];
});
var r = new RegExp( route.url.replace(/(:\w+)/, '\\w+'));
return r.test($location.path());
};
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('CreateViewInstanceCtrl',
['$scope', 'View','RemoteCluster' , 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate', '$modalInstance', 'views', 'instanceClone', '$q',
function($scope, View, RemoteCluster, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate, $modalInstance, views, instanceClone, $q) {
var $t = $translate.instant;
var viewToVersionMap = {};
var instances = {};
$scope.form = {};
$scope.nameValidationPattern = /^\s*\w*\s*$/;
$scope.isLoading = false;
$scope.clusterType = 'LOCAL_AMBARI'; // LOCAL_AMBARI, REMOTE_AMBARI, NONE
$scope.views = views;
$scope.instanceClone = instanceClone;
$scope.viewOptions = [];
$scope.versionOptions = [];
$scope.localClusters = [];
$scope.remoteClusters = [];
$scope.clusterOptions = [];
$scope.fieldsWithErrors = [];
$scope.isInstanceExists = false;
$scope.clusterConfigurable = false;
$scope.clusterSettingsCount = 0;
$scope.nonClusterSettingsCount = 0;
$scope.instanceTemplate = null;
$scope.formData = {
view: null,
version: null,
instanceName: '',
displayName: '',
description: '',
clusterName: null,
visible: true,
settings: []
};
$scope.updateVersionOptions = function () {
if (viewToVersionMap[$scope.formData.view.value]) {
$scope.versionOptions = viewToVersionMap[$scope.formData.view.value];
$scope.formData.version = $scope.versionOptions[0];
$scope.updateSettingsList();
}
};
$scope.updateSettingsList = function() {
$scope.formData.settings = [];
$scope.clusterSettingsCount = 0;
$scope.nonClusterSettingsCount = 0;
$scope.instanceTemplate = null;
angular.forEach($scope.views, function(view) {
if (view.view_name === $scope.formData.view.value) {
angular.forEach(view.versionsList, function(version) {
if (version.ViewVersionInfo.version === $scope.formData.version.value) {
$scope.formData.settings = version.ViewVersionInfo.parameters.map(function(param) {
param.value = param['defaultValue'];
param.clusterConfig = Boolean(param.clusterConfig);
param.displayName = param.name.replace(/\./g, '\.\u200B');
$scope.clusterSettingsCount += param.clusterConfig;
$scope.nonClusterSettingsCount += !param.clusterConfig;
return param;
});
$scope.clusterConfigurable = version.ViewVersionInfo.cluster_configurable;
}
});
}
});
};
$scope.switchClusterType = function(clusterType) {
$scope.clusterType = clusterType;
if (clusterType === 'LOCAL_AMBARI') {
$scope.clusterOptions = $scope.localClusters;
resetErrors();
} else if (clusterType === 'REMOTE_AMBARI') {
$scope.clusterOptions = $scope.remoteClusters;
resetErrors();
} else {
$scope.clusterOptions = [];
}
$scope.formData.clusterName = $scope.clusterOptions[0];
};
$scope.save = function () {
var instanceName = $scope.form.instanceCreateForm.instanceName.$viewValue;
$scope.form.instanceCreateForm.submitted = true;
if ($scope.form.instanceCreateForm.$valid) {
View.createInstance({
instance_name: instanceName,
label: $scope.form.instanceCreateForm.displayName.$viewValue,
visible: $scope.form.instanceCreateForm.visible.$viewValue,
icon_path: '',
icon64_path: '',
description: $scope.form.instanceCreateForm.description.$viewValue,
view_name: $scope.form.instanceCreateForm.view.$viewValue.value,
version: $scope.form.instanceCreateForm.version.$viewValue.value,
properties: $scope.formData.settings,
clusterId: $scope.formData.clusterName ? $scope.formData.clusterName.id : null,
clusterType: $scope.clusterType
})
.then(function () {
$modalInstance.dismiss('created');
Alert.success($t('views.alerts.instanceCreated', {instanceName: instanceName}));
$location.path('/views/' + $scope.form.instanceCreateForm.view.$viewValue.value +
'/versions/' + $scope.form.instanceCreateForm.version.$viewValue.value +
'/instances/' + instanceName + '/edit');
})
.catch(function (resp) {
var errorMessage = resp.data.message;
if (data.status >= 400) {
try {
var errorObject = JSON.parse(errorMessage);
errorMessage = errorObject.detail;
angular.forEach(errorObject.propertyResults, function (item, key) {
$scope.form.instanceCreateForm[key].validationError = !item.valid;
if (!item.valid) {
$scope.form.instanceCreateForm[key].validationMessage = item.detail;
$scope.fieldsWithErrors.push(key);
}
});
} catch (e) {
console.warn(data.message, e);
}
}
Alert.error($t('views.alerts.cannotCreateInstance'), errorMessage);
});
}
};
$scope.cancel = function () {
unsavedChangesCheck();
};
$scope.checkIfInstanceExist = function() {
$scope.isInstanceExists = Boolean(instances[$scope.formData.instanceName]);
};
function resetErrors() {
$scope.fieldsWithErrors.forEach(function(field) {
$scope.form.instanceCreateForm[field].validationError = false;
$scope.form.instanceCreateForm[field].validationMessage = '';
});
$scope.fieldsWithErrors = [];
}
function initViewAndVersionSelect () {
$scope.viewOptions = [];
angular.forEach($scope.views, function(view) {
$scope.viewOptions.push({
label: view.view_name,
value: view.view_name
});
viewToVersionMap[view.view_name] = view.versionsList.map(function(version) {
angular.forEach(version.instances, function(instance) {
instances[instance.ViewInstanceInfo.instance_name] = true;
});
return {
label: version.ViewVersionInfo.version,
value: version.ViewVersionInfo.version
}
});
});
$scope.formData.view = $scope.viewOptions[0];
$scope.updateVersionOptions();
}
function loadClusters() {
return Cluster.getAllClusters().then(function (clusters) {
clusters.forEach(function (cluster) {
$scope.localClusters.push({
label: cluster.Clusters.cluster_name,
value: cluster.Clusters.cluster_name,
id: cluster.Clusters.cluster_id
});
});
});
}
function loadRemoteClusters() {
return RemoteCluster.listAll().then(function (clusters) {
clusters.forEach(function (cluster) {
$scope.remoteClusters.push({
label: cluster.ClusterInfo.name,
value: cluster.ClusterInfo.name,
id: cluster.ClusterInfo.cluster_id
});
});
});
}
function loadFormData () {
$scope.isLoading = true;
initViewAndVersionSelect();
$q.all(loadClusters(), loadRemoteClusters()).then(function() {
$scope.isLoading = false;
$scope.switchClusterType('LOCAL_AMBARI');
copyCloneInstanceInfo();
});
}
function copyCloneInstanceInfo() {
if ($scope.instanceClone) {
$scope.formData.view = $scope.viewOptions.filter(function(option) {
return option.value === $scope.instanceClone.view_name;
})[0];
$scope.updateVersionOptions();
$scope.formData.version = $scope.versionOptions.filter(function(option) {
return option.value === $scope.instanceClone.version;
})[0];
$scope.formData.instanceName = $scope.instanceClone.instance_name + $t('common.copy');
$scope.formData.displayName = $scope.instanceClone.label + $t('common.copy');
$scope.formData.description = $scope.instanceClone.description;
$scope.formData.visible = $scope.instanceClone.visible;
$scope.switchClusterType($scope.instanceClone.cluster_type);
$scope.updateSettingsList();
$scope.formData.settings.forEach(function (setting) {
if ($scope.instanceClone.properties[setting.name]) {
setting.value = $scope.instanceClone.properties[setting.name];
}
});
}
}
function unsavedChangesCheck() {
if ($scope.form.instanceCreateForm.$dirty) {
UnsavedDialog().then(function (action) {
switch (action) {
case 'save':
$scope.save();
break;
case 'discard':
$modalInstance.close('discard');
break;
case 'cancel':
break;
}
});
} else {
$modalInstance.close('discard');
}
}
loadFormData();
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('ViewUrlCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate', 'Settings', function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate, Settings) {
var $t = $translate.instant;
$scope.form = {};
$scope.constants = {
props: $t('views.properties')
};
var targetUrl = '/viewUrls';
$scope.url={};
$scope.formHolder = {};
$scope.stepOneNotCompleted = true;
$scope.stepTwoNotCompleted = true;
View.getAllVisibleInstance().then(function(views) {
var names = [];
var instances=[];
views.map(function(view){
var nameVersion = view.view_name+" {"+view.version+"}";
names.push(nameVersion);
instances.push({nameV:nameVersion,instance:view.instance_name,cname:view.view_name,version:view.version});
});
var output = [],
keys = [];
angular.forEach(names, function(item) {
var key = item;
if(keys.indexOf(key) === -1) {
keys.push(key);
output.push(item);
}
});
$scope.viewsVersions = output;
$scope.viewInstances = instances;
if($routeParams.viewName && $routeParams.viewVersion && $routeParams.viewInstanceName){
var selectedView = $routeParams.viewName+" {"+$routeParams.viewVersion+"}";
$scope.url.selectedView = selectedView;
$scope.url.selectedInstance = instances.find(function(inst){
return inst.nameV === selectedView && inst.instance === $routeParams.viewInstanceName && inst.version === $routeParams.viewVersion && inst.cname === $routeParams.viewName;
});
$scope.stepOneNotCompleted = false;
$scope.stepTwoNotCompleted = false;
}
}).catch(function(data) {
Alert.error($t('views.alerts.cannotLoadViews'), data.data.message);
});
$scope.filterByName = function(nameV){
return function (item) {
if (item.nameV === nameV)
{
return true;
}
return false;
};
};
$scope.chomp = function(viewNameVersion){
if(viewNameVersion) {
return viewNameVersion.substr(0, viewNameVersion.indexOf("{")).trim();
}
};
$scope.doStepOne = function () {
$scope.stepOneNotCompleted = false;
};
$scope.doStepTwo = function () {
$scope.stepTwoNotCompleted = false;
};
$scope.cancelForm = function () {
$scope.stepOneNotCompleted = true;
$scope.stepTwoNotCompleted = true;
};
$scope.saveUrl = function() {
$scope.formHolder.form.submitted = true;
if($scope.formHolder.form.$valid){
var payload = {ViewUrlInfo:{
url_name:$scope.url.urlName,
url_suffix:$scope.url.suffix,
view_instance_version:$scope.url.selectedInstance.version,
view_instance_name:$scope.url.selectedInstance.instance,
view_instance_common_name:$scope.url.selectedInstance.cname
}};
View.updateShortUrl(payload).then(function(urlStatus) {
Alert.success($t('urls.urlCreated', {
siteRoot: Settings.siteRoot,
viewName:$scope.url.selectedInstance.cname ,
shortUrl:$scope.url.suffix,
urlName:$scope.url.urlName
}));
$scope.formHolder.form.$setPristine();
$scope.url={};
$scope.formHolder = {};
$scope.stepOneNotCompleted = true;
$scope.stepTwoNotCompleted = true;
$location.path(targetUrl);
}).catch(function(resp) {
Alert.error($t('views.alerts.cannotLoadViewUrls'), resp.data.message);
});
}
};
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('ViewUrlEditCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate','ConfirmationModal', 'Settings' ,function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate,ConfirmationModal, Settings) {
var $t = $translate.instant;
$scope.form = {};
$scope.constants = {
props: $t('views.properties')
};
var targetUrl = '/viewUrls';
function setUpEdit(){
View.getUrlInfo($routeParams.urlName).then(function(url) {
$scope.url = url.ViewUrlInfo;
$scope.nameVersion = url.ViewUrlInfo.view_instance_common_name +" {" + url.ViewUrlInfo.view_instance_version +"}"
}).catch(function(data) {
Alert.error($t('views.alerts.cannotLoadViewUrl'), data.data.message);
});
}
setUpEdit();
$scope.updateUrl = function() {
$scope.url_form.submitted = true;
if($scope.url_form.$valid){
var payload = {ViewUrlInfo:{
url_name:$scope.url.url_name,
url_suffix:$scope.url.url_suffix,
view_instance_version:'',
view_instance_name:'',
view_instance_common_name:''
}};
View.editShortUrl(payload).then(function(urlStatus) {
Alert.success($t('urls.urlUpdated', {
siteRoot: Settings.siteRoot,
viewName:$scope.url.view_instance_common_name ,
shortUrl:$scope.url.suffix,
urlName:$scope.url.url_name
}));
$scope.url_form.$setPristine();
$location.path(targetUrl);
}).catch(function(resp) {
Alert.error($t('views.alerts.cannotLoadViewUrls'), resp.data.message);
});
}
};
$scope.deleteUrl = function() {
ConfirmationModal.show(
$t('common.delete', {
term: $t('urls.url')
}),
$t('common.deleteConfirmation', {
instanceType: $t('urls.url').toLowerCase(),
instanceName: '"' + $scope.url.url_name + '"'
})
).then(function() {
View.deleteUrl($scope.url.url_name).then(function() {
$location.path(targetUrl);
});
});
};
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('ViewsListCtrl',
['$scope', 'View','$modal', 'Alert', 'ConfirmationModal', '$translate', 'Settings', 'Pagination', 'Filters',
function($scope, View, $modal, Alert, ConfirmationModal, $translate, Settings, Pagination, Filters) {
var $t = $translate.instant;
var VIEWS_VERSION_STATUS_TIMEOUT = 5000;
$scope.isLoading = false;
$scope.minInstanceForPagination = Settings.minRowsToShowPagination;
$scope.filters = [
{
key: 'short_url_name',
label: $t('common.name'),
options: []
},
{
key: 'url',
label: $t('urls.url'),
customValueConverter: function(item) {
return '/main/view/' + item.view_name + '/' + item.short_url;
},
options: []
},
{
key: 'view_name',
label: $t('views.table.viewType'),
options: []
},
{
key: 'instance_name',
label: $t('urls.viewInstance'),
options: []
}
];
$scope.views = [];
$scope.instances = [];
$scope.tableInfo = {
filtered: 0,
showed: 0,
total: 0
};
$scope.pagination = Pagination.create();
$scope.resetPagination = function() {
$scope.pagination.resetPagination($scope.instances, $scope.tableInfo);
};
$scope.pageChanged = function() {
$scope.pagination.pageChanged($scope.instances, $scope.tableInfo);
};
$scope.filterInstances = function(appliedFilters) {
$scope.tableInfo.filtered = Filters.filterItems(appliedFilters, $scope.instances, $scope.filters);
$scope.pagination.resetPagination($scope.instances, $scope.tableInfo);
};
$scope.toggleSearchBox = function() {
$('.search-box-button .popup-arrow-up, .search-box-row').toggleClass('hide');
};
$scope.cloneInstance = function(instanceClone) {
$scope.createInstance(instanceClone);
};
$scope.createInstance = function (instanceClone) {
var modalInstance = $modal.open({
templateUrl: 'views/ambariViews/modals/create.html',
controller: 'CreateViewInstanceCtrl',
resolve: {
views: function() {
return $scope.views;
},
instanceClone: function() {
return instanceClone;
}
},
backdrop: 'static'
});
modalInstance.result.then(loadViews);
};
$scope.deleteInstance = function (instance) {
ConfirmationModal.show(
$t('common.delete', {
term: $t('views.viewInstance')
}),
$t('common.deleteConfirmation', {
instanceType: $t('views.viewInstance'),
instanceName: instance.label
}),
null,
null,
{
primaryClass: 'btn-danger'
}
).then(function () {
View.deleteInstance(instance.view_name, instance.version, instance.instance_name)
.then(function () {
loadViews();
})
.catch(function (data) {
Alert.error($t('views.alerts.cannotDeleteInstance'), data.data.message);
});
});
};
loadViews();
function checkViewVersionStatus(view, versionObj, versionNumber) {
var deferred = View.checkViewVersionStatus(view.view_name, versionNumber);
deferred.promise.then(function (status) {
if (versionNeedStatusUpdate(status)) {
setTimeout(function() {
checkViewVersionStatus(view, versionObj, versionNumber);
}, VIEWS_VERSION_STATUS_TIMEOUT);
} else {
versionObj.status = status;
angular.forEach(view.versions, function (version) {
if (version.status === 'DEPLOYED') {
view.canCreateInstance = true;
}
})
}
});
}
function versionNeedStatusUpdate(status) {
return status !== 'DEPLOYED' && status !== 'ERROR';
}
function loadViews() {
$scope.isLoading = true;
View.all().then(function (views) {
$scope.isLoading = false;
$scope.views = views;
$scope.instances = [];
angular.forEach(views, function (view) {
angular.forEach(view.versions, function (versionObj, versionNumber) {
if (versionNeedStatusUpdate(versionObj.status)) {
checkViewVersionStatus(view, versionObj, versionNumber);
}
});
angular.forEach(view.instances, function (instance) {
instance.ViewInstanceInfo.short_url_name = instance.ViewInstanceInfo.short_url_name || '';
instance.ViewInstanceInfo.short_url = instance.ViewInstanceInfo.short_url || '';
instance.ViewInstanceInfo.versionObj = view.versions[instance.ViewInstanceInfo.version] || {};
$scope.instances.push(instance.ViewInstanceInfo);
});
});
$scope.tableInfo.total = $scope.instances.length;
Filters.initFilterOptions($scope.filters, $scope.instances);
$scope.filterInstances();
}).catch(function (data) {
Alert.error($t('views.alerts.cannotLoadViews'), data.data.message);
});
}
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('AuthenticationMainCtrl', ['$scope', '$translate', 'Alert', 'Settings', function ($scope, $translate, $Alert, Settings) {
$scope.t = $translate.instant;
$scope.settings = Settings;
$scope.isLDAPEnabled = false;
$scope.connectivity = {
trustStore: 'default',
trustStoreOptions: ['default', 'custom'],
trustStoreType: 'jks',
trustStoreTypeOptions: ['jks', 'jceks', 'pkcs12']
};
$scope.attributes = {
detection: 'auto'
};
$scope.isConnectivityFormInvalid = true;
$scope.isAutoDetectFormInvalid = true;
$scope.isAttributesFormInvalid = true;
$scope.isTestAttributesFormInvalid = false;
$scope.isRequestRunning = false;
$scope.isConnectionTestRunning = false;
$scope.isConnectionTestComplete = false;
$scope.hasConnectionTestPassed = false;
$scope.isAttributeDetectionRunning = false;
$scope.isAttributeDetectionComplete = false;
$scope.isAttributeDetectionSuccessful = false;
$scope.isTestAttributesRunning = false;
$scope.isTestAttributesComplete = false;
$scope.isTestAttributesSuccessful = false;
$scope.isSaving = false;
$scope.isSavingComplete = false;
$scope.isSavingSuccessful = false;
$scope.isTestAttributesFormShown = false;
$scope.toggleAuthentication = function () {
$scope.isConnectionTestRunning = false;
$scope.isConnectionTestComplete = false;
$scope.hasConnectionTestPassed = false;
};
$scope.testConnection = function () {
$scope.isConnectionTestRunning = true;
$scope.isConnectionTestComplete = false;
$scope.isAttributeDetectionRunning = false;
$scope.isAttributeDetectionComplete = false;
$scope.isAttributeDetectionSuccessful = false;
// TODO replace mock with test connection request when API is available
setTimeout(function (prevValue) {
$scope.isConnectionTestRunning = false;
$scope.isConnectionTestComplete = true;
$scope.hasConnectionTestPassed = !prevValue;
}, 1000, $scope.hasConnectionTestPassed);
$scope.hasConnectionTestPassed = false;
};
$scope.detectAttributes = function () {
$scope.isAttributeDetectionRunning = true;
$scope.isAttributeDetectionComplete = false;
// TODO replace mock with attributes detection request when API is available
setTimeout(function (prevValue) {
$scope.isAttributeDetectionRunning = false;
$scope.isAttributeDetectionComplete = true;
$scope.isAttributeDetectionSuccessful = !prevValue;
if ($scope.isAttributeDetectionSuccessful) {
var form = $scope.attributes;
form.userObjClass = 'person';
form.userNameAttr = 'sAMAccountName';
form.groupObjClass = 'group';
form.groupNameAttr = 'cn';
form.groupMemberAttr = 'member';
form.distinguishedNameAttr = 'distinguishedName';
}
}, 1000, $scope.isAttributeDetectionSuccessful);
$scope.isAttributeDetectionSuccessful = false;
};
$scope.showTestAttributesForm = function () {
$scope.isTestAttributesFormShown = true;
};
$scope.testAttributes = function () {
$scope.isTestAttributesRunning = true;
$scope.isTestAttributesComplete = false;
// TODO replace mock with test attributes request when API is available
setTimeout(function (prevValue) {
$scope.isTestAttributesRunning = false;
$scope.isTestAttributesComplete = true;
$scope.isTestAttributesSuccessful = !prevValue;
if ($scope.isTestAttributesSuccessful) {
$scope.attributes.availableGroups = ['HadoopOps', 'HadoopOpsDFW', 'AmbariAdmins', 'ExchangeAdmins', 'AmbariUsers', 'ExchangeUsers'];
}
}, 1000, $scope.isTestAttributesSuccessful);
$scope.isTestAttributesSuccessful = false;
};
$scope.save = function () {
$scope.isSaving = true;
$scope.isSavingComplete = false;
// TODO replace mock with save request when API is available
setTimeout(function (prevValue) {
$scope.isSaving = false;
$scope.isSavingComplete = true;
$scope.isSavingSuccessful = !prevValue;
if ($scope.isSavingSuccessful) {
$Alert.success('Settings saved');
} else {
$Alert.error('Saving failed', '500 Error');
}
}, 1000, $scope.isSavingSuccessful);
$scope.isSavingSuccessful = false;
};
$scope.$watch('connectivity', function (form, oldForm, scope) {
scope.isConnectivityFormInvalid = !(form.host && form.port
&& (form.trustStore === 'default' || form.trustStorePath && form.trustStorePassword)
&& form.dn && form.bindPassword);
}, true);
$scope.$watch('attributes', function (form, oldForm, scope) {
scope.isAutoDetectFormInvalid = !(form.userSearch && form.groupSearch);
scope.isAttributesFormInvalid = !(form.userObjClass && form.userNameAttr && form.groupObjClass
&& form.groupNameAttr && form.groupMemberAttr && form.distinguishedNameAttr
&& (form.detection === 'auto' || form.userSearchManual && form.groupSearchManual));
scope.isTestAttributesFormInvalid = !(form.username && form.password);
}, true);
$scope.$watch('attributes.detection', function (newValue, oldValue, scope) {
scope.isTestAttributesFormShown = false;
scope.isAttributeDetectionComplete = false;
scope.isAttributeDetectionSuccessful = false;
});
$scope.$watch(function (scope) {
return scope.isConnectionTestRunning || scope.isAttributeDetectionRunning || scope.isTestAttributesRunning || scope.isSaving;
}, function (newValue, oldValue, scope) {
scope.isRequestRunning = newValue;
});
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('ClusterInformationCtrl',
['$scope', '$http', '$location', 'Cluster', '$routeParams', '$translate', '$rootScope', 'ConfirmationModal', 'Alert',
function($scope, $http, $location, Cluster, $routeParams, $translate, $rootScope, ConfirmationModal, Alert) {
var $t = $translate.instant;
$scope.isDataLoaded = false;
$scope.edit = {
clusterName: null
};
$scope.isClusterNameEdited = false;
$scope.nameValidationPattern = /^\s*\w*\s*$/;
$scope.$watch(function() {
return $rootScope.cluster;
}, function() {
$scope.cluster = $rootScope.cluster;
if ($scope.cluster) {
$scope.edit.clusterName = $scope.cluster.Clusters.cluster_name;
$scope.getBlueprint();
}
}, true);
$scope.getBlueprint = function () {
Cluster.getBlueprint({
clusterName: $scope.cluster.Clusters.cluster_name
}).then(function (data) {
console.debug($t('exportBlueprint.dataLoaded'), data);
$scope.isDataLoaded = true;
var response = JSON.stringify(data, null, 4),
lt = /&lt;/g,
gt = /&gt;/g,
ap = /&#39;/g,
ic = /&#34;/g;
$scope.blueprint = response ? response.toString().replace(lt, "<").replace(gt, ">").replace(ap, "'").replace(ic, '"') : "";
});
};
$scope.downloadBlueprint = function () {
if (window.navigator.msSaveOrOpenBlob) {
var blob = new Blob([decodeURIComponent(encodeURIComponent($scope.blueprint))], {
type: "text/csv;charset=utf-8;"
});
navigator.msSaveBlob(blob, 'blueprint.json');
} else {
var a = document.createElement('a');
a.href = 'data:attachment/json;charset=utf-8,' + encodeURIComponent($scope.blueprint);
a.target = '_blank';
a.download = 'blueprint.json';
document.body.appendChild(a);
a.click();
}
};
$scope.toggleSaveButton = function() {
var value = $scope.edit.clusterName;
$scope.isClusterNameEdited = (value !== null && $scope.cluster.Clusters.cluster_name !== value);
};
$scope.confirmClusterNameChange = function() {
ConfirmationModal.show(
$t('common.clusterNameChangeConfirmation.title'),
$t('common.clusterNameChangeConfirmation.message', {
clusterName: $scope.edit.clusterName
})
)
.then(function () {
$scope.saveClusterName();
}).catch(function () {
// user clicked cancel
$scope.edit.clusterName = $scope.cluster.Clusters.cluster_name;
$scope.toggleSaveButton();
});
};
$scope.saveClusterName = function() {
var oldClusterName = $scope.cluster.Clusters.cluster_name,
newClusterName = $scope.edit.clusterName;
Cluster.editName(oldClusterName, newClusterName).then(function() {
$scope.cluster.Clusters.cluster_name = newClusterName;
$scope.edit.clusterName = newClusterName;
$scope.toggleSaveButton();
Alert.success($t('common.alerts.clusterRenamed', {clusterName: newClusterName}));
}).catch(function(data) {
Alert.error($t('common.alerts.cannotRenameCluster', {clusterName: newClusterName}), data.data.message);
});
};
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('HomeDirectoryCtrl', ['$scope', '$location', 'UnsavedDialog', function($scope, $location, UnsavedDialog) {
$scope.TEMPLATE_PLACEHOLER = '/user/{{username}}';
$scope.autoCreate = false;
$scope.template = '';
$scope.group = '';
$scope.permissions = '';
$scope.save = function (targetUrl) {
targetUrl ? $location.path(targetUrl) : "";
}
$scope.$on('$locationChangeStart', function(event, __targetUrl) {
if( $scope.form.$dirty ){
UnsavedDialog().then(function(action) {
var targetUrl = __targetUrl.split('#').pop();
switch(action){
case 'save':
$scope.save(targetUrl);
$scope.form.$setPristine();
break;
case 'discard':
$scope.form.$setPristine();
$location.path(targetUrl);
break;
case 'cancel':
targetUrl = '/homeDirectory';
break;
}
});
event.preventDefault();
}
});
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('LoginActivitiesMainCtrl',['$scope', '$location', function($scope, $location) {
$scope.tab = $location.path().substr(1) == "loginActivities" ? "loginMessage" : $location.path().substr(1);
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.controller('UserManagementCtrl', ['$scope', '$routeParams', function($scope, $routeParams) {
$scope.activeTab = $routeParams.tab === 'groups' ? 'GROUPS' : 'USERS';
}]);
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('ambariAdminConsole')
.directive('passwordVerify', function() {
return {
require: 'ngModel',
restrict: 'A',
scope: {
passwordVerify: '='
},
link: function(scope, elem, attrs, ctrl) {
scope.$watch(function() {
return (ctrl.$pristine && angular.isUndefined(ctrl.$modelValue)) || scope.passwordVerify === ctrl.$modelValue;
}, function(currentValue) {
ctrl.$setValidity('passwordVerify', currentValue);
})
}
}
});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment