Giter Club home page Giter Club logo

drupal-admin-ui's Introduction

Drupal Admin UI

Greenkeeper badge

This is an admin UI for Drupal, built with JavaScript and based on create-react-app.

Requirements

Installation

Ensure that you currently have nothing running on port 80 (e.g. a local webserver) or port 3000 (e.g. a local node process). You can run lsof -i :80 -S to see what you currently have running.

git clone [email protected]:jsdrupal/drupal-admin-ui.git
cd drupal-admin-ui
make build
docker-compose up
(open a new terminal)
make install

If this fails and you see Killed from composer, you will need to increase your memory allocation for Docker.

You can run your Drupal commands inside the container (e.g. docker exec -it drupal_admin_ui_drupal drush status). Instead of first entering the container to run commands (with make drupal:cli), you can create an alias to run commands directly in the containers, e.g.

alias admin_ui_drupal='function _admin_ui_drupal() { docker exec -it drupal_admin_ui_drupal $@ };_admin_ui_drupal'
admin_ui_drupal drush status

The Makefile contains several useful commands! e.g. enabling XDebug.

Open the one time login link in your browser to log into Drupal. You will then have the following available:

URL Description
http://127.0.0.1 Regular Drupal installation / JSON API endpoints
http://127.0.0.1/admin/content A page taken over by the new admin UI. This uses the bundled version from packages/admin-ui/build, run yarn workspace admin-ui build in the node container to re-build

Development

yarn workspace @drupal/admin-ui start will start the Webpack dev sever that comes with Create React App.

Testing

We have functional testing with Nightwatch, and component/unit testing with Jest.

When deciding which system to use to add test coverage, the general rule is Nightwatch should be used to test the common path, and Jest can be used for more detailed test coverage. Nightwatch tests will run slower as they simulate clicking around in a real browser.

Nightwatch

  • If you don't know the password for admin, change it with docker exec -it drupal_admin_ui_drupal drush user:password admin admin
  • Update your .env.local file, setting NIGHTWATCH_LOGIN_admin_PASSWORD to the password you set above e.g. NIGHTWATCH_LOGIN_admin_PASSWORD=admin
  • If you want to test against the current JS, not the production build change set NIGHTWATCH_URL=http://127.0.0.1:3000 in the .env.local file.
  • Run yarn workspace @drupal/admin-ui build, which creates a new production build to test.
  • Run yarn workspace @drupal/admin-ui nightwatch or yarn test to run all tests

React AXE

Due to outstanding performance issues, react-axe is behind a flag. To enable the assessment provided by react-axe, pass an environment variable when starting the application.

REACT_APP_AXE=true yarn workspace @drupal/admin-ui start

Contributing to This Repository

  • Fork this repo to your own user
  • Set your fork as origin, and this repo as upstream. From inside the drupal-admin-ui folder:
    git remote rm origin
    git remote add origin [email protected]:<your-username>/drupal-admin-ui.git
    git remote add upstream [email protected]:jsdrupal/drupal-admin-ui.git
    
  • Make your proposed changes on a branch and then push them to your fork
    git push origin <your-branch>
    
  • Make a pull request!
  • Switch back to master and pull in the latest changes
    git checkout master
    git pull upstream master
    
  • Our issue queue is public and you already have the required permissions to participate. However in order to perform administrative tasks, such as assigning issues or editing labels, make a request in #javascript in Drupal Slack to be added as a member of the Contributors Team

If someone has made a pull request and you would like to add code to their branch, there are a number of ways to move forward. It will be very helpful to get familiar with managing remotes in Git.

  • First, ping them in #javascript to discuss the addition/changes!

  • Once agreed, you can make a pull request to their fork/branch, which once accepted will appear in the pull request to the main jsdrupal/drupal-admin-ui repo

  • Alternatively, they could give you access to modify their branch directly at https://github.com/<username>/drupal-admin-ui/settings/collaboration (although bear in mind this will give access to their entire repository fork)

  • If you're unable to agree, or unable to get in touch with the author, you could create a new pull request that incorporates the work from their branch

    git remote add <their-username> [email protected]:<their-username>/drupal-admin-ui.git
    git fetch <their-username>
    git checkout -b <branch-name> <their-username>/<branch-name>
    .
    . work, commit things, etc
    .
    git push <your-fork> <branch-name>
    

