feat(fe/panel_files): enable endpoint for admin

This commit is contained in:
hexxa 2022-01-25 22:39:34 +08:00 committed by Hexxa
parent 75c6f06a6d
commit b6cee897e1
4 changed files with 31 additions and 1 deletions

View file

@ -493,6 +493,7 @@
.theme-default .pane-title { .theme-default .pane-title {
color: black; color: black;
font-size: 1.6rem; font-size: 1.6rem;
line-height: 1.6rem;
} }
.theme-default #pane-settings { .theme-default #pane-settings {

View file

@ -755,6 +755,24 @@ export class FilesPanel extends React.Component<Props, State, {}> {
}; };
render() { render() {
const showEndpoints =
this.props.login.userRole === roleAdmin ? "" : "hidden";
const gotoRoot = () => this.chdir(List(["/"]));
const endPoints = (
<div className={showEndpoints}>
<Container>
<h5 className="pane-title margin-r-m">{this.props.msg.pkg.get("endpoints")}</h5>
<div className="hr"></div>
<button onClick={gotoRoot} className="margin-r-m">
{this.props.msg.pkg.get("endpoints.root")}
</button>
<button onClick={this.goHome}>
{this.props.msg.pkg.get("endpoints.home")}
</button>
</Container>
</div>
);
const shareModeClass = const shareModeClass =
this.props.ui.control.controls.get(sharingCtrl) === ctrlOn this.props.ui.control.controls.get(sharingCtrl) === ctrlOn
? "hidden" ? "hidden"
@ -771,7 +789,9 @@ export class FilesPanel extends React.Component<Props, State, {}> {
} }
className="item clickable" className="item clickable"
> >
<span className="content">{pathPart}</span> <span className="content">
{pathPart === "/" ? "~" : pathPart}
</span>
</a> </a>
<span className="item"> <span className="item">
<span className="content">{"/"}</span> <span className="content">{"/"}</span>
@ -851,8 +871,11 @@ export class FilesPanel extends React.Component<Props, State, {}> {
this.props.ui.control.controls.get(filesViewCtrl) === "table" this.props.ui.control.controls.get(filesViewCtrl) === "table"
? "cyan1-font" ? "cyan1-font"
: "black-font"; : "black-font";
const itemListPane = ( const itemListPane = (
<div> <div>
{endPoints}
<div className={showOp}> <div className={showOp}>
<Container>{ops}</Container> <Container>{ops}</Container>
</div> </div>

View file

@ -133,4 +133,7 @@ export const msgs: Map<string, string> = Map({
"op.cancel": "Cancel", "op.cancel": "Cancel",
"term.time": "Time", "term.time": "Time",
"breadcrumb.loc": "Location", "breadcrumb.loc": "Location",
"endpoints": "Endpoints",
"endpoints.root": "Root",
"endpoints.home": "Home",
}); });

View file

@ -130,4 +130,7 @@ export const msgs: Map<string, string> = Map({
"op.cancel": "取消", "op.cancel": "取消",
"term.time": "时间", "term.time": "时间",
"breadcrumb.loc": "位置", "breadcrumb.loc": "位置",
"endpoints": "端点",
"endpoints.root": "根",
"endpoints.home": "家",
}); });