Update publish dialog UI (#11996)
* change svgs * change label to server and get rid of connection string * fix user for windows auth * move blue icons out of dark and light folders
3
extensions/sql-database-projects/images/connect.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2 9.5C2 9.03646 2.08854 8.59115 2.26562 8.16406C2.44271 7.73698 2.69531 7.35677 3.02344 7.02344L4.79688 5.25781L9.74219 10.2031L7.97656 11.9766C7.64844 12.3047 7.27083 12.5573 6.84375 12.7344C6.41667 12.9115 5.96875 13 5.5 13C5.11979 13 4.7526 12.9427 4.39844 12.8281C4.04427 12.7135 3.71354 12.5391 3.40625 12.3047L0.851562 14.8516L0.148438 14.1484L2.69531 11.5938C2.46615 11.2917 2.29427 10.9635 2.17969 10.6094C2.0651 10.2552 2.00521 9.88542 2 9.5ZM5.5 12C5.83333 12 6.15104 11.9375 6.45312 11.8125C6.75521 11.6875 7.02604 11.5052 7.26562 11.2656L8.32812 10.2031L4.79688 6.67188L3.73438 7.73438C3.5 7.96875 3.32031 8.23698 3.19531 8.53906C3.07031 8.84115 3.00521 9.16146 3 9.5C3 9.84375 3.0651 10.1667 3.19531 10.4688C3.32552 10.7708 3.5026 11.0365 3.72656 11.2656C3.95052 11.4948 4.21615 11.6745 4.52344 11.8047C4.83073 11.9349 5.15625 12 5.5 12ZM12.3047 3.40625C12.5339 3.70833 12.7057 4.03646 12.8203 4.39062C12.9349 4.74479 12.9948 5.11458 13 5.5C13 5.96354 12.9115 6.40885 12.7344 6.83594C12.5573 7.26302 12.3047 7.64323 11.9766 7.97656L10.2031 9.74219L5.25781 4.79688L7.02344 3.02344C7.35156 2.69531 7.72917 2.44271 8.15625 2.26562C8.58333 2.08854 9.03125 2 9.5 2C9.88021 2 10.2474 2.05729 10.6016 2.17188C10.9557 2.28646 11.2865 2.46094 11.5938 2.69531L14.1484 0.148438L14.8516 0.851562L12.3047 3.40625ZM11.2656 7.26562C11.5 7.03125 11.6797 6.76302 11.8047 6.46094C11.9297 6.15885 11.9948 5.83854 12 5.5C12 5.15625 11.9349 4.83333 11.8047 4.53125C11.6745 4.22917 11.4948 3.96615 11.2656 3.74219C11.0365 3.51823 10.7708 3.33854 10.4688 3.20312C10.1667 3.06771 9.84375 3 9.5 3C9.16667 3 8.84896 3.0625 8.54688 3.1875C8.24479 3.3125 7.97396 3.49479 7.73438 3.73438L6.67188 4.79688L10.2031 8.32812L11.2656 7.26562Z" fill="#0078D4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.62C15.9975 2.96301 15.9296 3.3024 15.8 3.62C15.6698 3.94212 15.476 4.23464 15.23 4.48L5 14.77L0 16L1.23 11.05L11.52 0.77C11.7654 0.524034 12.0579 0.330158 12.38 0.2C12.6976 0.0704162 13.037 0.00253902 13.38 0C13.7242 0.000976246 14.0645 0.0724452 14.38 0.21C14.6919 0.338295 14.9743 0.528845 15.21 0.77C15.4479 1.00841 15.638 1.29014 15.77 1.6C15.9171 1.92018 15.9955 2.26766 16 2.62ZM1.38 14.62L4 14C3.94126 13.7636 3.85395 13.5353 3.74 13.32C3.62299 13.1141 3.48201 12.9228 3.32 12.75C3.14724 12.588 2.95591 12.447 2.75 12.33C2.51363 12.2036 2.26139 12.1094 2 12.05L1.38 14.62ZM2.55 11.16C3.0852 11.3342 3.57163 11.6324 3.96961 12.0304C4.36759 12.4284 4.66583 12.9148 4.84 13.45L13.29 5L11 2.71L2.55 11.16ZM14 4.29L14.38 3.92C14.4943 3.80702 14.6012 3.68677 14.7 3.56C14.789 3.42875 14.8628 3.28786 14.92 3.14C14.9755 2.97236 15.0026 2.79659 15 2.62C15.0032 2.40625 14.9588 2.19445 14.87 2C14.7902 1.80451 14.6711 1.62751 14.52 1.48C14.3725 1.32892 14.1955 1.20978 14 1.13C13.8055 1.04118 13.5938 0.996774 13.38 1C13.2034 0.997418 13.0276 1.02446 12.86 1.08C12.7121 1.13724 12.5712 1.21105 12.44 1.3C12.3108 1.39589 12.1904 1.50297 12.08 1.62L11.71 2L14 4.29Z" fill="#0078D4"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.62C15.9975 2.96301 15.9296 3.3024 15.8 3.62C15.6698 3.94212 15.476 4.23464 15.23 4.48L5 14.77L0 16L1.23 11.05L11.52 0.77C11.7654 0.524034 12.0579 0.330158 12.38 0.2C12.6976 0.0704162 13.037 0.00253902 13.38 0C13.7242 0.000976246 14.0645 0.0724452 14.38 0.21C14.6919 0.338295 14.9743 0.528845 15.21 0.77C15.4479 1.00841 15.638 1.29014 15.77 1.6C15.9171 1.92018 15.9955 2.26766 16 2.62ZM1.38 14.62L4 14C3.94126 13.7636 3.85395 13.5353 3.74 13.32C3.62299 13.1141 3.48201 12.9228 3.32 12.75C3.14724 12.588 2.95591 12.447 2.75 12.33C2.51363 12.2036 2.26139 12.1094 2 12.05L1.38 14.62ZM2.55 11.16C3.0852 11.3342 3.57163 11.6324 3.96961 12.0304C4.36759 12.4284 4.66583 12.9148 4.84 13.45L13.29 5L11 2.71L2.55 11.16ZM14 4.29L14.38 3.92C14.4943 3.80702 14.6012 3.68677 14.7 3.56C14.789 3.42875 14.8628 3.28786 14.92 3.14C14.9755 2.97236 15.0026 2.79659 15 2.62C15.0032 2.40625 14.9588 2.19445 14.87 2C14.7902 1.80451 14.6711 1.62751 14.52 1.48C14.3725 1.32892 14.1955 1.20978 14 1.13C13.8055 1.04118 13.5938 0.996774 13.38 1C13.2034 0.997418 13.0276 1.02446 12.86 1.08C12.7121 1.13724 12.5712 1.21105 12.44 1.3C12.3108 1.39589 12.1904 1.50297 12.08 1.62L11.71 2L14 4.29Z" fill="#0078D4"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg width="17" height="12" viewBox="0 0 17 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16.8457 3V11C16.8457 11.1406 16.8197 11.2708 16.7676 11.3906C16.7155 11.5104 16.6426 11.6172 16.5488 11.7109C16.4603 11.7995 16.3561 11.8698 16.2363 11.9219C16.1165 11.974 15.9863 12 15.8457 12H1.8457C1.70508 12 1.57487 11.974 1.45508 11.9219C1.33529 11.8698 1.22852 11.7995 1.13477 11.7109C1.04622 11.6172 0.975911 11.5104 0.923828 11.3906C0.871745 11.2708 0.845703 11.1406 0.845703 11V1C0.845703 0.859375 0.871745 0.729167 0.923828 0.609375C0.975911 0.489583 1.04622 0.385417 1.13477 0.296875C1.22852 0.203125 1.33529 0.130208 1.45508 0.078125C1.57487 0.0260417 1.70508 0 1.8457 0H7.5957C7.78841 0 7.9681 0.0364583 8.13477 0.109375C8.30143 0.177083 8.45247 0.270833 8.58789 0.390625C8.72852 0.505208 8.85352 0.638021 8.96289 0.789062C9.07747 0.934896 9.18164 1.08594 9.27539 1.24219C9.3431 1.36198 9.4082 1.46875 9.4707 1.5625C9.53841 1.65625 9.61133 1.73698 9.68945 1.80469C9.77279 1.86719 9.86393 1.91667 9.96289 1.95312C10.0671 1.98438 10.1947 2 10.3457 2H15.8457C15.9863 2 16.1165 2.02604 16.2363 2.07812C16.3561 2.13021 16.4603 2.20312 16.5488 2.29688C16.6426 2.38542 16.7155 2.48958 16.7676 2.60938C16.8197 2.72917 16.8457 2.85938 16.8457 3ZM7.5957 1H1.8457V3H7.5957C7.73633 3 7.85352 2.97656 7.94727 2.92969C8.04622 2.88281 8.13737 2.82552 8.2207 2.75781C8.30924 2.6901 8.39779 2.61719 8.48633 2.53906C8.57487 2.45573 8.67643 2.38281 8.79102 2.32031C8.71289 2.23177 8.62956 2.11458 8.54102 1.96875C8.45768 1.81771 8.36654 1.67188 8.26758 1.53125C8.16862 1.38542 8.06185 1.26042 7.94727 1.15625C7.83789 1.05208 7.7207 1 7.5957 1ZM15.8457 11V3H10.3457C10.054 3 9.81706 3.02604 9.63477 3.07812C9.45768 3.125 9.30664 3.1849 9.18164 3.25781C9.06185 3.33073 8.95768 3.41146 8.86914 3.5C8.7806 3.58854 8.68164 3.66927 8.57227 3.74219C8.4681 3.8151 8.34049 3.8776 8.18945 3.92969C8.03841 3.97656 7.84049 4 7.5957 4H1.8457V11H15.8457Z" fill="#0078D4"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.1328 0.296875C10.9974 0.53125 11.7891 0.898438 12.5078 1.39844C13.2266 1.89323 13.8438 2.48177 14.3594 3.16406C14.8802 3.84115 15.2839 4.59375 15.5703 5.42188C15.8568 6.24479 16 7.10417 16 8C16 8.73438 15.9036 9.44271 15.7109 10.125C15.5234 10.8073 15.2552 11.4453 14.9062 12.0391C14.5625 12.6328 14.1458 13.1745 13.6562 13.6641C13.1719 14.1484 12.6328 14.5651 12.0391 14.9141C11.4453 15.2578 10.8073 15.526 10.125 15.7188C9.44271 15.9062 8.73438 16 8 16C7.26562 16 6.55729 15.9062 5.875 15.7188C5.19271 15.526 4.55469 15.2578 3.96094 14.9141C3.36719 14.5651 2.82552 14.1484 2.33594 13.6641C1.85156 13.1745 1.4349 12.6328 1.08594 12.0391C0.742188 11.4453 0.473958 10.8099 0.28125 10.1328C0.09375 9.45052 0 8.73958 0 8C0 7.27083 0.0963542 6.5625 0.289062 5.875C0.481771 5.1875 0.755208 4.54167 1.10938 3.9375C1.46875 3.32812 1.90365 2.77604 2.41406 2.28125C2.92448 1.78125 3.5 1.35417 4.14062 1H2V0H6V4H5V1.67969C4.39062 1.97135 3.83854 2.33854 3.34375 2.78125C2.85417 3.21875 2.4349 3.71354 2.08594 4.26562C1.73698 4.8125 1.46875 5.40365 1.28125 6.03906C1.09375 6.67448 1 7.32812 1 8C1 8.64062 1.08333 9.26042 1.25 9.85938C1.41667 10.4531 1.65104 11.0104 1.95312 11.5312C2.26042 12.0469 2.6276 12.5182 3.05469 12.9453C3.48177 13.3724 3.95312 13.7396 4.46875 14.0469C4.98958 14.349 5.54688 14.5833 6.14062 14.75C6.73438 14.9167 7.35417 15 8 15C8.64062 15 9.25781 14.9167 9.85156 14.75C10.4505 14.5833 11.0078 14.349 11.5234 14.0469C12.0443 13.7396 12.5182 13.3724 12.9453 12.9453C13.3724 12.5182 13.737 12.0469 14.0391 11.5312C14.3464 11.0104 14.5833 10.4531 14.75 9.85938C14.9167 9.26562 15 8.64583 15 8C15 7.21875 14.8724 6.46615 14.6172 5.74219C14.3672 5.01823 14.0156 4.35938 13.5625 3.76562C13.1094 3.17188 12.5677 2.65885 11.9375 2.22656C11.3125 1.78906 10.6224 1.46615 9.86719 1.25781L10.1328 0.296875Z" fill="#0078D4"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
10
extensions/sql-database-projects/images/selectConnection.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M2.00816 9.49995C2.00713 9.03996 2.09707 8.5843 2.27281 8.15919C2.44855 7.73409 2.70661 7.34794 3.03216 7.02295L4.68016 5.37495L9.63316 10.3279L7.98516 11.9769C7.65992 12.3021 7.2737 12.5598 6.84864 12.7354C6.42358 12.9109 5.96804 13.0008 5.50816 12.9999C5.13179 13.0009 4.75771 12.9415 4.40016 12.8239C4.04405 12.7076 3.71005 12.5321 3.41216 12.3049L0.860156 14.8519L0.160156 14.1519L2.70016 11.5939C2.47227 11.296 2.29646 10.9616 2.18016 10.6049C2.06422 10.2482 2.00615 9.8751 2.00816 9.49995ZM5.50816 12.0229C5.80194 12.0292 6.09449 11.9831 6.37216 11.8869C6.61668 11.7972 6.84678 11.6722 7.05516 11.5159C7.27008 11.3536 7.4708 11.1733 7.65516 10.9769C7.84516 10.7729 8.04949 10.5619 8.26816 10.3439L4.66816 6.74395C4.45416 6.95795 4.24449 7.16128 4.03916 7.35395C3.83924 7.53839 3.65494 7.73908 3.48816 7.95395C3.32685 8.16355 3.19651 8.39525 3.10116 8.64195C3.00022 8.91547 2.95138 9.20546 2.95716 9.49695C2.95057 9.99708 3.09549 10.4875 3.37285 10.9037C3.65021 11.3199 4.04704 11.6425 4.51116 11.8289C4.82761 11.9582 5.16634 12.0241 5.50816 12.0229ZM13.0082 5.49995C13.0087 5.95979 12.9187 6.41523 12.7431 6.84024C12.5676 7.26526 12.31 7.65152 11.9852 7.97695L10.3292 9.62495L5.38316 4.67995L7.03216 3.02295C7.35564 2.69807 7.74413 2.44521 8.17216 2.28095C8.9523 1.97914 9.8117 1.95058 10.6102 2.19995C10.9656 2.31203 11.3006 2.48088 11.6022 2.69995L14.1572 0.147949L14.8572 0.847949L12.3132 3.40595C12.5398 3.70468 12.7156 4.03886 12.8332 4.39495C12.95 4.75161 13.009 5.12465 13.0082 5.49995ZM10.3522 8.26595C10.5652 8.05795 10.7752 7.85495 10.9812 7.65995C11.1802 7.47256 11.3631 7.26885 11.5282 7.05095C11.6874 6.83852 11.8175 6.6058 11.9152 6.35895C12.0179 6.08442 12.0681 5.79303 12.0632 5.49995C12.0664 5.16515 12.002 4.83315 11.8738 4.52385C11.7456 4.21455 11.5563 3.93432 11.3172 3.69995C11.0828 3.47239 10.8067 3.29211 10.5042 3.16895C10.1867 3.04001 9.84682 2.97509 9.50416 2.97795C9.21038 2.97188 8.91795 3.01932 8.64116 3.11795C8.39657 3.21027 8.1655 3.33506 7.95416 3.48895C7.73806 3.64837 7.5372 3.82747 7.35416 4.02395C7.16416 4.22795 6.95982 4.43895 6.74116 4.65695L10.3522 8.26595ZM16.0082 13.9999H14.0082V15.9999H13.0082V13.9999H11.0082V12.9999H13.0082V10.9999H14.0082V12.9999H16.0082V13.9999Z" fill="#0078D4"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="16" height="16" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -87,7 +87,8 @@ export const sqlCmdValueColumn = localize('sqlCmdValueColumn', "Value");
|
||||
export const loadSqlCmdVarsButtonTitle = localize('reloadValuesFromProjectButtonTitle', "Reload values from project");
|
||||
export const profile = localize('profile', "Profile");
|
||||
export const selectConnection = localize('selectConnection', "Select connection");
|
||||
export const connection = localize('connection', "Connection");
|
||||
export const server = localize('server', "Server");
|
||||
export const defaultUser = localize('default', "default");
|
||||
|
||||
// Add Database Reference dialog strings
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ export class IconPathHelper {
|
||||
|
||||
public static refresh: IconPath;
|
||||
public static folder_blue: IconPath;
|
||||
public static edit: IconPath;
|
||||
public static selectConnection: IconPath;
|
||||
public static connect: IconPath;
|
||||
|
||||
public static folder: IconPath;
|
||||
|
||||
@@ -37,19 +38,27 @@ export class IconPathHelper {
|
||||
IconPathHelper.referenceGroup = IconPathHelper.makeIcon('referenceGroup');
|
||||
IconPathHelper.referenceDatabase = IconPathHelper.makeIcon('reference-database');
|
||||
|
||||
IconPathHelper.refresh = IconPathHelper.makeIcon('refresh');
|
||||
IconPathHelper.folder_blue = IconPathHelper.makeIcon('folder_blue');
|
||||
IconPathHelper.edit = IconPathHelper.makeIcon('edit');
|
||||
IconPathHelper.refresh = IconPathHelper.makeIcon('refresh', true);
|
||||
IconPathHelper.folder_blue = IconPathHelper.makeIcon('folder_blue', true);
|
||||
IconPathHelper.selectConnection = IconPathHelper.makeIcon('selectConnection', true);
|
||||
IconPathHelper.connect = IconPathHelper.makeIcon('connect', true);
|
||||
|
||||
IconPathHelper.folder = IconPathHelper.makeIcon('folder');
|
||||
}
|
||||
|
||||
private static makeIcon(name: string) {
|
||||
private static makeIcon(name: string, sameIcon: boolean = false) {
|
||||
const folder = 'images';
|
||||
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/dark/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/light/${name}.svg`)
|
||||
};
|
||||
if (sameIcon) {
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/${name}.svg`)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/dark/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/light/${name}.svg`)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,8 @@ export class PublishDatabaseDialog {
|
||||
value: '',
|
||||
ariaLabel: constants.targetConnectionLabel,
|
||||
placeHolder: constants.selectConnection,
|
||||
width: cssStyles.publishDialogTextboxWidth
|
||||
width: cssStyles.publishDialogTextboxWidth,
|
||||
enabled: false
|
||||
}).component();
|
||||
|
||||
this.targetConnectionTextBox.onTextChanged(() => {
|
||||
@@ -350,13 +351,13 @@ export class PublishDatabaseDialog {
|
||||
this.targetConnectionTextBox = this.createTargetConnectionComponent(view);
|
||||
const selectConnectionButton: azdata.Component = this.createSelectConnectionButton(view);
|
||||
|
||||
const connectionLabel = view.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
|
||||
value: constants.connection,
|
||||
const serverLabel = view.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
|
||||
value: constants.server,
|
||||
requiredIndicator: true,
|
||||
width: cssStyles.publishDialogLabelWidth
|
||||
}).component();
|
||||
|
||||
const connectionRow = view.modelBuilder.flexContainer().withItems([connectionLabel, this.targetConnectionTextBox], { flex: '0 0 auto', CSSStyles: { 'margin-right': '10px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
const connectionRow = view.modelBuilder.flexContainer().withItems([serverLabel, this.targetConnectionTextBox], { flex: '0 0 auto', CSSStyles: { 'margin-right': '10px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
connectionRow.insertItem(selectConnectionButton, 2, { CSSStyles: { 'margin-right': '0px' } });
|
||||
|
||||
return connectionRow;
|
||||
@@ -410,7 +411,7 @@ export class PublishDatabaseDialog {
|
||||
headerCssStyles: cssStyles.tableHeader,
|
||||
rowCssStyles: cssStyles.tableRow
|
||||
}],
|
||||
width: '410px'
|
||||
width: '420px'
|
||||
}).component();
|
||||
|
||||
table.onDataChanged(() => {
|
||||
@@ -453,7 +454,7 @@ export class PublishDatabaseDialog {
|
||||
private createSelectConnectionButton(view: azdata.ModelView): azdata.Component {
|
||||
let selectConnectionButton: azdata.ButtonComponent = view.modelBuilder.button().withProperties({
|
||||
ariaLabel: constants.selectConnection,
|
||||
iconPath: IconPathHelper.edit,
|
||||
iconPath: IconPathHelper.selectConnection,
|
||||
height: '16px',
|
||||
width: '16px'
|
||||
}).component();
|
||||
@@ -462,29 +463,47 @@ export class PublishDatabaseDialog {
|
||||
let connection = await azdata.connection.openConnectionDialog();
|
||||
this.connectionId = connection.connectionId;
|
||||
|
||||
// show connection name if there is one, otherwise show connection string
|
||||
// show connection name if there is one, otherwise show connection in format that shows in OE
|
||||
let connectionTextboxValue: string;
|
||||
if (connection.options['connectionName']) {
|
||||
this.targetConnectionTextBox!.value = connection.options['connectionName'];
|
||||
connectionTextboxValue = connection.options['connectionName'];
|
||||
} else {
|
||||
this.targetConnectionTextBox!.value = await azdata.connection.getConnectionString(connection.connectionId, false);
|
||||
let user = connection.options['user'];
|
||||
if (!user) {
|
||||
user = constants.defaultUser;
|
||||
}
|
||||
|
||||
connectionTextboxValue = `${connection.options['server']} (${user})`;
|
||||
}
|
||||
|
||||
// populate database dropdown with the databases for this connection
|
||||
const databaseValues = (await azdata.connection.listDatabases(this.connectionId))
|
||||
// filter out system dbs
|
||||
.filter(db => constants.systemDbs.find(systemdb => db === systemdb) === undefined);
|
||||
|
||||
this.targetDatabaseDropDown!.values = databaseValues;
|
||||
this.updateConnectionComponents(connectionTextboxValue, this.connectionId);
|
||||
|
||||
// change the database inputbox value to the connection's database if there is one
|
||||
if (connection.options.database && connection.options.database !== constants.master) {
|
||||
this.targetDatabaseDropDown!.value = connection.options.database;
|
||||
}
|
||||
|
||||
// change icon to the one without a plus sign
|
||||
selectConnectionButton.iconPath = IconPathHelper.connect;
|
||||
});
|
||||
|
||||
return selectConnectionButton;
|
||||
}
|
||||
|
||||
private async updateConnectionComponents(connectionTextboxValue: string, connectionId: string) {
|
||||
this.targetConnectionTextBox!.value = connectionTextboxValue;
|
||||
this.targetConnectionTextBox!.placeHolder = connectionTextboxValue;
|
||||
|
||||
// populate database dropdown with the databases for this connection
|
||||
if (connectionId) {
|
||||
const databaseValues = (await azdata.connection.listDatabases(connectionId))
|
||||
// filter out system dbs
|
||||
.filter(db => constants.systemDbs.find(systemdb => db === systemdb) === undefined);
|
||||
|
||||
this.targetDatabaseDropDown!.values = databaseValues;
|
||||
}
|
||||
}
|
||||
|
||||
private createLoadProfileButton(view: azdata.ModelView): azdata.ButtonComponent {
|
||||
let loadProfileButton: azdata.ButtonComponent = view.modelBuilder.button().withProperties({
|
||||
ariaLabel: constants.loadProfilePlaceholderText,
|
||||
@@ -512,10 +531,12 @@ export class PublishDatabaseDialog {
|
||||
|
||||
if (this.readPublishProfile) {
|
||||
const result = await this.readPublishProfile(fileUris[0]);
|
||||
// clear out old database dropdown values. They'll get populated later if there was a connection specified in the profile
|
||||
(<azdata.DropDownComponent>this.targetDatabaseDropDown).values = [];
|
||||
(<azdata.DropDownComponent>this.targetDatabaseDropDown).value = result.databaseName;
|
||||
|
||||
this.connectionId = result.connectionId;
|
||||
(<azdata.InputBoxComponent>this.targetConnectionTextBox).value = result.connectionString;
|
||||
await this.updateConnectionComponents(result.connection, <string>this.connectionId);
|
||||
|
||||
for (let key in result.sqlCmdVariables) {
|
||||
(<Record<string, string>>this.sqlCmdVars)[key] = result.sqlCmdVariables[key];
|
||||
@@ -538,8 +559,9 @@ export class PublishDatabaseDialog {
|
||||
this.formBuilder?.removeFormItem(<azdata.FormComponentGroup>this.sqlCmdVariablesFormComponentGroup);
|
||||
}
|
||||
|
||||
// show file path in text box
|
||||
// show file path in text box and hover text
|
||||
this.loadProfileTextBox!.value = fileUris[0].fsPath;
|
||||
this.loadProfileTextBox!.placeHolder = fileUris[0].fsPath;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SqlConnectionDataSource } from '../dataSources/sqlConnectionStringSourc
|
||||
export interface PublishProfile {
|
||||
databaseName: string;
|
||||
connectionId: string;
|
||||
connectionString: string;
|
||||
connection: string;
|
||||
sqlCmdVariables: Record<string, string>;
|
||||
options?: mssql.DeploymentOptions;
|
||||
}
|
||||
@@ -46,38 +46,46 @@ export async function load(profileUri: Uri, dacfxService: mssql.IDacFxService):
|
||||
return {
|
||||
databaseName: targetDbName,
|
||||
connectionId: connectionInfo.connectionId,
|
||||
connectionString: connectionInfo.connectionString,
|
||||
connection: connectionInfo.connection,
|
||||
sqlCmdVariables: sqlCmdVariables,
|
||||
options: optionsResult.deploymentOptions
|
||||
};
|
||||
}
|
||||
|
||||
async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string, connectionString: string }> {
|
||||
let targetConnectionString: string = '';
|
||||
async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string, connection: string }> {
|
||||
let targetConnection: string = '';
|
||||
let connId: string = '';
|
||||
|
||||
if (xmlDoc.documentElement.getElementsByTagName(constants.targetConnectionString).length > 0) {
|
||||
targetConnectionString = xmlDoc.documentElement.getElementsByTagName(constants.TargetConnectionString)[0].textContent;
|
||||
const targetConnectionString = xmlDoc.documentElement.getElementsByTagName(constants.TargetConnectionString)[0].textContent;
|
||||
const dataSource = new SqlConnectionDataSource('temp', targetConnectionString);
|
||||
let server: string = '';
|
||||
let username: string = '';
|
||||
const connectionProfile = dataSource.getConnectionProfile();
|
||||
|
||||
try {
|
||||
if (dataSource.integratedSecurity) {
|
||||
connId = (await azdata.connection.connect(connectionProfile, false, false)).connectionId;
|
||||
const connection = await azdata.connection.connect(connectionProfile, false, false);
|
||||
connId = connection.connectionId;
|
||||
server = dataSource.server;
|
||||
username = constants.defaultUser;
|
||||
}
|
||||
else {
|
||||
connId = (await azdata.connection.openConnectionDialog(undefined, connectionProfile)).connectionId;
|
||||
const connection = await azdata.connection.openConnectionDialog(undefined, connectionProfile);
|
||||
connId = connection.connectionId;
|
||||
server = connection.options['server'];
|
||||
username = connection.options['username'];
|
||||
}
|
||||
|
||||
targetConnection = `${server} (${username})`;
|
||||
} catch (err) {
|
||||
throw new Error(constants.unableToCreatePublishConnection(utils.getErrorMessage(err)));
|
||||
}
|
||||
}
|
||||
|
||||
// mask password in connection string
|
||||
targetConnectionString = await azdata.connection.getConnectionString(connId, false);
|
||||
|
||||
return {
|
||||
connectionId: connId,
|
||||
connectionString: targetConnectionString
|
||||
connection: targetConnection
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,16 +43,14 @@ describe('Publish profile tests', function (): void {
|
||||
testContext.dacFxService.setup(x => x.getOptionsFromProfile(TypeMoq.It.isAny())).returns(async () => {
|
||||
return Promise.resolve(mockDacFxOptionsResult);
|
||||
});
|
||||
const connectionString = 'Data Source=testserver;Integrated Security=true;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True';
|
||||
sinon.stub(azdata.connection, 'connect').resolves(connectionResult);
|
||||
sinon.stub(azdata.connection, 'getConnectionString').resolves(connectionString);
|
||||
|
||||
let result = await load(vscode.Uri.file(profilePath), testContext.dacFxService.object);
|
||||
should(result.databaseName).equal('targetDb');
|
||||
should(Object.keys(result.sqlCmdVariables).length).equal(1);
|
||||
should(result.sqlCmdVariables['ProdDatabaseName']).equal('MyProdDatabase');
|
||||
should(result.connectionId).equal('connId');
|
||||
should(result.connectionString).equal('Data Source=testserver;Integrated Security=true;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True');
|
||||
should(result.connection).equal('testserver (default)');
|
||||
should(result.options).equal(mockDacFxOptionsResult.deploymentOptions);
|
||||
});
|
||||
|
||||
@@ -62,21 +60,22 @@ describe('Publish profile tests', function (): void {
|
||||
const connectionResult = {
|
||||
providerName: 'MSSQL',
|
||||
connectionId: 'connId',
|
||||
options: {}
|
||||
options: {
|
||||
'server': 'testserver',
|
||||
'username': 'testUser'
|
||||
}
|
||||
};
|
||||
testContext.dacFxService.setup(x => x.getOptionsFromProfile(TypeMoq.It.isAny())).returns(async () => {
|
||||
return Promise.resolve(mockDacFxOptionsResult);
|
||||
});
|
||||
const connectionString = 'Data Source=testserver;User Id=testUser;Password=******;Integrated Security=false;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True';
|
||||
sinon.stub(azdata.connection, 'openConnectionDialog').resolves(connectionResult);
|
||||
sinon.stub(azdata.connection, 'getConnectionString').resolves(connectionString);
|
||||
|
||||
let result = await load(vscode.Uri.file(profilePath), testContext.dacFxService.object);
|
||||
should(result.databaseName).equal('targetDb');
|
||||
should(Object.keys(result.sqlCmdVariables).length).equal(1);
|
||||
should(result.sqlCmdVariables['ProdDatabaseName']).equal('MyProdDatabase');
|
||||
should(result.connectionId).equal('connId');
|
||||
should(result.connectionString).equal('Data Source=testserver;User Id=testUser;Password=******;Integrated Security=false;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True');
|
||||
should(result.connection).equal('testserver (testUser)');
|
||||
should(result.options).equal(mockDacFxOptionsResult.deploymentOptions);
|
||||
});
|
||||
|
||||
@@ -85,9 +84,7 @@ describe('Publish profile tests', function (): void {
|
||||
let profilePath = await testUtils.createTestFile(baselines.publishProfileIntegratedSecurityBaseline, 'publishProfile.publish.xml');
|
||||
const projController = new ProjectsController(new SqlDatabaseProjectTreeViewProvider());
|
||||
|
||||
const connectionString = 'Data Source=testserver;Integrated Security=true;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True';
|
||||
sinon.stub(azdata.connection, 'connect').throws(new Error('Could not connect'));
|
||||
sinon.stub(azdata.connection, 'getConnectionString').resolves(connectionString);
|
||||
|
||||
await testUtils.shouldThrowSpecificError(async () => await projController.readPublishProfileCallback(vscode.Uri.file(profilePath)), constants.unableToCreatePublishConnection('Could not connect'));
|
||||
});
|
||||
|
||||