Merge pull request #974 from wwitzel3/rbac

RBAC Testing Fixes
This commit is contained in:
Wayne Witzel III 2016-02-19 16:39:28 -05:00
commit dcb378fff9
31 changed files with 390 additions and 163 deletions

View File

@ -798,7 +798,7 @@ docker-compose-test:
MACHINE?=default
docker-refresh:
rm -f awx/lib/.deps_built
rm -f awx/lib/.deps_built awx/lib/site-packages
eval $$(docker-machine env $(MACHINE))
docker stop $$(docker ps -a -q)
docker rm $$(docker ps -f name=tools_tower -a -q)

View File

@ -953,6 +953,7 @@ class InventorySerializer(BaseSerializerWithVariables):
tree = reverse('api:inventory_tree_view', args=(obj.pk,)),
inventory_sources = reverse('api:inventory_inventory_sources_list', args=(obj.pk,)),
activity_stream = reverse('api:inventory_activity_stream_list', args=(obj.pk,)),
job_templates = reverse('api:inventory_job_template_list', args=(obj.pk,)),
scan_job_templates = reverse('api:inventory_scan_job_template_list', args=(obj.pk,)),
ad_hoc_commands = reverse('api:inventory_ad_hoc_commands_list', args=(obj.pk,)),
#single_fact = reverse('api:inventory_single_fact_view', args=(obj.pk,)),

View File

