Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show dataset name or explorative tracing name in webknossos tab title #4767

Merged
merged 7 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/javascripts/oxalis/view/components/tab_title_component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @flow

import useDocumentTitle from "@rehooks/document-title";

function TabTitle({ title }: { title: string }) {
useDocumentTitle(title);
return null;
}

export default TabTitle;
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import messages from "messages";
import window, { document, location } from "libs/window";
import ErrorHandling from "libs/error_handling";
import CrossOriginApi from "oxalis/api/cross_origin_api";
import TabTitle from "../components/tab_title_component";

import { GoldenLayoutAdapter } from "./golden_layout_adapter";
import { determineLayout } from "./default_layout_configs";
Expand All @@ -58,6 +59,8 @@ type StateProps = {|
isDatasetOnScratchVolume: boolean,
autoSaveLayouts: boolean,
datasetName: string,
displayName: string,
organization: string,
|};
type DispatchProps = {|
setAutoSaveLayouts: boolean => void,
Expand Down Expand Up @@ -159,6 +162,8 @@ class TracingLayoutView extends React.PureComponent<PropsWithRouter, State> {
storeLayoutConfig(this.currentLayoutConfig, layoutKey, this.currentLayoutName);
};

getTabTitle = () => `${this.props.displayName} ${this.props.organization} webknossos`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getTabTitle = () => `${this.props.displayName} ${this.props.organization} webknossos`;
getTabTitle = () => `${this.props.displayName} ${this.props.organization} webKnossos`;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think that some sort of separator between these different parts would be nice. For example an |. If some of these parts happens to be empty or null, unnecessary | should be avoided then (for example, filtering the parts as an array and then use join).


getLayoutNamesFromCurrentView = (layoutKey): Array<string> =>
this.props.storedLayouts[layoutKey] ? Object.keys(this.props.storedLayouts[layoutKey]) : [];

Expand Down Expand Up @@ -190,6 +195,7 @@ class TracingLayoutView extends React.PureComponent<PropsWithRouter, State> {
onImport={isUpdateTracingAllowed ? importTracingFiles : createNewTracing}
isUpdateAllowed={isUpdateTracingAllowed}
>
<TabTitle title={this.getTabTitle()} />
<OxalisController
initialAnnotationType={this.props.initialAnnotationType}
initialCommandType={this.props.initialCommandType}
Expand Down Expand Up @@ -343,6 +349,8 @@ function mapStateToProps(state: OxalisState): StateProps {
storedLayouts: state.uiInformation.storedLayouts,
isDatasetOnScratchVolume: state.dataset.dataStore.isScratch,
datasetName: state.dataset.name,
displayName: state.tracing.name ? state.tracing.name : state.dataset.name,
organization: state.activeUser ? state.activeUser.organization : "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that no organization is shown if the user is not logged in? I think, this is problematic since the organization title should especially be presented for guest users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be the organization that owns the dataset instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that makes sense!

};
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
]
},
"dependencies": {
"@rehooks/document-title": "^1.0.2",
"@scalableminds/prop-types": "^15.6.1",
"@scalableminds/saxophone": "^0.5.0",
"@tensorflow/tfjs": "^1.0.0",
Expand Down
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,13 @@
resolved "https://registry.yarnpkg.com/@redux-saga/types/-/types-1.0.2.tgz#1d94f02800b094753f9271c206a26c2a06ca14ee"
integrity sha512-8/qcMh15507AnXJ3lBeuhsdFwnWQqnp68EpUuHlYPixJ5vjVmls7/Jq48cnUlrZI8Jd9U1jkhfCl0gaT5KMgVw==

"@rehooks/document-title@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@rehooks/document-title/-/document-title-1.0.2.tgz#d03e8a09e09f6fd481518982b151ab0da4bc5eec"
integrity sha512-8ckcelpgqmWtGNXob+P6Lw2lHM2IfkP7sl8QJ2BNHkFeDQnc1CYeYf2NMVuFflYh3YVlAlfUzAxcIG1QCBrRQQ==
dependencies:
react "^16.13.1"

"@rpl/[email protected]":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@rpl/badge-up/-/badge-up-2.2.0.tgz#79a5ccf72bdb1777390bb7e4caa08dc42d57dd9a"
Expand Down Expand Up @@ -10435,6 +10442,15 @@ [email protected]:
object-assign "^4.1.0"
prop-types "^15.5.7"

react@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"

react@^16.3.0, react@^16.8.0:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
Expand Down