Skip to content

cyfronet-fid/eosc-portal-common

Repository files navigation

EOSC Portal common

Stable library documentation Latest library documentation

Description

Library contains the custom UI components of the EOSC Portal services. Uses the JS scripts, and the SCSS styles for consistent visualization and events triggering through many services.

Table of contents

Requirements

Only for build purposes

  • nodejs >= 14.17.1 LTE

Bucket policy update

Sometimes reading files may not work. To fix the issue run Update bucket policy workflow

Dependencies installation

npm install -g gulp-cli
npm i

Development

Building

Building process produce *.min.js, *.min.css files into dist folder by default.

Params

  • production

    Flag. When added library will be:

    • uglified
    • optimized with bundle size
    • source maps (help in debugging for developers) won't be added
  • env

    A relative path to a configuration

Examples

gulp build_lib --mode development --env env/env.production.js

Prerequisites

You'll need to know a bit of HTML and JS. For refresher see HTML tutorial or JS tutorial.

Quickstart

Components can be rendered using CSS class, CSS id or HTML tags. HTML tags can be written in snake or camel case.

Simple page with custom components

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>
    <eosc-common-main-header
      username="name surname"
      login-url="https://marketplace.eosc-portal.eu/users/auth/checkin"
      logout-url="https://marketplace.eosc-portal.eu/users/logout"
    ></eosc-common-main-header>
    <div id="eosc-common-eu-information"></div>
    <EoscCommonMainFooter></EoscCommonMainFooter>

    <script src="https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.min.js"></script>
    <link rel="stylesheet" href="https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.min.css" />
  </body>
</html>

Attaching only specific component from the list

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>
    <eosc-common-main-header
      username="name surname"
      login-url="https://marketplace.eosc-portal.eu/users/auth/checkin"
      logout-url="https://marketplace.eosc-portal.eu/users/logout"
    ></eosc-common-main-header>

    <script src="https://s3.cloud.cyfronet.pl/eosc-portal-common/main-header.production.min.js"></script>
    <link rel="stylesheet" href="https://s3.cloud.cyfronet.pl/eosc-portal-common/main-header.production.min.css" />
  </body>
</html>

Using render toolset to dynamically re-render components

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.min.js"></script>
    <link rel="stylesheet" href="https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.min.css" />
  </head>
  <body>
    <eosc-common-main-header
      username="name surname"
      login-url="https://marketplace.eosc-portal.eu/users/auth/checkin"
      logout-url="https://marketplace.eosc-portal.eu/users/logout"
    ></eosc-common-main-header>
    <script>
      window.eosccommon.renderMainHeader("eosc-common-main-header");
    </script>

    <div id="eosc-common-eu-information"></div>
    <script>
      window.eosccommon.renderMainHeader("#eosc-common-eu-information");
    </script>

    <EoscCommonMainFooter></EoscCommonMainFooter>
    <script>
      window.eosccommon.renderMainHeader("EoscCommonMainFooter");
    </script>
  </body>
</html>

Library instances URLs

index.min.js and index.mn.css contains all library components. Other scripts and styles will be named as components. See full components list.

Stable library instance

URL base: https://s3.cloud.cyfronet.pl/eosc-portal-common/

Components documentation: https://s3.cloud.cyfronet.pl/eosc-portal-common/docs/index.html

Examples

All components

https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/index.production.js

Specific component

https://s3.cloud.cyfronet.pl/eosc-portal-common/main-header.development.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/main-header.production.js

Latest library instance

URL base: https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/

Components documentation: https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/docs/index.html

Examples

All components

https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/index.production.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/index.development.js

Specific component

https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/main-header.production.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/latest/main-header.development.js

Pull Request library instance

URL base: https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-

Components documentation: https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-/docs/index.html

Examples

All components

https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-other-feature-branch-name/index.production.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-feature-1/index.development.js

Specific component

https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-bugfix-2-replace-urls-in-config/main-header.production.css
https://s3.cloud.cyfronet.pl/eosc-portal-common/pr-bugfix-4-fix-rendering/main-header.development.js

How to contribute

  1. Go to file you want to edit (for example https://github.com/cyfronet-fid/eosc-portal-common/blob/develop/configurations/configuration.production.json)
  2. Click pen icon config
  3. Provide changes in edition field edition
  4. Click Propose changes propose changes
  5. See provided changes and confirm them by clicking Create pull request Provided changes