mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Added file path check (#13201)
This commit is contained in:
@@ -27,6 +27,7 @@ export const crashButtonText = localize('import.serviceCrashButton', "Give Feedb
|
||||
export const serviceCrashMessageText = localize('serviceCrashMessage', "service component could not start");
|
||||
export const serverDropDownTitleText = localize('flatFileImport.serverDropdownTitle', "Server the database is in");
|
||||
export const databaseDropdownTitleText = localize('flatFileImport.databaseDropdownTitle', "Database the table is created in");
|
||||
export const invalidFileLocationError = localize('flatFile.InvalidFileLocation', "Invalid file location. Please try a different input file");
|
||||
export const browseFilesText = localize('flatFileImport.browseFiles', "Browse");
|
||||
export const openFileText = localize('flatFileImport.openFile', "Open");
|
||||
export const fileTextboxTitleText = localize('flatFileImport.fileTextboxTitle', "Location of the file to be imported");
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { ImportPage } from '../api/importPage';
|
||||
import * as constants from '../../common/constants';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class FileConfigPage extends ImportPage {
|
||||
|
||||
@@ -228,9 +229,13 @@ export class FileConfigPage extends ImportPage {
|
||||
}
|
||||
|
||||
private async createFileBrowser(): Promise<azdata.FormComponent> {
|
||||
this.fileTextBox = this.view.modelBuilder.inputBox().withProperties({
|
||||
required: true
|
||||
this.fileTextBox = this.view.modelBuilder.inputBox().withProps({
|
||||
required: true,
|
||||
validationErrorMessage: constants.invalidFileLocationError
|
||||
}).withValidation((component) => {
|
||||
return fs.existsSync(component.value);
|
||||
}).component();
|
||||
|
||||
this.fileButton = this.view.modelBuilder.button().withProperties({
|
||||
label: constants.browseFilesText,
|
||||
}).component();
|
||||
|
||||
Reference in New Issue
Block a user