@ -73,6 +73,7 @@ inventory_urls = patterns('awx.api.views',
url(r'^(?P<pk>[0-9]+)/tree/$', 'inventory_tree_view'),
url(r'^(?P<pk>[0-9]+)/inventory_sources/$', 'inventory_inventory_sources_list'),
url(r'^(?P<pk>[0-9]+)/activity_stream/$', 'inventory_activity_stream_list'),
url(r'^(?P<pk>[0-9]+)/job_templates/$', 'inventory_job_template_list'),
url(r'^(?P<pk>[0-9]+)/scan_job_templates/$', 'inventory_scan_job_template_list'),
url(r'^(?P<pk>[0-9]+)/ad_hoc_commands/$', 'inventory_ad_hoc_commands_list'),
#url(r'^(?P<pk>[0-9]+)/single_fact/$', 'inventory_single_fact_view'),

View File

@ -1111,6 +1111,20 @@ class InventoryActivityStreamList(SubListAPIView):
qs = self.request.user.get_queryset(self.model)
return qs.filter(Q(inventory=parent) | Q(host__in=parent.hosts.all()) | Q(group__in=parent.groups.all()))
class InventoryJobTemplateList(SubListAPIView):
model = JobTemplate
serializer_class = JobTemplateSerializer
parent_model = Inventory
relationship = 'jobtemplates'
new_in_300 = True
def get_queryset(self):
parent = self.get_parent_object()
self.check_parent_access(parent)
qs = self.request.user.get_queryset(self.model)
return qs.filter(inventory=parent)
class InventoryScanJobTemplateList(SubListAPIView):
model = JobTemplate

View File

@ -63,7 +63,7 @@ class ResourceFieldDescriptor(ReverseSingleRelatedObjectDescriptor):
resource = super(ResourceFieldDescriptor, self).__get__(instance, instance_type)
if resource:
return resource
resource = Resource._default_manager.create(content_object=instance)
resource = Resource.objects.create(content_object=instance)
setattr(instance, self.field.name, resource)
instance.save(update_fields=[self.field.name,])
return resource
@ -85,7 +85,8 @@ class ImplicitResourceField(models.ForeignKey):
def _save(self, instance, *args, **kwargs):
# Ensure that our field gets initialized after our first save
getattr(instance, self.name)
if not hasattr(instance, self.name):
getattr(instance, self.name)
class ImplicitRoleDescriptor(ReverseSingleRelatedObjectDescriptor):
@ -106,7 +107,7 @@ class ImplicitRoleDescriptor(ReverseSingleRelatedObjectDescriptor):
if not self.role_name:
raise FieldError('Implicit role missing `role_name`')
role = Role._default_manager.create(name=self.role_name, content_object=instance)
role = Role.objects.create(name=self.role_name, content_object=instance)
if self.parent_role:
def resolve_field(obj, field):
ret = []
@ -257,4 +258,5 @@ class ImplicitRoleField(models.ForeignKey):
def _save(self, instance, *args, **kwargs):
# Ensure that our field gets initialized after our first save
getattr(instance, self.name)
if not hasattr(instance, self.name):
getattr(instance, self.name)

View File

@ -130,3 +130,8 @@ def get():
middleware.process_response(request, response)
return response
return rf
@pytest.fixture(scope="session", autouse=True)
def celery_memory_broker():
from django.conf import settings
settings.BROKER_URL='memory://localhost/'

View File

@ -80,9 +80,10 @@ def test_credential_access_admin(user, organization, team, credential):
# unowned credential can be deleted
assert access.can_delete(credential)
credential.created_by = u
credential.save()
team.users.add(u)
assert not access.can_change(credential, {'user': u.pk})
team.users.add(u)
credential.team = team
credential.save()
assert access.can_change(credential, {'user': u.pk})

View File

@ -1,9 +1,15 @@
import mock
import pytest
from awx.main.access import (
BaseAccess,
JobTemplateAccess,
)
from awx.main.migrations import _rbac as rbac
from awx.main.models import Permission
from django.apps import apps
@pytest.mark.django_db
def test_job_template_migration_check(deploy_jobtemplate, check_jobtemplate, user):
admin = user('admin', is_superuser=True)
@ -131,3 +137,15 @@ def test_job_template_team_deploy_migration(deploy_jobtemplate, check_jobtemplat
assert check_jobtemplate.accessible_by(admin, {'execute': True}) is True
assert check_jobtemplate.accessible_by(joe, {'execute': True}) is True
@mock.patch.object(BaseAccess, 'check_license', return_value=None)
@pytest.mark.django_db
def test_job_template_access_superuser(check_license, user, deploy_jobtemplate):
# GIVEN a superuser
u = user('admin', True)
# WHEN access to a job template is checked
access = JobTemplateAccess(u)
# THEN all access checks should pass
assert access.can_read(deploy_jobtemplate)
assert access.can_add({})

View File

@ -1,7 +1,11 @@
import mock
import pytest
from awx.main.migrations import _rbac as rbac
from awx.main.access import OrganizationAccess
from awx.main.access import (
BaseAccess,
OrganizationAccess,
)
from django.apps import apps
@ -29,8 +33,10 @@ def test_organization_migration_user(organization, permissions, user):
assert len(migrations) == 1
assert organization.accessible_by(u, permissions['auditor'])
@mock.patch.object(BaseAccess, 'check_license', return_value=None)
@pytest.mark.django_db
def test_organization_access_superuser(organization, user):
def test_organization_access_superuser(cl, organization, user):
access = OrganizationAccess(user('admin', True))
organization.users.add(user('user', False))
@ -42,8 +48,9 @@ def test_organization_access_superuser(organization, user):
assert len(org.users.all()) == 1
@mock.patch.object(BaseAccess, 'check_license', return_value=None)
@pytest.mark.django_db
def test_organization_access_admin(organization, user):
def test_organization_access_admin(cl, organization, user):
'''can_change because I am an admin of that org'''
a = user('admin', False)
organization.admins.add(a)
@ -57,8 +64,10 @@ def test_organization_access_admin(organization, user):
assert len(org.admins.all()) == 1
assert len(org.users.all()) == 1
@mock.patch.object(BaseAccess, 'check_license', return_value=None)
@pytest.mark.django_db
def test_organization_access_user(organization, user):
def test_organization_access_user(cl, organization, user):
access = OrganizationAccess(user('user', False))
organization.users.add(user('user', False))

View File

@ -1063,7 +1063,7 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest):
self.assertNotEqual(new_inv.groups.count(), 0)
self.assertNotEqual(new_inv.total_hosts, 0)
self.assertNotEqual(new_inv.total_groups, 0)
self.assertElapsedLessThan(30)
self.assertElapsedLessThan(60)
def test_splunk_inventory(self):
new_inv = self.organizations[0].inventories.create(name='splunk')
@ -1082,7 +1082,7 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest):
self.assertNotEqual(new_inv.groups.count(), 0)
self.assertNotEqual(new_inv.total_hosts, 0)
self.assertNotEqual(new_inv.total_groups, 0)
self.assertElapsedLessThan(120)
self.assertElapsedLessThan(600)
def _get_ngroups_for_nhosts(self, n):
if n > 0:
@ -1108,7 +1108,7 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest):
self.assertEqual(new_inv.hosts.filter(active=False).count(), nhosts_inactive)
self.assertEqual(new_inv.total_hosts, nhosts)
self.assertEqual(new_inv.total_groups, ngroups)
self.assertElapsedLessThan(45)
self.assertElapsedLessThan(120)
@unittest.skipIf(getattr(settings, 'LOCAL_DEVELOPMENT', False),
'Skip this test in local development environments, '

View File

@ -15,7 +15,7 @@ import yaml
__all__ = ['JobTemplateLaunchTest', 'JobTemplateLaunchPasswordsTest']
class JobTemplateLaunchTest(BaseJobTestMixin, django.test.TestCase):
class JobTemplateLaunchTest(BaseJobTestMixin, django.test.TransactionTestCase):
def setUp(self):
super(JobTemplateLaunchTest, self).setUp()
@ -178,7 +178,7 @@ class JobTemplateLaunchTest(BaseJobTestMixin, django.test.TestCase):
with self.current_user(self.user_sue):
self.post(self.launch_url, {}, expect=400)
class JobTemplateLaunchPasswordsTest(BaseJobTestMixin, django.test.TestCase):
class JobTemplateLaunchPasswordsTest(BaseJobTestMixin, django.test.TransactionTestCase):
def setUp(self):
super(JobTemplateLaunchPasswordsTest, self).setUp()

View File

@ -183,7 +183,7 @@ TEST_SURVEY_REQUIREMENTS = '''
}
'''
class JobTemplateTest(BaseJobTestMixin, django.test.TestCase):
class JobTemplateTest(BaseJobTestMixin, django.test.TransactionTestCase):
JOB_TEMPLATE_FIELDS = ('id', 'type', 'url', 'related', 'summary_fields',
'created', 'modified', 'name', 'description',
@ -492,7 +492,7 @@ class JobTemplateTest(BaseJobTestMixin, django.test.TestCase):
with self.current_user(self.user_doug):
self.get(detail_url, expect=403)
class JobTest(BaseJobTestMixin, django.test.TestCase):
class JobTest(BaseJobTestMixin, django.test.TransactionTestCase):
def test_get_job_list(self):
url = reverse('api:job_list')
@ -1068,7 +1068,7 @@ class JobTransactionTest(BaseJobTestMixin, django.test.LiveServerTestCase):
self.assertEqual(job.status, 'successful', job.result_stdout)
self.assertFalse(errors)
class JobTemplateSurveyTest(BaseJobTestMixin, django.test.TestCase):
class JobTemplateSurveyTest(BaseJobTestMixin, django.test.TransactionTestCase):
def setUp(self):
super(JobTemplateSurveyTest, self).setUp()
# TODO: Test non-enterprise license

View File

@ -43,6 +43,7 @@
@import "portal.less";
@import "text-label.less";
@import "./bootstrap-datepicker.less";
@import "awx/ui/client/src/shared/branding/colors.default.less";
/* Bootstrap fix that's causing a right margin to appear
whenver a modal is opened */
@ -107,7 +108,7 @@ a:focus {
}
.btn-grey:hover {
background-color: #FFF;
background-color: @default-bg;
}
#cowsay {
@ -317,7 +318,7 @@ i:active,
#home_groups_table .actions .cancel { padding-right: 3px; }
.success-badge {
color: #ffffff;
color: @default-bg;
background-color: #5cb85c;
}
@ -630,6 +631,14 @@ dd {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 5px rgba(255, 88, 80, 0.6);
}
.form-control.ng-dirty.ng-pristine {
border-color: @default-second-border;
box-shadow: none;
}
.form-control.ng-dirty.ng-pristine:focus {
border-color: @default-link;
}
/* For some reason TB 3 RC1 does not provide an input-mini */
.input-mini {
@ -704,7 +713,7 @@ legend {
padding-bottom: 0;
}
.pagination > .active > a {
background-color: #fff;
background-color: @default-bg;
color: #428bca;
border-color: none;
border: 1px solid #428bca;
@ -937,7 +946,7 @@ input[type="checkbox"].checkbox-no-label {
.table-hover tbody tr:hover > td,
.table-hover tbody tr:hover > th {
background-color: #fff;
background-color: @default-bg;
}
.table-hover-inverse tbody tr:hover > td,
@ -1161,12 +1170,12 @@ input[type="checkbox"].checkbox-no-label {
/* Inventory job status badge */
.failures-true {
background-color: @red;
color: #fff;
color: @default-bg;
}
.failures-false {
background-color: @green;
color: #fff;
color: @default-bg;
}
/* Cloud inventory status. i.e. inventory_source.status values */
@ -1349,8 +1358,8 @@ input[type="checkbox"].checkbox-no-label {
}
.free-button {
background-color: #ff5850;
border: 1px solid #ff5850;
background-color: @default-err;
border: 1px solid @default-err;
color: @white;
}
.free-button:hover {
@ -1939,20 +1948,20 @@ button.dropdown-toggle,
}
.tooltip.bottom .tooltip-arrow {
border-bottom-color: #848992;
border-bottom-color: @default-interface-txt;
}
.tooltip.top .tooltip-arrow {
border-top-color: #848992;
border-top-color: @default-interface-txt;
}
.tooltip.left .tooltip-arrow {
border-left-color: #848992;
border-left-color: @default-interface-txt;
}
.tooltip.right .tooltip-arrow {
border-right-color: #848992;
border-right-color: @default-interface-txt;
}
.tooltip.Tooltip.fade.bottom.in {
@ -1965,7 +1974,7 @@ button.dropdown-toggle,
}
.tooltip-inner {
background-color: #848992;
background-color: @default-interface-txt;
}
.tooltip-inner--logOut {
@ -1986,9 +1995,9 @@ button.dropdown-toggle,
}
.form-control {
border-color: #e1e1e1;
border-color: @default-second-border;
background-color: #f6f6f6;
color: #161b1f;
color: @default-data-txt;
transition: border-color 0.3s;
box-shadow: none;
}
@ -2018,3 +2027,11 @@ button.dropdown-toggle,
.list-actions button, .list-actions .checkbox-inline {
margin-top: 10px;
}
.select2-container--disabled,.select2-container--disabled .select2-selection--single{
cursor: not-allowed !important;
}
.select2-container--disabled {
opacity: .35;
}

View File

@ -191,8 +191,13 @@
cursor: pointer!important;
}
.Form-inputButton {
border-color: @default-second-border;
color: @default-data-txt;
}
.Form-numberInputButton{
color: @field-label!important;
color: @default-icon!important;
font-size: 14px;
}

View File

@ -108,6 +108,8 @@ angular.module('AngularScheduler', ['underscore'])
scope.schedulerEnd = scope.endOptions[0];
}
scope.sheduler_frequency_error = false;
scope.$emit("updateSchedulerSelects");
};
scope.showCalendar = function(fld) {
@ -994,7 +996,11 @@ angular.module('AngularScheduler', ['underscore'])
.filter('schZeroPad', [ function() {
return function (n, pad) {
var str = (Math.pow(10,pad) + '').replace(/^1/,'') + (n + '').trim();
return str.substr(str.length - pad);
if (str.substr(str.length - pad) === 'll') {
return undefined;
} else {
return str.substr(str.length - pad);
}
};
}])
@ -1050,6 +1056,10 @@ angular.module('AngularScheduler', ['underscore'])
return {
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
if (element.attr("ng-model").indexOf("$parent") > -1) {
scope = scope.$parent;
attr.ngModel = attr.ngModel.split("$parent.")[1];
}
// Add jquerui spinner to 'spinner' type input
var form = attr.schSpinner,
zeroPad = attr.zeroPad,
@ -1074,16 +1084,25 @@ angular.module('AngularScheduler', ['underscore'])
});
}, 100);
},
icons: {
down: "Form-numberInputButton fa fa-angle-down",
up: "Form-numberInputButton fa fa-angle-up"
},
spin: function() {
scope[form].$setDirty();
ctrl.$dirty = true;
ctrl.$pristine = false;
if (scope[form][attr.ngModel]) {
scope[form][attr.ngModel].$setDirty();
scope[form][attr.ngModel].$dirty = true;
scope[form][attr.ngModel].$pristine = false;
}
if (!scope.$$phase) {
scope.$digest();
}
}
});
$('.ui-icon').text('');
$(".ui-icon").removeClass('ui-icon ui-icon-triangle-1-n ui-icon-triangle-1-s');
$(element).on("click", function () {
$(element).select();
});

