Giter VIP home page Giter VIP logo

contenta_vue_nuxt's People

Contributors

davidjor-hpan avatar dependabot[bot] avatar e0ipso avatar jeanfei avatar mogtofu33 avatar nickstees avatar penyaskito avatar yann-yinn avatar yusadolat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contenta_vue_nuxt's Issues

Nuxt app crashes when files are edited during `npm run dev`

While npm run dev was running, I tried to change a component file. Even the most trivial change, such as indenting a line of code, resulted in a crash. The error message on the command line:

✖ error TypeError: Cannot read property 'data' of undefined
  at exports.modules../lib/jsonApiClient.js.axios__WEBPACK_IMPORTED_MODULE_1___default.a.interceptors.response.use.response (pages/recipes/index.js:900:83)
  at process._tickCallback (internal/process/next_tick.js:68:7)

I have been looking into this with support from @yann-yinn (thank you!) and finally found this workaround:

import qs from 'qs';

 // Add a response interceptor to format response with jsonapi-parse
 axios.interceptors.response.use(response => {
-  return jsonapiParse.parse(response.data).data;
+  const parsedResponse = jsonapiParse.parse(response.data);
+  if (parsedResponse === undefined) {
+    return response;
+  }
+  return parsedResponse.data;
 });

 export default {

What I think is happening: The response object that is passed to this interceptor when the first request is made, is indeed a proper response object that contains response.data and can be parsed by jsonapiParse.parse(). However, when a file is edited and the app is rebuilt, it seems that the parsed result (which was cached somewhere?) passes through this interceptor again.

While this workaround stops the crashing, it's ugly and it shouldn't be there. I guess we should be looking for a way to either pass the original, raw response to the interceptor again, or else avoid calling the interceptor again when the app is rebuilt with cached data. I'm willing to help fix this, but I could use some help in understanding how the app works and finding out where this data comes from.

Additional info about my setup:
contenta_vue_nuxt 2.0.1, with under the hood nuxt 2.2.0 and axios 0.18.0
node v10.14.2 with npm v6.4.1
backend: contenta_jsonapi dev-8.x-3.x, installed using contenta-jsonapi-project dev-8.x-2.x

Implement "Get in touch" contact page

http://contentacms.readthedocs.io/en/latest/demos-consumers-implementation-guidelines/#get-in-touch-page-contact-page

I did this : https://contentavuenuxt.github.io/contact/
But this does not send any http request to post a mail, because at the time i did this, Drupal contact form had a bug and it was not possible to post a mail with an http request.

We should solve this issue, maybe with a another drupal module if needed, a rule, something ? Contact form is a very common features and should possible to implement with decoupled D8

Contact link should be added in the footer

get the content of the authenticated user

How to get only the content of the authenticated user ?
thru the JsonAPI ? Or thru the role permission in Contenta admin ?

I tried on the role permissions but can't find it.
I see "Edit own content" and "Delete own content" but can't find "View Only own content"

Homepage : list of links

capture d ecran 2017-10-20 a 12 11 10

Create links to the "all recipes" page, to get them filtered as explained here : http://contentacms.readthedocs.io/en/latest/demos-consumers-implementation-guidelines/#front-page
  1. Create a new "all recipes" page ( look this page as an example https://github.com/contentacms/contenta_vue_nuxt/blob/master/pages/recipes-latest/index.vue )
    So you need to create a "pages/all-recipes/index.vue" file and a PageRecipesAll component
  2. This page can get params from url to filter the recipes
  3. link from the homepage are just passing get params in url to filter this page.

npm install warnings

Hi, I get this warnings during installation, but I can run npm run dev

$ npm install
npm WARN [email protected] requires a peer of eslint@>= 5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.

macOS High Sierra - 10.13.6 (17G65)

$ node -v
v11.1.0
$ npm -v
6.4.1

A bit more info guys

Having finally got vue_nuxt to run following the advice here #57 I changed the following:

In the nuxt.config.js:

// change this to your own server.
const serverBaseUrl = 'http://localhost:3000';
const serverFilesUrl = 'http://contenta.com'; // where I installed the CMS :3000 didn't work??

Also in components/RecipeDetail.vue I changed

<div class="content method"> <h3 class="title has-text-centered"> Methods </h3> <div v-html="recipe.instructions.value" /> </div> to: <div class="content method"> <h3 class="title has-text-centered"> Instructions </h3> <div v-html="recipe.instructions" /> </div>
And the recipe details page works nicely now. The link on the home page :
Quick and easy 20 minutes or less doesn't work:
` case 'quick':
recipes = await findAllRecipesByMaxTotalTime(20, limit, offset);
break;

And the function it calls is:
`export function findAllRecipesByMaxTotalTime(
maxTotalTime,
limit = 4,
offset = 0
) {
const query = {
sort: '-created',
include: 'image,image.thumbnail',
filter: {
totalTime: {
condition: {
path: 'totalTime',
value: maxTotalTime,
operator: '<',
},
},
},
fields: {
recipes: 'title,difficulty,image',
images: 'name,thumbnail',
files: 'filename,uri',
},
page: {
offset: 0,
limit: limit,
},
};

Anybody see any errors in that?`

✖ error Error: certificate has expired

Site does not load locally.

✖ error Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34)
at TLSSocket.emit (events.js:189:13)
at TLSSocket.EventEmitter.emit (domain.js:441:20)
at TLSSocket._finishInit (_tls_wrap.js:633:8)

images do not work in demo site

Today I installed the Contenta Vue Nuxt app, version 2.0.1, and the latest Contenta CMS demo site using the Quick Install method from https://www.contentacms.org/#install :

php -r "readfile('https://raw.githubusercontent.com/contentacms/contenta_jsonapi/8.x-2.x/installer.sh');" > contentacms-quick-installer.sh
chmod a+x contentacms-quick-installer.sh
./contentacms-quick-installer.sh

Unfortunately, images do not work. I did find out that the code on line 18 of components/RecipeDetail.vue should not be

              <img v-lazy="`${serverFilesUrl}/${recipe.image.thumbnail.url}`" />

but

              <img v-lazy="`${serverFilesUrl}/${recipe.image.thumbnail.uri.url}`" />

I haven't found a fix for the other images yet.

Service worker support

Nuxt.js aims to support PWA. I used @nuxt/pwa module but i had some issues so i disabled it ( sw.js file was super long to load ).
Nuxt is moving very fast so maybe it has a better support now.

waterwheel timeout

sometimes i get now a "timeout" error when displaying a recipe for example. Maybe related to waterwheel default timeout ? Try to instanciate waterwheel with a 1000ms timeout to see if it corrects the issue

npm install failed

$ npm install
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] requires a peer of webpack@^3.2.0 but none was installed.

My OS is Ubuntu 16.04 64bit.

TypeError: Cannot read property 'url' of undefined

In the list pages, the description images come as files. Therefore, I think that "url" in the relevant lines in api.js file should be changed to "uri".

Application fails because "url" cannot be found.

lib/api.js

diff --git a/lib/api.js b/lib/api.js
index 9a3b9a6..034a62b 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -38,7 +38,7 @@ export function findAllPromotedRecipes(limit = 4) {
fields: {
recipes: 'title,difficulty,image',
images: 'name,thumbnail',

  •  files: 'filename,url',
    
  •  files: 'filename,uri',
    
    },
    sort: '-created',
    };
    @@ -64,7 +64,7 @@ export function findAllLatestRecipes(limit = 4, offset = 0) {
    fields: {
    recipes: 'title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
    
    },
    };
    return jsonApi.get('recipes', query);
    @@ -89,7 +89,7 @@ export function findHomePromotedArticlesAndRecipes(limit) {
    fields: {
    recipes: 'contentType,title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
     contentTypes: 'type',
    
    },
    sort: '-created',
    @@ -112,7 +112,7 @@ export function findHomePromotedArticlesAndRecipes(limit) {
    fields: {
    recipes: 'title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
     contentTypes: 'type',
    
    },
    sort: '-created',
    @@ -146,7 +146,7 @@ export function findAllRecipesByCategoryName(
    fields: {
    recipes: 'title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
    
    },
    page: {
    offset: 0,
    @@ -173,7 +173,7 @@ export function findAllRecipesByDifficultyName(
    fields: {
    recipes: 'title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
    
    },
    page: {
    offset: 0,
    @@ -203,7 +203,7 @@ export function findAllRecipesByMaxTotalTime(
    fields: {
    recipes: 'title,difficulty,image',
    images: 'name,thumbnail',
  •  files: 'filename,url',
    
  •  files: 'filename,uri',
    
    },
    page: {
    offset: 0,

Unknown error on Server Side Rendering with local contentaCMS

Hello, first of all thanks for this project because I'm learning a lot about Vue.js and Nuxt.js.

I'm experiencing an unknown error on SSR when I run contenta_jsonapi locally.
Now, I'm not sure whether the issue is with the consumer or with the server as if I use the public APIs (https://live-contentacms.pantheonsite.io/api) it actually works, so my apologies in advance if I'm posting to the wrong repo.

Anyway, the issue I'm having is only on SSR because after the first page load, which redirects me to /server-unreachable, if I navigate to the home, recipes etc.. using the router links it is all good.

I tried to log what the waterwheel calls are returning and here is what I get:

error findAllLatestRecipes { Error: Unknown error. at /Users/imfaber/Sites/imfaber-v3/node_modules/waterwheel/dist/waterwheel.js:1:5194 at <anonymous> at process._tickDomainCallback (internal/process/next_tick.js:228:7) message: 'Unknown error.', status: 500 }

Has anyone experienced the same by any chance?

I thought about posting this here first because, unless I'm missing something, I can't find anything wrong on the server side, CORS is fine, API endpoints are fine etc...

Many thanks.

Error in waterwheel.js

After npm run dev I've get this error:
{ Error: Unknown error.
at /Users/meinolfdroste/github-projects/druxt/node_modules/waterwheel/dist/waterwheel.js:1:5256
at
at process._tickCallback (internal/process/next_tick.js:160:7)
message: 'Unknown error.',
status: 500,
statusCode: 500,
name: 'NuxtServerError' }

ERROR

Error: Unknown error.

  • waterwheel.js:1
    [druxt]/[waterwheel]/dist/waterwheel.js:1:5256

  • next_tick.js:160 process._tickCallback
    internal/process/next_tick.js:160:7

I have to change package.json of waterwheel to "main": "lib/waterwheel.js"
Now it works.

Create guidelines for components organization

What happens now :

  • components pages fetch all datas
  • datas flows down from pages components to components children
  • components children may events up if needed
  • a store may be added if it is required by components communcation but "pure" components and internal state is preferred when possible.
  • components should have a corresponding unit test

Determines what will be the components from the wireframes and out to organize components directory

Would love to maintain this project

Hi there,

I've been working with Nuxt.js and with Vue.js for about a year now, and before that with React. As victorkane I've been part of the Drupal community for over a decade.

And at DurableDrupal we're inventing the wheel! And writing a book about migration from Drupal to Full Stack.

Wanna go with Contenta and, especially, ContentaJS, and put my shoulder to the wheel for there to be SSR based on Nuxt. The possibilities are numerous.

How can we get started?

Implement "No recipes found"

Recipe method don't show

On the recipe detail page, the methods field is empty. The following line in the corresponding component needs to be changed.

RecipeDetail.vue

before
<div v-html="recipe.instructions.value" />

after
<div v-html="recipe.instructions" />

Install Bulma css as a npm dependency / should we use a css framework ?

Bulma was used because there was no design at the beginning of the project, and because it is a "zero JS" CSS framework, which make it very easy to use with Vue.js or React.
Today 95% of css is not used because I included all bulma.css file manually.
We may decreased if needed css sized using bulma sass version with npm and importing only what we are using.

And now that they are designs styleguides (https://www.drupal.org/node/2900720), should we even use a css framework ?

Move back hosting to github pages instead of now.sh

Now.sh is very great and offers a node.js server for Server Side Rendering but in 5 days we used 14MB / 1000MB from free plan.

Hard to say without Analytics but i guess there is for now very few visits on the demo, so a big visits peaks will quickly trigger the "On Demand" Pricing ( which is : $0.10 / GB ).

Only real downside of Github pages is that it can not serve some of the pages from the server (only from the client). Pages likes recipes/{recipe_id} : urls with a dynamic argument requires Node JS (or a function to crawl ids and generate pages ...) to be Server Side Rendered, but README may add a warning about that.

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.