Coder Social home page Coder Social logo

gridsome-source-directus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gridsome-source-directus's Issues

gridsome_image is always null

I've installed the 1.1 version of the plugin and though many things are working well, the gridsome_image field is always null when queried. The files are downloaded in the .cache-directus folder. Many of the other directus-fed fields are present.

Directus version: 8.6.2

collections: [
          {
            name: 'rotator',
            status: 'published',
            fields: '*.*.*',
            downloadImages: true,
            downloadFiles: true,
          }

What else can I share to help diagnose this?

Add more options

  1. Add option to set protocol, because development mode at localhost && test servers often using http protocol:
    const http = require(protocol_option);

  2. Add option to set directory for uploading images
    let download = async (url, dest, dir = upload_dir_option) => {

  3. Add option for choosing sanitize item or not:

function sanitizeItem(fields) {
if( sanitize_option ) {
  let { id, title, slug, path, date, content, excerpt } = fields;
  let _id = id.toString();
  delete fields.id;
}
  return sanitizeFields(fields);
}

When you create new site it is doesn't matter, but when you change current site you haven't to change existing urls

  1. Add option to fetching flat data. In my case my site fetch multi language data:
{
        "node": {
            "id": "883a7598",
            "lang": [
                {
                    "id": 11,
                    "title": "russian title",
                    "news_text": "russian text",
                    "lang": "ru"
                },
                {
                    "id": 13,
                    "title": "english title",
                    "news_text": "english text",
                    "lang": "en"
                },
                {
                    "id": 12,
                    "title": "ukrainian title",
                    "news_text": "ukrainian tezt",
                    "lang": "ua"
                }
            ]
        }
    }

I would like fetch data like this:

{
        "node": {
            "id": "883a7598",
            "lang_0_id": 11,
            "lang_0_title": "russian title",
            "lang_0_news_text": "russian text",
            "lang_0_lang": "ru",
            "lang_1_id": 13,
            "lang_1_title": "english title",
            "lang_1_news_text": "english text",
            "lang_1_lang": "en",
            "lang_2_id": 12,
            "lang_2_title": "ukrainian title",
            "lang_2_news_text": "ukrainian text",
            "lang_2_lang": "ua",
        }
    }

ERROR: Can not login to Directus

I get the following error with a directus instance I spun up and double and triple checked the URL and login info for:

DIRECTUS ERROR: Can not login to Directus { code: 3, message: 'Unauthorized request', class: 'Directus\\Exception\\UnauthorizedException', file: '/app/code/src/helpers/app.php', line: 287 }

Is anyone else encountering this issue? To specify, I did make the collection I am attempting to fetch and have done no other configuration. Is there something else I need to be doing on the directus side of things?

No details on how to call fetched data

After reviewing the readme there is no information on how to use the data retrieved from directus. I assume it is a {{ data.collection.item }} or similar? Would recommend adding it to readme info.

Also is the data available on ALL pages globally?

How to deal with files when specified as O2M ?

Hello @peXed ,

In directus, I have a collection with a "multiple files" field (O2M).

But on the gridsome side, I can't create a query to get files details. I only have details from the junction table.

What's the best way to have all details of linked files ?

Filtering the collection using the Directus filter option

I'd like to use filtering in directus using published_on and expired_on fields to control what content gets build into the site. In the docs, it's suggested that other parameters can be passed to the directus api. Is filter on of them. I've been trying some different options and can't seem to get it to work.

collections: [
          {
            name: 'rotator',
            status: 'published',
            fields: '*.*.*',
            downloadImages: true,
            downloadFiles: true,
            //filter: "[published_on][lte]=now"
          }, 

Getting 'Not Found' Error During Login

I'm sure it's not a bug, but I'm trying to connect to my new directus DB. I think I'm having trouble figuring out what to put in for the apiUrl since I haven't seen any examples. Perhaps I'm missing some other information as well... This is what I've got (sensitive info obfuscated).

    {
      use: 'gridsome-source-directus',
      options: {
        apiUrl: 'http://mysite.com/my-project-key/gql',
        project: 'my-project-key',
        email: '[email protected]',
        password: 'superSecretPassword!',
       collections: [
          {
            name: 'blog',
            status: 'published',
            fields: '*.*',
            downloadImages: true
          }
        ]
      }
    },

I am able to connect to my directus dashboard at the domain. I have set the Public role to have Read permissions on the blog collection, though I'm logging in with an Admin user, so it shouldn't matter.

Since this is my first time trying to connect to directus, can you see where I've gone wrong?

Populating directus_image object

Hey!

This is not really an issue, but my desire to understand how do you populate "gridsome_image" with data when enabled of downloading images?

"gridsome_image": {
  "type": "image",
  "mimeType": "image/jpeg",
  "src": "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=2048&fit=cover&blur=20&key=215a2f9",
  "size": {
    "width": 2048,
    "height": 1365
  },
  "sizes": "(max-width: 2048px) 100vw, 2048px",
  "srcset": [
    "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=480&fit=cover&blur=20&key=215a2f9 480w",
    "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=1024&fit=cover&blur=20&key=215a2f9 1024w",
    "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=2048&fit=cover&blur=20&key=215a2f9 2048w"
  ],
  "dataUri": "data:image/svg+xml,%3csvg fill='none' viewBox='0 0 2048 1365' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs%3e%3cfilter id='__svg-blur-4ec14479b512767969be30dd9d849ccd'%3e%3cfeGaussianBlur in='SourceGraphic' stdDeviation='20'/%3e%3c/filter%3e%3c/defs%3e%3cimage x='0' y='0' filter='url(%23__svg-blur-4ec14479b512767969be30dd9d849ccd)' width='2048' height='1365' xlink:href='data:image/jpeg%3bbase64%2c/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAArAEADASIAAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAABQQGAwcB/8QALxAAAgEDAwIEBQMFAAAAAAAAAQIDAAQRBRIhBjETIkFRBzJhcZEUgbEVI2Khwf/EABcBAQEBAQAAAAAAAAAAAAAAAAMBAgT/xAAdEQACAgMBAQEAAAAAAAAAAAAAAQIhETFRAxJB/9oADAMBAAIRAxEAPwCO/wDiheagxaOyhGTzvYsT%2bOKoHxE1MW%2bIYbGErgZYMxP1FeMadNMZgiZLYOAPtSj3csRZQ%2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vQDGuR7UcaK%2bH//Z' /%3e%3c/svg%3e"
},

I am asking this because there is a port of your Directus 8 implementation but for Directus 9. Unfortunately, when downloading the images, "gridsome_image" is null.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.