Code Monkey home page Code Monkey logo

operatorfabric-core's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

operatorfabric-core's Issues

As an Operator, I want to filter the feed to focus on specific relevant cards

The feed needs to be filtered, there is two kind of filters:

  • filters which affects purely rendering
    • severity filter (one toggle per severity)
    • see mine/see others toggle
  • filters which affects the cards wich the operator is updated with (See #22)
    • date filter (mandatory filters)
    • stick to clock (filter constantly evolve following clock ticks)

The latter needs specific server side behaviour for optimisation.

As an Operator I want to access cards previously published

This is a sub user story of #22.

When accessing the feed an Operator needs to it to be initiated with cards previously published. The loaded cards are limited to the actual selected time span.

Related tasks:

  • #25 Load already published cards from persistent storage
  • #26 Mix loaded cards from persistent storage into SSE card flow

As a Third Party Service, I want to define templates

Templates are defined using Handlebars template syntax. The same template must be redefine for each languages supported by the Third Party Service.

Templates define html layout of a card detail, they are injected with data consisting of the card itself allowing its properties to be accessed in the template definition (See card model as defined in card swagger file.

In addition to the standard Handlebars helpers, operator-fabric provides some additionnal helpers:

numberFormat

formats a number parameter using Intl.NumberFormat.
The locale used is current user selected one, and options are passed as hash parameters (see Handlebars doc Literals section).

{{numberFormat data.price style="currency" currency="EUR"}}
dateFormat

formats the submitted parameters (millisecond since epoch) using mement.format.
The locale used is current user selected one, thr format is "format" hash parameter (see Handlebars doc Literals section).

{{dateFormat data.birthday format="MMMM Do YYYY, h:mm:ss a"}}
slice

extracts a sub array from ann array

example:

<!--
{"array": ["foo","bar","baz"]}
-->
<ul>
{{#each (slice array 0 2)}}
  <li>{{this}}</li>
{{/each}}
</ul>

outputs:

<ul>
  <li>foo</li>
  <li>bar</li>
</ul>

and

<!--
{"array": ["foo","bar","baz"]}
-->
<ul>
{{#each (slice array 1)}}
  <li>{{this}}</li>
{{/each}}
</ul>

outputs:

<ul>
  <li>bar</li>
  <li>baz</li>
</ul>
now

Outputs current date as millisecond from epoch. the date is computed from application internal time service and thus may be different from the date that one can compute from javascript api which relies on the browsers' system time.

NB: Due to Handlebars limitation you must provide at least one argument to helpers otherwise, Handlebars will confuse a helper and a variable. In the bellow example, we simply pass an empty string.

example:

{{now ""}}

{{dateFormat (now "") format="MMMM Do YYYY, h:mm:ss a"}}

outputs

preserveSpace

preserve space in parameter string to avoid html standard space trimming.

{{preserveSpace data.businessId}}
bool

returns a boolean result value on an arithmetical operation (including object equality) or boolean operation.
arguments:

  • v1: left value operand
  • op: operator (string value)
  • v2: right value operand

arithmetical operator:

  • ==
  • ===
  • !=
  • !==
  • <
  • <=
  • >
  • >=

boolean operators

  • &&
  • ||

examples:

{{#if (bool v1 '<' v2}}
  v1 is strictly lower than v2
{{else}}
 V2 is lower or equal to v1
{{/if}}
math

returns the result of a mathematical operation.
arguments:

  • v1: left value operand
  • op: operator (string value)
  • v2: right value operand

arithmetical operator:

  • /
  • %

example:

{{math 1 '+' 2}}
split

splits a string into an array based on a split string

example:

<ul>
{{#each (split 'my.example.string' '.')]]
  <li>{{this}}</li>
{{/each}}
</ul>

outputs

<ul>
  <li>my</li>
  <li>example</li>
  <li>string</li>
</ul>
cardAction

outputs a card action button whose card action id is the concatenation of an arbitrary number of helper arguments

{{{cardAction "PREREQUISITE_" id}}}
svg

outputs a svg tag with lazy loading, and missing image replacement message. The image url is the concatenation of an arbitrary number of helper arguments

{{{svg baseUri scheduledOpId "/" substation "/before/" computationPhaseOrdinal}}}
i18n

outputs a i18n result from a key and parameters. There are two way of configuring

  • Pass an object as its sole argument. The object contains a key field (string) and an optionnal parameters field (map of parameterKey => value)
{{i18n data.i18nTitle}}
<!--
emergency.title=Emergency situation happened on {{date}}. Cause : {{cause}}.
-->
{{i18n "emergency.title" date="2018-06-14" cause="Broken Cofee Machine"}}

outputs

Emergency situation happened on 2018-06-14. Cause : Broken Cofee Machine
sort

Sorts an array or object's properties (first argument) using an optional field name (second argument) to sort the collection on this fields natural order
if no field argument is provided :
* if the sorted structure is an array, the original order of the array is kept ;
* if the sorted structure is an object, the structure is sorted by objects field name.

<!--
users :

{"john": { "firstName": "John", "lastName": "Cleese"},
"graham": { "firstName": "Graham", "lastName": "Chapman"},
"terry": { "firstName": "Terry", "lastName": "Gilliam"},
"eric": { "firstName": "Eric", "lastName": "Idle"},
"terry": { "firstName": "Terry", "lastName": "Jones"},
"michael": { "firstName": "Michael", "lastName": "Palin"},
-->

<ul>
{{#each (sort users)}}
    <li>{{this.firstName}} {{this.lastName}}</li>
{{/each}}
</ul>

outputs :

<ul>
  <li>Eric Idle</li>
  <li>Graham Chapman</li>
  <li>John Cleese</li>
  <li>Michael Pallin</li>
  <li>Terry Gilliam</li>
  <li>Terry Jones</li>
</ul>

and

<ul>
{{#each (sort users "lastName")}}
    <li>{{this.firstName}} {{this.lastName</li>
{{/each}}
</ul>

outputs :

<ul>
  <li>Graham Chapman</li>
  <li>John Cleese</li>
  <li>Terry Gilliam</li>
  <li>Eric Idle</li>
  <li>Terry Jones</li>
  <li>Michael Pallin</li>
</ul>

As a User I want to log into the application

The user logs in relying on an external authentication service.

On a technical note, the external autherization service must be Oauth2 compliant (By design or with a Facade)

As an Operator, I want to display the business content of a card as details

When a feed card is selected by clicking on it, the following is displayed:

  • In the feed, the card is unfolded revealing its summary and other advanced information (those information will be definned in later user stories)
  • Next to the feed the details of the card are displayed in a tabbed pane layout. Each tab displays an associated details.

The details are a rendition of a template defined by the associated Third Party Service (the card publisher) templates are defined separately by the Third Party Services (See #44). The templates are injected with data consisting of the card itself allowing it properties to be accessed in the template definition (See #47).
Card are loaded throught a REST endpoint (See #32).

  • #31 Add template support
  • #30 Add I18n support

Integrate client with card read SSE endpoint

Integrate the client ui with the card-publication-business-service endpoint GET /cardOperations and display incomming cards. Requires :

  • Oauth token intagration
  • SSE integration

As a Third Party Service, I want to publish one or more new cards

Publication has to be available through a REST entry point, it allows to publish one or more cards.

Two publication mode are available:

  • Synchrounous: awaits for the service to complete publication with a CREATED status
  • Asynchronous: does not await for the publication to be completed, immediately returns an ACCEPTED status

Init travis CI

See #2

Initiate Travis config in repository, declare project in Travis

Unable to launch the Demo docker.

After cloning the project and building it, the compose up of the demo stack generates a lot of exceptions and the platform is not running correctly.
It looks that the registry and config containers are involved in a dead lock.

The registry failed to run because it is unable to connect the config container, but the config container is trying to connect the registry container.

From the registry container logs:
2019-01-21 16:06:14.146 INFO 1 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://config:8080
2019-01-21 16:06:14.161 INFO 1 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://config:8080. Will be trying the next url if available
2019-01-21 16:06:14.179 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:136) ~[spring-cloud-config-client-2.1.0.RC3.jar!/:2.1.0.RC3]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<

Form the config container logs:

2019-01-21 16:06:13.663 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-01-21 16:06:13.663 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-01-21 16:06:13.859 ERROR 1 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://registry:8080/eureka/}

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused (Connection refused)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar!/:1.19.1]
at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123) ~[jersey-client-1.19.1.jar!/:1.19.1]

Full log files are attached to this issue (note that I ran the demo twice, but with the same effect).
config.log
registry.log

Best regards

Environment: Mac OS
Java 1.8 Gradle 4.7

Script

514 git clone https://github.com/opfab/operatorfabric-core.git
515 cd operatorfabric-core/
516 bin/build_all.sh
517 bin/setup_dockerized_environment.sh
518 cd src/main/docker/demo/
523 docker-compose up
524 docker-compose up
525 mkdir /tmp/opfab
526 docker logs registry /tmp/opfab/registry.log
527 docker logs registry >/tmp/opfab/registry.log

Solve java related quality issues

Head ticket for the following quality related tickets

  • #10 Solve sonar java raised bugs for 0.0.1.RELEASE
  • #11 Solve sonar java raised vulnerabilities for 0.0.1.RELEASE
  • #12 Solve sonar java test coverage gap for 0.0.1.RELEASE
  • #14 Solve sonar java raised code smells for 0.0.1.RELEASE

As an Operator, I want to be fed with relevant Cards

Once authenticated, an operator needs to access the card feed. The card feed provides the Operator with relevant card.
A "relevant card" is a card for which the operator is either:

  • the main recipient or a recipient
  • part of at least one group recipient

A recipient is an Operator or Group which is concerned by the card
A main recipient is an Operator that is supposed the handle the card himself

NB: not all cards have main recipient but all cards accessible to an operator have recipient.

The following Tasks and user stories are sub task to this user story:

  • #23 As an Operator I want to be updated with relevant cards (US)
  • #24 As an Operator I want to access cards previously published (US)
  • #27 Display the cards as a Feed (Task)
  • #43 As an Operator, I want the feed to be displayed sorted
  • #1 Integrate with Card SSE endpoint (Task)

[Thirds] Add menu entries to Third model

The Third Model class must be enhance with the following attribute:

  • menuEntries an array of MenuEntry.

MenuEntry is a class composed of the folowing attributes

  • id : string
  • url: string
  • label: string (must match a i18n key declared in the i18n files)

How to build Operator Fabric?

Dear,

I am trying to build OperatorFabric from scratch on Mac OS X using the bin/build_all script but the build stopped by 'Failed to apply plugin [id 'cz.malohlava']'.
Note that I have to uncomment in the main build.gradle file the last lines because gradle complains about the fact that the wrapper task is defined several times.

Here follows the stack trace.

Thanks for your attention

Olivier Coussaert
Aprico Consultants

Env:

Gradle 5.1

Build time: 2019-01-02 18:57:47 UTC
Revision: d09c2e354576ac41078c322815cc6db2b66d976e
Kotlin DSL: 1.1.0
Kotlin: 1.3.11
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Mac OS X 10.14 x86_64

NB/ realpath from Apple does not behave like the Linux realpath (but can be easily fixed by using brew).

Now the output of bin/build_all.sh :

Building artifacts

Using gradle options:

Building swagger generator

  • gradle :tools:swagger-spring-generators:assemble

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 29s

  • set +x

Building client libs

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building tools

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building services

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s
Oliviers-MacBook-Pro:operatorfabric-core ocouss$ clear

Oliviers-MacBook-Pro:operatorfabric-core ocouss$ bin/build_all.sh

Building artifacts

Using gradle options:

Building swagger generator

  • gradle :tools:swagger-spring-generators:assemble

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

  • set +x

Building client libs

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building tools

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building services

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/ocouss/operatorFabric/operatorfabric-core/services/services.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating project ':services'.

Failed to apply plugin [id 'cz.malohlava']
Could not create plugin of type 'VisTaskExecGraphPlugin'.
> org/gradle/execution/taskgraph/TaskInfo

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s

Host generated documentation

Create site in github io to host API pages, user documentation and other public documentation.

Keep deeper technical documentation, governance documentation etc. in github wiki.

As a Third Party Service, I want to define the service card resources

Define the following resources

  • i18n
  • templates and styles
  • sound
  • menu entries

i18n entries may be used in:

  • templates with the i18n helper
  • card attributes: title and summary
  • menu entries

Templates and style define the rendering of card data. Their may be multiple templates associated with cards, templates are internationnalized, service may provide one template for each language it supports.

Sound are media files played when a new card is first displayed in a user's feed.

Menu entries are additionnal menu items to display in Operator Fabric main menu.

Definition

Definition of those data relies on a bundle of configuration file compressed as a tar.gz file, the archive must comply with a specific structure.

layout

bundle
└──css
│   └──tab.css
│   └──emergency.css
└──i18n
│   └──en.json
│   └──fr.json
└──media
│   └──en
│       └──sound.opus
│       └──sound.mp3
│   └──fr
│       └──sound.opus
│       └──sound.mp3
└──template
│   └──en
│       └──emergency.handlebars
│   └──fr
│       └──emergency.handlebars
└──config.json

configuration: config.json

{
  "name": "sample",
  "version": "0.1",
  "defaultLocale": "fr",
  "templates": [
    "emergency"
  ],
  "csses": [
    "tab",
    "emergency"
  ],
  "medias": {
    "sound": {
      "name": "sound",
      "files": [
        "sound.opus",
        "sound.mp3"
      ]
    }
  },
  "locales": [
    "fr",
    "en"
  ]
}

Declaration

An entry point must be available that accepts POST request and consumes multipart/form-data

[Card consultation] Add archive endpoint

Part of #52 user story.

Create an entry point to access archiveCard mongo collection.

The collection will be queried throught a Spring mongo reactive repository.

The Http routing to the controller is to be defined in ArchiveCardRouteConfig (see CardRouteConfig and CardOperationRoutesConfig as an example).

Different filters are to be implemented, a custom repository may be needed see CardRepository for deep repository customization.

Configure Travis CI

This is the header task for the following travis configuration subtasks

  • #3 Init Travis
  • #4 configure e2e test with docker containers in Travis CI
  • #5 Configure quality with SonarQube & Travis CI
  • #6 Intégrate ng build with Travis CI
  • #7 Intégrate ng tests with Travis CI
  • #8 Intégrate ng quality with Travis CI/SonarQube

As an operator, I want to access Third Party Specific web pages

The Operator may access predefine webpages throught URLs referenced in a menu.

If a Third Party Service define one menu item, it is displayed as a first level operator fabric main menu item. Otherwise a first level menu item named by the name of the service unfold into a submenu listing all URL.

Each menu item is define by:

  • a unique id (relative to the Third Party Service)
  • URL
  • a i18n key used for label

Related tickets:

  • #50 Add menu entries to Third model
  • #49 Add Third Party Service menu entries
  • #51 Add an i18n label to the third class
  • #59 Add Third Party menu entries to navbar

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.