View File

@ -613,6 +613,10 @@ var tower = angular.module('Tower', [
data: {
activityStreamId: 'organization_id'
},
ncyBreadcrumb: {
parent: "organizations",
label: "{{name}}"
},
resolve: {
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();

View File

@ -52,6 +52,7 @@
.BreadCrumb-item {
display: inline-block;
color: #B7B7B7;
text-transform: uppercase;
}
.BreadCrumb-item + .BreadCrumb-item:before {

View File

@ -12,13 +12,38 @@
export function OrganizationsList($stateParams, $scope, $rootScope, $location,
$log, Rest, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait,
$log, $compile, Rest, PaginateWidget, PaginateInit, SearchInit, OrganizationList, Alert, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait,
$state) {
ClearScope();
var defaultUrl = GetBasePath('organizations');
var defaultUrl = GetBasePath('organizations'),
list = OrganizationList,
pageSize = $scope.orgCount;
PaginateInit({
scope: $scope,
list: list,
url: defaultUrl,
pageSize: pageSize,
});
SearchInit({
scope: $scope,
list: list,
url: defaultUrl,
});
$scope.search(list.iterator);
$scope.PaginateWidget = PaginateWidget({
iterator: list.iterator,
set: 'organizations'
});
var paginationContainer = $('#pagination-container');
paginationContainer.html($scope.PaginateWidget);
$compile(paginationContainer.contents())($scope)
var parseCardData = function (cards) {
return cards.map(function (card) {
var val = {};
@ -150,7 +175,7 @@ export function OrganizationsList($stateParams, $scope, $rootScope, $location,
}
OrganizationsList.$inject = ['$stateParams', '$scope', '$rootScope',
'$location', '$log', 'Rest', 'Alert', 'Prompt', 'ClearScope',
'$location', '$log', '$compile', 'Rest', 'PaginateWidget', 'PaginateInit', 'SearchInit', 'OrganizationList', 'Alert', 'Prompt', 'ClearScope',
'ProcessErrors', 'GetBasePath', 'Wait',
'$state'
];
@ -354,4 +379,4 @@ OrganizationsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location',
'$log', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt',
'ClearScope', 'GetBasePath', 'Wait', '$state'
];
];

View File

@ -55,9 +55,9 @@ export default
}])
.factory('EditSchedule', ['SchedulerInit', 'ShowSchedulerModal', 'Wait',
'Rest', 'ProcessErrors', 'GetBasePath', 'SchedulePost',
'Rest', 'ProcessErrors', 'GetBasePath', 'SchedulePost', '$state',
function(SchedulerInit, ShowSchedulerModal, Wait, Rest, ProcessErrors,
GetBasePath, SchedulePost) {
GetBasePath, SchedulePost, $state) {
return function(params) {
var scope = params.scope,
id = params.id,
@ -171,6 +171,7 @@ export default
if (callback) {
scope.$emit(callback, data);
}
$state.go("^");
});
scope.saveSchedule = function() {
@ -208,8 +209,8 @@ export default
}])
.factory('AddSchedule', ['$location', '$stateParams', 'SchedulerInit', 'ShowSchedulerModal', 'Wait', 'GetBasePath', 'Empty',
'SchedulePost',
function($location, $stateParams, SchedulerInit, ShowSchedulerModal, Wait, GetBasePath, Empty, SchedulePost) {
'SchedulePost', '$state',
function($location, $stateParams, SchedulerInit, ShowSchedulerModal, Wait, GetBasePath, Empty, SchedulePost, $state) {
return function(params) {
var scope = params.scope,
callback= params.callback,
@ -280,6 +281,7 @@ export default
if (callback) {
scope.$emit(callback, data);
}
$state.go("^");
});
scope.saveSchedule = function() {

View File

@ -57,4 +57,6 @@
</div>
</div>
</div>
</div>
<div id="pagination-container" ng-hide="organization_num_pages < 2">
</div>
</div>

View File

@ -1,9 +1,11 @@
/** @define RepeatFrequencyOptions */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.RepeatFrequencyOptions {
width: ~"calc(100% + 21px)";
padding: 20px;
border-left: 5px solid #e8e8e8;
border-left: 5px solid @default-border;
margin-left: -20px;
padding-left: 17px;
padding-right: 0px;
@ -60,10 +62,10 @@
margin-top: -2px;
text-transform: uppercase;
font-weight: bold;
color: #848992;
color: @default-interface-txt;
font-size: 13px;
margin-left: -20px;
border-left: 5px solid #e8e8e8;
border-left: 5px solid @default-border;
padding-left: 15px;
padding-bottom: 15px;
}
@ -94,7 +96,7 @@
.RepeatFrequencyOptions-inlineLabel {
font-weight: normal;
color: #848992;
color: @default-interface-txt;
text-transform: uppercase;
flex: initial;
width: 54px;
@ -115,14 +117,15 @@
margin-top: 2px;
}
.RepeatFrequencyOptions-spacedSelect {
.RepeatFrequencyOptions-spacedSelect,
.RepeatFrequencyOptions-spacedSelect ~ .select2 {
margin-bottom: 10px;
}
.RepeatFrequencyOptions-subFormBorderFixer {
height: 25px;
width: 5px;
background: #ffffff;
background: @default-bg;
margin-left: -20px;
margin-top: -25px;
margin-right: 50px;
@ -137,3 +140,25 @@
flex: initial;
width: 100%;
}
.RepeatFrequencyOptions-nameBorderErrorFix {
border-color: @default-err !important;
}
.RepeatFrequencyOptions-inputGroup {
display: flex;
justify-content: space-between;
}
.RepeatFrequencyOptions-inputGroup--thirds > .select2 {
width: ~"calc(33% - 3px)" !important;
}
.RepeatFrequencyOptions-inputGroup--halves > .select2 {
width: ~"calc(50% - 3px)" !important;
}
.RepeatFrequencyOptions-inputGroup--halvesWithNumber > .select2 {
width: ~"calc(50% - 3px)" !important;
margin-right: 7px;
}

View File

@ -1,19 +1,21 @@
/** @define ScheduleToggle */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.ScheduleToggle {
border-radius: 5px;
border: 1px solid #b7b7b7;
background-color: #b7b7b7;
border: 1px solid @default-icon;
background-color: @default-icon;
width: 40px;
margin-top: 2px;
cursor: pointer;
}
.ScheduleToggle-switch {
color: #848992;
background-color: #fff;
color: @default-interface-txt;
background-color: @default-bg;
margin-left: 4px;
border-left: 1px solid #b7b7b7;
border-left: 1px solid @default-icon;
margin-right: 0px;
text-align: center;
text-transform: uppercase;
@ -30,8 +32,8 @@
.ScheduleToggle-switch.is-on {
margin-right: 5px;
margin-left: 0px;
background-color: #1678c4;
color: #fff;
background-color: @default-link;
color: @default-bg;
border-left: 0;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
@ -40,13 +42,13 @@
}
.ScheduleToggle-switch:hover {
background-color: #fafafa;
background-color: @default-tertiary-bg;
}
.ScheduleToggle.is-on:hover {
border-color: #4498DA;
border-color: @default-link-hov;
}
.ScheduleToggle-switch.is-on:hover {
background-color: #4498DA;
background-color: @default-link-hov;
}

View File

@ -1,4 +1,4 @@
export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$scope', '$rootScope', function($compile, $state, $stateParams, AddSchedule, Wait, $scope, $rootScope) {
export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$scope', '$rootScope', 'CreateSelect2', function($compile, $state, $stateParams, AddSchedule, Wait, $scope, $rootScope, CreateSelect2) {
$scope.$on("ScheduleFormCreated", function(e, scope) {
$scope.hideForm = false;
$scope = angular.extend($scope, scope);
@ -43,10 +43,23 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
$scope.formCancel = function() {
$state.go("^");
}
};
AddSchedule({
scope: $scope,
callback: 'SchedulesRefresh'
});
var callSelect2 = function() {
CreateSelect2({
element: '.MakeSelect2',
multiple: false
});
};
$scope.$on("updateSchedulerSelects", function() {
callSelect2();
});
callSelect2();
}];

View File

@ -1,4 +1,4 @@
export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$scope', '$rootScope', function($compile, $state, $stateParams, EditSchedule, Wait, $scope, $rootScope) {
export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$scope', '$rootScope', 'CreateSelect2', function($compile, $state, $stateParams, EditSchedule, Wait, $scope, $rootScope, CreateSelect2) {
$scope.$on("ScheduleFormCreated", function(e, scope) {
$scope.hideForm = false;
$scope = angular.extend($scope, scope);
@ -53,4 +53,17 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
id: parseInt($stateParams.schedule_id),
callback: 'SchedulesRefresh'
});
var callSelect2 = function() {
CreateSelect2({
element: '.MakeSelect2',
multiple: false
});
};
$scope.$on("updateSchedulerSelects", function() {
callSelect2();
});
callSelect2();
}];

View File

@ -1,5 +1,7 @@
/** @define SchedulerForm */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.SchedulerForm-formGroup {
padding-right: 0px;
}

View File

@ -12,7 +12,7 @@
<form class="form Form"
role="form"
name="scheduler_form"
name="scheduler_form_new"
novalidate>
<div class="form-group SchedulerForm-formGroup">
@ -22,13 +22,15 @@
</label>
<input
type="text"
class="form-control input-sm"
class="form-control input-sm
Form-textInput"
ng-class="{'RepeatFrequencyOptions-nameBorderErrorFix': scheduler_form_new.$dirty && scheduler_form_new.schedulerName.$error.required}"
name="schedulerName"
id="schedulerName"
ng-model="schedulerName" required
placeholder="Schedule name">
<div class="error"
ng-show="scheduler_form.schedulerName.$dirty && scheduler_form.schedulerName.$error.required">
ng-show="scheduler_form_new.$dirty && scheduler_form_new.schedulerName.$error.required">
A schedule name is required.
</div>
</div>
@ -40,9 +42,10 @@
(mm/dd/yyyy)
</span>
</label>
<div class="input-group">
<div class="input-group Form-inputGroup">
<input type="text"
class="form-control input-sm"
class="form-control input-sm
Form-textInput"
name="schedulerStartDt"
id="schedulerStartDt"
ng-model="schedulerStartDt"
@ -52,7 +55,8 @@
ng-change="scheduleTimeChange()" >
<span class="input-group-btn">
<button
class="btn btn-default btn-sm"
class="btn btn-default btn-sm
Form-inputButton Form-lookupButton"
type="button"
ng-click="showCalendar('schedulerStartDt')">
<i class="fa fa-calendar"></i>
@ -80,7 +84,7 @@
<div class="input-group SchedulerTime">
<input name="schedulerStartHour"
id="schedulerStartHour"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-time-spinner
ScheduleTime-input SpinnerInput"
ng-model="schedulerStartHour"
@ -94,7 +98,7 @@
</span>
<input name="schedulerStartMinute"
id="schedulerStartMinute"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-time-spinner
SchedulerTime-input SpinnerInput"
ng-model="schedulerStartMinute"
@ -108,7 +112,7 @@
</span>
<input name="schedulerStartSecond"
id="schedulerStartSecond"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-time-spinner
SchedulerTime-input SpinnerInput"
ng-model="schedulerStartSecond"
@ -137,9 +141,11 @@
<div class="form-group SchedulerForm-formGroup"
ng-show="schedulerShowTimeZone">
<label class="Form-inputLabel">
<span class="red-text">*</span>
Local Time Zone
</label>
<select
class="MakeSelect2"
name="schedulerTimeZone"
id="schedulerTimeZone"
ng-model="schedulerTimeZone"
@ -150,10 +156,12 @@
</div>
<div class="form-group SchedulerForm-formGroup">
<label class="Form-inputLabel">
<span class="red-text">*</span>
Repeat frequency
</label>
<select name="schedulerFrequency"
id="schedulerFrequency"
class="MakeSelect2"
ng-model="schedulerFrequency"
ng-options="f.name for f in frequencyOptions"
required class="form-control input-sm"
@ -174,11 +182,12 @@
ng-if="schedulerShowInterval">
<label class="Form-inputLabel
RepeatFrequencyOptions-everyLabel">
<span class="red-text">*</span>
Every
</label>
<input name="schedulerInterval"
id="schedulerInterval"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-spinner
SpinnerInput"
ng-model="$parent.schedulerInterval"
@ -202,6 +211,7 @@
<div class="radio
RepeatFrequencyOptions-radioLabel">
<label class="Form-inputLabel">
<span class="red-text">*</span>
<input type="radio" value="day"
ng-model="$parent.monthlyRepeatOption"
ng-change="monthlyRepeatChange()"
@ -213,7 +223,7 @@
<input
name="monthDay"
id="monthDay"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-spinner SpinnerInput"
ng-model="$parent.monthDay"
min="1" max="31"
@ -229,6 +239,7 @@
<div class="radio
RepeatFrequencyOptions-radioLabel">
<label class="Form-inputLabel">
<span class="red-text">*</span>
<input type="radio"
value="other"
ng-model="$parent.monthlyRepeatOption"
@ -238,29 +249,34 @@
on the
</label>
</div>
<select name="monthlyOccurrence"
id="monthlyOccurrence"
ng-model="$parent.monthlyOccurrence"
ng-options="o.name for o in occurrences"
ng-disabled="monthlyRepeatOption != 'other'"
class="form-control input-sm
RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-monthlyOccurence"
>
</select>
<select name="monthlyWeekDay"
id="monthlyWeekDay"
ng-model="$parent.monthlyWeekDay"
ng-options="w.name for w in weekdays"
ng-disabled="monthlyRepeatOption != 'other'"
class="form-control input-sm" >
</select>
<div class="RepeatFrequencyOptions-inputGroup
RepeatFrequencyOptions-inputGroup--halves">
<select name="monthlyOccurrence"
id="monthlyOccurrence"
ng-model="$parent.monthlyOccurrence"
ng-options="o.name for o in occurrences"
ng-disabled="monthlyRepeatOption != 'other'"
class=" MakeSelect2 form-control
input-sm
RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-monthlyOccurence"
>
</select>
<select name="monthlyWeekDay"
id="monthlyWeekDay"
ng-model="$parent.monthlyWeekDay"
ng-options="w.name for w in weekdays"
ng-disabled="monthlyRepeatOption != 'other'"
class="MakeSelect2 form-control input-sm" >
</select>
</div>
</div>
<div class="form-group
RepeatFrequencyOptions-formGroup"
ng-if="schedulerFrequency && schedulerFrequency.value == 'yearly'">
<div class="radio
RepeatFrequencyOptions-radioLabel">
<span class="red-text">*</span>
<label class="Form-inputLabel">
<input type="radio"
value="month"
@ -271,24 +287,27 @@
on
</label>
</div>
<select name="yearlyMonth"
id="yearlyMonth"
ng-model="$parent.yearlyMonth"
ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'month'"
class="form-control input-sm
RepeatFrequencyOptions-spacedSelect"
>
</select>
<input name="yearlyMonthDay"
id="yearlyMonthDay"
sch-spinner="scheduler_form"
class="scheduler-spinner
SpinnerInput"
ng-model="$parent.yearlyMonthDay"
min="1" max="31"
ng-change="resetError('scheduler_yearlyMonthDay_error')"
>
<div class="RepeatFrequencyOptions-inputGroup
RepeatFrequencyOptions-inputGroup--halvesWithNumber">
<select name="yearlyMonth"
id="yearlyMonth"
ng-model="$parent.yearlyMonth"
ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'month'"
class="MakeSelect2 form-control input-sm
RepeatFrequencyOptions-spacedSelect"
>
</select>
<input name="yearlyMonthDay"
id="yearlyMonthDay"
sch-spinner="scheduler_form_new"
class="scheduler-spinner
SpinnerInput"
ng-model="$parent.yearlyMonthDay"
min="1" max="31"
ng-change="resetError('scheduler_yearlyMonthDay_error')"
>
</div>
<div class="error"
ng-show="$parent.scheduler_yearlyMonthDay_error">
The day must be between 1 and 31.
@ -300,6 +319,7 @@
<div class="radio
RepeatFrequencyOptions-radioLabel">
<label class="Form-inputLabel">
<span class="red-text">*</span>
<input type="radio"
value="other"
ng-model="$parent.yearlyRepeatOption"
@ -309,32 +329,43 @@
on the
</label>
</div>
<select name="yearlyOccurrence"
id="yearlyOccurrence"
ng-model="$parent.yearlyOccurrence"
ng-options="o.name for o in occurrences"
ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm
RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-yearlyOccurence"
<div
class="RepeatFrequencyOptions-inputGroup
RepeatFrequencyOptions-inputGroup--thirds"
>
</select>
<select name="yearlyWeekDay"
id="yearlyWeekDay"
ng-model="$parent.yearlyWeekDay"
ng-options="w.name for w in weekdays"
ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm
RepeatFrequencyOptions-spacedSelect"
>
</select>
<select name="yearlyOtherMonth"
id="yearlyOtherMonth"
ng-model="$parent.yearlyOtherMonth"
ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm">
</select>
<select name="yearlyOccurrence"
id="yearlyOccurrence"
ng-model="$parent.yearlyOccurrence"
ng-options="o.name for o in occurrences"
ng-disabled="yearlyRepeatOption != 'other'"
class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-yearlyOccurence
RepeatFrequencyOptions-thirdSelect"
>
</select>
<select name="yearlyWeekDay"
id="yearlyWeekDay"
ng-model="$parent.yearlyWeekDay"
ng-options="w.name for w in weekdays"
ng-disabled="yearlyRepeatOption != 'other'"
class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-thirdSelect"
>
</select>
<select name="yearlyOtherMonth"
id="yearlyOtherMonth"
ng-model="$parent.yearlyOtherMonth"
ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'other'"
class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-thirdSelect">
</select>
</div>
</div>
<div class="form-group
RepeatFrequencyOptions-week
@ -417,6 +448,7 @@
RepeatFrequencyOptions-formGroup"
ng-if="schedulerShowInterval">
<label class="Form-inputLabel">
<span class="red-text">*</span>
End
</label>
<div>
@ -425,7 +457,8 @@
ng-model="$parent.schedulerEnd"
ng-options="e.name for e in endOptions"
required
class="form-control input-sm"
class="MakeSelect2
form-control input-sm"
ng-change="schedulerEndChange()">
</select>
</div>
@ -435,12 +468,13 @@
RepeatFrequencyOptions-formGroup"
ng-if="schedulerEnd && schedulerEnd.value == 'after'">
<label class="Form-inputLabel">
<span class="red-text">*</span>
Occurrence(s)
</label>
<input
ng-name="schedulerOccurrenceCount"
ng-id="schedulerOccurrenceCount"
sch-spinner="scheduler_form"
sch-spinner="scheduler_form_new"
class="scheduler-spinner
SpinnerInput"
ng-model="$parent.schedulerOccurrenceCount"
@ -454,7 +488,7 @@
</div>
</div>
<div class="form-group RepeatFrequencyOptions-formGroup"
ng-show="schedulerEnd && schedulerEnd.value == 'on'">
ng-if="schedulerEnd && schedulerEnd.value == 'on'">
<label class="Form-inputLabel">
<span class="red-text">*</span>
End Date
@ -462,18 +496,20 @@
(mm/dd/yyyy)
</span>
</label>
<div class="input-group">
<div class="input-group Form-inputGroup">
<input type="text"
name="schedulerEndDt"
id="schedulerEndDt"
class="form-control input-sm"
ng-model="schedulerEndDt"
class="form-control input-sm
Form-textInput"
ng-model="$parent.schedulerEndDt"
sch-date-picker
data-min-today="true"
placeholder="mm/dd/yyyy"
ng-change="resetError('scheduler_endDt_error')">
ng-change="$parent.resetError('scheduler_endDt_error')">
<span class="input-group-btn">
<button class="btn btn-default btn-sm"
<button class="btn btn-default btn-sm
Form-inputButton Form-lookupButton"
type="button"
ng-click="showCalendar('schedulerEndDt')"
>
@ -534,7 +570,7 @@
</form>
<div class="SchedulerFormDetail-container
SchedulerFormDetail-container--error"
ng-show="!schedulerIsValid">
ng-show="!schedulerIsValid && scheduler_form_new.$dirty">
<p class="SchedulerFormDetail-errorText">
The scheduler options are invalid or incomplete.
</p>

View File

@ -1,14 +1,16 @@
/** @define SchedulerFormDetail */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.SchedulerFormDetail-container {
padding: 15px;
border: 1px solid #e8e8e8;
border: 1px solid @default-border;
border-radius: 5px;
margin-bottom: 20px;
}
.SchedulerFormDetail-container--error {
border-color: #ff5850;
border-color: @default-err;
}
.SchedulerFormDetail-errorText {
@ -19,7 +21,7 @@
.SchedulerFormDetail-label {
text-transform: uppercase;
color: #848992;
color: @default-interface-txt;
margin-bottom: 15px;
}
@ -47,7 +49,7 @@
.SchedulerFormDetail-dateFormats {
text-transform: uppercase;
font-size: 13px;
color: #848992;
color: @default-interface-txt;
}
.SchedulerFormDetail-dateFormatsLabel {
@ -57,12 +59,12 @@
.SchedulerFormDetail-radioLabel {
margin-top: -3px !important;
color: #161B1F !important;
color: @default-data-txt !important;
}
.SchedulerFormDetail-radioButton {
margin-top: 2px !important;
color: #848992 !important;
color: @default-interface-txt !important;
}
.SchedulerFormDetail-occurrenceList {

View File

@ -1,5 +1,7 @@
/** @define SchedulerTime */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.SchedulerTime {
display: flex;
flex-wrap: wrap;
@ -14,7 +16,7 @@ span.ui-spinner.ui-widget.ui-widget-content.ui-corner-all {
.SchedulerTime-separator {
margin-left: 3px;
margin-right: 3px;
margin-top: 2px;
margin-top: 3px;
}
.SchedulerTime-utc {

View File

@ -1,5 +1,7 @@
/** @define SpinnerInput */
@import "awx/ui/client/src/shared/branding/colors.default.less";
.SpinnerInput {
width: ~"calc(100% - 26px)";
}

View File

@ -15,6 +15,10 @@
@default-link: #1678C4;
@default-link-hov: #4498DA;
@default-button-hov: #F2F2F2;
@default-list-header-bg:#EBEBEB;
@default-no-items-bord: #F6F6F6;
@default-as-detail-txt: #707070;
@default-dark: #000000;
// layout
@page-bg: @default-secondary-bg;
@ -31,7 +35,7 @@
// lists
@list-empty-txt: @default-interface-txt;
@list-header-bord: @default-bg;
@list-header-bg: #EBEBEB;
@list-header-bg: @default-list-header-bg;
@list-header-txt: @default-interface-txt;
@list-header-icon: @default-icon;
@list-item: @default-data-txt;
@ -64,7 +68,7 @@
@list-srch-btn-bg: @default-bg;
@list-srch-btn-hov-bg: @default-tertiary-bg;
@list-no-items-txt: @default-icon;
@list-no-items-bord: #F6F6F6;
@list-no-items-bord: @default-no-items-bord;
@list-no-items-bg: @default-secondary-bg;
// tooltups
@ -73,7 +77,7 @@
// login modal
@login-alert: @default-interface-txt;
@login-backdrop: #000000;
@login-backdrop: @default-dark;
@login-bg: @default-bg;
@login-header-bg: @default-bg;
@login-alert-error: @default-err;
@ -82,7 +86,7 @@
@login-notice-title: @default-interface-txt;
@login-notice-bg: @default-secondary-bg;
@login-notice-border: @default-secondary-bg;
@login-notice-text: #707070;
@login-notice-text: @default-as-detail-txt;
// login modal third party auth
@third-party-label: @default-interface-txt;
@ -157,8 +161,8 @@
@db-graph-axis-label: @default-interface-txt;
// panel
@panel-bg: @default-bg;
@panel-border: @default-border;
@panel-bg: @default-bg;
@panel-border: @default-border;
// activity stream details modal
@as-detail-changes-txt: #707070;
@as-detail-changes-txt: @default-as-detail-txt;

View File

@ -5,7 +5,7 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update && apt-get install -y software-properties-common python-software-properties curl
RUN add-apt-repository -y ppa:chris-lea/redis-server; add-apt-repository -y ppa:chris-lea/zeromq; add-apt-repository -y ppa:chris-lea/node.js; add-apt-repository ppa:ansible/ansible
RUN add-apt-repository -y ppa:chris-lea/redis-server; add-apt-repository -y ppa:chris-lea/zeromq; add-apt-repository -y ppa:chris-lea/node.js; add-apt-repository -y ppa:ansible/ansible
RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && apt-key adv --fetch-keys http://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list && echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/postgres-9.4.list