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">
<at-panel ng-cloak id="htmlTemplate">
<div>
<div ng-hide="$state.includes('jobs.schedules')">
<div ng-hide="$state.includes('schedules')">
<at-panel-heading hide-dismiss="true">
<translate>JOBS</translate>
</at-panel-heading>
<div ui-view="jobsList"></div>
</div>
<div ng-hide="!$state.includes('jobs.schedules')">
<div ng-hide="!$state.includes('schedules')">
<at-panel-heading hide-dismiss="true">
<translate>SCHEDULES</translate>
</at-panel-heading>

View File

@ -45,6 +45,27 @@ function LegacyRedirect ($stateRegistry) {
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));

View File

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

View File

@ -11,7 +11,7 @@ function AtSideNavItemController ($scope, strings) {
if ($scope.name === 'portal mode') {
vm.isRoute = (current && current.indexOf('portalMode') === 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;
} else {
vm.isRoute = true;

View File

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

View File

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