本文整理汇总了TypeScript中core/navigation/state.provider.StateConfigProvider.addRewriteRule方法的典型用法代码示例。如果您正苦于以下问题:TypeScript provider.StateConfigProvider.addRewriteRule方法的具体用法?TypeScript provider.StateConfigProvider.addRewriteRule怎么用?TypeScript provider.StateConfigProvider.addRewriteRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/navigation/state.provider.StateConfigProvider
的用法示例。
在下文中一共展示了provider.StateConfigProvider.addRewriteRule方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
]).config((stateConfigProvider: StateConfigProvider) => {
stateConfigProvider.addToRootState({
name: 'infrastructure',
url: '/infrastructure?q',
reloadOnSearch: false,
views: {
'main@': {
templateUrl: require('./infrastructure.html'),
controller: 'InfrastructureCtrl',
controllerAs: 'ctrl'
}
},
data: {
pageTitleMain: {
label: 'Infrastructure'
}
}
});
stateConfigProvider.addRewriteRule('/', '/infrastructure');
stateConfigProvider.addRewriteRule('', '/infrastructure');
});
示例2: module
module(INFRASTRUCTURE_STATES, [STATE_CONFIG_PROVIDER]).config((stateConfigProvider: StateConfigProvider) => {
'ngInject';
stateConfigProvider.addToRootState({
name: 'search',
url: '/search?q&key&tab&name&account®ion&stack',
params: {
account: { dynamic: true, value: null },
key: { dynamic: true, value: null },
name: { dynamic: true, value: null },
q: { dynamic: true, value: null },
region: { dynamic: true, value: null },
stack: { dynamic: true, value: null },
tab: { dynamic: true, value: null },
},
views: {
'main@': {
template: `
<infrastructure-search-v1 ng-if="$resolve.version == 1" class="flex-fill"></infrastructure-search-v1>
<infrastructure-search-v2 ng-if="$resolve.version == 2" class="flex-fill"></infrastructure-search-v2>
`,
},
},
data: {
pageTitleMain: {
label: 'Search',
},
},
resolve: {
version: () => SETTINGS.searchVersion || 1,
},
});
stateConfigProvider.addToRootState({ name: 'infrastructure', url: '/search?q', redirectTo: 'home.search' });
stateConfigProvider.addRewriteRule('/infrastructure?q', '/search?q');
stateConfigProvider.addRewriteRule('', '/search');
stateConfigProvider.addRewriteRule('/', '/search');
});
示例3:
]).config((stateConfigProvider: StateConfigProvider, applicationStateProvider: ApplicationStateProvider) => {
const applicationsState: INestedState = {
name: 'applications',
url: '/applications',
views: {
'main@': {
component: Applications, $type: 'react',
}
},
data: {
pageTitleMain: {
label: 'Applications'
}
},
children: [],
};
applicationStateProvider.addParentState(applicationsState, 'main@');
stateConfigProvider.addToRootState(applicationsState);
stateConfigProvider.addRewriteRule('/applications/{application}', '/applications/{application}/clusters');
});
示例4: require
]).config((stateConfigProvider: StateConfigProvider, applicationStateProvider: ApplicationStateProvider) => {
const applicationsState: INestedState = {
name: 'applications',
url: '/applications',
views: {
'main@': {
templateUrl: require('../application/applications.html'),
controller: 'ApplicationsCtrl',
controllerAs: 'ctrl'
}
},
data: {
pageTitleMain: {
label: 'Applications'
}
},
children: [],
};
applicationStateProvider.addParentState(applicationsState, 'main@');
stateConfigProvider.addToRootState(applicationsState);
stateConfigProvider.addRewriteRule('/applications/{application}', '/applications/{application}/clusters');
});
示例5: require
]).config((stateConfigProvider: StateConfigProvider, applicationStateProvider: ApplicationStateProvider) => {
const dashboard: INestedState = {
name: 'dashboard',
url: '/dashboard',
views: {
detail: {
templateUrl: require('../projects/dashboard/dashboard.html'),
controller: 'ProjectDashboardCtrl',
controllerAs: 'vm',
},
},
data: {
pageTitleSection: {
title: 'Dashboard',
},
},
};
const project: INestedState = {
name: 'project',
url: '/projects/{project}',
resolve: {
projectConfiguration: [
'$stateParams',
($stateParams: IProjectStateParms) => {
return ProjectReader.getProjectConfig($stateParams.project).then(
(projectConfig: IProject) => projectConfig,
(): IProject => {
return {
id: null,
name: $stateParams.project,
email: null,
config: null,
notFound: true,
};
},
);
},
],
},
views: {
'main@': {
templateUrl: require('../projects/project.html'),
controller: 'ProjectCtrl',
controllerAs: 'vm',
},
},
data: {
pageTitleMain: {
field: 'project',
},
history: {
type: 'projects',
},
},
children: [dashboard],
};
const allProjects: INestedState = {
name: 'projects',
url: '/projects',
views: {
'main@': {
templateUrl: require('../projects/projects.html'),
controller: 'ProjectsCtrl',
controllerAs: 'ctrl',
},
},
data: {
pageTitleMain: {
label: 'Projects',
},
},
children: [project],
};
stateConfigProvider.addToRootState(allProjects);
stateConfigProvider.addToRootState(project);
applicationStateProvider.addParentState(project, 'detail', '/applications');
stateConfigProvider.addRewriteRule('/projects/{project}', '/projects/{project}/dashboard');
stateConfigProvider.addRewriteRule(
'/projects/{project}/applications/{application}',
'/projects/{project}/applications/{application}/clusters',
);
});
示例6: require
]).config((applicationStateProvider: ApplicationStateProvider, stateConfigProvider: StateConfigProvider) => {
const clusters: INestedState = {
name: 'clusters',
url: '/clusters',
views: {
'nav': {
templateUrl: require('../cluster/filter/filterNav.html'),
controller: 'ClusterFilterCtrl',
controllerAs: 'clustersFilters'
},
'master': {
templateUrl: require('../cluster/all.html'),
controller: 'AllClustersCtrl',
controllerAs: 'allClusters'
}
},
data: {
pageTitleSection: {
title: 'Clusters'
}
},
children: [],
};
const serverGroupDetails: INestedState = {
name: 'serverGroup',
url: '/serverGroupDetails/:provider/:accountId/:region/:serverGroup',
views: {
'detail@../insight': {
templateProvider: ['$templateCache', '$stateParams', 'cloudProviderRegistry',
($templateCache: ng.ITemplateCacheService,
$stateParams: IServerGroupStateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return $templateCache.get(cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsTemplateUrl'));
}],
controllerProvider: ['$stateParams', 'cloudProviderRegistry',
($stateParams: IServerGroupStateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsController');
}],
controllerAs: 'ctrl'
}
},
resolve: {
serverGroup: ['$stateParams', ($stateParams: IServerGroupStateParams) => {
return {
name: $stateParams.serverGroup,
accountId: $stateParams.accountId,
region: $stateParams.region,
};
}]
},
data: {
pageTitleDetails: {
title: 'Server Group Details',
nameParam: 'serverGroup',
accountParam: 'accountId',
regionParam: 'region'
},
history: {
type: 'serverGroups',
},
}
};
const multipleServerGroups: INestedState = {
name: 'multipleServerGroups',
url: '/multipleServerGroups',
views: {
'detail@../insight': {
templateUrl: require('../serverGroup/details/multipleServerGroups.view.html'),
controller: 'MultipleServerGroupsCtrl',
controllerAs: 'vm'
}
},
data: {
pageTitleDetails: {
title: 'Multiple Server Groups',
},
}
};
applicationStateProvider.addInsightState(clusters);
applicationStateProvider.addInsightDetailState(serverGroupDetails);
applicationStateProvider.addInsightDetailState(multipleServerGroups);
stateConfigProvider.addRewriteRule('/applications/{application}', '/applications/{application}/clusters');
});
示例7: require
]).config((applicationStateProvider: ApplicationStateProvider, stateConfigProvider: StateConfigProvider) => {
const clusters: INestedState = {
name: 'clusters',
url: `/clusters?${stateConfigProvider.paramsToQuery(filterModelConfig)}`,
views: {
'nav': {
template: '<cluster-filter app="$resolve.app"></cluster-filter>',
},
'master': {
templateUrl: require('../cluster/allClusters.html'),
controller: 'AllClustersCtrl',
controllerAs: 'ctrl'
}
},
redirectTo: (transition) => {
return transition.injector().getAsync('app').then((app: Application) => {
if (app.serverGroups.disabled) {
const relativeSref = app.dataSources.find(ds => ds.sref && !ds.disabled).sref;
const params = transition.params();
// Target the state relative to the `clusters` state
const options = { relative: transition.to().name };
// Up two state levels first
return transition.router.stateService.target('^.^' + relativeSref, params, options);
}
return null;
});
},
params: stateConfigProvider.buildDynamicParams(filterModelConfig),
data: {
pageTitleSection: {
title: 'Clusters'
}
},
children: [],
};
const serverGroupDetails: INestedState = {
name: 'serverGroup',
url: '/serverGroupDetails/:provider/:accountId/:region/:serverGroup',
views: {
'detail@../insight': {
templateProvider: ['$templateCache', '$stateParams', 'cloudProviderRegistry',
($templateCache: ng.ITemplateCacheService,
$stateParams: StateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return $templateCache.get(cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsTemplateUrl'));
}],
controllerProvider: ['$stateParams', 'cloudProviderRegistry',
($stateParams: StateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsController');
}],
controllerAs: 'ctrl'
}
},
resolve: {
serverGroup: ['$stateParams', ($stateParams: StateParams) => {
return {
name: $stateParams.serverGroup,
accountId: $stateParams.accountId,
region: $stateParams.region,
};
}]
},
data: {
pageTitleDetails: {
title: 'Server Group Details',
nameParam: 'serverGroup',
accountParam: 'accountId',
regionParam: 'region'
},
history: {
type: 'serverGroups',
},
}
};
const multipleServerGroups: INestedState = {
name: 'multipleServerGroups',
url: '/multipleServerGroups',
views: {
'detail@../insight': {
templateUrl: require('../serverGroup/details/multipleServerGroups.view.html'),
controller: 'MultipleServerGroupsCtrl',
controllerAs: 'vm'
}
},
data: {
pageTitleDetails: {
title: 'Multiple Server Groups',
},
}
};
applicationStateProvider.addInsightState(clusters);
applicationStateProvider.addInsightDetailState(serverGroupDetails);
applicationStateProvider.addInsightDetailState(multipleServerGroups);
stateConfigProvider.addRewriteRule('/applications/{application}', '/applications/{application}/clusters');
});
示例8: require
]).config((applicationStateProvider: ApplicationStateProvider, stateConfigProvider: StateConfigProvider) => {
const clusters: INestedState = {
name: 'clusters',
url: '/clusters',
views: {
'nav': {
template: '<cluster-filter app="$resolve.app"></cluster-filter>',
},
'master': {
templateUrl: require('../cluster/all.html'),
controller: 'AllClustersCtrl',
controllerAs: 'ctrl'
}
},
resolve: {
// prevents flash of filters if fetchOnDemand is enabled; catch any exceptions so the route resolves
// and deal with the exception in the AllClustersCtrl
ready: (app: Application) => app.getDataSource('serverGroups').ready().catch(() => null),
},
data: {
pageTitleSection: {
title: 'Clusters'
}
},
children: [],
};
const serverGroupDetails: INestedState = {
name: 'serverGroup',
url: '/serverGroupDetails/:provider/:accountId/:region/:serverGroup',
views: {
'detail@../insight': {
templateProvider: ['$templateCache', '$stateParams', 'cloudProviderRegistry',
($templateCache: ng.ITemplateCacheService,
$stateParams: IServerGroupStateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return $templateCache.get(cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsTemplateUrl'));
}],
controllerProvider: ['$stateParams', 'cloudProviderRegistry',
($stateParams: IServerGroupStateParams,
cloudProviderRegistry: CloudProviderRegistry) => {
return cloudProviderRegistry.getValue($stateParams.provider, 'serverGroup.detailsController');
}],
controllerAs: 'ctrl'
}
},
resolve: {
serverGroup: ['$stateParams', ($stateParams: IServerGroupStateParams) => {
return {
name: $stateParams.serverGroup,
accountId: $stateParams.accountId,
region: $stateParams.region,
};
}]
},
data: {
pageTitleDetails: {
title: 'Server Group Details',
nameParam: 'serverGroup',
accountParam: 'accountId',
regionParam: 'region'
},
history: {
type: 'serverGroups',
},
}
};
const multipleServerGroups: INestedState = {
name: 'multipleServerGroups',
url: '/multipleServerGroups',
views: {
'detail@../insight': {
templateUrl: require('../serverGroup/details/multipleServerGroups.view.html'),
controller: 'MultipleServerGroupsCtrl',
controllerAs: 'vm'
}
},
data: {
pageTitleDetails: {
title: 'Multiple Server Groups',
},
}
};
applicationStateProvider.addInsightState(clusters);
applicationStateProvider.addInsightDetailState(serverGroupDetails);
applicationStateProvider.addInsightDetailState(multipleServerGroups);
stateConfigProvider.addRewriteRule('/applications/{application}', '/applications/{application}/clusters');
});