awx/awx/ui/static/js/lists/Projects.js
Jared Tabor 79b79f0481 initial files for license diff directive
awLicenseFeature with show/hide

changed file locations

changing file location

adjusting controller logic to only return list of features

leveraging $rootScope instead of local storage

adding awFeature directive for lists/forms for activity stream button

Adding route resolvers and service for getting license

In order to get the license info from the API and not from local storage, the UI needs to hit hte API before loading any pages, therefore I've added route resolvers that will ensure that we have the appropriate data (license features) before navigating to a new page. I've also added the awFeature directive to the organizations list -> add-button and the ldap checkbox on the user form page.

adjusting alignment

fixing jshint errors

commting file for testings

adding tests for features service and features controller

adding features controller unit test
2015-05-04 11:34:38 -04:00

120 lines
4.2 KiB
JavaScript

/*********************************************
* Copyright (c) 2014 AnsibleWorks, Inc.
*
* Projects.js
* List view object for Project data model.
*
*
*/
export default
angular.module('ProjectsListDefinition', [])
.value('ProjectList', {
name: 'projects',
iterator: 'project',
selectTitle: 'Add Project',
editTitle: 'Projects',
selectInstructions: '<p>Select existing projects by clicking each project or checking the related checkbox. When finished, click the blue ' +
'<em>Select</em> button, located bottom right.</p><p>Create a new project by clicking the <i class=\"fa fa-plus\"></i> button.</p>',
index: false,
hover: true,
fields: {
status: {
label: 'Status',
iconOnly: true,
ngClick: 'showSCMStatus(project.id)',
awToolTip: '{{ project.statusTip }}',
dataTipWatch: 'project.statusTip',
dataPlacement: 'top',
icon: "icon-job-{{ project.statusIcon }}",
columnClass: "col-lg-1 col-md-1 col-sm-2 col-xs-2",
nosort: true,
searchType: 'select',
searchOptions: [], //set in the controller
excludeModal: true
},
name: {
key: true,
label: 'Name',
columnClass: "col-lg-5 col-md-4 col-sm-6 col-xs-6",
modalColumnClass: 'col-md-8'
},
last_updated: {
label: 'Last Updated',
filter: "date:'MM/dd/yy HH:mm:ss'",
columnClass: "col-lg-2 col-md-2 hidden-sm hidden-xs",
excludeModal: true,
searchable: false,
nosort: true
},
scm_type: {
label: 'Type',
searchType: 'select',
searchOptions: [], // will be set by Options call to projects resource
excludeModal: true,
columnClass: 'col-lg-2 col-md-2 hidden-sm hidden-xs'
}
},
actions: {
add: {
mode: 'all', // One of: edit, select, all
ngClick: 'addProject()',
awToolTip: 'Create a new project'
},
refresh: {
mode: 'all',
awToolTip: "Refresh the page",
ngClick: "refresh()",
ngShow: "socketStatus == 'error'"
},
stream: {
ngClick: "showActivity()",
awToolTip: "View Activity Stream",
mode: 'edit',
awFeature: 'activity_streams'
}
},
fieldActions: {
columnClass: 'col-lg-2 col-md-3 col-sm-4 col-xs-4',
scm_update: {
ngClick: 'SCMUpdate(project.id, $event)',
awToolTip: "{{ project.scm_update_tooltip }}",
dataTipWatch: "project.scm_update_tooltip",
ngClass: "project.scm_type_class",
dataPlacement: 'top'
},
schedule: {
mode: 'all',
ngClick: "editSchedules(project.id)",
awToolTip: "{{ project.scm_schedule_tooltip }}",
ngClass: "project.scm_type_class",
dataPlacement: 'top'
},
edit: {
ngClick: "editProject(project.id)",
awToolTip: 'Edit the project',
dataPlacement: 'top'
},
"delete": {
ngClick: "deleteProject(project.id, project.name)",
awToolTip: 'Delete the project',
ngShow: "project.status !== 'updating' && project.status !== 'running' && project.status !== 'pending'",
dataPlacement: 'top'
},
cancel: {
ngClick: "cancelUpdate(project.id, project.name)",
awToolTip: 'Cancel the SCM update',
ngShow: "project.status == 'updating' || project.status == 'running' || project.status == 'pending'",
dataPlacement: 'top'
}
}
});