mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Merge branch 'devel' into rbac
This commit is contained in:
commit
4724d0c067
@ -552,6 +552,10 @@ class BaseSerializer(serializers.ModelSerializer):
|
||||
return ret
|
||||
|
||||
|
||||
class EmptySerializer(serializers.Serializer):
|
||||
pass
|
||||
|
||||
|
||||
class BaseFactSerializer(DocumentSerializer):
|
||||
|
||||
__metaclass__ = BaseSerializerMetaclass
|
||||
@ -2059,7 +2063,7 @@ class JobLaunchSerializer(BaseSerializer):
|
||||
variables_needed_to_start = serializers.ReadOnlyField()
|
||||
credential_needed_to_start = serializers.SerializerMethodField()
|
||||
survey_enabled = serializers.SerializerMethodField()
|
||||
extra_vars = VerbatimField(required=False)
|
||||
extra_vars = VerbatimField(required=False, write_only=True)
|
||||
|
||||
class Meta:
|
||||
model = JobTemplate
|
||||
@ -2067,18 +2071,11 @@ class JobLaunchSerializer(BaseSerializer):
|
||||
'ask_variables_on_launch', 'survey_enabled', 'variables_needed_to_start',
|
||||
'credential', 'credential_needed_to_start',)
|
||||
read_only_fields = ('ask_variables_on_launch',)
|
||||
write_only_fields = ('credential', 'extra_vars',)
|
||||
|
||||
def to_representation(self, obj):
|
||||
res = super(JobLaunchSerializer, self).to_representation(obj)
|
||||
view = self.context.get('view', None)
|
||||
if obj and hasattr(view, '_raw_data_form_marker'):
|
||||
if obj.passwords_needed_to_start:
|
||||
password_keys = dict([(p, u'') for p in obj.passwords_needed_to_start])
|
||||
res.update(password_keys)
|
||||
if self.get_credential_needed_to_start(obj) is True:
|
||||
res.update(dict(credential=''))
|
||||
return res
|
||||
extra_kwargs = {
|
||||
'credential': {
|
||||
'write_only': True,
|
||||
},
|
||||
}
|
||||
|
||||
def get_credential_needed_to_start(self, obj):
|
||||
return not (obj and obj.credential and obj.credential.active)
|
||||
|
||||
@ -1896,6 +1896,21 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
||||
is_job_start = True
|
||||
always_allow_superuser = False
|
||||
|
||||
def update_raw_data(self, data):
|
||||
obj = self.get_object()
|
||||
extra_vars = data.get('extra_vars') or {}
|
||||
if obj:
|
||||
for p in obj.passwords_needed_to_start:
|
||||
data[p] = u''
|
||||
if obj.credential and obj.credential.active:
|
||||
data.pop('credential', None)
|
||||
else:
|
||||
data['credential'] = None
|
||||
for v in obj.variables_needed_to_start:
|
||||
extra_vars.setdefault(v, u'')
|
||||
data['extra_vars'] = extra_vars
|
||||
return data
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
if not request.user.can_access(self.model, 'start', obj):
|
||||
@ -1945,7 +1960,7 @@ class JobTemplateSurveySpec(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
parent_model = JobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
@ -2024,8 +2039,8 @@ class JobTemplateActivityStreamList(SubListAPIView):
|
||||
class JobTemplateCallback(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
permission_classes = (JobTemplateCallbackPermission,)
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
@csrf_exempt
|
||||
@transaction.non_atomic_requests
|
||||
@ -2207,7 +2222,7 @@ class SystemJobTemplateDetail(RetrieveAPIView):
|
||||
class SystemJobTemplateLaunch(GenericAPIView):
|
||||
|
||||
model = SystemJobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return Response({})
|
||||
@ -2278,7 +2293,7 @@ class JobActivityStreamList(SubListAPIView):
|
||||
class JobStart(GenericAPIView):
|
||||
|
||||
model = Job
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
is_job_start = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
@ -34,7 +34,10 @@ def handle_error(request, status=404, **kwargs):
|
||||
status_code = status
|
||||
default_detail = kwargs['content']
|
||||
api_error_view = ApiErrorView.as_view(view_name=kwargs['name'], exception_class=APIException)
|
||||
return api_error_view(request)
|
||||
response = api_error_view(request)
|
||||
if hasattr(response, 'render'):
|
||||
response.render()
|
||||
return response
|
||||
else:
|
||||
kwargs['content'] = format_html('<span class="nocode">{}</span>', kwargs.get('content', ''))
|
||||
return render(request, 'error.html', kwargs, status=status)
|
||||
|
||||
@ -697,11 +697,23 @@ legend {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.pagination > li > a {
|
||||
.pagination>li>a,
|
||||
.pagination>li>span {
|
||||
border: 1px solid @grey-border;
|
||||
padding: 3px 6px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.pagination li {
|
||||
a#next-page {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
a#previous-page {
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
.pagination {
|
||||
margin-top: 15px;
|
||||
|
||||
@ -141,6 +141,28 @@
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.Form-subForm {
|
||||
width: 100%;
|
||||
border-left: 5px solid @default-border;
|
||||
margin-left: -20px;
|
||||
padding-left: 15px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
.Form-formGroup {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
.Form-subForm--title {
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
color: @default-interface-txt;
|
||||
font-size: small;
|
||||
width: 100%;
|
||||
float: left;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.Form-textAreaLabel{
|
||||
width:100%;
|
||||
}
|
||||
@ -364,6 +386,16 @@ input[type='radio']:checked:before {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.Form-button{
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.Form-buttonDefault {
|
||||
background-color: @default-bg;
|
||||
color: @default-interface-txt;
|
||||
border-color: @default-border;
|
||||
}
|
||||
|
||||
.Form-saveButton{
|
||||
background-color: @submit-button-bg;
|
||||
margin-right: 20px;
|
||||
|
||||
@ -14,12 +14,13 @@ table.ui-datepicker-calendar {
|
||||
}
|
||||
|
||||
/* Modal dialog */
|
||||
|
||||
.ui-dialog-title {
|
||||
font-size: 22px;
|
||||
color: @blue-link;
|
||||
font-size: 15px;
|
||||
color: @default-interface-txt;
|
||||
font-weight: bold;
|
||||
line-height: normal;
|
||||
font-family: 'Open Sans', helvetica;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.ui-dialog {
|
||||
.close {
|
||||
@ -33,12 +34,14 @@ table.ui-datepicker-calendar {
|
||||
.ui-widget-header {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
border-bottom: 1px solid #A9A9A9;
|
||||
height: 55px;
|
||||
}
|
||||
.ui-dialog-titlebar {
|
||||
padding-bottom: 0;
|
||||
padding-top: 12px;
|
||||
|
||||
button.close i {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
.ui-dialog-titlebar .ui-state-default {
|
||||
background-image: none;
|
||||
@ -58,9 +61,58 @@ table.ui-datepicker-calendar {
|
||||
background-position: -80px -224px;
|
||||
color: @black;
|
||||
}
|
||||
|
||||
button.btn.btn-primary,
|
||||
button.btn.btn-default {
|
||||
padding: 5px 15px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
transition: background-color 0.2s;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
button.btn.btn-primary {
|
||||
text-transform: uppercase;
|
||||
background-color: @default-succ;
|
||||
border-color: @default-succ;
|
||||
|
||||
&:hover {
|
||||
background-color: @default-succ-hov;
|
||||
border-color: @default-succ-hov;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background-color: @default-succ-disabled;
|
||||
border-color: @default-succ-disabled;
|
||||
}
|
||||
|
||||
&:first-of-type {
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
button.btn.btn-default {
|
||||
text-transform: uppercase;
|
||||
border-color: @default-border;
|
||||
color: @default-interface-txt;
|
||||
}
|
||||
|
||||
.ui-dialog-buttonpane.ui-widget-content {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding-top: 0;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.input-group-btn.dropdown, .List-pagination, .List-tableHeader {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.ui-dialog-buttonset {
|
||||
text-transform: uppercase;
|
||||
|
||||
button.btn.btn-default.ui-state-hover,
|
||||
button.btn.btn-default.ui-state-active,
|
||||
button.btn.btn-default.ui-state-focus {
|
||||
|
||||
@ -101,6 +101,7 @@ table, tbody {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* -- Pagination -- */
|
||||
.List-pagination {
|
||||
margin-top: 20px;
|
||||
font-size: 12px;
|
||||
@ -244,6 +245,7 @@ table, tbody {
|
||||
padding-left: 15px!important;
|
||||
height: 34px!important;
|
||||
padding-right: 45px!important;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
}
|
||||
|
||||
.List-searchInput:placeholder-shown {
|
||||
|
||||
@ -91,6 +91,10 @@ body {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.btn{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media (max-width: 1075px) {
|
||||
|
||||
#main-menu-container {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
@ -10,7 +10,7 @@
|
||||
* @description This controller controls the adhoc form creation, command launching and navigating to standard out after command has been succesfully ran.
|
||||
*/
|
||||
function adhocController($q, $scope, $rootScope, $location, $stateParams,
|
||||
CheckPasswords, PromptForPasswords, CreateLaunchDialog, adhocForm,
|
||||
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, adhocForm,
|
||||
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
|
||||
KindChange, LookUpInit, CredentialList, Empty, Wait) {
|
||||
|
||||
@ -162,6 +162,10 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
|
||||
|
||||
privateFn.initializeForm(id, urls, hostPattern);
|
||||
|
||||
$scope.formCancel = function(){
|
||||
$state.go('inventoryManage');
|
||||
}
|
||||
|
||||
// remove all data input into the form and reset the form back to defaults
|
||||
$scope.formReset = function () {
|
||||
GenerateForm.reset();
|
||||
@ -291,7 +295,7 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
|
||||
}
|
||||
|
||||
export default ['$q', '$scope', '$rootScope', '$location', '$stateParams',
|
||||
'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'adhocForm',
|
||||
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'adhocForm',
|
||||
'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath',
|
||||
'GetChoices', 'KindChange', 'LookUpInit', 'CredentialList', 'Empty', 'Wait',
|
||||
adhocController];
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
export default function() {
|
||||
return {
|
||||
editTitle: 'Execute Command',
|
||||
addTitle: 'Execute Command',
|
||||
name: 'adhoc',
|
||||
well: true,
|
||||
forceListeners: true,
|
||||
@ -125,13 +125,16 @@ export default function() {
|
||||
|
||||
buttons: {
|
||||
launch: {
|
||||
label: 'Launch',
|
||||
label: 'Save',
|
||||
ngClick: 'launchJob()',
|
||||
ngDisabled: true
|
||||
ngDisabled: true,
|
||||
'class': 'Form-buttonDefault Form-button'
|
||||
},
|
||||
reset: {
|
||||
ngClick: 'formReset()',
|
||||
ngDisabled: true
|
||||
ngDisabled: true,
|
||||
label: 'Reset',
|
||||
'class': 'Form-buttonDefault Form-button'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="tab-pane" id="credentials">
|
||||
<div class="Panel" id="adhoc">
|
||||
<div ng-cloak id="htmlTemplate">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
route: '/inventories/:inventory_id/adhoc',
|
||||
name: 'inventoryAdhoc',
|
||||
route: '/adhoc',
|
||||
name: 'inventoryManage.adhoc',
|
||||
templateUrl: templateUrl('adhoc/adhoc'),
|
||||
controller: 'adhocController',
|
||||
resolve: {
|
||||
|
||||
@ -45,6 +45,7 @@ import adhoc from './adhoc/main';
|
||||
import login from './login/main';
|
||||
import activityStream from './activity-stream/main';
|
||||
import standardOut from './standard-out/main';
|
||||
import lookUpHelper from './lookup/main';
|
||||
import {JobTemplatesList, JobTemplatesAdd, JobTemplatesEdit} from './controllers/JobTemplates';
|
||||
import {LicenseController} from './controllers/License';
|
||||
import {ScheduleEditController} from './controllers/Schedules';
|
||||
@ -234,7 +235,7 @@ var tower = angular.module('Tower', [
|
||||
}).
|
||||
|
||||
state('dashboardGroups', {
|
||||
url: '/home/groups',
|
||||
url: '/home/groups?id&name&has_active_failures&status&source&has_external_source&inventory_source__id',
|
||||
templateUrl: urlPrefix + 'partials/subhome.html',
|
||||
controller: HomeGroups,
|
||||
ncyBreadcrumb: {
|
||||
@ -249,7 +250,7 @@ var tower = angular.module('Tower', [
|
||||
}).
|
||||
|
||||
state('dashboardHosts', {
|
||||
url: '/home/hosts?has_active_failures',
|
||||
url: '/home/hosts?has_active_failures&name&id',
|
||||
templateUrl: urlPrefix + 'partials/subhome.html',
|
||||
controller: HomeHosts,
|
||||
data: {
|
||||
|
||||
@ -859,7 +859,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
|
||||
}
|
||||
}
|
||||
$rootScope.hostPatterns = host_patterns;
|
||||
$location.path('/inventories/' + $scope.inventory.id + '/adhoc');
|
||||
$state.go('inventoryManage.adhoc');
|
||||
};
|
||||
|
||||
$scope.refreshHostsOnGroupRefresh = false;
|
||||
|
||||
@ -18,6 +18,9 @@ export default
|
||||
editTitle: '{{ name }}', //Legend in edit mode
|
||||
name: 'credential',
|
||||
forceListeners: true,
|
||||
subFormTitles: {
|
||||
credentialSubForm: 'Type Details',
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
@ -103,7 +106,8 @@ export default
|
||||
'</dl>\n',
|
||||
dataTitle: 'Type',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
dataContainer: "body",
|
||||
hasSubForm: true,
|
||||
// helpCollapse: [{
|
||||
// hdr: 'Select a Credential Type',
|
||||
// content: '<dl>\n' +
|
||||
@ -131,7 +135,8 @@ export default
|
||||
init: false
|
||||
},
|
||||
autocomplete: false,
|
||||
apiField: 'username'
|
||||
apiField: 'username',
|
||||
subForm: 'credentialSubForm',
|
||||
},
|
||||
secret_key: {
|
||||
label: 'Secret Key',
|
||||
@ -145,7 +150,8 @@ export default
|
||||
ask: false,
|
||||
clear: false,
|
||||
hasShowInputButton: true,
|
||||
apiField: 'passwowrd'
|
||||
apiField: 'passwowrd',
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
security_token: {
|
||||
label: 'STS Token',
|
||||
@ -157,7 +163,8 @@ export default
|
||||
hasShowInputButton: true,
|
||||
dataTitle: 'STS Token',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
dataContainer: "body",
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"host": {
|
||||
labelBind: 'hostLabel',
|
||||
@ -172,7 +179,8 @@ export default
|
||||
awRequiredWhen: {
|
||||
variable: 'host_required',
|
||||
init: false
|
||||
}
|
||||
},
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"username": {
|
||||
labelBind: 'usernameLabel',
|
||||
@ -183,7 +191,8 @@ export default
|
||||
variable: 'username_required',
|
||||
init: false
|
||||
},
|
||||
autocomplete: false
|
||||
autocomplete: false,
|
||||
subForm: "credentialSubForm"
|
||||
},
|
||||
"email_address": {
|
||||
labelBind: 'usernameLabel',
|
||||
@ -197,7 +206,8 @@ export default
|
||||
awPopOver: '<p>The email address assigned to the Google Compute Engine <b><i>service account.</b></i></p>',
|
||||
dataTitle: 'Email',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
dataContainer: "body",
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"subscription_id": {
|
||||
labelBind: "usernameLabel",
|
||||
@ -213,8 +223,8 @@ export default
|
||||
awPopOver: '<p>Subscription ID is an Azure construct, which is mapped to a username.</p>',
|
||||
dataTitle: 'Subscription ID',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
|
||||
dataContainer: "body",
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"api_key": {
|
||||
label: 'API Key',
|
||||
@ -228,6 +238,7 @@ export default
|
||||
ask: false,
|
||||
hasShowInputButton: true,
|
||||
clear: false,
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"password": {
|
||||
labelBind: 'passwordLabel',
|
||||
@ -242,7 +253,8 @@ export default
|
||||
awRequiredWhen: {
|
||||
variable: "password_required",
|
||||
init: false
|
||||
}
|
||||
},
|
||||
subForm: "credentialSubForm"
|
||||
},
|
||||
"ssh_password": {
|
||||
label: 'Password', // formally 'SSH Password'
|
||||
@ -252,7 +264,8 @@ export default
|
||||
editRequired: false,
|
||||
ask: true,
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false
|
||||
autocomplete: false,
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"ssh_key_data": {
|
||||
labelBind: 'sshKeyDataLabel',
|
||||
@ -273,7 +286,8 @@ export default
|
||||
awPopOverWatch: "key_description",
|
||||
dataTitle: 'Help',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
dataContainer: "body",
|
||||
subForm: "credentialSubForm"
|
||||
},
|
||||
"ssh_key_unlock": {
|
||||
label: 'Private Key Passphrase',
|
||||
@ -285,6 +299,7 @@ export default
|
||||
ask: true,
|
||||
hasShowInputButton: true,
|
||||
askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"become_method": {
|
||||
label: "Privilege Escalation",
|
||||
@ -297,7 +312,8 @@ export default
|
||||
"This is equivalent to specifying the <code>--become-method=BECOME_METHOD</code> parameter, where <code>BECOME_METHOD</code> could be "+
|
||||
"<code>sudo | su | pbrun | pfexec | runas</code> <br>(defaults to <code>sudo</code>)</p>",
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body"
|
||||
dataContainer: "body",
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"become_username": {
|
||||
label: 'Privilege Escalation Username',
|
||||
@ -305,7 +321,8 @@ export default
|
||||
ngShow: "kind.value == 'ssh' && (become_method && become_method.value)",
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
autocomplete: false
|
||||
autocomplete: false,
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"become_password": {
|
||||
label: 'Privilege Escalation Password',
|
||||
@ -315,7 +332,8 @@ export default
|
||||
editRequired: false,
|
||||
ask: true,
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false
|
||||
autocomplete: false,
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"project": {
|
||||
labelBind: 'projectLabel',
|
||||
@ -331,7 +349,8 @@ export default
|
||||
awRequiredWhen: {
|
||||
variable: 'project_required',
|
||||
init: false
|
||||
}
|
||||
},
|
||||
subForm: 'credentialSubForm'
|
||||
},
|
||||
"vault_password": {
|
||||
label: "Vault Password",
|
||||
@ -341,7 +360,8 @@ export default
|
||||
editRequired: false,
|
||||
ask: true,
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false
|
||||
autocomplete: false,
|
||||
subForm: 'credentialSubForm'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -19,6 +19,10 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
name: 'project',
|
||||
forceListeners: true,
|
||||
tabs: true,
|
||||
subFormTitles: {
|
||||
sourceSubForm: 'Source Details',
|
||||
},
|
||||
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
@ -62,7 +66,8 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
ngOptions: 'type.label for type in scm_type_options track by type.value',
|
||||
ngChange: 'scmChange()',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
editRequired: true,
|
||||
hasSubForm: true
|
||||
},
|
||||
missing_path_alert: {
|
||||
type: 'alertblock',
|
||||
@ -112,6 +117,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
variable: "scmRequired",
|
||||
init: false
|
||||
},
|
||||
subForm: 'sourceSubForm',
|
||||
helpCollapse: [{
|
||||
hdr: 'GIT URLs',
|
||||
content: '<p>Example URLs for GIT SCM include:</p><ul class=\"no-bullets\"><li>https://github.com/ansible/ansible.git</li>' +
|
||||
@ -135,14 +141,15 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
'Do not put the username and key in the URL. ' +
|
||||
'If using Bitbucket and SSH, do not supply your Bitbucket username.',
|
||||
show: "scm_type.value == 'hg'"
|
||||
}]
|
||||
}],
|
||||
},
|
||||
scm_branch: {
|
||||
labelBind: "scmBranchLabel",
|
||||
type: 'text',
|
||||
ngShow: "scm_type && scm_type.value !== 'manual'",
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
subForm: 'sourceSubForm'
|
||||
},
|
||||
credential: {
|
||||
label: 'SCM Credential',
|
||||
@ -152,12 +159,14 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
sourceField: 'name',
|
||||
ngClick: 'lookUpCredential()',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
subForm: 'sourceSubForm'
|
||||
},
|
||||
checkbox_group: {
|
||||
label: 'SCM Update Options',
|
||||
type: 'checkbox_group',
|
||||
ngShow: "scm_type && scm_type.value !== 'manual'",
|
||||
subForm: 'sourceSubForm',
|
||||
fields: [{
|
||||
name: 'scm_clean',
|
||||
label: 'Clean',
|
||||
|
||||
@ -22,7 +22,6 @@ import Jobs from "./helpers/Jobs";
|
||||
import License from "./helpers/License";
|
||||
import LoadConfig from "./helpers/LoadConfig";
|
||||
import LogViewer from "./helpers/LogViewer";
|
||||
import Lookup from "./helpers/Lookup";
|
||||
import PaginationHelpers from "./helpers/PaginationHelpers";
|
||||
import Parse from "./helpers/Parse";
|
||||
import ProjectPath from "./helpers/ProjectPath";
|
||||
@ -60,7 +59,6 @@ export
|
||||
License,
|
||||
LoadConfig,
|
||||
LogViewer,
|
||||
Lookup,
|
||||
PaginationHelpers,
|
||||
Parse,
|
||||
ProjectPath,
|
||||
|
||||
@ -1,307 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name helpers.function:Lookup
|
||||
* @description
|
||||
* LookUpInit( {
|
||||
* scope: <caller's scope>,
|
||||
* form: <form object>,
|
||||
* current_item: <id of item to select on open>,
|
||||
* list: <list object>,
|
||||
* field: <name of the form field with which the lookup is associated>,
|
||||
* hdr: <optional. modal dialog header>
|
||||
* postAction: optional function to run after selection made,
|
||||
* callback: optional label to $emit() on parent scope
|
||||
* input_type: optional string that specifies whether lookup should have checkboxes or radio buttons. defaults to 'checkbox' --- added by JT 8/21/14
|
||||
* })
|
||||
*/
|
||||
|
||||
import listGenerator from '../shared/list-generator/main';
|
||||
|
||||
export default
|
||||
angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ApiLoader', 'ModalDialog'])
|
||||
|
||||
.factory('LookUpInit', ['Alert', 'Rest', 'ProcessErrors', 'generateList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'FormatDate', 'Empty', 'CreateDialog',
|
||||
function (Alert, Rest, ProcessErrors, GenerateList, SearchInit, PaginateInit, GetBasePath, FormatDate, Empty, CreateDialog) {
|
||||
return function (params) {
|
||||
|
||||
var parent_scope = params.scope,
|
||||
form = params.form,
|
||||
list = params.list,
|
||||
field = params.field,
|
||||
instructions = params.instructions,
|
||||
postAction = params.postAction,
|
||||
callback = params.callback,
|
||||
autopopulateLookup,
|
||||
input_type = (params.input_type) ? params.input_type: "checkbox",
|
||||
defaultUrl, name, watchUrl;
|
||||
|
||||
if (params.autopopulateLookup !== undefined) {
|
||||
autopopulateLookup = params.autopopulateLookup;
|
||||
} else {
|
||||
autopopulateLookup = true;
|
||||
}
|
||||
|
||||
if (params.url) {
|
||||
// pass in a url value to override the default
|
||||
defaultUrl = params.url;
|
||||
} else {
|
||||
defaultUrl = (list.name === 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
|
||||
}
|
||||
|
||||
if ($('#htmlTemplate #lookup-modal-dialog').length > 0) {
|
||||
$('#htmlTemplate #lookup-modal-dialog').empty();
|
||||
}
|
||||
else {
|
||||
$('#htmlTemplate').append("<div id=\"lookup-modal-dialog\"></div>");
|
||||
}
|
||||
|
||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
|
||||
watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
||||
watchUrl += form.fields[field].sourceField + '__' + 'iexact=:value';
|
||||
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url', watchUrl);
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source', field);
|
||||
|
||||
var sourceModel = form.fields[field].sourceModel,
|
||||
sourceField = form.fields[field].sourceField;
|
||||
|
||||
// this logic makes sure that the form is being added, and that the lookup to be autopopulated is required
|
||||
// we also look to see if the lookupinit autopopulateLookup parameter passed in by the controller is false
|
||||
function fieldIsAutopopulatable() {
|
||||
if (autopopulateLookup === false) {
|
||||
return false;
|
||||
} if (parent_scope.mode === "add") {
|
||||
if (parent_scope[sourceModel + "_field"].awRequiredWhen &&
|
||||
parent_scope[sourceModel + "_field"].awRequiredWhen.variable &&
|
||||
parent_scope[parent_scope[sourceModel + "_field"].awRequiredWhen.variable]) {
|
||||
return true;
|
||||
} else if (parent_scope[sourceModel + "_field"].addRequired === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldIsAutopopulatable()) {
|
||||
// Auto populate the field if there is only one result
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.get()
|
||||
.success(function (data) {
|
||||
if (data.count === 1) {
|
||||
parent_scope[field] = data.results[0].id;
|
||||
if (parent_scope[form.name + '_form'] && form.fields[field] && sourceModel) {
|
||||
parent_scope[sourceModel + '_' + sourceField] =
|
||||
data.results[0][sourceField];
|
||||
if (parent_scope[form.name + '_form'][sourceModel + '_' + sourceField]) {
|
||||
parent_scope[form.name + '_form'][sourceModel + '_' + sourceField]
|
||||
.$setValidity('awlookup', true);
|
||||
}
|
||||
}
|
||||
if (parent_scope[form.name + '_form']) {
|
||||
parent_scope[form.name + '_form'].$setDirty();
|
||||
}
|
||||
}
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors(parent_scope, data, status, form, { hdr: 'Error!',
|
||||
msg: 'Failed to launch adhoc command. POST returned status: ' +
|
||||
status });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
parent_scope['lookUp' + name] = function () {
|
||||
|
||||
var master = {},
|
||||
scope = parent_scope.$new(),
|
||||
name, hdr, buttons;
|
||||
|
||||
// Generating the search list potentially kills the values held in scope for the field.
|
||||
// We'll keep a copy in master{} that we can revert back to on cancel;
|
||||
master[field] = scope[field];
|
||||
master[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField];
|
||||
|
||||
GenerateList.inject(list, {
|
||||
mode: 'lookup',
|
||||
id: 'lookup-modal-dialog',
|
||||
scope: scope,
|
||||
instructions: instructions,
|
||||
input_type: input_type
|
||||
});
|
||||
|
||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||
|
||||
// Show pop-up
|
||||
buttons = [{
|
||||
label: "Cancel",
|
||||
icon: "fa-times",
|
||||
"class": "btn btn-default",
|
||||
"id": "lookup-cancel-button",
|
||||
onClick: function() {
|
||||
$('#lookup-modal-dialog').dialog('close');
|
||||
}
|
||||
},{
|
||||
label: "Select",
|
||||
onClick: function() {
|
||||
scope.selectAction();
|
||||
},
|
||||
icon: "fa-check",
|
||||
"class": "btn btn-primary",
|
||||
"id": "lookup-save-button"
|
||||
}];
|
||||
|
||||
if (scope.removeModalReady) {
|
||||
scope.removeModalReady();
|
||||
}
|
||||
scope.removeModalReady = scope.$on('ModalReady', function() {
|
||||
$('#lookup-save-button').attr('disabled','disabled');
|
||||
$('#lookup-modal-dialog').dialog('open');
|
||||
});
|
||||
|
||||
CreateDialog({
|
||||
scope: scope,
|
||||
buttons: buttons,
|
||||
width: 600,
|
||||
height: (instructions) ? 625 : 500,
|
||||
minWidth: 500,
|
||||
title: hdr,
|
||||
id: 'lookup-modal-dialog',
|
||||
onClose: function() {
|
||||
setTimeout( function() {
|
||||
scope.$apply( function() {
|
||||
if (Empty(scope[field])) {
|
||||
scope[field] = master[field];
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
master[form.fields[field].sourceModel + '_' + form.fields[field].sourceField];
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
callback: 'ModalReady'
|
||||
});
|
||||
|
||||
SearchInit({
|
||||
scope: scope,
|
||||
set: list.name,
|
||||
list: list,
|
||||
url: defaultUrl
|
||||
});
|
||||
|
||||
PaginateInit({
|
||||
scope: scope,
|
||||
list: list,
|
||||
url: defaultUrl,
|
||||
mode: 'lookup'
|
||||
});
|
||||
|
||||
if (scope.lookupPostRefreshRemove) {
|
||||
scope.lookupPostRefreshRemove();
|
||||
}
|
||||
scope.lookupPostRefreshRemove = scope.$on('PostRefresh', function () {
|
||||
var fld, i;
|
||||
for (fld in list.fields) {
|
||||
if (list.fields[fld].type && list.fields[fld].type === 'date') {
|
||||
//convert dates to our standard format
|
||||
for (i = 0; i < scope[list.name].length; i++) {
|
||||
scope[list.name][i][fld] = FormatDate(new Date(scope[list.name][i][fld]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// List generator creates the list, resetting it and losing the previously selected value.
|
||||
// If the selected value is in the current set, find it and mark selected.
|
||||
if (!Empty(parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField])) {
|
||||
scope[list.name].forEach(function(elem) {
|
||||
if (elem[form.fields[field].sourceField] ===
|
||||
parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField]) {
|
||||
scope[field] = elem.id;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!Empty(scope[field])) {
|
||||
scope['toggle_' + list.iterator](scope[field]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
scope.search(list.iterator);
|
||||
|
||||
scope.selectAction = function () {
|
||||
var i, found = false;
|
||||
for (i = 0; i < scope[list.name].length; i++) {
|
||||
if (scope[list.name][i].checked === '1' || scope[list.name][i].checked===1 || scope[list.name][i].checked === true) {
|
||||
found = true;
|
||||
parent_scope[field] = scope[list.name][i].id;
|
||||
if (parent_scope[form.name + '_form'] && form.fields[field] && form.fields[field].sourceModel) {
|
||||
parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
scope[list.name][i][form.fields[field].sourceField];
|
||||
if (parent_scope[form.name + '_form'][form.fields[field].sourceModel + '_' + form.fields[field].sourceField]) {
|
||||
parent_scope[form.name + '_form'][form.fields[field].sourceModel + '_' + form.fields[field].sourceField]
|
||||
.$setValidity('awlookup', true);
|
||||
}
|
||||
}
|
||||
if (parent_scope[form.name + '_form']) {
|
||||
parent_scope[form.name + '_form'].$setDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
// Selection made
|
||||
$('#lookup-modal-dialog').dialog('close');
|
||||
if (postAction) {
|
||||
postAction();
|
||||
}
|
||||
if (callback) {
|
||||
parent_scope.$emit(callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
scope['toggle_' + list.iterator] = function (id) {
|
||||
var count = 0;
|
||||
scope[list.name].forEach( function(row, i) {
|
||||
if (row.id === id) {
|
||||
if (row.checked) {
|
||||
scope[list.name][i].success_class = 'success';
|
||||
}
|
||||
else {
|
||||
row.checked = true;
|
||||
scope[list.name][i].success_class = '';
|
||||
}
|
||||
} else {
|
||||
scope[list.name][i].checked = 0;
|
||||
scope[list.name][i].success_class = '';
|
||||
}
|
||||
});
|
||||
// Check if any rows are checked
|
||||
scope[list.name].forEach(function(row) {
|
||||
if (row.checked) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
if (count === 0) {
|
||||
$('#lookup-save-button').attr('disabled','disabled');
|
||||
}
|
||||
else {
|
||||
$('#lookup-save-button').removeAttr('disabled');
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
}]);
|
||||
@ -214,19 +214,18 @@ export default
|
||||
return function(params) {
|
||||
var scope = params.scope,
|
||||
callback= params.callback,
|
||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
base = params.base || $location.path().replace(/^\//, '').split('/')[0],
|
||||
url = GetBasePath(base),
|
||||
scheduler;
|
||||
|
||||
if (!Empty($stateParams.template_id)) {
|
||||
url += $stateParams.template_id + '/schedules/';
|
||||
}
|
||||
else if (!Empty($stateParams.id)) {
|
||||
else if (!Empty($stateParams.id) && base != 'system_job_templates') {
|
||||
url += $stateParams.id + '/schedules/';
|
||||
}
|
||||
else if (!Empty($stateParams.management_job)) {
|
||||
url += $stateParams.management_job + '/schedules/';
|
||||
if(scope.management_job.id === 4){
|
||||
else if (base == 'system_job_templates') {
|
||||
url += $stateParams.id + '/schedules/';
|
||||
if($stateParams.id == 4){
|
||||
scope.isFactCleanup = true;
|
||||
scope.keep_unit_choices = [{
|
||||
"label" : "Days",
|
||||
@ -538,7 +537,7 @@ export default
|
||||
var scope = params.scope,
|
||||
parent_scope = params.parent_scope,
|
||||
iterator = (params.iterator) ? params.iterator : scope.iterator,
|
||||
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||
base = params.base || $location.path().replace(/^\//, '').split('/')[0];
|
||||
|
||||
scope.toggleSchedule = function(event, id) {
|
||||
try {
|
||||
|
||||
22
awx/ui/client/src/lookup/lookup.block.less
Normal file
22
awx/ui/client/src/lookup/lookup.block.less
Normal file
@ -0,0 +1,22 @@
|
||||
@import "../shared/branding/colors.default.less";
|
||||
|
||||
#LookupModal-dialog {
|
||||
.List-searchWidget {
|
||||
width: 66.6666%
|
||||
}
|
||||
|
||||
.List-tableHeaderRow {
|
||||
.List-tableHeader:first-of-type {
|
||||
width: 3%;
|
||||
}
|
||||
}
|
||||
|
||||
.List-tableHeader,
|
||||
.List-tableHeader:last-of-type {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.List-tableCell {
|
||||
color: @default-interface-txt;
|
||||
}
|
||||
}
|
||||
305
awx/ui/client/src/lookup/lookup.factory.js
Normal file
305
awx/ui/client/src/lookup/lookup.factory.js
Normal file
@ -0,0 +1,305 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name helpers.function:Lookup
|
||||
* @description
|
||||
* LookUpInit( {
|
||||
* scope: <caller's scope>,
|
||||
* form: <form object>,
|
||||
* current_item: <id of item to select on open>,
|
||||
* list: <list object>,
|
||||
* field: <name of the form field with which the lookup is associated>,
|
||||
* hdr: <optional. modal dialog header>
|
||||
* postAction: optional function to run after selection made,
|
||||
* callback: optional label to $emit() on parent scope
|
||||
* input_type: optional string that specifies whether lookup should have checkboxes or radio buttons. defaults to 'checkbox' --- added by JT 8/21/14
|
||||
* })
|
||||
*/
|
||||
|
||||
export default ['Rest', 'ProcessErrors', 'generateList',
|
||||
'SearchInit', 'PaginateInit', 'GetBasePath', 'FormatDate',
|
||||
'Empty', 'CreateDialog',
|
||||
function(Rest, ProcessErrors, GenerateList,
|
||||
SearchInit, PaginateInit, GetBasePath, FormatDate,
|
||||
Empty, CreateDialog) {
|
||||
return function(params) {
|
||||
|
||||
var parent_scope = params.scope,
|
||||
form = params.form,
|
||||
list = params.list,
|
||||
field = params.field,
|
||||
instructions = params.instructions,
|
||||
postAction = params.postAction,
|
||||
callback = params.callback,
|
||||
autopopulateLookup,
|
||||
input_type = (params.input_type) ? params.input_type : "checkbox",
|
||||
defaultUrl, name, watchUrl;
|
||||
|
||||
if (params.autopopulateLookup !== undefined) {
|
||||
autopopulateLookup = params.autopopulateLookup;
|
||||
} else {
|
||||
autopopulateLookup = true;
|
||||
}
|
||||
|
||||
if (params.url) {
|
||||
// pass in a url value to override the default
|
||||
defaultUrl = params.url;
|
||||
} else {
|
||||
defaultUrl = (list.name === 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
|
||||
}
|
||||
|
||||
if ($('#htmlTemplate #LookupModal-dialog').length > 0) {
|
||||
$('#htmlTemplate #LookupModal-dialog').empty();
|
||||
} else {
|
||||
$('#htmlTemplate').append("<div id=\"LookupModal-dialog\"></div>");
|
||||
}
|
||||
|
||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
|
||||
watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
||||
watchUrl += form.fields[field].sourceField + '__' + 'iexact=:value';
|
||||
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url', watchUrl);
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source', field);
|
||||
|
||||
var sourceModel = form.fields[field].sourceModel,
|
||||
sourceField = form.fields[field].sourceField;
|
||||
|
||||
// this logic makes sure that the form is being added, and that the lookup to be autopopulated is required
|
||||
// we also look to see if the lookupinit autopopulateLookup parameter passed in by the controller is false
|
||||
function fieldIsAutopopulatable() {
|
||||
if (autopopulateLookup === false) {
|
||||
return false;
|
||||
}
|
||||
if (parent_scope.mode === "add") {
|
||||
if (parent_scope[sourceModel + "_field"].awRequiredWhen &&
|
||||
parent_scope[sourceModel + "_field"].awRequiredWhen.variable &&
|
||||
parent_scope[parent_scope[sourceModel + "_field"].awRequiredWhen.variable]) {
|
||||
return true;
|
||||
} else if (parent_scope[sourceModel + "_field"].addRequired === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldIsAutopopulatable()) {
|
||||
// Auto populate the field if there is only one result
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
if (data.count === 1) {
|
||||
parent_scope[field] = data.results[0].id;
|
||||
if (parent_scope[form.name + '_form'] && form.fields[field] && sourceModel) {
|
||||
parent_scope[sourceModel + '_' + sourceField] =
|
||||
data.results[0][sourceField];
|
||||
if (parent_scope[form.name + '_form'][sourceModel + '_' + sourceField]) {
|
||||
parent_scope[form.name + '_form'][sourceModel + '_' + sourceField]
|
||||
.$setValidity('awlookup', true);
|
||||
}
|
||||
}
|
||||
if (parent_scope[form.name + '_form']) {
|
||||
parent_scope[form.name + '_form'].$setDirty();
|
||||
}
|
||||
}
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors(parent_scope, data, status, form, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to launch adhoc command. POST returned status: ' +
|
||||
status
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
parent_scope['lookUp' + name] = function() {
|
||||
|
||||
var master = {},
|
||||
scope = parent_scope.$new(),
|
||||
name, hdr, buttons;
|
||||
|
||||
// Generating the search list potentially kills the values held in scope for the field.
|
||||
// We'll keep a copy in master{} that we can revert back to on cancel;
|
||||
master[field] = scope[field];
|
||||
master[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField];
|
||||
GenerateList.inject(list, {
|
||||
mode: 'lookup',
|
||||
id: 'LookupModal-dialog',
|
||||
scope: scope,
|
||||
instructions: instructions,
|
||||
input_type: input_type
|
||||
});
|
||||
|
||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||
|
||||
// Show pop-up
|
||||
buttons = [{
|
||||
label: "Save",
|
||||
onClick: function() {
|
||||
scope.selectAction();
|
||||
},
|
||||
//icon: "fa-check",
|
||||
"class": "btn btn-primary",
|
||||
"id": "lookup-save-button"
|
||||
}, {
|
||||
label: "Cancel",
|
||||
"class": "btn btn-default",
|
||||
"id": "lookup-cancel-button",
|
||||
onClick: function() {
|
||||
$('#LookupModal-dialog').dialog('close');
|
||||
}
|
||||
}];
|
||||
|
||||
if (scope.removeModalReady) {
|
||||
scope.removeModalReady();
|
||||
}
|
||||
scope.removeModalReady = scope.$on('ModalReady', function() {
|
||||
$('#lookup-save-button').attr('disabled', 'disabled');
|
||||
$('#LookupModal-dialog').dialog('open');
|
||||
});
|
||||
|
||||
CreateDialog({
|
||||
scope: scope,
|
||||
buttons: buttons,
|
||||
width: 600,
|
||||
height: (instructions) ? 625 : 450,
|
||||
minWidth: 500,
|
||||
title: hdr,
|
||||
id: 'LookupModal-dialog',
|
||||
onClose: function() {
|
||||
setTimeout(function() {
|
||||
scope.$apply(function() {
|
||||
if (Empty(scope[field])) {
|
||||
scope[field] = master[field];
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
master[form.fields[field].sourceModel + '_' + form.fields[field].sourceField];
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
callback: 'ModalReady'
|
||||
});
|
||||
|
||||
SearchInit({
|
||||
scope: scope,
|
||||
set: list.name,
|
||||
list: list,
|
||||
url: defaultUrl
|
||||
});
|
||||
|
||||
PaginateInit({
|
||||
scope: scope,
|
||||
list: list,
|
||||
url: defaultUrl,
|
||||
mode: 'lookup'
|
||||
});
|
||||
|
||||
if (scope.lookupPostRefreshRemove) {
|
||||
scope.lookupPostRefreshRemove();
|
||||
}
|
||||
scope.lookupPostRefreshRemove = scope.$on('PostRefresh', function() {
|
||||
var fld, i;
|
||||
for (fld in list.fields) {
|
||||
if (list.fields[fld].type && list.fields[fld].type === 'date') {
|
||||
//convert dates to our standard format
|
||||
for (i = 0; i < scope[list.name].length; i++) {
|
||||
scope[list.name][i][fld] = FormatDate(new Date(scope[list.name][i][fld]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// List generator creates the list, resetting it and losing the previously selected value.
|
||||
// If the selected value is in the current set, find it and mark selected.
|
||||
if (!Empty(parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField])) {
|
||||
scope[list.name].forEach(function(elem) {
|
||||
if (elem[form.fields[field].sourceField] ===
|
||||
parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField]) {
|
||||
scope[field] = elem.id;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!Empty(scope[field])) {
|
||||
scope['toggle_' + list.iterator](scope[field]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
scope.search(list.iterator);
|
||||
|
||||
scope.selectAction = function() {
|
||||
var i, found = false;
|
||||
for (i = 0; i < scope[list.name].length; i++) {
|
||||
if (scope[list.name][i].checked === '1' || scope[list.name][i].checked === 1 || scope[list.name][i].checked === true) {
|
||||
found = true;
|
||||
parent_scope[field] = scope[list.name][i].id;
|
||||
if (parent_scope[form.name + '_form'] && form.fields[field] && form.fields[field].sourceModel) {
|
||||
parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
scope[list.name][i][form.fields[field].sourceField];
|
||||
if (parent_scope[form.name + '_form'][form.fields[field].sourceModel + '_' + form.fields[field].sourceField]) {
|
||||
parent_scope[form.name + '_form'][form.fields[field].sourceModel + '_' + form.fields[field].sourceField]
|
||||
.$setValidity('awlookup', true);
|
||||
}
|
||||
}
|
||||
if (parent_scope[form.name + '_form']) {
|
||||
parent_scope[form.name + '_form'].$setDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
// Selection made
|
||||
$('#LookupModal-dialog').dialog('close');
|
||||
if (postAction) {
|
||||
postAction();
|
||||
}
|
||||
if (callback) {
|
||||
parent_scope.$emit(callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
scope['toggle_' + list.iterator] = function(id) {
|
||||
var count = 0;
|
||||
scope[list.name].forEach(function(row, i) {
|
||||
if (row.id === id) {
|
||||
if (row.checked) {
|
||||
scope[list.name][i].success_class = 'success';
|
||||
} else {
|
||||
row.checked = true;
|
||||
scope[list.name][i].success_class = '';
|
||||
}
|
||||
} else {
|
||||
scope[list.name][i].checked = 0;
|
||||
scope[list.name][i].success_class = '';
|
||||
}
|
||||
});
|
||||
// Check if any rows are checked
|
||||
scope[list.name].forEach(function(row) {
|
||||
if (row.checked) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
if (count === 0) {
|
||||
$('#lookup-save-button').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$('#lookup-save-button').removeAttr('disabled');
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
];
|
||||
12
awx/ui/client/src/lookup/main.js
Normal file
12
awx/ui/client/src/lookup/main.js
Normal file
@ -0,0 +1,12 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
import LookUpInit from './lookup.factory';
|
||||
import listGenerator from '../shared/list-generator/main';
|
||||
|
||||
export default
|
||||
angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper',
|
||||
'PaginationHelpers', listGenerator.name, 'ApiLoader', 'ModalDialog'])
|
||||
.factory('LookUpInit', LookUpInit);
|
||||
@ -238,10 +238,9 @@ export default
|
||||
}
|
||||
};
|
||||
|
||||
$scope.configureSchedule = function() {
|
||||
$state.transitionTo('managementJobsSchedule', {
|
||||
management_job: this.job_type,
|
||||
management_job_id: this.card.id
|
||||
$scope.configureSchedule = function(id) {
|
||||
$state.transitionTo('managementJobSchedules', {
|
||||
id: id
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<i class="MgmtCards-actionItemIcon fa fa-rocket"></i>
|
||||
</button>
|
||||
<button class="MgmtCards-actionItem List-actionButton"
|
||||
ng-click='configureSchedule()'>
|
||||
ng-click='configureSchedule(card.id)'>
|
||||
<i class="MgmtCards-actionItemIcon fa fa-calendar"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import managementJobsCard from './card/main';
|
||||
import managementJobsSchedule from './schedule/main';
|
||||
import managementJobsScheduler from './scheduler/main';
|
||||
import list from './management-jobs.list';
|
||||
|
||||
export default
|
||||
angular.module('managementJobs', [
|
||||
managementJobsCard.name,
|
||||
managementJobsSchedule.name
|
||||
managementJobsScheduler.name
|
||||
])
|
||||
.factory('managementJobsListObject', list);
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import route from './schedule.route';
|
||||
import controller from './schedule.controller';
|
||||
|
||||
export default
|
||||
angular.module('managementJobsSchedule', [])
|
||||
.controller('managementJobsScheduleController', controller)
|
||||
.run(['$stateExtender', function($stateExtender) {
|
||||
$stateExtender.addState(route);
|
||||
}]);
|
||||
@ -1,89 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name controllers.function:Schedules
|
||||
* @description This controller's for schedules
|
||||
*/
|
||||
|
||||
export default [
|
||||
'$scope', '$location', '$stateParams', 'SchedulesList', 'Rest',
|
||||
'ProcessErrors', 'GetBasePath', 'Wait','LoadSchedulesScope', 'GetChoices',
|
||||
'management_job', '$rootScope',
|
||||
function($scope, $location, $stateParams, SchedulesList, Rest,
|
||||
ProcessErrors, GetBasePath, Wait, LoadSchedulesScope, GetChoices,
|
||||
management_job, $rootScope) {
|
||||
var base, id, url, parentObject;
|
||||
$scope.management_job = management_job;
|
||||
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||
|
||||
// GetBasePath('management_job') must map to 'system_job_templates'
|
||||
// to match the api syntax
|
||||
$rootScope.defaultUrls.management_jobs = 'api/v1/system_job_templates/';
|
||||
|
||||
if ($scope.removePostRefresh) {
|
||||
$scope.removePostRefresh();
|
||||
}
|
||||
$scope.removePostRefresh = $scope.$on('PostRefresh', function() {
|
||||
var list = $scope.schedules;
|
||||
list.forEach(function(element, idx) {
|
||||
list[idx].play_tip = (element.enabled) ? 'Schedule is Active.'+
|
||||
' Click to temporarily stop.' : 'Schedule is temporarily '+
|
||||
'stopped. Click to activate.';
|
||||
});
|
||||
});
|
||||
|
||||
if ($scope.removeParentLoaded) {
|
||||
$scope.removeParentLoaded();
|
||||
}
|
||||
$scope.removeParentLoaded = $scope.$on('ParentLoaded', function() {
|
||||
url += "schedules/";
|
||||
SchedulesList.well = true;
|
||||
LoadSchedulesScope({
|
||||
parent_scope: $scope,
|
||||
scope: $scope,
|
||||
list: SchedulesList,
|
||||
id: 'management_jobs_schedule',
|
||||
url: url,
|
||||
pageSize: 20
|
||||
});
|
||||
});
|
||||
|
||||
if ($scope.removeChoicesReady) {
|
||||
$scope.removeChocesReady();
|
||||
}
|
||||
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
||||
// Load the parent object
|
||||
id = $stateParams.management_job_id;
|
||||
url = GetBasePath('system_job_templates') + id + '/';
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
parentObject = data;
|
||||
$scope.$emit('ParentLoaded');
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshJobs = function() {
|
||||
$scope.search(SchedulesList.iterator);
|
||||
};
|
||||
|
||||
Wait('start');
|
||||
|
||||
GetChoices({
|
||||
scope: $scope,
|
||||
url: GetBasePath('system_jobs'),
|
||||
field: 'type',
|
||||
variable: 'type_choices',
|
||||
callback: 'choicesReady'
|
||||
});
|
||||
}
|
||||
];
|
||||
@ -1,6 +0,0 @@
|
||||
<div class="tab-pane" id="management_jobs_schedule">
|
||||
<div ng-cloak id="htmlTemplate"></div>
|
||||
</div>
|
||||
|
||||
<div ng-include="'/static/partials/logviewer.html'"></div>
|
||||
<div ng-include="'/static/partials/schedule_dialog.html'"></div>
|
||||
@ -1,51 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'managementJobsSchedule',
|
||||
route: '/management_jobs/:management_job_id/schedules',
|
||||
templateUrl: templateUrl('management-jobs/schedule/schedule'),
|
||||
controller: 'managementJobsScheduleController',
|
||||
data: {
|
||||
activityStream: true,
|
||||
activityStreamTarget: 'schedule'
|
||||
},
|
||||
params: {management_job: null},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
management_job:
|
||||
[ '$stateParams',
|
||||
'$q',
|
||||
'Rest',
|
||||
'GetBasePath',
|
||||
'ProcessErrors',
|
||||
function($stateParams, $q, rest, getBasePath, ProcessErrors) {
|
||||
if ($stateParams.management_job) {
|
||||
return $q.when($stateParams.management_job);
|
||||
}
|
||||
|
||||
var managementJobId = $stateParams.management_job_id;
|
||||
|
||||
var url = getBasePath('system_job_templates') + managementJobId + '/';
|
||||
rest.setUrl(url);
|
||||
return rest.get()
|
||||
.then(function(data) {
|
||||
return data.data;
|
||||
}).catch(function (response) {
|
||||
ProcessErrors(null, response.data, response.status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get inventory script info. GET returned status: ' +
|
||||
response.status
|
||||
});
|
||||
});
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
52
awx/ui/client/src/management-jobs/scheduler/main.js
Normal file
52
awx/ui/client/src/management-jobs/scheduler/main.js
Normal file
@ -0,0 +1,52 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
|
||||
import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
import controller from '../../scheduler/scheduler.controller';
|
||||
import addController from '../../scheduler/schedulerAdd.controller';
|
||||
import editController from '../../scheduler/schedulerEdit.controller';
|
||||
|
||||
export default
|
||||
angular.module('managementJobScheduler', [])
|
||||
.controller('managementJobController', controller)
|
||||
.controller('managementJobAddController', addController)
|
||||
.controller('managementJobEditController', editController)
|
||||
.run(['$stateExtender', function($stateExtender){
|
||||
$stateExtender.addState({
|
||||
name: 'managementJobSchedules',
|
||||
route: '/management_jobs/:id/schedules',
|
||||
templateUrl: templateUrl('scheduler/scheduler'),
|
||||
controller: 'managementJobController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService){
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
});
|
||||
$stateExtender.addState({
|
||||
name: 'managementJobSchedules.add',
|
||||
route: '/add',
|
||||
templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'),
|
||||
controller: 'managementJobAddController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService){
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
});
|
||||
$stateExtender.addState({
|
||||
name: 'managementJobSchedules.edit',
|
||||
route: '/add',
|
||||
templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'),
|
||||
controller: 'managementJobEditController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService){
|
||||
return FeaturesService.get();
|
||||
}]
|
||||
}
|
||||
});
|
||||
}]);
|
||||
@ -0,0 +1,652 @@
|
||||
<div id="htmlTemplate" class=" SchedulerFormPanel Panel" ng-hide="hideForm">
|
||||
<div class="Form-header">
|
||||
<div class="Form-title" ng-show="!isEdit">{{ schedulerName || "Add Schedule"}}</div>
|
||||
<div class="Form-title" ng-show="isEdit">{{ schedulerName || "Edit Schedule"}}</div>
|
||||
<div class="Form-exitHolder">
|
||||
<button class="Form-exit" ng-click="formCancel()">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="SchedulerFormTarget">
|
||||
|
||||
<form class="form Form"
|
||||
role="form"
|
||||
name="scheduler_form_new"
|
||||
novalidate>
|
||||
|
||||
<div class="form-group SchedulerForm-formGroup">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
Name
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
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_new.$dirty && scheduler_form_new.schedulerName.$error.required">
|
||||
A schedule name is required.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group SchedulerForm-formGroup">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
Start Date
|
||||
<span class="fmt-help">
|
||||
(mm/dd/yyyy)
|
||||
</span>
|
||||
</label>
|
||||
<div class="input-group Form-inputGroup">
|
||||
<input type="text"
|
||||
class="form-control input-sm
|
||||
Form-textInput"
|
||||
name="schedulerStartDt"
|
||||
id="schedulerStartDt"
|
||||
ng-model="schedulerStartDt"
|
||||
sch-date-picker
|
||||
placeholder="mm/dd/yyyy"
|
||||
required
|
||||
ng-change="scheduleTimeChange()" >
|
||||
<span class="input-group-btn">
|
||||
<button
|
||||
class="btn btn-default btn-sm
|
||||
Form-inputButton Form-lookupButton"
|
||||
type="button"
|
||||
ng-click="showCalendar('schedulerStartDt')">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="error"
|
||||
ng-show="scheduler_form_schedulerStartDt_error"
|
||||
ng-bind="scheduler_form_schedulerStartDt_error">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group SchedulerForm-formGroup">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
Start Time
|
||||
<span class="fmt-help"
|
||||
ng-show="schedulerShowTimeZone">
|
||||
(HH24:MM:SS)
|
||||
</span>
|
||||
<span class="fmt-help"
|
||||
ng-show="!schedulerShowTimeZone">
|
||||
(HH24:MM:SS UTC)
|
||||
</span>
|
||||
</label>
|
||||
<div class="input-group SchedulerTime">
|
||||
<input name="schedulerStartHour"
|
||||
id="schedulerStartHour"
|
||||
sch-spinner="scheduler_form_new"
|
||||
class="scheduler-time-spinner
|
||||
ScheduleTime-input SpinnerInput"
|
||||
ng-model="schedulerStartHour"
|
||||
placeholder="HH24"
|
||||
aw-min="0" min="0" aw-max="23"
|
||||
max="23" data-zero-pad="2" required
|
||||
ng-change="scheduleTimeChange()" >
|
||||
<span
|
||||
class="SchedulerTime-separator">
|
||||
:
|
||||
</span>
|
||||
<input name="schedulerStartMinute"
|
||||
id="schedulerStartMinute"
|
||||
sch-spinner="scheduler_form_new"
|
||||
class="scheduler-time-spinner
|
||||
SchedulerTime-input SpinnerInput"
|
||||
ng-model="schedulerStartMinute"
|
||||
placeholder="MM"
|
||||
min="0" max="59" data-zero-pad="2"
|
||||
required
|
||||
ng-change="scheduleTimeChange()" >
|
||||
<span
|
||||
class="SchedulerTime-separator">
|
||||
:
|
||||
</span>
|
||||
<input name="schedulerStartSecond"
|
||||
id="schedulerStartSecond"
|
||||
sch-spinner="scheduler_form_new"
|
||||
class="scheduler-time-spinner
|
||||
SchedulerTime-input SpinnerInput"
|
||||
ng-model="schedulerStartSecond"
|
||||
placeholder="SS"
|
||||
min="0" max="59" data-zero-pad="2"
|
||||
required
|
||||
ng-change="scheduleTimeChange()" >
|
||||
<!-- <div class="form-group
|
||||
SchedulerTime-utc"
|
||||
ng-show="schedulerShowUTCStartTime">
|
||||
<label
|
||||
class="SchedulerTime-utcLabel">
|
||||
UTC Start Time
|
||||
</label>
|
||||
<div id="schedulerUTCTime"
|
||||
class="SchedulerTime-utcTime">
|
||||
{{ schedulerUTCTime.split("UTC")[0] }}
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="error"
|
||||
ng-show="scheduler_startTime_error">
|
||||
The time must be in HH24:MM:SS format.
|
||||
</div>
|
||||
</div>
|
||||
<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"
|
||||
ng-options="z.name for z in timeZones"
|
||||
required class="form-control input-sm"
|
||||
ng-change="scheduleTimeChange()" >
|
||||
</select>
|
||||
</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"
|
||||
ng-change="scheduleRepeatChange()">
|
||||
</select>
|
||||
<div class="error"
|
||||
ng-show="sheduler_frequency_error">
|
||||
</div>
|
||||
</div>
|
||||
<div class="RepeatFrequencyOptions-label"
|
||||
ng-show="schedulerFrequency.value && schedulerFrequency.value !== 'none'">
|
||||
Frequency Details</div>
|
||||
<div class="RepeatFrequencyOptions Form"
|
||||
ng-show="schedulerFrequency.value && schedulerFrequency.value !== 'none'">
|
||||
<div class="form-group
|
||||
RepeatFrequencyOptions-everyGroup
|
||||
RepeatFrequencyOptions-formGroup"
|
||||
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_new"
|
||||
class="scheduler-spinner
|
||||
SpinnerInput"
|
||||
ng-model="$parent.schedulerInterval"
|
||||
min="1"
|
||||
max="999"
|
||||
ng-change="resetError('scheduler_interval_error')"
|
||||
>
|
||||
<label class="inline-label
|
||||
RepeatFrequencyOptions-inlineLabel"
|
||||
ng-bind="schedulerIntervalLabel">
|
||||
</label>
|
||||
<div
|
||||
class="error
|
||||
RepeatFrequencyOptions-error"
|
||||
ng-show="$parent.scheduler_interval_error">
|
||||
Please provide a value between 1 and 999.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerFrequency && schedulerFrequency.value == 'monthly'">
|
||||
<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()"
|
||||
name="monthlyRepeatOption"
|
||||
id="monthlyRepeatOption">
|
||||
on day
|
||||
</label>
|
||||
</div>
|
||||
<input
|
||||
name="monthDay"
|
||||
id="monthDay"
|
||||
sch-spinner="scheduler_form_new"
|
||||
class="scheduler-spinner SpinnerInput"
|
||||
ng-model="$parent.monthDay"
|
||||
min="1" max="31"
|
||||
ng-change="resetError('scheduler_monthDay_error')" >
|
||||
<div class="error"
|
||||
ng-show="$parent.scheduler_monthDay_error">
|
||||
The day must be between 1 and 31.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group
|
||||
RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerFrequency && schedulerFrequency.value == 'monthly'">
|
||||
<div class="radio
|
||||
RepeatFrequencyOptions-radioLabel">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
<input type="radio"
|
||||
value="other"
|
||||
ng-model="$parent.monthlyRepeatOption"
|
||||
ng-change="monthlyRepeatChange()"
|
||||
name="monthlyRepeatOption"
|
||||
id="monthlyRepeatOption">
|
||||
on the
|
||||
</label>
|
||||
</div>
|
||||
<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"
|
||||
ng-model="$parent.yearlyRepeatOption"
|
||||
ng-change="yearlyRepeatChange()"
|
||||
name="yearlyRepeatOption"
|
||||
id="yearlyRepeatOption">
|
||||
on
|
||||
</label>
|
||||
</div>
|
||||
<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.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group
|
||||
RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerFrequency && schedulerFrequency.value == 'yearly'">
|
||||
<div class="radio
|
||||
RepeatFrequencyOptions-radioLabel">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
<input type="radio"
|
||||
value="other"
|
||||
ng-model="$parent.yearlyRepeatOption"
|
||||
ng-change="yearlyRepeatChange()"
|
||||
name="yearlyRepeatOption"
|
||||
id="yearlyRepeatOption">
|
||||
on the
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="RepeatFrequencyOptions-inputGroup
|
||||
RepeatFrequencyOptions-inputGroup--thirds"
|
||||
>
|
||||
<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
|
||||
RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerFrequency && schedulerFrequency.value == 'weekly'">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
On Days
|
||||
</label>
|
||||
<div class="input-group
|
||||
RepeatFrequencyOptions-weekButtonContainer">
|
||||
<div class="btn-group
|
||||
RepeatFrequencyOptions-weekButtonGroup"
|
||||
data-toggle="buttons-checkbox"
|
||||
id="weekdaySelect">
|
||||
<button type="button"
|
||||
ng-class="weekDaySUClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="SU"
|
||||
ng-click="$parent.setWeekday($event,'su')">
|
||||
Sun
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDayMOClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="MO"
|
||||
ng-click="$parent.setWeekday($event,'mo')">
|
||||
Mon
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDayTUClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="TU"
|
||||
ng-click="$parent.setWeekday($event,'tu')">
|
||||
Tue
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDayWEClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="WE"
|
||||
ng-click="$parent.setWeekday($event,'we')">
|
||||
Wed
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDayTHClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="TH"
|
||||
ng-click="$parent.setWeekday($event,'th')">
|
||||
Thu
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDayFRClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="FR"
|
||||
ng-click="$parent.setWeekday($event,'fr')">
|
||||
Fri
|
||||
</button>
|
||||
<button type="button"
|
||||
ng-class="weekDaySAClass"
|
||||
class="btn btn-default
|
||||
RepeatFrequencyOptions-weekButton"
|
||||
data-value="SA"
|
||||
ng-click="$parent.setWeekday($event,'sa')">
|
||||
Sat
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="error"
|
||||
ng-show="$parent.scheduler_weekDays_error">
|
||||
Please select one or more days.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group
|
||||
RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerShowInterval">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
End
|
||||
</label>
|
||||
<div>
|
||||
<select id="schedulerEnd"
|
||||
name="schedulerEnd"
|
||||
ng-model="$parent.schedulerEnd"
|
||||
ng-options="e.name for e in endOptions"
|
||||
required
|
||||
class="MakeSelect2
|
||||
form-control input-sm"
|
||||
ng-change="schedulerEndChange()">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group
|
||||
RepeatFrequencyOptions-everyGroup
|
||||
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_new"
|
||||
class="scheduler-spinner
|
||||
SpinnerInput"
|
||||
ng-model="$parent.schedulerOccurrenceCount"
|
||||
min="1" max="999"
|
||||
on-change="resetError('scheduler_occurrenceCount_error')"
|
||||
>
|
||||
<div class="error
|
||||
RepeatFrequencyOptions-error"
|
||||
ng-show="$parent.scheduler_occurrenceCount_error">
|
||||
Please provide a value between 1 and 999.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group RepeatFrequencyOptions-formGroup"
|
||||
ng-if="schedulerEnd && schedulerEnd.value == 'on'">
|
||||
<label class="Form-inputLabel">
|
||||
<span class="red-text">*</span>
|
||||
End Date
|
||||
<span class="fmt-help">
|
||||
(mm/dd/yyyy)
|
||||
</span>
|
||||
</label>
|
||||
<div class="input-group Form-inputGroup">
|
||||
<input type="text"
|
||||
name="schedulerEndDt"
|
||||
id="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="$parent.resetError('scheduler_endDt_error')">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-sm
|
||||
Form-inputButton Form-lookupButton"
|
||||
type="button"
|
||||
ng-click="showCalendar('schedulerEndDt')"
|
||||
>
|
||||
<i class="fa fa-calendar"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="error"
|
||||
ng-show="$parent.scheduler_endDt_error">
|
||||
Please provide a valid date.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="RepeatFrequencyOptions-subFormBorderFixer"
|
||||
ng-show="schedulerFrequency.value && schedulerFrequency.value !== 'none'">
|
||||
</div>
|
||||
<!-- start management job fields -->
|
||||
<div class="factDetailsNote" ng-if="isFactCleanup">
|
||||
<span class="factDetailsHeader">Note:</span> For facts collected older than the time period specified, save one fact scan (snapshot) per time window (frequency). For example, facts older than 30 days are purged, while one weekly fact scan is kept.
|
||||
Caution: Setting both numerical variables to "0" will delete all facts.</div>
|
||||
|
||||
<div class="form-group" ng-if="cleanupJob && !isFactCleanup">
|
||||
<label class="Form-inputLabel"><span class="red-text">*</span> Days of data to keep</label>
|
||||
<input type="number" class="form-control input-sm" name="schedulerPurgeDays" id="schedulerPurgeDays" min="1" ng-model="schedulerPurgeDays" required placeholder="Days of data to keep">
|
||||
<div class="error" ng-show="scheduler_form.schedulerPurgeDays.$dirty && scheduler_form.schedulerPurgeDays.$error.required">A value is required.</div>
|
||||
<div class="error" ng-show="scheduler_form.schedulerPurgeDays.$error.number">This is not a valid number.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group cleanupStretcher factDaysToKeepCompacter" ng-if="isFactCleanup">
|
||||
<div class="col-md-12">
|
||||
<label class="Form-inputLabel"><span class="red-text">*</span> Select a time period after which to remove old facts</label>
|
||||
</div>
|
||||
<div class="col-md-6 inputSpacer inputCompactMobile">
|
||||
<input type="number" id="keep_amount" name="keep_amount" ng-model="keep_amount" ng-required="true" class="form-control input-sm" aw-min=0 aw-max=9999 integer></input>
|
||||
<div class="error" ng-show="scheduler_form.keep_amount.$dirty && scheduler_form.keep_amount.$error.required">Please enter the number of days you would like to keep this data.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.keep_amount.$error.number || scheduler_form.keep_amount.$error.integer" >Please enter a valid number.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.keep_amount.$error.awMin">Please enter a non-negative number.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.keep_amount.$error.awMax">Please enter a number smaller than 9999.</div>
|
||||
</div>
|
||||
<div class="col-md-6 inputSpacer">
|
||||
<select id="keep_unit" name="keep_unit" ng-model="keep_unit" ng-options="type.label for type in keep_unit_choices track by type.value" ng-required="true" class="form-control input-sm"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group cleanupStretcher" ng-if="isFactCleanup">
|
||||
<div class="col-md-12">
|
||||
<label class="Form-inputLabel"><span class="red-text">*</span> Select a frequency for snapshot retention</label>
|
||||
</div>
|
||||
<div class="col-md-6 inputSpacer inputCompactMobile">
|
||||
<input type="number" class="form-control input-sm" id="granularity_keep_amount" name="granularity_keep_amount" ng-model="granularity_keep_amount" ng-required="true" aw-min=0 aw-max=9999 >
|
||||
<div class="error" ng-show="scheduler_form.granularity_keep_amount.$dirty && scheduler_form.granularity_keep_amount.$error.required">Please enter the number of days you would like to keep this data.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.granularity_keep_amount.$error.number || scheduler_form.granularity_keep_amount.$error.integer" >Please enter a valid number.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.granularity_keep_amount.$error.awMin">Please enter a non-negative number.</div>
|
||||
<div class="error survey_error" ng-show="scheduler_form.granularity_keep_amount.$error.awMax">Please enter a number smaller than 9999.</div>
|
||||
</div>
|
||||
<div class="col-md-6 inputSpacer">
|
||||
<select id="granularity_keep_unit" name="granularity_keep_unit" ng-model="granularity_keep_unit" ng-options="type.label for type in granularity_keep_unit_choices track by type.value" ng-required="true" class="form-control input-sm"></select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end management job fields -->
|
||||
</form>
|
||||
<div class="SchedulerFormDetail-container
|
||||
SchedulerFormDetail-container--error"
|
||||
ng-show="!schedulerIsValid && scheduler_form_new.$dirty">
|
||||
<p class="SchedulerFormDetail-errorText">
|
||||
The scheduler options are invalid or incomplete.
|
||||
</p>
|
||||
</div>
|
||||
<div class="SchedulerFormDetail-container"
|
||||
ng-show="schedulerIsValid">
|
||||
<label class="SchedulerFormDetail-label">
|
||||
Description
|
||||
</label>
|
||||
<div class="SchedulerFormDetail-nlp">
|
||||
{{ rrule_nlp_description }}
|
||||
</div>
|
||||
<div class="SchedulerFormDetail-occurrenceHeader">
|
||||
<label class="SchedulerFormDetail-label
|
||||
SchedulerFormDetail-labelOccurrence">
|
||||
Occurrences
|
||||
<span
|
||||
class="SchedulerFormDetail-labelDetail">
|
||||
(Limited to first 10)
|
||||
</span>
|
||||
</label>
|
||||
<div id="date-choice"
|
||||
class="SchedulerFormDetail-dateFormats">
|
||||
<label
|
||||
class="SchedulerFormDetail-dateFormatsLabel">
|
||||
Date format
|
||||
</label>
|
||||
<label class="radio-inline
|
||||
SchedulerFormDetail-radioLabel">
|
||||
<input type="radio"
|
||||
class="SchedulerFormDetail-radioButton"
|
||||
ng-model="dateChoice"
|
||||
id="date-choice-local"
|
||||
value="local" >
|
||||
Local time
|
||||
</label>
|
||||
<label class="radio-inline
|
||||
SchedulerFormDetail-radioLabel">
|
||||
<input type="radio"
|
||||
class="SchedulerFormDetail-radioButton"
|
||||
ng-model="dateChoice"
|
||||
id="date-choice-utc"
|
||||
value="utc" >
|
||||
UTC
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="occurrence-list mono-space
|
||||
SchedulerFormDetail-occurrenceList"
|
||||
ng-show="dateChoice == 'utc'">
|
||||
<li ng-repeat="occurrence in occurrence_list">
|
||||
{{ occurrence.utc }}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="occurrence-list mono-space
|
||||
SchedulerFormDetail-occurrenceList"
|
||||
ng-show="dateChoice == 'local'">
|
||||
<li ng-repeat="occurrence in occurrence_list">
|
||||
{{ occurrence.local }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="buttons Form-buttons">
|
||||
<button type="button"
|
||||
class="btn btn-sm Form-saveButton"
|
||||
id="project_save_btn"
|
||||
ng-click="saveSchedule()"
|
||||
ng-disabled="!schedulerIsValid"> Save</button>
|
||||
<button type="button"
|
||||
class="btn btn-sm Form-cancelButton"
|
||||
id="project_cancel_btn"
|
||||
ng-click="formCancel()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,4 +1,5 @@
|
||||
<div class="tab-pane" id="inventory_edit">
|
||||
<div ui-view></div>
|
||||
<div ng-cloak id="htmlTemplate">
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -32,4 +32,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="lookup-modal-dialog" style="display:none"> </div>
|
||||
<div id="LookupModal-dialog" style="display:none"> </div>
|
||||
|
||||
@ -21,9 +21,13 @@ export default [
|
||||
ClearScope();
|
||||
|
||||
var base, e, id, url, parentObject;
|
||||
|
||||
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||
|
||||
if (base == 'management_jobs') {
|
||||
$scope.base = base = 'system_job_templates';
|
||||
}
|
||||
if ($stateParams.job_type){
|
||||
$scope.job_type = $stateParams.job_type;
|
||||
}
|
||||
if ($scope.removePostRefresh) {
|
||||
$scope.removePostRefresh();
|
||||
}
|
||||
|
||||
@ -47,7 +47,8 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
|
||||
|
||||
AddSchedule({
|
||||
scope: $scope,
|
||||
callback: 'SchedulesRefresh'
|
||||
callback: 'SchedulesRefresh',
|
||||
base: $scope.base ? $scope.base : null
|
||||
});
|
||||
|
||||
var callSelect2 = function() {
|
||||
|
||||
@ -51,7 +51,8 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
|
||||
EditSchedule({
|
||||
scope: $scope,
|
||||
id: parseInt($stateParams.schedule_id),
|
||||
callback: 'SchedulesRefresh'
|
||||
callback: 'SchedulesRefresh',
|
||||
base: $scope.base ? $scope.base: null
|
||||
});
|
||||
|
||||
var callSelect2 = function() {
|
||||
|
||||
@ -106,7 +106,7 @@ angular.module('ModalDialog', ['Utilities', 'ParseHelper'])
|
||||
resizable: resizable,
|
||||
create: function () {
|
||||
// Fix the close button
|
||||
$('.ui-dialog[aria-describedby="' + id + '"]').find('.ui-dialog-titlebar button').empty().attr({'class': 'close'}).text('x');
|
||||
$('.ui-dialog[aria-describedby="' + id + '"]').find('.ui-dialog-titlebar button').empty().attr({'class': 'close'}).html('<i class="fa fa-times-circle"></i>');
|
||||
|
||||
setTimeout(function() {
|
||||
// Make buttons bootstrapy
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
@default-err-hov: #FF1105;
|
||||
@default-succ: #3CB878;
|
||||
@default-succ-hov: #60D66F;
|
||||
@default-succ-disabled: lighten(@default-succ, 30);
|
||||
@default-link: #1678C4;
|
||||
@default-link-hov: #4498DA;
|
||||
@default-button-hov: #F2F2F2;
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
@blue-dark: #2a6496; /* link hover */
|
||||
@grey: #A9A9A9;
|
||||
@grey-txt: #707070;
|
||||
@grey-border: #DDDDDD;
|
||||
@info: #d9edf7; /* alert info background color */
|
||||
@info-border: #bce8f1; /* alert info border color */
|
||||
@info-color: #3a87ad;
|
||||
|
||||
@ -1476,6 +1476,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
}
|
||||
html += "</div>\n";
|
||||
} else {
|
||||
var inSubForm = false;
|
||||
var currentSubForm = undefined;
|
||||
var hasSubFormField;
|
||||
// original, single-column form
|
||||
section = '';
|
||||
group = '';
|
||||
@ -1502,9 +1505,33 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "<div" + sectionShow + ">\n";
|
||||
section = field.section;
|
||||
}
|
||||
|
||||
// To hide/show the subform when the value changes on parent
|
||||
if (field.hasSubForm === true) {
|
||||
hasSubFormField = fld;
|
||||
}
|
||||
|
||||
// Add a subform container
|
||||
if(field.subForm && currentSubForm === undefined) {
|
||||
currentSubForm = field.subForm;
|
||||
var subFormTitle = this.form.subFormTitles[field.subForm];
|
||||
|
||||
html += '<div class="Form-subForm '+ currentSubForm + '" ng-hide="'+ hasSubFormField + '.value === undefined"> ';
|
||||
html += '<span class="Form-subForm--title">'+ subFormTitle +'</span>';
|
||||
}
|
||||
else if (!field.subForm && currentSubForm !== undefined) {
|
||||
currentSubForm = undefined;
|
||||
html += '</div></div> ';
|
||||
}
|
||||
|
||||
html += this.buildField(fld, field, options, this.form);
|
||||
|
||||
}
|
||||
}
|
||||
if (currentSubForm) {
|
||||
currentSubForm = undefined;
|
||||
html += '</div>';
|
||||
}
|
||||
if (section !== '') {
|
||||
html += "</div>\n</div>\n";
|
||||
}
|
||||
|
||||
@ -299,44 +299,47 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
list = this.list,
|
||||
base, size, action, fld, cnt, field_action, fAction, itm;
|
||||
|
||||
if(options.title !== false){
|
||||
html += "<div class=\"List-header\">";
|
||||
html += "<div class=\"List-title\">";
|
||||
if (options.mode !== 'lookup') {
|
||||
if(options.title !== false){
|
||||
html += "<div class=\"List-header\">";
|
||||
html += "<div class=\"List-title\">";
|
||||
|
||||
if (list.listTitle) {
|
||||
if (list.listTitle) {
|
||||
|
||||
html += "<div class=\"List-titleText\">" + list.listTitle + "</div>";
|
||||
// We want to show the list title badge by default and only hide it when the list config specifically passes a false flag
|
||||
list.listTitleBadge = (typeof list.listTitleBadge === 'boolean' && list.listTitleBadge == false) ? false : true;
|
||||
if(list.listTitleBadge) {
|
||||
html += "<span class=\"badge List-titleBadge\">{{(" + list.iterator + "_total_rows | number:0)}}</span>";
|
||||
}
|
||||
html += "<div class=\"List-titleText\">" + list.listTitle + "</div>";
|
||||
// We want to show the list title badge by default and only hide it when the list config specifically passes a false flag
|
||||
list.listTitleBadge = (typeof list.listTitleBadge === 'boolean' && list.listTitleBadge == false) ? false : true;
|
||||
if(list.listTitleBadge) {
|
||||
html += "<span class=\"badge List-titleBadge\">{{(" + list.iterator + "_total_rows | number:0)}}</span>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
if(list.toolbarAuxAction) {
|
||||
html += "<div class=\"List-auxAction\">";
|
||||
html += list.toolbarAuxAction;
|
||||
html += "</div>";
|
||||
}
|
||||
html += "<div class=\"List-actions\">";
|
||||
html += "<div class=\"list-actions\" ng-include=\"'" +
|
||||
templateUrl('shared/list-generator/list-actions') +
|
||||
"'\">\n";
|
||||
|
||||
for (action in list.actions) {
|
||||
list.actions[action] = _.defaults(list.actions[action], { dataPlacement: "top" });
|
||||
}
|
||||
|
||||
html += "</div>\n";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
if(list.toolbarAuxAction) {
|
||||
html += "<div class=\"List-auxAction\">";
|
||||
html += list.toolbarAuxAction;
|
||||
html += "</div>";
|
||||
}
|
||||
html += "<div class=\"List-actions\">";
|
||||
html += "<div class=\"list-actions\" ng-include=\"'" +
|
||||
templateUrl('shared/list-generator/list-actions') +
|
||||
"'\">\n";
|
||||
|
||||
for (action in list.actions) {
|
||||
list.actions[action] = _.defaults(list.actions[action], { dataPlacement: "top" });
|
||||
}
|
||||
|
||||
html += "</div>\n";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
if (options.mode === 'edit' && list.editInstructions) {
|
||||
html += "<div class=\"alert alert-info alert-block\">\n";
|
||||
html += "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n";
|
||||
html += "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"fa fa-times-circle\"></i></button>\n";
|
||||
html += "<strong>Hint: </strong>" + list.editInstructions + "\n";
|
||||
html += "</div>\n";
|
||||
}
|
||||
@ -356,7 +359,6 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
html += "<div class=\"List-noItems\" ng-show=\"" + list.iterator + "Loading == false && " + list.iterator + "_active_search == false && " + list.iterator + "_total_rows < 1\">";
|
||||
html += (list.emptyListText) ? list.emptyListText : "PLEASE ADD ITEMS TO THIS LIST";
|
||||
html += "</div>";
|
||||
|
||||
if (options.showSearch=== undefined || options.showSearch === true) {
|
||||
// Only show the search bar if we are loading results or if we have at least 1 base result
|
||||
html += "<div class=\"row List-searchRow\" ng-show=\"" + list.iterator + "Loading == true || " + list.iterator + "_active_search == true || (" + list.iterator + "Loading == false && " + list.iterator + "_active_search == false && " + list.iterator + "_total_rows > 0)\">\n";
|
||||
@ -459,6 +461,20 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
innerTable += '<td class="col-xs-1 select-column List-tableCell"><select-list-item item=\"' + list.iterator + '\"></select-list-item></td>';
|
||||
}
|
||||
|
||||
// Change layout if a lookup list, place radio buttons before labels
|
||||
if (options.mode === 'lookup') {
|
||||
if(options.input_type==="radio"){ //added by JT so that lookup forms can be either radio inputs or check box inputs
|
||||
innerTable += "<td class=\"List-tableCell\"><input type=\"radio\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
|
||||
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator + "(" + list.iterator + ".id, true)\" ng-value=\"1\" " +
|
||||
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
|
||||
}
|
||||
else { // its assumed that options.input_type = checkbox
|
||||
innerTable += "<td class=\"List-tableCell\"><input type=\"checkbox\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
|
||||
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator + "(" + list.iterator + ".id, true)\" ng-true-value=\"1\" " +
|
||||
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
|
||||
}
|
||||
}
|
||||
|
||||
cnt = 2;
|
||||
base = (list.base) ? list.base : list.name;
|
||||
base = base.replace(/^\//, '');
|
||||
@ -475,7 +491,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
}
|
||||
}
|
||||
|
||||
if (options.mode === 'select' || options.mode === 'lookup') {
|
||||
if (options.mode === 'select') {
|
||||
if(options.input_type==="radio"){ //added by JT so that lookup forms can be either radio inputs or check box inputs
|
||||
innerTable += "<td class=\"List-tableCell\"><input type=\"radio\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
|
||||
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator + "(" + list.iterator + ".id, true)\" ng-value=\"1\" " +
|
||||
@ -543,6 +559,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
}
|
||||
innerTable += "</td>\n";
|
||||
}
|
||||
|
||||
innerTable += "</tr>\n";
|
||||
|
||||
// Message for loading
|
||||
@ -611,7 +628,9 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
if (list.multiSelect) {
|
||||
html += buildSelectAll().prop('outerHTML');
|
||||
}
|
||||
|
||||
else if (options.mode === 'lookup') {
|
||||
html += "<th class=\"List-tableHeader col-lg-1 col-md-1 col-sm-2 col-xs-2\"></th>";
|
||||
}
|
||||
for (fld in list.fields) {
|
||||
if ((list.fields[fld].searchOnly === undefined || list.fields[fld].searchOnly === false) &&
|
||||
!(options.mode === 'lookup' && list.fields[fld].excludeModal === true)) {
|
||||
@ -643,9 +662,10 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
||||
html += "</th>\n";
|
||||
}
|
||||
}
|
||||
if (options.mode === 'select' || options.mode === 'lookup') {
|
||||
html += "<th class=\"List-tableHeader col-lg-1 col-md-1 col-sm-2 col-xs-2\">Select</th>";
|
||||
} else if (options.mode === 'edit' && list.fieldActions) {
|
||||
if (options.mode === 'select') {
|
||||
html += "<th class=\"List-tableHeader col-lg-1 col-md-1 col-sm-2 col-xs-2\">Select</th>";
|
||||
}
|
||||
else if (options.mode === 'edit' && list.fieldActions) {
|
||||
html += "<th class=\"List-tableHeader actions-column";
|
||||
html += (list.fieldActions && list.fieldActions.columnClass) ? " " + list.fieldActions.columnClass : "";
|
||||
html += "\">";
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<div class="StandardOut-detailsLabel">STATUS</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<i class="fa icon-job-{{ job.status }}"></i>
|
||||
<span class="StandardOut-statusText">{{ job.status }}</span>
|
||||
<span class="StandardOut-statusText StandardOut--capitalize">{{ job.status }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'adHocJobStdout',
|
||||
route: '/ad_hoc_commands/:id/stdout',
|
||||
route: '/ad_hoc_commands/:id',
|
||||
templateUrl: templateUrl('standard-out/adhoc/standard-out-adhoc'),
|
||||
controller: 'JobStdoutController',
|
||||
ncyBreadcrumb: {
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<div class="StandardOut-detailsRow" ng-show="inventory_source_name">
|
||||
<div class="StandardOut-detailsLabel">NAME</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<a href="/#/home/groups/?id={{ group }}">
|
||||
<a href="/#/home/groups?id={{ group }}">
|
||||
{{ inventory_source_name }}
|
||||
</a>
|
||||
</div>
|
||||
@ -21,13 +21,13 @@
|
||||
<div class="StandardOut-detailsLabel">STATUS</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<i class="fa icon-job-{{ job.status }}"></i>
|
||||
<span class="StandardOut-statusText">{{ job.status }}</span>
|
||||
<span class="StandardOut-statusText StandardOut--capitalize">{{ job.status }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="{{job.license_error !== null}}">
|
||||
<div class="StandardOut-detailsLabel">LICENSE ERROR</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.license_error }}
|
||||
</div>
|
||||
</div>
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="job.launch_type">
|
||||
<div class="StandardOut-detailsLabel">LAUNCH TYPE</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.launch_type }}
|
||||
</div>
|
||||
</div>
|
||||
@ -72,7 +72,7 @@
|
||||
<div class="StandardOut-detailsRow" ng-show="inventory_source_name">
|
||||
<div class="StandardOut-detailsLabel">GROUP</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<a href="/#/home/groups/?id={{ group }}">
|
||||
<a href="/#/home/groups?id={{ group }}">
|
||||
{{ inventory_source_name }}
|
||||
</a>
|
||||
</div>
|
||||
@ -94,14 +94,14 @@
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="{{ job.overwrite !== null }}">
|
||||
<div class="StandardOut-detailsLabel">OVERWRITE</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.overwrite }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="{{ job.overwrite_vars !== null }}">
|
||||
<div class="StandardOut-detailsLabel">OVERWRITE VARS</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.overwrite_vars }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,7 +10,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'inventorySyncStdout',
|
||||
route: '/inventory_sync/:id/stdout',
|
||||
route: '/inventory_sync/:id',
|
||||
templateUrl: templateUrl('standard-out/inventory-sync/standard-out-inventory-sync'),
|
||||
controller: 'JobStdoutController',
|
||||
ncyBreadcrumb: {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<div class="StandardOut-detailsLabel">STATUS</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<i class="fa icon-job-{{ job.status }}"></i>
|
||||
<span class="StandardOut-statusText">{{ job.status }}</span>
|
||||
<span class="StandardOut-statusText StandardOut--capitalize">{{ job.status }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="job.launch_type">
|
||||
<div class="StandardOut-detailsLabel">LAUNCH TYPE</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.launch_type }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -8,7 +8,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'managementJobStdout',
|
||||
route: '/management_jobs/:id/stdout',
|
||||
route: '/management_jobs/:id',
|
||||
templateUrl: templateUrl('standard-out/management-jobs/standard-out-management-jobs'),
|
||||
controller: 'JobStdoutController',
|
||||
ncyBreadcrumb: {
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<div class="StandardOut-detailsLabel">STATUS</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<i class="fa icon-job-{{ job.status }}"></i>
|
||||
<span class="StandardOut-statusText">{{ job.status }}</span>
|
||||
<span class="StandardOut-statusText StandardOut--capitalize">{{ job.status }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
<div class="StandardOut-detailsRow" ng-show="job.launch_type">
|
||||
<div class="StandardOut-detailsLabel">LAUNCH TYPE</div>
|
||||
<div class="StandardOut-detailsContent">
|
||||
<div class="StandardOut-detailsContent StandardOut--capitalize">
|
||||
{{ job.launch_type }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,7 +10,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'scmUpdateStdout',
|
||||
route: '/scm_update/:id/stdout',
|
||||
route: '/scm_update/:id',
|
||||
templateUrl: templateUrl('standard-out/scm-update/standard-out-scm-update'),
|
||||
controller: 'JobStdoutController',
|
||||
ncyBreadcrumb: {
|
||||
|
||||
@ -58,3 +58,18 @@
|
||||
.StandardOut-statusText {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.StandardOut--capitalize {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
@standardout-breakpoint: 900px;
|
||||
|
||||
@media screen and (max-width: @standardout-breakpoint) {
|
||||
.StandardOut {
|
||||
flex-direction: column;
|
||||
}
|
||||
.StandardOut-rightPanel {
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +158,6 @@ export function JobStdoutController ($location, $log, $rootScope, $scope, $compi
|
||||
}
|
||||
};
|
||||
|
||||
$(".StandardOut").height($("body").height() - 60);
|
||||
|
||||
Rest.setUrl(GetBasePath('base') + jobType + '/' + job_id + '/');
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
|
||||
@ -55,6 +55,7 @@ describe("adhoc.controller", function() {
|
||||
$provide.value('Wait', waitCallback);
|
||||
$provide.value('$stateExtender', stateExtenderCallback);
|
||||
$provide.value('$stateParams', angular.noop);
|
||||
$provide.value('$state', angular.noop);
|
||||
}]));
|
||||
|
||||
beforeEach("put $q in scope", window.inject(['$q', function($q) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user