fix(ui/browser): sort items by type
This commit is contained in:
parent
008181a9aa
commit
87868dea4c
2 changed files with 20 additions and 3 deletions
|
@ -15,6 +15,7 @@ export interface User {
|
||||||
pwd: string;
|
pwd: string;
|
||||||
role: string;
|
role: string;
|
||||||
quota: Quota;
|
quota: Quota;
|
||||||
|
usedSpace: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListUsersResp {
|
export interface ListUsersResp {
|
||||||
|
@ -55,11 +56,16 @@ export interface ListUploadingsResp {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListSharingsResp {
|
export interface ListSharingsResp {
|
||||||
sharingDirs: string[];
|
sharingDirs: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IUsersClient {
|
export interface IUsersClient {
|
||||||
login: (user: string, pwd: string, captchaId: string, captchaInput:string) => Promise<Response>;
|
login: (
|
||||||
|
user: string,
|
||||||
|
pwd: string,
|
||||||
|
captchaId: string,
|
||||||
|
captchaInput: string
|
||||||
|
) => Promise<Response>;
|
||||||
logout: () => Promise<Response>;
|
logout: () => Promise<Response>;
|
||||||
isAuthed: () => Promise<Response>;
|
isAuthed: () => Promise<Response>;
|
||||||
self: () => Promise<Response>;
|
self: () => Promise<Response>;
|
||||||
|
|
|
@ -363,7 +363,18 @@ export class Browser extends React.Component<Props, State, {}> {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const itemList = this.props.browser.items.map((item: MetadataResp) => {
|
const sortedItems = this.props.browser.items.sort(
|
||||||
|
(item1: MetadataResp, item2: MetadataResp) => {
|
||||||
|
if (item1.isDir && !item2.isDir) {
|
||||||
|
return -1;
|
||||||
|
} else if (!item1.isDir && item2.isDir) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const itemList = sortedItems.map((item: MetadataResp) => {
|
||||||
const isSelected = this.state.selectedItems.has(item.name);
|
const isSelected = this.state.selectedItems.has(item.name);
|
||||||
const dirPath = this.props.browser.dirPath.join("/");
|
const dirPath = this.props.browser.dirPath.join("/");
|
||||||
const itemPath = dirPath.endsWith("/")
|
const itemPath = dirPath.endsWith("/")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue