1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #2290 from Haokun-Chen/2254

update jobs/schedules to schedules in route and breadcrumb
This commit is contained in:
Haokun Chen 2018-06-25 10:24:36 -04:00 committed by GitHub
commit fb56585636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 13 deletions

View File

@ -2,13 +2,13 @@
<div class="tab-pane" id="jobs-page"> <div class="tab-pane" id="jobs-page">
<at-panel ng-cloak id="htmlTemplate"> <at-panel ng-cloak id="htmlTemplate">
<div> <div>
<div ng-hide="$state.includes('jobs.schedules')"> <div ng-hide="$state.includes('schedules')">
<at-panel-heading hide-dismiss="true"> <at-panel-heading hide-dismiss="true">
<translate>JOBS</translate> <translate>JOBS</translate>
</at-panel-heading> </at-panel-heading>
<div ui-view="jobsList"></div> <div ui-view="jobsList"></div>
</div> </div>
<div ng-hide="!$state.includes('jobs.schedules')"> <div ng-hide="!$state.includes('schedules')">
<at-panel-heading hide-dismiss="true"> <at-panel-heading hide-dismiss="true">
<translate>SCHEDULES</translate> <translate>SCHEDULES</translate>
</at-panel-heading> </at-panel-heading>

View File

@ -45,6 +45,27 @@ function LegacyRedirect ($stateRegistry) {
return { state: destination, params: { type: 'project', id } }; return { state: destination, params: { type: 'project', id } };
} }
}, },
{
name: 'legacySchedulesList',
url: '/jobs/schedules?schedule_search',
redirectTo: (trans) => {
const {
schedule_search // eslint-disable-line camelcase
} = trans.params();
return { state: 'schedules', params: { schedule_search } };
}
},
{
name: 'legacySchedule',
url: '/jobs/schedules/:schedule_id?schedule_search',
redirectTo: (trans) => {
const {
schedule_id, // eslint-disable-line camelcase
schedule_search // eslint-disable-line camelcase
} = trans.params();
return { state: 'schedules.edit', params: { schedule_id, schedule_search } };
}
},
]; ];
routes.forEach(state => $stateRegistry.register(state)); routes.forEach(state => $stateRegistry.register(state));

View File

@ -40,7 +40,7 @@
</at-side-nav-item> </at-side-nav-item>
<at-side-nav-item icon-class="fa-spinner" route="jobs" name="JOBS"> <at-side-nav-item icon-class="fa-spinner" route="jobs" name="JOBS">
</at-side-nav-item> </at-side-nav-item>
<at-side-nav-item icon-class="fa-calendar" route="jobs.schedules" name="SCHEDULES"> <at-side-nav-item icon-class="fa-calendar" route="schedules" name="SCHEDULES">
</at-side-nav-item> </at-side-nav-item>
<at-side-nav-item icon-class="fa-columns" route="portalMode.myJobs" name="MY_VIEW"> <at-side-nav-item icon-class="fa-columns" route="portalMode.myJobs" name="MY_VIEW">
</at-side-nav-item> </at-side-nav-item>

View File

@ -11,7 +11,7 @@ function AtSideNavItemController ($scope, strings) {
if ($scope.name === 'portal mode') { if ($scope.name === 'portal mode') {
vm.isRoute = (current && current.indexOf('portalMode') === 0); vm.isRoute = (current && current.indexOf('portalMode') === 0);
} else if (current && current.indexOf($scope.route) === 0) { } else if (current && current.indexOf($scope.route) === 0) {
if (current.indexOf('jobs.schedules') === 0 && $scope.route === 'jobs') { if (current.indexOf('schedules') === 0 && $scope.route === 'jobs') {
vm.isRoute = false; vm.isRoute = false;
} else { } else {
vm.isRoute = true; vm.isRoute = true;

View File

@ -101,7 +101,7 @@ export default [
} }
buildTooltips(itm); buildTooltips(itm);
if (!$state.is('jobs.schedules')){ if (!$state.is('schedules')){
if($state.current.name.endsWith('.add')) { if($state.current.name.endsWith('.add')) {
itm.linkToDetails = `^.edit({schedule_id:schedule.id})`; itm.linkToDetails = `^.edit({schedule_id:schedule.id})`;
} }
@ -157,8 +157,8 @@ export default [
}; };
$scope.editSchedule = function(schedule) { $scope.editSchedule = function(schedule) {
if ($state.is('jobs.schedules')){ if ($state.is('schedules')){
$state.go('jobs.schedules.edit', {schedule_id: schedule.id}); $state.go('schedules.edit', {schedule_id: schedule.id});
} }
else { else {
if($state.current.name.endsWith('.add')) { if($state.current.name.endsWith('.add')) {

View File

@ -269,7 +269,7 @@ const projectsSchedulesEditRoute = {
const jobsSchedulesRoute = { const jobsSchedulesRoute = {
searchPrefix: 'schedule', searchPrefix: 'schedule',
name: 'jobs.schedules', name: 'schedules',
route: '/schedules', route: '/schedules',
params: { params: {
schedule_search: { schedule_search: {
@ -284,7 +284,6 @@ const jobsSchedulesRoute = {
activityStream: false, activityStream: false,
}, },
ncyBreadcrumb: { ncyBreadcrumb: {
parent: 'jobs',
label: N_('SCHEDULES') label: N_('SCHEDULES')
}, },
resolve: { resolve: {
@ -312,8 +311,9 @@ const jobsSchedulesRoute = {
}] }]
}, },
views: { views: {
'schedulesList@jobs': { '@': {
templateProvider: function(ScheduleList, generateList){ templateProvider: function(ScheduleList, generateList){
ScheduleList.well = true;
let html = generateList.build({ let html = generateList.build({
list: ScheduleList, list: ScheduleList,
mode: 'edit', mode: 'edit',
@ -339,14 +339,14 @@ const parentResolve = {
}; };
const jobsSchedulesEditRoute = { const jobsSchedulesEditRoute = {
name: 'jobs.schedules.edit', name: 'schedules.edit',
route: '/:schedule_id', route: '/:schedule_id',
ncyBreadcrumb: { ncyBreadcrumb: {
parent: 'jobs.schedules', parent: 'schedules',
label: "{{breadcrumb.schedule_name}}" label: "{{breadcrumb.schedule_name}}"
}, },
views: { views: {
'scheduler@jobs': { '@': {
controller: 'schedulerEditController', controller: 'schedulerEditController',
templateUrl: templateUrl("scheduler/schedulerForm"), templateUrl: templateUrl("scheduler/schedulerForm"),
} }