Extension Points Bundler

See the documentation in packages/extension-points for how this tooling works.

drupal-admin-ui's People

Contributors

alexburrows avatar alexpott avatar anandtoshniwal avatar dawehner avatar eojthebrave avatar francescopersico avatar greenkeeper[bot] avatar iberdinsky-skilld avatar jeevanbhushetty avatar justafish avatar koskinpark avatar lauriii avatar lhuria94 avatar martinfrances107 avatar mattgrill avatar matthewgrill avatar ol0lll avatar pls avatar porkloin avatar progga avatar rahulsavaria avatar rsanzante avatar rsau avatar slipo avatar tedbow avatar uncultured avatar vd39 avatar vishalchandna1 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drupal-admin-ui's Issues

Get the anonymous username from the backend

Drupal allows users to configure the name of the anonymous users. As part of #123 we added a hard coded anonymous user name. We should fetch the user configured anonymous username and use that instead of the hard coded one.

The anonymous user is stored in the user.settings configuration.

Do we (and to what extent) support themeable output

In Drupal, there is support for overriding markup / CSS coming from a theme, and/or massaging data prior to it being output, on a pretty granular basis (only for these content types, etc.).

We need to figure out if, and if so how, we support this concept from the React application.

Add pager to the content list

Currently we load all content on a single page which causes performance issues when there is lots of content. Add pager to the content list. The pager should be linked to work with the JSON API instead of paging content in the browser.

Component Library

This is an issue to record things which would be good to go into a re-usable component library. These are things which require talking to Drupal in some way:

  • File upload widget design issue
  • Multiple items wrapper (For example N textfields instead of one)
  • WYSIWYG fulltext field
  • Vertical tabs

composer create-project fails for Node 10

When I follow the step on the main page, namely

composer create-project jsdrupal/drupal-admin-ui-demo -s dev --prefer-dist

After a time I get this response.

....

.....

So it looks like D8.6.x has been updated past the point at which 2018-04-11/2911319-2-191.patch is usable. And the patch needs a reroll

Eject from CRA

Can we eject from CRA and use the defaults it provides? I think long term we'll probably run into some configuration we need/want to change and that might be difficult.

I personally don't mind setting up and maintaining the build process, if thats something that is worrisome.

Do we (and to what extent) support dynamic content generated by e.g. views

If we're planning to handle the admin experience of Drupal, one of the big parts of the admin experience is content listings. For example, admin/people, admin/content, etc.

We did a lot of work in Drupal 8 to ensure all of these things are Views, and can be customized by the site builder without any development.

I don't think we want to lose one of the hugest benefits of Drupal (Views) during the React-ification. How do we balance this?

Generating simple admin forms automatically

Drupal consists of a large amount of configuration pages. Writing react components for all of them (as we do in PHP) would be a lot of effort without much gain

As outlined on drupal.org autogenerating those forms would be a nice solution.
This issue is about discussing an approach to the problem. Implementation will be done on top of that.

It could require a couple of steps:

  • Configuration schema needs to be improved.
    1. In order to provide better UX we need to have some way of defining widgets. PHP and JS could then convert this into meaningful things
    2. access checking etc.
    3. many more, see https://www.drupal.org/project/drupal/issues/2949888
  • We need to expose configuration schema somehow to the client. Either directly or indirectly using JSON schema. Given that config schema has concept of labels etc. already, using config schema seems more natural
  • And then we need to actually implement such a UI generator
  • Finally we need connectors to fetch and post the actual configuration back.
  • Generating configuration forms doesn't result into generating every form using this mechanism, as this would reinvent form api

Note: There is some experiment on https://github.com/jsdrupal/drupal-admin-ui/tree/config-experiment-2 going on. Please ping @dawehner if you want to play around with it. Setting this up is a bit tricky right now.

Add support for user configured timezones

The PR #115 introduced some date formatting. This doesn't take into account users timezone configuration from Drupal, but instead falls back to using users browser settings. We should get the timezone configuration from the backend and format the date using that.

Come up with an agenda/attendee list for JS sprint at Front End United

Based on discussions w/ core committers, it seems like it would be very advantageous to get everyone on the same page about what this initiative is attempting to do, plans on how/when exactly to get the work into core, how to handle major points of collaboration, work through some architectural questions, etc.

Front End United is coming up the weekend of Thursday, May 31 - Saturday, June 2, and has sprinting space available the weekdays prior (Monday, May 28 - Wednesday, May 30). Several key initiative folks are already planning to be there, along with committers such as Dries and Alex Pott.

So let's figure out:

  1. What's the agenda for such a sprint?
  2. Who's coming and when can they be there? (and/or participate remotely)

Here's a stab. I'm sure it needs lots of work.

Logistics

Sprint runs Tuesday, May 29 until Friday, May 1.
Location is at the co-working code sprints at Front End United in Utrecht, Netherlands: https://www.frontendunited.org/program/coworking-code-sprints
Address:
In de Ruimte
Oudegracht-Tolsteegzijde 230, 3511 NT Utrecht

Cost is €11.95 / day; tickets available at https://www.eventbrite.com/e/frontend-united-utrecht-tickets-40107668115 Apparently we are getting access to the space for free! :O Thanks, FEU! :D

Agenda

  • Agreement on scope/timeline for initiative w/ Dries + other committers
  • Work through architectural questions of various issues tagged Problems That Need Solving, ideally with outside expertise:
    • Views support / What should "site builders" be able to change: #15
    • What should themes be able to alter: #14
    • What should modules be able to alter: #13
    • Translation/localization: #11
    • Component library: #17
    • Routing: #12
  • Dynamic loading of additional JS from modules?
  • Hammer out plan for release management challenges:
    • Experimental vs. Stable
    • GitHub ❤️
    • Coordination with API-First initiative
  • Next-generation admin UI designs, goals, and how to integrate with them.
    • Ideally we would be able to come up with tasks for people to get involved
  • Flesh out roadmap for admin UI: release 1, release 2, release 3... and how/when to integrate upstream with Drupal.

(This seems like a VERY lofty list, so we probably want to prioritize it and focus on doing only a few of these things well.)

Who/when?

If you're planning to attend (remotely or in-person), please fill out your availability at https://docs.google.com/spreadsheets/d/1b73QHyqRKzbiL_sdAflnBCGLbLOghhdTq4VjnyQq7_0/edit?ts=5a9f9ba3#gid=0 under the "Drupal JavaScript Initiative / Admin UI" heading (~row 125).

FAQ

Do I need to buy a ticket for the conference?

webchick
@dawehner I looked into that, and no. However, you do need to buy daily tickets to the co-working space. Sec.

https://www.frontendunited.org/program/coworking-code-sprints

What information do we need from Drupal for routing related things

  • Which Drupal paths are overridden by the app?
  • Where are components exposed by routes in Drupal modules, so we can allow modules to expose custom routes?
  • How do we communicate to the app which routes a user has access to?
  • How do we communicate available items in a menu tree?
  • Will we continue to have something like local tasks/local actions?

Add storybook? styleguide and plan component development

I saw that issue #7 mentions the "bonus" of a storybook story for the permissions page and #17 deals with components that are Drupal Admin specific.

I think it would be a good idea to

  1. have a storybook style guide for this project to enable style development asynchronously to feature implementation
  2. to create an architecture where we do not copy paste components between react-drupal-components and this project, but for example, require drupal-react-components as a dependency lib.

Then we can decide if a component like the Message component should also go to the more general Drupal components in the drupal-react-components project, where people with a Drupal background could use them for all kinds of React projects.

I think that would make a sustainable solution that would only need a bit of refactoring in the already existing components to make them compatible with emotion or other concepts of providing styles through passing in className as a prop.

[X-Post] Explore 'create-form' and 'edit-form' link relations to support JS Modernisation Initiative

https://www.drupal.org/project/jsonapi/issues/2960550

JS oriented summary: JSON API specifies a concept of 'links objecta'

These links objects are used to like to related resources.

