-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix console error on loading package list * Update vuetify from 1.0.19 to 1.3.4 * Make server read package fileList * PackageDetail.vue: add tree view for fileList * PackageDetail.vue: beautify file tree icons * format code * cli: correct server and ui logs properties * PackageDetail.vue: file tree: add open animation * PackageDetail.vue: add video icons * backend: add file content service * BackendApi: fix tslint error * file content service: add version as param * BackendApi: add new fetFileContent method * vscode tasks: never scan output * tasks: format * Server: add path to file tree * BackendApi: fix promise type and xhr param * DataStore: Add getFileContent method and format code * types/Package: add property `fileList` * (WIP) PackageDetail.vue: Make code selectable in file tree * fileLister: cleanup code: fix warnings * cleanup code: typedef * format code * update vuetify to 1.3.5 * Add type TreeItem * backendApi: fix filepath concat * DataStore: cache fileContent Promise * PackageDetail.vue: open code on click and add loadingspinner * cleanup: remove function * EventBus: Add timeout error * improve error handling * PackageDetail fileContent: add timeout, error handling, find subdirfiles * remove console.log * PackageDetail: tree view: fix timeout * improve error message style * PackgeDetail tree view: get clicked label correctly * PackageDetail tree view: encode filepath to send correct request * packagedetail tree view: try to get smooth transition * format code * PackageDetail: improve treeview loading animation * DataStore: fix promise cache * DataStore: add fileContentCache * cleanup code
- Loading branch information
Showing
18 changed files
with
525 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { promisify } from 'util'; | ||
import { resolve } from 'path'; | ||
import * as fs from 'fs'; | ||
|
||
const readdir = promisify(fs.readdir); | ||
const stat = promisify(fs.stat); | ||
|
||
function generateId(): string { | ||
return ( | ||
'_' + | ||
Math.random() | ||
.toString(36) | ||
.substr(2, 30) | ||
); | ||
} | ||
|
||
export default async function getFiles( | ||
basedir: string, | ||
sub: string, | ||
recursive: boolean, | ||
): Promise<any> { | ||
const dir = resolve(basedir, sub); | ||
const subdirs = await readdir(dir); | ||
return await Promise.all( | ||
subdirs.map(async subdir => { | ||
const res = resolve(dir, subdir); | ||
return (await stat(res)).isDirectory() | ||
? { | ||
id: generateId(), | ||
name: subdir, | ||
children: await getFiles(basedir, `${sub}/${subdir}`, true), | ||
} | ||
: { | ||
id: generateId(), | ||
name: subdir, | ||
path: recursive ? sub.substring(sub.indexOf('/') + 1, sub.length) : '', | ||
}; | ||
}), | ||
); | ||
} |
Oops, something went wrong.