Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Directus
  3. Directus new extension layout

Directus new extension layout

Scheduled Pinned Locked Moved Directus
9 Posts 3 Posters 2.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JeyakumarrathnaselviJ Offline
    JeyakumarrathnaselviJ Offline
    Jeyakumarrathnaselvi
    wrote on last edited by
    #1

    Can someone help in what format we need to upload the layout extension for directus? does directus app automatically take the layout from it?

    6d6eae79-c930-48de-b11e-9dfa3e29d79c-image.png

    if yes Can someone guide me how to compile the directus layout with minimal changes and upload it here directly

    girishG 1 Reply Last reply
    0
    • girishG girish moved this topic from Support on
    • JeyakumarrathnaselviJ Jeyakumarrathnaselvi

      Can someone help in what format we need to upload the layout extension for directus? does directus app automatically take the layout from it?

      6d6eae79-c930-48de-b11e-9dfa3e29d79c-image.png

      if yes Can someone guide me how to compile the directus layout with minimal changes and upload it here directly

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @Jeyakumarrathnaselvi Not an expert on directus, so your mileage with my suggestion might vary.

      Have you seen https://docs.directus.io/extensions/creating-extensions/ ? I ran npm init directus-extension on my PC:

      $ npm init directus-extension
      Need to install the following packages:
        create-directus-extension
      Ok to proceed? (y) y
      npm WARN deprecated @types/cssnano@5.1.0: This is a stub types definition. cssnano provides its own type definitions, so you do not need this installed.
      npm WARN deprecated @types/pino@7.0.5: This is a stub types definition. pino provides its own type definitions, so you do not need this installed.
      This utility will walk you through creating a Directus extension.
      
      ? Choose the extension type layout
      ? Choose a name for the extension helloworld
      ? Choose the language to use javascript
      āœ” Done
      
      Your layout extension has been created at /home/girish/tmp/foo/helloworld
      
      Build your extension by running:
        cd helloworld
        npm run build
      	
      

      I then built it and got a dist/index.js . Per https://docs.directus.io/extensions/creating-extensions/#deploying-your-extension, I should upload that file as extensions/layouts/helloworld/index.js . I haven't tried all that since I don't know much about directus, maybe others here know.

      JeyakumarrathnaselviJ 1 Reply Last reply
      1
      • girishG girish

        @Jeyakumarrathnaselvi Not an expert on directus, so your mileage with my suggestion might vary.

        Have you seen https://docs.directus.io/extensions/creating-extensions/ ? I ran npm init directus-extension on my PC:

        $ npm init directus-extension
        Need to install the following packages:
          create-directus-extension
        Ok to proceed? (y) y
        npm WARN deprecated @types/cssnano@5.1.0: This is a stub types definition. cssnano provides its own type definitions, so you do not need this installed.
        npm WARN deprecated @types/pino@7.0.5: This is a stub types definition. pino provides its own type definitions, so you do not need this installed.
        This utility will walk you through creating a Directus extension.
        
        ? Choose the extension type layout
        ? Choose a name for the extension helloworld
        ? Choose the language to use javascript
        āœ” Done
        
        Your layout extension has been created at /home/girish/tmp/foo/helloworld
        
        Build your extension by running:
          cd helloworld
          npm run build
        	
        

        I then built it and got a dist/index.js . Per https://docs.directus.io/extensions/creating-extensions/#deploying-your-extension, I should upload that file as extensions/layouts/helloworld/index.js . I haven't tried all that since I don't know much about directus, maybe others here know.

        JeyakumarrathnaselviJ Offline
        JeyakumarrathnaselviJ Offline
        Jeyakumarrathnaselvi
        wrote on last edited by
        #3

        @girish Thanks Girish, Tried it but the new layout is not reflected in directus. don't know why? can someone guide

        43bbe75e-5cdf-4869-ac8b-e7689fba33c4-image.png

        unknown (2).png

        girishG 1 Reply Last reply
        0
        • jdaviescoatesJ Offline
          jdaviescoatesJ Offline
          jdaviescoates
          wrote on last edited by
          #4

          Just in case, presumably you've tried clearing browser cache etc? šŸ™‚

          I use Cloudron with Gandi & Hetzner

          JeyakumarrathnaselviJ 1 Reply Last reply
          0
          • jdaviescoatesJ jdaviescoates

            Just in case, presumably you've tried clearing browser cache etc? šŸ™‚

            JeyakumarrathnaselviJ Offline
            JeyakumarrathnaselviJ Offline
            Jeyakumarrathnaselvi
            wrote on last edited by
            #5

            @jdaviescoates No it didn't help

            1 Reply Last reply
            0
            • JeyakumarrathnaselviJ Jeyakumarrathnaselvi

              @girish Thanks Girish, Tried it but the new layout is not reflected in directus. don't know why? can someone guide

              43bbe75e-5cdf-4869-ac8b-e7689fba33c4-image.png

              unknown (2).png

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              @Jeyakumarrathnaselvi It looks like maybe you did not restart the app after uploading ? Just guessing because the file permissions of index.ts is still 'root'. It should become 'cloudron' after restart.

              JeyakumarrathnaselviJ 1 Reply Last reply
              1
              • girishG girish

                @Jeyakumarrathnaselvi It looks like maybe you did not restart the app after uploading ? Just guessing because the file permissions of index.ts is still 'root'. It should become 'cloudron' after restart.

                JeyakumarrathnaselviJ Offline
                JeyakumarrathnaselviJ Offline
                Jeyakumarrathnaselvi
                wrote on last edited by
                #7

                @girish 35d77980-7935-470a-8d89-41c6d3fa8435-image.png

                still no effect. pls guide

                girishG 1 Reply Last reply
                0
                • JeyakumarrathnaselviJ Jeyakumarrathnaselvi

                  @girish 35d77980-7935-470a-8d89-41c6d3fa8435-image.png

                  still no effect. pls guide

                  girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by
                  #8

                  @Jeyakumarrathnaselvi The index.js needs to be inside tabularview directory.

                  Let me preface by saying I have little to no idea about Directus. This is my index.js:

                  import{openBlock as e,createElementBlock as l,createElementVNode as o,toDisplayString as n,ref as t}from"vue";var r={inheritAttrs:!1,props:{collection:{type:String,required:!0},name:{type:String,required:!0}}};r.render=function(t,r,i,u,a,c){return e(),l("div",null,[o("p",null,"Name: "+n(i.name),1),o("p",null,"Collection: "+n(i.collection),1)])},r.__file="src/layout.vue";var i={id:"custom",name:"Helloworld",icon:"box",component:r,slots:{options:()=>null,sidebar:()=>null,actions:()=>null},setup:()=>({name:t("Helloworld Layout")})};export{i as default};
                  

                  Which I uploaded like this into extensions/layouts/helloworld and restarted the app:

                  ca41667d-7212-4698-b705-955b472793ae-image.png

                  I can then see the layout:

                  f0f0c0d4-c7be-4f0e-83ee-98d296494948-image.png

                  JeyakumarrathnaselviJ 1 Reply Last reply
                  0
                  • girishG girish

                    @Jeyakumarrathnaselvi The index.js needs to be inside tabularview directory.

                    Let me preface by saying I have little to no idea about Directus. This is my index.js:

                    import{openBlock as e,createElementBlock as l,createElementVNode as o,toDisplayString as n,ref as t}from"vue";var r={inheritAttrs:!1,props:{collection:{type:String,required:!0},name:{type:String,required:!0}}};r.render=function(t,r,i,u,a,c){return e(),l("div",null,[o("p",null,"Name: "+n(i.name),1),o("p",null,"Collection: "+n(i.collection),1)])},r.__file="src/layout.vue";var i={id:"custom",name:"Helloworld",icon:"box",component:r,slots:{options:()=>null,sidebar:()=>null,actions:()=>null},setup:()=>({name:t("Helloworld Layout")})};export{i as default};
                    

                    Which I uploaded like this into extensions/layouts/helloworld and restarted the app:

                    ca41667d-7212-4698-b705-955b472793ae-image.png

                    I can then see the layout:

                    f0f0c0d4-c7be-4f0e-83ee-98d296494948-image.png

                    JeyakumarrathnaselviJ Offline
                    JeyakumarrathnaselviJ Offline
                    Jeyakumarrathnaselvi
                    wrote on last edited by
                    #9

                    @girish Thanks Girish. It worked. but there is a challenge with directus is they don't have an option to copy the existing layout of directus and make a small change and create it as a new extension. it doesn't help. we should develop from scratch as per them šŸ˜ž

                    1 Reply Last reply
                    1
                    • ruihildtR ruihildt referenced this topic on
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search