GithubHelp home page GithubHelp logo

dataoneorg / gnis-ld.org Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blake-regalia/gnis-ld.org

0.0 1.0 0.0 3.7 MB

GNIS-LD

Home Page: https://gnis-ld.org/

License: Other

JavaScript 42.86% Dockerfile 1.22% Pug 37.55% Less 18.37%

gnis-ld.org's Introduction

gnis-ld.org

Frontend for https://gnis-ld.org

Building

To build the source, run gulp from the project root.

When building a development docker image, run

docker build -t thomasthelen/gnis-ld:dev .

When building a production docker image, run

docker build -t thomasthelen/gnis-ld .

Finally, push the image to thomasthelen/gnis-ld:<dev/latest>

Differentiating Between Production & Development

The main difference between production and development builds is the base URL. For example, development builds that are deployed on the develop cluster have address stage.gnis-ld.org while production builds have gnis-ld.org. This value is controlled by the DEPLOYMENT_ADDRESS variable in config.app.js.

Running

To run the website, run the following from the project root

npm i -g gulp
npm i
gulp

Developing

Website Design

The website uses pug templates with less css. layout.pug holds the base template for each page. In it, it has the layout for the banner, page content, and the footer. The HTML for the banner and footer are generated by calling mixings. The page content is defined in an external file. Examples of these include 'about.pug' and 'queries.pug'. The content in these files are passed into the main template and the result is a page that should look okay with the rest of the site. If a page needs to have any content in the header (for linking scripts, stylesheets, etc), block content-header can be defined with the requirements.

For example, to create a new page called news, create a new pug file as lib/webapp/_layout/news.pug.

news.pug

block content-header
  link(rel='stylesheet', type='text/css', href='/style/news.css')
  script(src='/script/news.js')

block content-block
  body
    .content-layout
      .left-col 
      .content
        .page-content
          .news-content1
            p Breaking News Story 1
          .news-content2
            p foo
          .news-content3
            p bar

One shortcoming of the template is the tricky rule that every page must have, at a minimum in their content-block.

  body
    .content-layout
      .left-col 
      .content
        .page-content

New page content is inserted underneath the page-content div.

Next, add a route in server.js so that connecting clients get the correct page delivered.

k_app.get([
	'/news',
], (d_req, d_res) => {
	d_res.type('text/html');
	d_res.render('news');
  d_res.set('Access-Control-Allow-Origin', '*');
});

Finally, add the page to the navigation bar.

Build System

gulpfile.js contains the gulp tasks for building and running the application. Each gulp task accomplishes a small part in the build process. For example, there's a task for turning the less styling sheets into css and another for compiling the pug files. There are also higher level tasks that combine these steps, for example the default task (which performs a build).

One potentially confusing part of the build/content serving system is that not all files are served from dist/. The paths to the files (css, ontology files, robots.txt, etc) are defined in server.js. Some of the files are being directly served from the lib directory.

Acknowledgments

Work on this package was supported by:

  • NSF OIA grant 2033521 to Krzysztof Janowicz

gnis-ld.org's People

Contributors

blake-regalia avatar dependabot[bot] avatar thomasthelen avatar

Watchers

 avatar

gnis-ld.org's Issues

Fix Major Security Vulnerabilities

At the moment there are a number of critical security vulnerabilities (not including the ones from the docker OS). We should upgrade the project to get rid of the high severity ones and assess the smaller ones.

Finalize Readme

The finalized readme should have a few things:

  • The standard NCEAS Readme header (authors, license, etc)
  • The DataONE logos as the bottom
  • Slightly reformatted dev notes
  • A link to gnis-ld.org

Automate deployment url selection

At the moment, there are some user facing links that point to stage.gnis-ld.org. When the production build is done, these will have to be changed manually. It would be nice if we had a flag or config value that we could use for the URL.

Add package-lock file

Dependabot should issue pull requests when it has access to the package-lock file. We should remove it from the gitignore file and add it to the repo.

Remove kiwi-loader

Since Kiwi is no longer being used as the triple store and has been replaced by GraphDB, we need to replace it with something compatible with GraphDB

Incorrect Query Tab Name

When clicking Try it out! on the "What are all of the Dams?" query-the query tab has the same name from the elevation query tab.

Add more content to the website

We should make sure we're properly giving credit to everyone involved with the project and provide more information about how this project can be used.

Investigate slow graph dump

@amoeba noticed some slow download speeds for the database dump. Internally, the dump/ endpoint redirects to GraphDB's repository dump endpoint, which is ultimately responsible for supplying the data. We've been having some issues (Nick says it's the storage on campus) with Kubernetes and one of the issues is slow response time while interacting with kubectl. This may or may not be related to the slow download speed, so retest this once the kubernetes issues are resolved.

Remove Port 30443 Refrences

Now that we're serving on 80/443, remove all of the port references to 30443. This is relevant to the SPARQL endpoint, which isn't found at 30443.

Add a robots.txt

To prevent crawlers from hiccuping on the sparql and data/ endpoints, we should add a robots.txt

Add a footer

1ffdd42 introduced a mixin that produces a footer. The layout uses this mixin while creating page content.

The call to the mixin is currently commented out because it's not staying at the bottom of the page (see image below). Fix the footer so that it stays at the bottom of the page an uncomment the footer mixin call to add it all pages.
Screen Shot 2021-09-05 at 10 28 12 AM

Create a default account

gnis-ld is responsible for creating and configuring GraphDB on initial startup. It should include the creation of an account that the triplifier can use to insert data.

Add more example queries

Right now we have two example queries on the queries/ page. We should add 2-3 more that demonstrate more of the ontologies.

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.