If one retrieves an entity via JSON API, we could include a link to a resource which describes the edit form for that entity (for the current user)

The form representation could be JSON.

That JSON could be a special object describing schema, available fields (respecting field access), field settings, and possibly links to JS form validators.

Stub out the permissions page

API Endpoints Needed

We're already going to be on the same domain as Drupal, meaning we can use Cookie authentication, so we can use the browser's fetch API directly for this.

Components Needed

Submit Function

I'm not sure if we can write the config entities through JSON API yet, so for now let's pretend it's making a successful request with an artificial delay

Permissions Page

Component skeleton is here, with ability to add CSS
See also https://github.com/jsdrupal/drupal-admin-ui/tree/master/src/styles for global styles

Jest Test

Can be added as an additional file in https://github.com/jsdrupal/drupal-admin-ui/tree/master/src/components/05_pages/Permissions

Bonus Round

It would be great to add Storybook to this project and add a .story file into https://github.com/jsdrupal/drupal-admin-ui/blob/master/src/components/05_pages/Permissions

Add roles page to the UI

The roles UI is currently just accessible when you know the UI.

  • Adapt Default.enhanceMenuLinks to includes a link to roles

Add a favicon

What about using the logo ◀️👋▶️ as favicon?

Tagged as novice task / help wanted

Create strategy for persisting data in store

We might want to consider caching some data in the store instead of refetching everything on every route change. There are some examples such as current username, menu etc. that are quite easy to persist in the store but should be changed when mutations happen. Some more difficult cases are for example content listing and single pieces of content.

Document local development environment better

  • Describe how to setup a local dev environment:
  • Configure cors

sites/default/services.yml

  cors.config:
    enabled: true
    # Specify allowed headers, like 'x-allowed-header'.
    allowedHeaders: ['*']
    # Specify allowed request methods, specify ['*'] to allow all possible ones.
    allowedMethods: ['*']
    # Configure requests allowed from specific origins.
    allowedOrigins: ['*']
    # Sets the Access-Control-Expose-Headers header.
    exposedHeaders: true
    # Sets the Access-Control-Max-Age header.
    maxAge: false
    # Sets the Access-Control-Allow-Credentials header.
    supportsCredentials: true
  • Grant permissions: "administer site configuration" "administer users"

Add loading animation

We should build a generic loading animation that could be utilized in different pages. For now this could be at least utilized on the content listing.

How to localize the app: strings/numbers/pluralize strings etc.

Drupal worked a lot throughout the years to get a good localization support in PHP.
For example we do support pluralized strings properly: Every language has potential a different concept of pluralization (1, 2, 5, 10 for example).

Let's discuss in this issue which features we need and how to not move ourself into an edge case

Features we need | keep in our head

  • String localization
  • Do we want people to manage these strings through Drupal somehow?
  • Proper string pluralization

Useful libraries

Add pager support for the content listing

It would be nice to have pager support for the content listing. Right now in core we prefer simple pagers, aka. "mini pagers" over full fledged ones for performance reasons.

Pager component in Material UI and a demo.

The pager should be linked to work with the JSON API instead of paging content in the browser.

Consider using Typescript

I do not want to open up a huge discussion on pros and cons, but I thought to bring this up early would make sense.
I personally am doing my first project that will go into production with Typescript and saw a definite improvement in code quality and safety. It was hard in the beginning especially with some more complex definitions in React for interfaces of some HOCs of e.g. react-apollo, but in the end, it really pays off especially when an application gets more and more complex.
Since this here will no doubt be a complex beast, I would recommend using Typescript over just defining PropTypes...

I would gladly help by refactoring the current code with https://www.npmjs.com/package/react-scripts-ts if we can agree upon using TS

Do we (and to what extent) support aspects of the Drupal Form API, such as form alters

One of the larger questions around how this app will interface with Drupal is deciding what features of Drupal we will support.

One of the major features of Drupal that people love is its extensibility. An example of this is Form API, which through mechanisms such as hook_form_alter(), let you make per-module, or site-specific decisions about how another module's forms look and act. (Hiding a field for content authors, for example.)

Do we, and if so to what extent, want to support this capability in our React app?

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.