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

display import modal #3

Merged
merged 8 commits into from
Aug 14, 2023
Merged

display import modal #3

merged 8 commits into from
Aug 14, 2023

Conversation

ETLaurent
Copy link
Contributor

@ETLaurent ETLaurent commented Aug 9, 2023

Summary

Display the 3-dot menu with the Import item on page and docs manager.

Clicking on this item display the import modal.
For now, the modal does not actually import selected zip files.

image

image

What are the specific steps to test this change?

use pro-4272-import-modal branch of apostrophe. (now on main)

setting import: false on the page module, on project side, should remove the 3-dots menu
same for the pieces, setting it to articles for instance should hide the menu, only for articles manager modal.

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

Comment on lines 19 to 26
<p class="apos-import__description">
{{ $t(descriptionStart) }}
<a
href="https://v3.docs.apostrophecms.org/"
target="_blank"
>{{ $t(descriptionLink) }}</a>
{{ $t(descriptionEnd) }}
</p>
Copy link
Contributor Author

@ETLaurent ETLaurent Aug 9, 2023

Choose a reason for hiding this comment

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

image

i18n/en.json Outdated Show resolved Hide resolved
@linear
Copy link

linear bot commented Aug 9, 2023

PRO-4272 As an editor, I can see the import UI modal

As an editor, I can click on the import buttons available from the pages manager menu as well as from the pieces manager menu:

pieces-manager-import.png

https://www.sketch.com/s/fbfcda4a-08a4-4c8d-ab88-fdad7532217e/a/YZGrpyE

pages-manager.png

When I click on these buttons, I must see an import modal being opened:

import-modal.png

https://www.sketch.com/s/fbfcda4a-08a4-4c8d-ab88-fdad7532217e/a/w5Lj7Q9

When I click on the drag and drop area I can see my files browser being opened, I also can drag and drop my file directly into the area.

Once done, it must look like this:

import-modal-file.png

Limited to one file for now (since we won't manage big data loads), So if dropping another file, it should replace the existing one.

For the loading state we will use the notification bar that is already used in piece-type-exporter and piece-type-importer.

Since it will be done in your import process directly since it's about wrapping you method with the run from the job module, we'll implement that with the backend.

ℹ️ the initial modal exists almost like in the designs in the module apostrophecms-pro/dataset, you might save some time by taking code from there.

Acceptance Criteria

  • I can see the buttons import in the pages modal and in the pieces modal if there is no option shareDocsDisableImport set to true for the concerned module.
  • When clicking on it I can see the import modal appearing following the given designs.
  • I can load a file in the browser, if I load another one, the first is replaced.

@ETLaurent ETLaurent requested a review from falkodev August 9, 2023 15:53
@ETLaurent ETLaurent marked this pull request as ready for review August 9, 2023 15:53
@ETLaurent ETLaurent requested a review from ValJed August 14, 2023 09:17
this.modal.showModal = false;
},
async runImport () {
// try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this comment?

Copy link
Contributor Author

@ETLaurent ETLaurent Aug 14, 2023

Choose a reason for hiding this comment

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

we can leave it, it'll be implemented soon

Copy link
Contributor

@ValJed ValJed left a comment

Choose a reason for hiding this comment

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

Just few questions.

i18n/en.json Outdated
"exportModalNoRelatedTypes": "No Related Types"
"exportModalNoRelatedTypes": "No Related Types",
"import": "Import",
"importModalDescription": "Importing content requires a zip file. See our <a href=\"https://v3.docs.apostrophecms.org/\" target=\"_blank\">guide to importing content</a> in Apostrophe.",
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose it will redirect to the proper doc later that doesn't exist already?
We might create a ticket for that in order to not forget , wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I'll a note to the existing ticket that's related to writing the doc about sharing docs across sites

i18n/en.json Outdated
"exportModalNoRelatedTypes": "No Related Types",
"import": "Import",
"importModalDescription": "Importing content requires a zip file. See our <a href=\"https://v3.docs.apostrophecms.org/\" target=\"_blank\">guide to importing content</a> in Apostrophe.",
"importType": "Import {{ type }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

It matches the designs, just a note, the same route will be called whatever document or page is imported.
So it might be clearer to say, Import Documents. We can ask @stuartromanek maybe?

Copy link
Contributor Author

@ETLaurent ETLaurent Aug 14, 2023

Choose a reason for hiding this comment

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

Hmm, as I understand the tech design and the tickets, when we import from a piece manager modal, we expect the zip to contain only the pieces of that type (+ related docs and attachments).

Same for pages, what's imported from the page manager should be pages... As I understand it.

I might be wrong though...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

here you go

image

improve: '@apostrophecms/page',

utilityOperations (self) {
if (self.options.import === false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

From the ticket, the option name is shareDocsDisableImport. Not sure it's a good one since he module is called import-export but we might check.

Copy link
Contributor Author

@ETLaurent ETLaurent Aug 14, 2023

Choose a reason for hiding this comment

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

Yes that's why Anthony has changed it to export.
I did the same with import so we can disable the export and not the import, and vice versa.
We could still change the name later I think.

@ETLaurent
Copy link
Contributor Author

final:

image

@ETLaurent ETLaurent requested review from ValJed and falkodev and removed request for falkodev August 14, 2023 14:48
@ETLaurent ETLaurent merged commit 8bdea29 into main Aug 14, 2023
9 checks passed
@ETLaurent ETLaurent deleted the pro-4272-import-modal branch August 14, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants