mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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 serviceCrashMessageText = localize('serviceCrashMessage', "service component could not start");
|
||||||
export const serverDropDownTitleText = localize('flatFileImport.serverDropdownTitle', "Server the database is in");
|
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 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 browseFilesText = localize('flatFileImport.browseFiles', "Browse");
|
||||||
export const openFileText = localize('flatFileImport.openFile', "Open");
|
export const openFileText = localize('flatFileImport.openFile', "Open");
|
||||||
export const fileTextboxTitleText = localize('flatFileImport.fileTextboxTitle', "Location of the file to be imported");
|
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 * as vscode from 'vscode';
|
||||||
import { ImportPage } from '../api/importPage';
|
import { ImportPage } from '../api/importPage';
|
||||||
import * as constants from '../../common/constants';
|
import * as constants from '../../common/constants';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export class FileConfigPage extends ImportPage {
|
export class FileConfigPage extends ImportPage {
|
||||||
|
|
||||||
@@ -228,9 +229,13 @@ export class FileConfigPage extends ImportPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async createFileBrowser(): Promise<azdata.FormComponent> {
|
private async createFileBrowser(): Promise<azdata.FormComponent> {
|
||||||
this.fileTextBox = this.view.modelBuilder.inputBox().withProperties({
|
this.fileTextBox = this.view.modelBuilder.inputBox().withProps({
|
||||||
required: true
|
required: true,
|
||||||
|
validationErrorMessage: constants.invalidFileLocationError
|
||||||
|
}).withValidation((component) => {
|
||||||
|
return fs.existsSync(component.value);
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.fileButton = this.view.modelBuilder.button().withProperties({
|
this.fileButton = this.view.modelBuilder.button().withProperties({
|
||||||
label: constants.browseFilesText,
|
label: constants.browseFilesText,
|
||||||
}).component();
|
}).component();
|
||||||
|
|||||||
Reference in New Issue
Block a user