Comments (6)
Great ideas how this could be implemented! Maybe we could start with saving the files to database and create another issue to support S3 integration through application config? There's already S3 integration for the Backstage catalog so maybe there's something we could re-use for this. Configuration could also support saving files to filesystem or other cloud services later on but still we need a database that contains:
- uuid/id/hash of the image
- location type (db/s3/filesystem/etc.)
- location uri (in case type is not db)
- content (image content when type is db)
- question_id (see below if this makes sense)
- answer_id (see below)
- created timestamp
- creator user reference
Basically we need two new endpoints, one to upload image, return an UUID or similar hash, and another one to download it using that hash. It would be nice to also have a database relation set up between the image and the question/answer but it might be a bit more complicated to implement as the image is uploaded during the creation of the post and it does not have an id at that point. This could help clean the database of images that are not used in case the question/answer is deleted or edited.
If you are willing to start with the implementation it would be awesome!
from backstage-plugin-qeta.
That's a great idea! Though I think this feature should be configurable from the application; at least there should be options for on/off and for the upload size limit (and maybe for allowed file formats). Saving large attachments might grow the database size pretty quickly. Have to think this through, but it's doable.
from backstage-plugin-qeta.
The markdown editor react-mde
seems to have some support for file uploads. Should check that out. I think it should work similarly to the editor here in GitHub; file is uploaded and then it's linked as an image (or link if it's not an image) to the markdown content. This would mean at least the following changes:
- New route to upload attachments, should return uuid
- New database table to save and serve attachments from
- New route to download attachments by their uuid
- Automatic markdown input after attachment is uploaded
Previews etc. should work directly if the attachments are available in public for example in http://localhost:7007/api/qeta/attachments/{uuid} and that returns the attachment using content-disposition and correct content-type headers.
from backstage-plugin-qeta.
I did some experiments and did a small functional test.
And I would just like to know your opinion on some points:
- To perform the upload in frontend I based on the example reconmap/web-client#238 (comment)
- For the backend part I used https://github.com/expressjs/multer
My question would be to persist the image, we may have to support more than one type.
By default, the multer ends up saving the images locally.
But we can embed them inside the database or maybe support object storage like S3 using multer-s3.
With your opinion, I can continue and open a PR in the coming weeks 😄
from backstage-plugin-qeta.
I made my first functional suggestion #58
Disclaimer: I'm not a frontend developer so some things may not be in the best possible shape. 😅
Currently, it is not very modular for us to plug in other forms of upload, but I can contribute in the following PR`s.
I left a possibility to disable the upload in case someone believes it is not necessary or has some requirement that makes it impossible to use the plugin.
from backstage-plugin-qeta.
This is done and dusted, thanks for the contribution @gabriel-dantas98 !
from backstage-plugin-qeta.
Related Issues (20)
- Qeta backend failing with 500 for search requests with special characters included HOT 2
- Getting - ERROR 404: PAGE NOT FOUND error on Q and A page HOT 7
- feat: searching resets the page HOT 2
- feat: show related questions on question page HOT 1
- feat: add entity filter to list view
- feat: add tag filter to list
- bug: text does not wrap line when using code block HOT 4
- feat: scroll to top of the page when changing page
- Upvote/downvote count not updating automatically HOT 1
- Question : Importing content from another system HOT 4
- Possibility of changing the color of the home page header. HOT 1
- feat: Azure Blob Storage attachment support
- feat: i18n support
- Customize font color in RootPage Header HOT 2
- With list of allowedTags and allowCreation false configuration tags are not getting attached to question HOT 2
- Pre-filtering questions with selected tag is not working HOT 1
- Feat: Migrate to material UI 5
- feat: date range filter for questions HOT 3
- SignIn Error HOT 2
- bug: Viewing anonymous questions/answers causes crash on frontend HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backstage-plugin-qeta.