move object management interfaces (#23358)

This commit is contained in:
Alan Ren
2023-06-08 12:46:44 -07:00
committed by GitHub
parent f9b4c52211
commit 7886b28565
11 changed files with 522 additions and 509 deletions

View File

@@ -6,6 +6,7 @@
import * as nls from 'vscode-nls';
import { ObjectManagement } from 'mssql';
import { ObjectTypeInfo } from './ui/findObjectDialog';
import { AuthenticationType, UserType } from './interfaces';
const localize = nls.loadMessageBundle();
// Object Types
@@ -242,19 +243,19 @@ export function getNodeTypeDisplayName(type: string, inTitle: boolean = false):
}
}
const AuthencationTypeDisplayNameMap = new Map<ObjectManagement.AuthenticationType, string>();
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Windows, WindowsAuthenticationTypeDisplayText);
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.Sql, SQLAuthenticationTypeDisplayText);
AuthencationTypeDisplayNameMap.set(ObjectManagement.AuthenticationType.AzureActiveDirectory, AADAuthenticationTypeDisplayText);
const AuthencationTypeDisplayNameMap = new Map<AuthenticationType, string>();
AuthencationTypeDisplayNameMap.set(AuthenticationType.Windows, WindowsAuthenticationTypeDisplayText);
AuthencationTypeDisplayNameMap.set(AuthenticationType.Sql, SQLAuthenticationTypeDisplayText);
AuthencationTypeDisplayNameMap.set(AuthenticationType.AzureActiveDirectory, AADAuthenticationTypeDisplayText);
export function getAuthenticationTypeDisplayName(authType: ObjectManagement.AuthenticationType): string {
export function getAuthenticationTypeDisplayName(authType: AuthenticationType): string {
if (AuthencationTypeDisplayNameMap.has(authType)) {
return AuthencationTypeDisplayNameMap.get(authType);
}
throw new Error(`Unknown authentication type: ${authType}`);
}
export function getAuthenticationTypeByDisplayName(displayName: string): ObjectManagement.AuthenticationType {
export function getAuthenticationTypeByDisplayName(displayName: string): AuthenticationType {
for (let [key, value] of AuthencationTypeDisplayNameMap.entries()) {
if (value === displayName)
return key;
@@ -262,21 +263,21 @@ export function getAuthenticationTypeByDisplayName(displayName: string): ObjectM
throw new Error(`Unknown authentication type display name: ${displayName}`);
}
const UserTypeDisplayNameMap = new Map<ObjectManagement.UserType, string>();
UserTypeDisplayNameMap.set(ObjectManagement.UserType.LoginMapped, UserType_LoginMapped);
UserTypeDisplayNameMap.set(ObjectManagement.UserType.WindowsUser, UserType_WindowsUser);
UserTypeDisplayNameMap.set(ObjectManagement.UserType.SqlAuthentication, UserType_SqlAuthentication);
UserTypeDisplayNameMap.set(ObjectManagement.UserType.AADAuthentication, UserType_AADAuthentication);
UserTypeDisplayNameMap.set(ObjectManagement.UserType.NoLoginAccess, UserType_NoLoginAccess);
const UserTypeDisplayNameMap = new Map<UserType, string>();
UserTypeDisplayNameMap.set(UserType.LoginMapped, UserType_LoginMapped);
UserTypeDisplayNameMap.set(UserType.WindowsUser, UserType_WindowsUser);
UserTypeDisplayNameMap.set(UserType.SqlAuthentication, UserType_SqlAuthentication);
UserTypeDisplayNameMap.set(UserType.AADAuthentication, UserType_AADAuthentication);
UserTypeDisplayNameMap.set(UserType.NoLoginAccess, UserType_NoLoginAccess);
export function getUserTypeDisplayName(userType: ObjectManagement.UserType): string {
export function getUserTypeDisplayName(userType: UserType): string {
if (UserTypeDisplayNameMap.has(userType)) {
return UserTypeDisplayNameMap.get(userType);
}
throw new Error(`Unknown user type: ${userType}`);
}
export function getUserTypeByDisplayName(displayName: string): ObjectManagement.UserType {
export function getUserTypeByDisplayName(displayName: string): UserType {
for (let [key, value] of UserTypeDisplayNameMap.entries()) {
if (value === displayName)
return key;