Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix for defaultLocation

Stanimir Marinovba68c7a69a53
diff --git a/app/components/LocationManager.js b/app/components/LocationManager.js
index 7bb62dd7b..2aa7d3f2c 100644
--- a/app/components/LocationManager.js
+++ b/app/components/LocationManager.js
@@ -19,7 +19,7 @@
import React from 'react';
import Table from 'rc-table';
-import 'rc-table/assets/index.css';
+// import 'rc-table/assets/index.css';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
@@ -132,6 +132,16 @@ class LocationManager extends React.Component<Props, State> {
dirs: {}
};
+ componentWillReceiveProps = (nextProps: any) => {
+ if (this.props.locations !== nextProps.locations) {
+ nextProps.locations.forEach((location) => {
+ if (location.isDefault) {
+ this.loadSubDirectories(location, 1);
+ }
+ });
+ }
+ };
+
loadSubDirectories = (location: Location, deepLevel: number) => {
const subFolder = {
uuid: location.uuid,
@@ -400,6 +410,8 @@ class LocationManager extends React.Component<Props, State> {
this.setState({
dirs: dirsTree
});
+ } else {
+ this.loadSubDirectories(location, 1);
}
this.props.loadDirectoryContent(location.paths[0]);
} else {
@@ -425,8 +437,8 @@ class LocationManager extends React.Component<Props, State> {
renderNameColumnAction = (field, location, key) => {
const children = (
<span>
- <FolderIcon style={{ marginTop: 0, marginBottom: -8 }} className={this.props.classes.icon} />
- <span style={{ fontSize: 15 }}>{field}</span>
+ {/* <FolderIcon style={{ marginTop: 0, marginBottom: -8 }} className={this.props.classes.icon} /> */}
+ <span style={{ fontSize: 15, marginLeft: 5 }}>{field}</span>
{/* <IconButton
style={{ float: 'right', paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }}
aria-label={i18n.t('core:options')}
@@ -488,7 +500,22 @@ class LocationManager extends React.Component<Props, State> {
(<span />)
;
// expandedRowRender = (record, index, indent, expanded) => (<p>extra: {record.name}</p>);
-
+ /* CustomExpandIcon = (props) => {
+ let text;
+ if (props.expanded) {
+ text = '&#8679; collapse';
+ } else {
+ text = '&#8681; expand';
+ }
+ return (
+ <a
+ className="expand-row-icon"
+ onClick={e => props.onExpand(props.record, e)}
+ dangerouslySetInnerHTML={{ __html: text }}
+ style={{ color: 'blue', cursor: 'pointer' }}
+ />
+ );
+ }; */
// <Tooltip id="tooltip-icon" title={i18n.t('core:moreOperations')} placement="bottom"></Tooltip>
renderLocation = (location: Location) => {
let table;
@@ -509,13 +536,13 @@ class LocationManager extends React.Component<Props, State> {
components={{
header: { cell: this.renderHeaderRow },
}}
- className="table"
+ // className="table"
rowKey="path"
data={this.state.dirs[location.uuid]}
columns={columns}
// expandedRowRender={this.expandedRowRender}
onExpand={this.onExpand}
- // expandIcon={CustomExpandIcon}
+ // expandIcon={this.CustomExpandIcon}
// expandIconAsCell
/* onRow={(record, index) => ({
onClick: this.onRowClick.bind(null, record, index),
diff --git a/package.json b/package.json
index dc7035d66..a6b36e0a7 100644
--- a/package.json
+++ b/package.json
@@ -202,7 +202,7 @@
"path": "^0.12.7",
"pdfjs-dist": "^2.0.271",
"rasterizehtml": "^1.3.0",
- "rc-table": "^6.1.0",
+ "rc-table": "^6.4.0",
"rc-tree": "^1.7.8",
"react": "^16.6.0",
"react-autosuggest": "^9.3.2",
diff --git a/yarn.lock b/yarn.lock
index 129df42d7..c26defb4e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8465,13 +8465,14 @@ min-document@^2.19.0:
dependencies:
dom-walk "^0.1.0"
-mini-store@^1.0.2:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/mini-store/-/mini-store-1.1.0.tgz#4d6b3fb5c89aa0303d9b39475efb3439cd42f04f"
- integrity sha512-/Ou2jdD7/CDyJBjHnpRuc8aehh2WHxBpUpVvVHn0XhvLHk35YOiUlOYhX55NX00/e4phr1F3aNnhWKkGMqLUfQ==
+mini-store@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/mini-store/-/mini-store-2.0.0.tgz#0843c048d6942ce55e3e78b1b67fc063022b5488"
+ integrity sha512-EG0CuwpQmX+XL4QVS0kxNwHW5ftSbhygu1qxQH0pipugjnPkbvkalCdQbEihMwtQY6d3MTN+MS0q+aurs+RfLQ==
dependencies:
hoist-non-react-statics "^2.3.1"
prop-types "^15.6.0"
+ react-lifecycles-compat "^3.0.4"
shallowequal "^1.0.2"
minimalistic-assert@^1.0.0:
@@ -10309,16 +10310,16 @@ [email protected]:
css-animation "^1.3.2"
prop-types "15.x"
-rc-table@^6.1.0:
- version "6.2.2"
- resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-6.2.2.tgz#829cd47f8b656edbb0418bd4da632b6cf10c073b"
- integrity sha512-ZlWiU3J9JZ2bmuVLdqG+5YRntAaWQDRwRR5Pt/fv0sNpyoyg59VnHeZ2SPlmr7EoIdErDzWHk0XxLjd/g43AVA==
+rc-table@^6.4.0:
+ version "6.4.0"
+ resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-6.4.0.tgz#ea26a4002a3fde9a26f7d7889bb016e7b8e5a598"
+ integrity sha512-dd1vcomCZtV8NIVLz6i0aK8019rRojrmVktTruHmFRc7LiFKm6M+Ij3aHp5jUAs0t5dUeToFu9AoYzA0JknBTg==
dependencies:
babel-runtime "6.x"
classnames "^2.2.5"
component-classes "^1.2.6"
lodash "^4.17.5"
- mini-store "^1.0.2"
+ mini-store "^2.0.0"
prop-types "^15.5.8"
rc-util "^4.0.4"
react-lifecycles-compat "^3.0.2"