mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
More HDFS Manage Access dialog updates (#7692)
* Add support for default permissions on directories (cherry picked from commit 4e81cceba142c6763c3447b4d2965cd75764f8f9) * Remove unneeded import (cherry picked from commit ffe5f357357e75e9290966e89768c699df2e1311) * Add recursive apply and clean up webhdfs (cherry picked from commit ae76df14f99e599df1cdfcc74ee22d3822f11a59) * Final set of changes * Undo changes to azdata/sqlops and few minor fixes * Remove cast to fix build error * Hide defaults checkbox for files and switch checkbox order
This commit is contained in:
@@ -17,7 +17,7 @@ import * as constants from '../constants';
|
||||
import { WebHDFS, HdfsError } from '../hdfs/webhdfs';
|
||||
import { AclEntry, PermissionStatus } from '../hdfs/aclEntry';
|
||||
import { Mount, MountStatus } from '../hdfs/mount';
|
||||
import { FileStatus } from '../hdfs/fileStatus';
|
||||
import { FileStatus, HdfsFileType } from '../hdfs/fileStatus';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -87,6 +87,11 @@ export interface IFileSource {
|
||||
* @param aclEntries The ACL entries to set
|
||||
*/
|
||||
setAcl(path: string, ownerEntry: AclEntry, groupEntry: AclEntry, otherEntry: AclEntry, aclEntries: AclEntry[]): Promise<void>;
|
||||
/**
|
||||
* Removes the default ACLs for the specified path
|
||||
* @param path The path to remove the default ACLs for
|
||||
*/
|
||||
removeDefaultAcl(path: string): Promise<void>;
|
||||
/**
|
||||
* Sets the permission octal (sticky, owner, group & other) for a file/folder
|
||||
* @param path The path to the file/folder to set the permission of
|
||||
@@ -120,11 +125,6 @@ export interface IRequestParams {
|
||||
headers?: {};
|
||||
}
|
||||
|
||||
export interface IHdfsFileStatus {
|
||||
type: 'FILE' | 'DIRECTORY';
|
||||
pathSuffix: string;
|
||||
}
|
||||
|
||||
export class FileSourceFactory {
|
||||
private static _instance: FileSourceFactory;
|
||||
|
||||
@@ -181,7 +181,7 @@ export class HdfsFileSource implements IFileSource {
|
||||
if (!this.mounts || refresh) {
|
||||
await this.loadMounts();
|
||||
}
|
||||
return this.readdir(path);
|
||||
return this.listStatus(path);
|
||||
}
|
||||
|
||||
private loadMounts(): Promise<void> {
|
||||
@@ -196,16 +196,15 @@ export class HdfsFileSource implements IFileSource {
|
||||
});
|
||||
}
|
||||
|
||||
private readdir(path: string): Promise<IFile[]> {
|
||||
private listStatus(path: string): Promise<IFile[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client.readdir(path, (error, files) => {
|
||||
this.client.listStatus(path, (error, fileStatuses) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
let hdfsFiles: IFile[] = files.map(fileStat => {
|
||||
let hdfsFile = <IHdfsFileStatus>fileStat;
|
||||
let file = new File(File.createPath(path, hdfsFile.pathSuffix), hdfsFile.type === 'DIRECTORY');
|
||||
let hdfsFiles: IFile[] = fileStatuses.map(fileStatus => {
|
||||
let file = new File(File.createPath(path, fileStatus.pathSuffix), fileStatus.type === HdfsFileType.Directory);
|
||||
if (this.mounts && this.mounts.has(file.path)) {
|
||||
file.mountStatus = MountStatus.Mount;
|
||||
}
|
||||
@@ -403,6 +402,22 @@ export class HdfsFileSource implements IFileSource {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the default ACLs for the specified path
|
||||
* @param path The path to remove the default ACLs for
|
||||
*/
|
||||
public removeDefaultAcl(path: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client.removeDefaultAcl(path, (error: HdfsError) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the permission octal (sticky, owner, group & other) for a file/folder
|
||||
* @param path The path to the file/folder to set the permission of
|
||||
|
||||
Reference in New Issue
Block a user