Skip to content

資料夾分類 / Support collection or folder#442

Closed
0140454 wants to merge 25 commits into
hackmdio:masterfrom
0140454:feature/folder
Closed

資料夾分類 / Support collection or folder#442
0140454 wants to merge 25 commits into
hackmdio:masterfrom
0140454:feature/folder

Conversation

@0140454

@0140454 0140454 commented Apr 28, 2017

Copy link
Copy Markdown

Issue: #109

To implement folder feature, we create Folders table and introduce sequelize-hierarchy module which will create FoldersAncestors to maintain relationship between folders.

Each user will have a root folder. If user is new registered or there is no root folder assigned to user, it will create it automatically.

Also, notes created before folder feature will show in root folder.

@0140454 0140454 force-pushed the feature/folder branch 3 times, most recently from 6dfa6a4 to d320f95 Compare May 11, 2017 00:46
@0140454 0140454 force-pushed the feature/folder branch 4 times, most recently from c59b5b4 to e688769 Compare May 17, 2017 18:11
@jackycute jackycute temporarily deployed to hackmd-ce-pr-442 May 25, 2017 09:55 Inactive
@jackycute jackycute temporarily deployed to hackmd-ce-pr-442 June 3, 2017 02:58 Inactive
@0140454 0140454 force-pushed the feature/folder branch 3 times, most recently from 65512e5 to 0be0ef2 Compare June 9, 2017 02:16
@SISheogorath SISheogorath added the feature Wants to add a new feature label Oct 9, 2017
@davy-tw

davy-tw commented Oct 17, 2017

Copy link
Copy Markdown

Server doesn't response after I register new user and login on this PR (commit fd89373), and the error log below:

hackmdPostgres_1  | ERROR:  column "hierarchyLevel" of relation "Folders" does not exist at character 63
hackmdPostgres_1  | STATEMENT:  INSERT INTO "Folders" ("id","ownerId","createdAt","updatedAt","hierarchyLevel") VALUES ('698b6913-66e2-4c9a-95d4-652ba7ecdb92','d2528a5d-4158-49b2-a9b8-97e6b1fd8020','2017-10-17 03:04:16.572 +00:00','2017-10-17 03:04:16.572 +00:00',1) RETURNING *;
hackmd_1          | Unhandled rejection SequelizeDatabaseError: column "hierarchyLevel" of relation "Folders" does not exist
hackmd_1          |     at Query.formatError (/hackmd/node_modules/sequelize/lib/dialects/postgres/query.js:357:14)
hackmd_1          |     at Result.<anonymous> (/hackmd/node_modules/sequelize/lib/dialects/postgres/query.js:88:19)
hackmd_1          |     at emitOne (events.js:96:13)
hackmd_1          |     at Result.emit (events.js:188:7)
hackmd_1          |     at Result.Query.handleError (/hackmd/node_modules/pg/lib/query.js:163:8)
hackmd_1          |     at Client.<anonymous> (/hackmd/node_modules/pg/lib/client.js:188:26)
hackmd_1          |     at emitOne (events.js:96:13)
hackmd_1          |     at Connection.emit (events.js:188:7)
hackmd_1          |     at Socket.<anonymous> (/hackmd/node_modules/pg/lib/connection.js:133:12)
hackmd_1          |     at emitOne (events.js:96:13)
hackmd_1          |     at Socket.emit (events.js:188:7)
hackmd_1          |     at readableAddChunk (_stream_readable.js:176:18)
hackmd_1          |     at Socket.Readable.push (_stream_readable.js:134:10)
hackmd_1          |     at TCP.onread (net.js:547:20)

name: Sequelize.TEXT,
ownerId: Sequelize.UUID,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems that we have to add migration manually for sequelize-hierarchy:

-         updatedAt: Sequelize.DATE
+         updatedAt: Sequelize.DATE,
+
+         hierarchyLevel: Sequelize.STRING,
+         parentId: Sequelize.UUID

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, you're right. Thanks for your great investigation.
We will push new commit as soon as possible.

@SISheogorath

Copy link
Copy Markdown
Contributor

Has someone tested this PR in detail?

  • How well does the migration work?
  • Are existing notes lost?
  • Do functionalities, like slide mode or published notes, break?

@davy-tw

davy-tw commented Oct 20, 2017

Copy link
Copy Markdown

When you remove a folder, all notes in that folder will gone instead of going to root folder.
And you cannot find them in folder view anymore...

@dada8397

Copy link
Copy Markdown

@david50407 Do you mean that move notes to root folder better than delete all notes in the folder?

@davy-tw

davy-tw commented Oct 21, 2017 via email

Copy link
Copy Markdown

@dada8397

Copy link
Copy Markdown

@david50407
Thanks for your advice 😄

@SISheogorath

SISheogorath commented Oct 21, 2017

Copy link
Copy Markdown
Contributor

