mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Cluster management/newdashboard task (#6060)
* initial commit: added cluster status notebook and dashboard task * following the previous naming conventions * endpoint widget changes to accomodatw naming changes * management-proxy/mgmtproxy chnages * updates to address the comments and added the new copy image with hover text. * added user select for making the table selectable * localize changes * added the final documented notebook * reset execution_count to 0 for all cells * style changes * updated the url to point to private repo
This commit is contained in:
@@ -10,6 +10,7 @@ import * as crypto from 'crypto';
|
||||
import * as os from 'os';
|
||||
import * as findRemoveSync from 'find-remove';
|
||||
import * as constants from './constants';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configTracingLevel = 'tracingLevel';
|
||||
const configLogRetentionMinutes = 'logRetentionMinutes';
|
||||
@@ -29,6 +30,34 @@ export function getAppDataPath() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a file name that is not already used in the target directory
|
||||
* @param filePath source notebook file name
|
||||
* @param fileExtension file type
|
||||
*/
|
||||
export function getTargetFileName(filePath: string): string {
|
||||
const targetDirectory = os.homedir();
|
||||
const fileExtension = path.extname(filePath);
|
||||
const baseName = path.basename(filePath, fileExtension);
|
||||
let targetFileName;
|
||||
let idx = 0;
|
||||
do {
|
||||
const suffix = idx === 0 ? '' : `-${idx}`;
|
||||
targetFileName = path.join(targetDirectory, `${baseName}${suffix}${fileExtension}`);
|
||||
idx++;
|
||||
} while (fs.existsSync(targetFileName));
|
||||
|
||||
return targetFileName;
|
||||
}
|
||||
|
||||
export function fileExists(file: string): boolean {
|
||||
return fs.existsSync(file);
|
||||
}
|
||||
|
||||
export function copyFile(source: string, target: string): void {
|
||||
fs.copyFileSync(source, target);
|
||||
}
|
||||
|
||||
export function removeOldLogFiles(prefix: string): JSON {
|
||||
return findRemoveSync(getDefaultLogDir(), { prefix: `${prefix}_`, age: { seconds: getConfigLogRetentionSeconds() }, limit: getConfigLogFilesRemovalLimit() });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user