本文整理汇总了TypeScript中angular-ui-bootstrap.IModalService.open方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IModalService.open方法的具体用法?TypeScript IModalService.open怎么用?TypeScript IModalService.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular-ui-bootstrap.IModalService
的用法示例。
在下文中一共展示了IModalService.open方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: uniq
return this.accountService.listProviders(application).then((providers) => {
let provider;
let reducedProviders: string[] = [];
if (feature) {
reducedProviders = providers.filter((p) => this.cloudProviderRegistry.hasValue(p, feature));
}
// reduce the providers to the smallest, unique collection taking into consideration the useProvider values
reducedProviders = uniq(reducedProviders.map((providerName) => {
const providerFeature = this.cloudProviderRegistry.getProvider(providerName)[feature] || {};
return providerFeature.useProvider || providerName;
}));
if (reducedProviders.length > 1) {
provider = this.$uibModal.open({
templateUrl: require('./providerSelection.html'),
controller: 'ProviderSelectCtrl as ctrl',
resolve: {
providerOptions: () => reducedProviders
}
}).result;
} else if (reducedProviders.length === 1) {
provider = this.$q.when(reducedProviders[0]);
} else {
provider = this.$q.when(SETTINGS.defaultProvider || 'aws');
}
return provider;
});
示例2: filterFn
return this.accountService.applicationAccounts(application).then((accounts: IAccountDetails[]) => {
let reducedAccounts: IAccountDetails[] = [];
if (feature) {
reducedAccounts = accounts.filter(a => this.cloudProviderRegistry.hasValue(a.cloudProvider, feature));
}
if (filterFn) {
reducedAccounts = reducedAccounts.filter((acc: IAccountDetails) => {
return filterFn(application, acc, this.cloudProviderRegistry.getProvider(acc.cloudProvider, acc.providerVersion));
});
}
// reduce the accounts to the smallest, unique collection taking into consideration the useProvider values
const reducedProviders = uniq(reducedAccounts.map(a => {
const providerFeature = this.cloudProviderRegistry.getProvider(a.cloudProvider)[feature] || {};
return providerFeature.useProvider || a.cloudProvider;
}));
let provider;
if (reducedProviders.length > 1) {
provider = this.$uibModal.open({
templateUrl: require('./providerSelection.html'),
controller: 'ProviderSelectCtrl as ctrl',
resolve: {
providerOptions: () => reducedProviders
}
}).result;
} else if (reducedProviders.length === 1) {
provider = this.$q.when(reducedProviders[0]);
} else {
provider = this.$q.when(SETTINGS.defaultProvider || 'aws');
}
return provider;
});
示例3: editAccount
public editAccount(accountType?: string, index?: number): void {
// Helper function to sort by account name
function byName(a: Account, b: Account): number {
return a.name.localeCompare(b.name);
}
// Show the modal
this.$uibModal.open({
templateUrl: AccountEditView,
controller: "AccountEditController",
controllerAs: "vm",
backdrop: "static",
resolve: {
account: (): Account | undefined => {
let account: Account | undefined;
// If we didn't get an index, we're adding a new account so just return null
if (accountType && index && !isNaN(index)) {
account = this.accounts[accountType].accounts[index];
// Add the account to the LRU cache
this.accountModel.addRecent(account);
}
return account;
}
}
}).result.then((account: Account): void => {
const currentAccountType: string = `${account.account_type.charAt(0).toUpperCase() + account.account_type.substring(1)} accounts`;
if (!accountType || !index || isNaN(index)) {
// Add new account to the end of the array
this.accounts[currentAccountType].accounts.push(account);
// Add the account to the LRU cache
this.accountModel.addRecent(account);
} else if (currentAccountType === accountType) {
// Update the existing account in the array
this.accounts[accountType].accounts[index] = account;
} else {
// If the edited account type has changed, remove the account from the original array
this.accounts[accountType].accounts.splice(index, 1);
// Recalculate the array total
this.calculateAccountTypeTotal(accountType);
// Add the account to the end of the new array
this.accounts[currentAccountType].accounts.push(account);
}
// Resort the array
this.accounts[currentAccountType].accounts.sort(byName);
// Recalculate the array total
this.calculateAccountTypeTotal(currentAccountType);
});
}
示例4: addLoadBalancer
public addLoadBalancer(): void {
this.$uibModal.open({
templateUrl: require('./loadBalancerChoice.modal.html'),
controller: `appengineLoadBalancerChoiceModelCtrl as ctrl`,
resolve: {
application: () => this.$scope.application,
}
}).result.then((newLoadBalancer: ILoadBalancer) => {
this.$scope.stage.loadBalancers.push(newLoadBalancer);
});
}
示例5:
this.categoryModel.find(this.categories[index].id).then((category: Category): void => {
// Disable navigation on the table
this.ogTableNavigableService.enabled = false;
let modalOptions: IModalSettings = {
backdrop: "static"
};
// Check if the category has any transactions
if (category.num_transactions > 0) {
// Show an alert modal
modalOptions = angular.extend({
templateUrl: OgModalAlertView,
controller: "OgModalAlertController",
controllerAs: "vm",
resolve: {
alert: (): OgModalAlert => ({
header: "Category has existing transactions",
message: "You must first delete these transactions, or reassign to another category before attempting to delete this category."
})
}
}, modalOptions);
} else {
// Show the delete category modal
modalOptions = angular.extend({
templateUrl: CategoryDeleteView,
controller: "CategoryDeleteController",
controllerAs: "vm",
resolve: {
category: (): Category => this.categories[index]
}
}, modalOptions);
}
// Show the modal
this.$uibModal.open(modalOptions).result.then((): void => {
// If the deleted category has a parent, decrement the parent's children count
if (!isNaN(Number(this.categories[index].parent_id))) {
// Find the parent category by it's id
const parentIndex = this.categoryIndexById(this.categories[index].parent_id);
// If found, decrement the number of children
if (!isNaN(parentIndex)) {
this.categories[parentIndex].num_children--;
}
}
// Remove the category (and any children) from the array
this.categories.splice(index, 1 + this.categories[index].num_children);
// Go back to the parent state
this.$state.go("root.categories");
}).finally((): true => (this.ogTableNavigableService.enabled = true));
});
示例6: addCustomHeader
public addCustomHeader(): void {
if (!this.stage.customHeaders) {
this.stage.customHeaders = {};
}
this.$uibModal.open({
templateUrl: require('./modal/addCustomHeader.html'),
controller: 'WebhookStageAddCustomHeaderCtrl',
controllerAs: 'addCustomHeader',
}).result.then((customHeader: ICustomHeader) => {
this.stage.customHeaders[customHeader.key] = customHeader.value;
});
}
示例7: editVip
public editVip(cluster: any, vipType: 'oldVip' | 'newVip'): void {
const clusterVip = this.stage.vipOverrides[this.getClusterId(cluster)];
this.$uibModal.open({
templateUrl: require('./editVip.modal.html'),
controller: 'EditVipModalCtrl as vm',
size: 'md',
resolve: {
vip: () => clusterVip[vipType]
}
}).result.then(newVip => {
clusterVip[vipType] = newVip;
});
}
示例8:
this.providerSelectionService.selectProvider(this.$scope.application).then((selectedProvider: string) => {
let config = this.cloudProviderRegistry.getValue(selectedProvider, 'serverGroup');
this.$uibModal.open({
templateUrl: config.cloneServerGroupTemplateUrl,
controller: `${config.cloneServerGroupController} as ctrl`,
size: 'lg',
resolve: {
title: () => 'Add Isolated Testing Target Cluster',
application: () => this.$scope.application,
serverGroupCommand: () => this.buildServerGroupCommand(selectedProvider),
}
}).result.then((command: any) => this.applyCommandToStage(command));
});
示例9: editPayee
public editPayee(index?: number): void {
// Helper function to sort by payee name
function byName(a: Payee, b: Payee): number {
return a.name.localeCompare(b.name);
}
// Disable navigation on the table
this.ogTableNavigableService.enabled = false;
// Show the modal
this.$uibModal.open({
templateUrl: PayeeEditView,
controller: "PayeeEditController",
controllerAs: "vm",
backdrop: "static",
resolve: {
payee: (): Payee | null => {
let payee: Payee | null = null;
// If we didn't get an index, we're adding a new payee so just return null
if (!isNaN(Number(index))) {
payee = this.payees[Number(index)];
// Add the payee to the LRU cache
this.payeeModel.addRecent(payee);
}
return payee;
}
}
}).result.then((payee: Payee): void => {
if (isNaN(Number(index))) {
// Add new payee to the end of the array
this.payees.push(payee);
// Add the payee to the LRU cache
this.payeeModel.addRecent(payee);
} else {
// Update the existing payee in the array
this.payees[Number(index)] = payee;
}
// Resort the array
this.payees.sort(byName);
// Refocus the payee
this.focusPayee(payee.id);
}).finally((): true => (this.ogTableNavigableService.enabled = true));
}
示例10:
authenticated: ["$uibModal", "authenticationModel", ($uibModal: IModalService, authenticationModel: AuthenticationModel): angular.IPromise<boolean> | boolean => {
// Check if the user is authenticated
if (!authenticationModel.isAuthenticated) {
// Not authenticated, show the login modal
return $uibModal.open({
templateUrl: AuthenticationEditView,
controller: "AuthenticationEditController",
controllerAs: "vm",
backdrop: "static",
size: "sm"
}).result.then((): boolean => authenticationModel.isAuthenticated).catch((): false => false);
}
// User is authenticated
return true;
}]