I'm more asking for migrations from an existing instance and database.

I just checked the background of these changes and it seems very good. But of course we need to provide a proper migration, so we need to make sure that we can redirect and migrate the existing notes when we want to merge this feature

Also, do you have an example instance?

@0140454

0140454 commented Oct 21, 2017

Copy link
Copy Markdown
Author

@SISheogorath
About migration from an existing database, we have tested it using the following steps.

  1. Use master branch to build a clean system.
  2. Login and create some notes.
  3. Use sequelize to migrate database to feature/folder branch.
  4. Check created notes whether be displayed in root folder.

And we build an example instance at https://intense-waters-94449.herokuapp.com/, everyone can test this feature through it.

@SISheogorath

Copy link
Copy Markdown
Contributor

This is AWESOME!!! ❤️

I'll make sure this makes it into the upcoming release!

@SISheogorath SISheogorath added this to the Next release milestone Dec 22, 2017
@syhsu

syhsu commented Jan 18, 2018

Copy link
Copy Markdown

To be honest I don't really need folders to arrange my docs, which is, in my opinion, quite contradicted to the usages of tags. But I do hope to have "view" options in the dashboard, like a "list" view or a "tag" view, to have a kind-of bird view of docs I have, especially when hackmd adds docs you check to your dashboard automatically, which is a pretty handy feature too, BTW.

The current icon view is good, but when you have docs more than a certain number, browsing among icons is really a nightmare. A convenient and straight-forward solution is to provide an option to show a full tag list somewhere in the dashboard and a check box is in front of each tag. Then I could check up the tags I want to see, instead of searching in a tag search bar. Hope this doesn't offend the UI designers who made the tag search bar. At last, hackmd is awesome.

@dada8397

Copy link
Copy Markdown

Hi @syhsu
Thanks for your advice 😄
I wonder that are you talking about the currently "card view" and you want some "list view" to be more convenient? This can be another issue. I think we can make a button to switch whether we want "card view" or "list view".
About tag search has already been in the page, you can choose tags in "select tags..." area, and you can filter tags.

@SISheogorath

Copy link
Copy Markdown
Contributor

Agreed, I also think that the directory view is more independent from the current history view.

Central tagging is also way more difficult in HackMD since tags are part of the document. But that's another story. For this PR I think we are on a good way and I would like to see it in 1.1.0-ce. But when there is a majority against this change we can also re-discuss it.

I think folders and directories allow to categorize notes by adding a main topic above. Tags are different by design since they allow to add one document into multiple categories.

@syhsu

syhsu commented Jan 19, 2018

Copy link
Copy Markdown

Hello @dada8397,
Thanks for your reply. A "list view" is very very very good enough for me.:)

And hello @SISheogorath,
Agreed here. The folder implementation is a direction worthy to do in Hackmd since the tags in Hackmd are part of the document. The folder implementation here can improve multiple document operations, such as deleting/copying/selecting multiple documents.

As for document organising, I really think tags can totally replace folders and can provide better user experiences via searching. My point is that searching is more convenient and efficient than organizing since search engines have changed how people memorize things, transactive memory. Tags provide not only a "flat" view of documents but also a structure of scaffolds for tracking your documents/thoughts.

P.S. Maybe using what question I ask when I organize a doc is a better way to explain my idea. When organizing a document, I ask myself what tags I should make to allow me find it in the future, not where I should put it.

@SISheogorath SISheogorath modified the milestones: 1.1.0-CE Release, Next release Mar 22, 2018
@seijikun

Copy link
Copy Markdown

I agree that the tag-based search for files is a good way of organising / sorting stuff if one is alone. But as I understood it, hackmd is mainly meant as a collaboration system.
The real advantage of adding folders, would be the possibility of sharing a whole folder with a group of people. Potentially even adding permissions, to allow other people to add new hackmds into the folder. That is a feature that is currently missing for the way that we are using the software for note-taking as a group of students.

Because currently, one of us opens a new hackmd and sends the link around. This results in a myriad of links flowing around somewhere in some chat channels. We constantly have to ask for links to hackmds that others opened.
A "solution" would be to open a new hackmd with links to other hackmds. But in my opinion, that's not fitting for a proper collaboration.
It would be really cool if just one of us could create a folder, share it with everyone in the group and then everyone can create hackmds in that folder for anyone else to see.
We could even search for documents with specific tags within that shared folder!

@SISheogorath SISheogorath removed this from the Next minor release milestone Oct 4, 2018
@SISheogorath

Copy link
Copy Markdown
Contributor

To be honest, after all this time, and all the changes we made, I don't seeing this implemented this way any time soon. To be fair and not keeping anyone up with this, I'll close this PR.

You did an awesome work and it's really nice, my problem with it is just that the change is too invasive. Sorry for that. Hope you still enjoy working with use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Wants to add a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.