Commit Graph

4550 Commits

Author SHA1 Message Date
Anthony Laibe b423e87e49
Replace tabler react by new theme 2018-10-23 10:59:18 +02:00
emizzle 7b784b9618
Missing pieces for adding log limit 2018-10-23 10:59:18 +02:00
emizzle 145f376000
Add LOG_LIMIT to limit max log response size
Re-adds the log limit feature that limits the log size coming back from embark

Also adds the log limit to other process logs (ie blockchain).
2018-10-23 10:59:18 +02:00
Iuri Matias 64713254f6
move require out of function (not really needed in a browser environment) 2018-10-23 10:59:18 +02:00
Iuri Matias deeeb985ad
fix rebase issues 2018-10-23 10:59:18 +02:00
Pascal Precht 588641222b
feat(contrainers/HomeContainer): introduce contracts list in dashboard 2018-10-23 10:59:17 +02:00
Pascal Precht 35d86beab7
refactor(components/contracts): move ContractsList into its own component
This is done so we can reuse the contracts list component, without introducing an
entire page layout with headline etc.
2018-10-23 10:59:17 +02:00
emizzle 7690418bb1
Regexp support for node 8.9.4+
Changed the log regexp to remove named capture groups as this is only supported in 10.3+.
2018-10-23 10:59:17 +02:00
Iuri Matias fd142ac2e6
improve logs output 2018-10-23 10:59:17 +02:00
Iuri Matias 1c59701045
fix wording 2018-10-23 10:59:17 +02:00
Iuri Matias 085a282c96
add copytoken command 2018-10-23 10:59:17 +02:00
Richard Ramos 16499e0bb0
Array handling 2018-10-23 10:59:16 +02:00
Iuri Matias 65c7428a7f
comment out log code for now 2018-10-23 10:59:16 +02:00
Jonathan Rainville e6964c75cb
return error message on console error 2018-10-23 10:59:16 +02:00
Richard Ramos 939642f74c
Validation of datatypes + small refactoring 2018-10-23 10:59:16 +02:00
Richard Ramos d6de374ce7
Adding scaffold option to generate contract from scratch 2018-10-23 10:59:16 +02:00
Jonathan Rainville b815ea4d44
add back npm run build and remove cd 2018-10-23 10:59:16 +02:00
Jonathan Rainville 43030980b1
use cross-env for cd and make sure values are specified 2018-10-23 10:59:15 +02:00
Pascal Precht 0eb6067ddf
uiux(components/Login): use new Embark rocket 2018-10-23 10:59:15 +02:00
Anthony Laibe eeeb05fa43
Remove not needed import 2018-10-23 10:59:15 +02:00
Anthony Laibe 812a9d0dfa
Remove Dead Code 2018-10-23 10:59:15 +02:00
Anthony Laibe 4b2715421d
Adding tab to contract view 2018-10-23 10:59:15 +02:00
Pascal Precht df3bce145d
refactor(components/Ens): move ENS components to Utilities 2018-10-23 10:58:35 +02:00
Anthony Laibe 18320573d0
Update preview double load 2018-10-23 10:58:34 +02:00
Anthony Laibe cb4a1e1073
Fix height of flex 2018-10-23 10:58:34 +02:00
Pascal Precht 0e4cb11ab6
refactor(components/Communications): move component to Utilities 2018-10-23 10:58:34 +02:00
Anthony Laibe 9aac039e7e
Adding selector 2018-10-23 10:58:34 +02:00
Anthony Laibe a61f499abb
Fix embark logs guard 2018-10-23 10:58:34 +02:00
Pascal Precht 2d0dfdf6be
uiux(embark-ui/HomeContainer): show state of connected processes 2018-10-23 10:58:34 +02:00
Pascal Precht be3c792144
refactor(modules/whisper): use ProcessManager APIs to launch process 2018-10-23 10:58:33 +02:00
Pascal Precht 3dd28b9459
refactor(modules/webserver): use ProcessManager APIs to start and stop the server 2018-10-23 10:58:33 +02:00
Pascal Precht 188a688264
refactor(modules/ipfs): use ProcessManager APIs to register and launch IPFS process
ProcessManager can be used to "register" processes and along with it, a launch function
that will be executed when a process is requested to launch.

Prior to this commit the IPFS process has not be registered and launching the process
was done manually, bypassing ProcessManager APIs.

With this commit we take advantage of ProcessManager APIs to register the IPFS process
and launch it using the `process:launch` event.
2018-10-23 10:57:54 +02:00
Pascal Precht 64d8fa3368
feat(core/processManager): introduce `processes:stop` handlers
So far, `ProcessManager` was able to only register a `process:launch` handler.
There was no way to tell `ProcessManager` how to stop processes. This hasn't
been a problem so far as most of the service processes can be started without the usage
of the `ProcessManager`, but turns out to be necessary if we want Embark UI to be able
to pick up running services.

A good example is the webserver process, which until now bypasses the `ProcessManager`
all together. The webserver sets up two event handlers to start and stop it respectively:

```
this.events.setCommandHandler('start-webserver', () => this.server.start());
this.events.setCommandHandler('stop-webserver', () => this.server.stop());
```

In the future, this should happen through the `ProcessManager` instead, so the webserver
process can be picked up by Embark UI, like this:

```
this.request('process:register', 'webserver', () => {
  this.server.start();
});

// and then

this.request('process:launch', 'webserver', () => {
  // server started
});
```

Notice that the given callback to registering a process is actually the function that
gets called to launch the process.

Having that in mind, and considering that we also need a way to stop the process through
`ProcessManager, so we don't introduce a regression, we need a way to register a stop
call back as well.

The new API introduced in this commit looks like this:

```
this.request('process:register', 'webserver', {
  launchFn: (callback) => { this.server.start(callback) },
  stopFn: (callback) => this.server.stop(callback) }
});

// and then

this.request('process:launch', 'webserver', (err, message, port) => {
  // server started
});

this.request('process:stop', 'webserver', err => {
  // server stopped
});
```

Notice that `process:register` works exactly the same way as before as well.

Another thing to notice is that all parameters emitted by the underlying process
are propagated to the outside caller, which is why `err`, `message` and `port` are
available inside the launch callback.
2018-10-23 10:57:05 +02:00
Anthony Laibe de009db74f
Use process log ids 2018-10-23 10:57:05 +02:00
emizzle 5d29ab1d42
Minor PR comments
Removed a null check and intialised `this.context` to an empty object.
2018-10-23 10:57:05 +02:00
emizzle 46511bcfe8
Rebase updates
After the code was rebased, there were some additional changes for getting websockets logs that needed to be catered for.

When there is a call to get all logs for a process, the state entity is updated with a new array item containing all the logs (this is then reduced and selected for rendering). In the case of a websocket log that simply returns only one log item, the latest full log for the process is found in the state entities, and it’s logs are appending to with the data from the websocket.

Additionally, log limits were updated to be passed in as a parameter to the API calls from the frontend. Parameter validation (for `limit`) was also added in this commit.
2018-10-23 10:57:04 +02:00
emizzle d4d7e3b8ac
Addressed PR comments
*Console.js*
- Moved `DEFAULT_PROCESS` const to outside of the `Console` class (but inside the module).
- Removed `(` and `)` from `.filter` in `getProcessLogs()`.
- Updated comments

*logger.js*
- Moved `dateFormat` and `logRegex` to constants outside of `Logger` class
- Moved the `parseLogFile` method inside of the `Logger` class (ES6 style)
- Added a log limit to the `parseLogFile` method
- Added the log path to the constants file and used inside of `Logger`

*cmd_controller.js*
- Defaulted `this.context` to `[constants.context.any]` in the constructor.
- Changed `’embark’` to split modules`coreProcess` and `loggerApi`.

*engine.js*
- Changed `’embark’` to split modules`coreProcess` and `loggerApi`.
2018-10-23 10:57:04 +02:00
emizzle 0760965bda
Overwrite log file so .embark doesn’t bloat
The embark log file is being overwritten each time embark is run. There is a separate log file for each context, so that running, for example, `embark run` then `embark console` doesn’t get the `run` log overwritten with the `console` log.
2018-10-23 10:54:35 +02:00
emizzle 0fa1e11ac7
Fixed issue with compounding duplicated logs
On every load of the component, the API request would fetch the entire log history, and effective append it to the list of process logs, so that if a component was loaded multiple times (ie click to different tab, then back to home), the log would be duplicated.

This was solved by timestamping and labelling each fetch response, then getting the latest response in the selector, and filtering by process name in the component.
2018-10-23 10:53:25 +02:00
emizzle 7de72cb474
Addressed PR feedback
- Created an “embark” module so that an “embark” process could be registered in the correct way. This service is only used on `embark run` (can be extended to other commands if needed).

- extracted “embark” to a const `DEFAULT_PROCESS` param in the `Console` component.

- extracted commands result rendering to it’s own function to keep the `renderTabs` function from getting cluttered

- Added sorting of logs by timestamp

- Added milliseconds to the log file data (which helps in sorting log messages).
2018-10-23 10:53:25 +02:00
emizzle 487b18c8b2
added date-and-time-package 2018-10-23 10:53:00 +02:00
emizzle 42cc9b559f
Fills embark logs tabs with existing embark logs
A logfile is now generated by default, in the format `.embark/embark-log__YYYY-MM-DD_HH-mm-ss.log`.

When the home tab is loaded, the process logs are fetched for all the processes. The list of processes returned now includes `embark`, and when `/embark-api/process-logs/embark` is fetched, the logFile is parsed and an array of log messages are returned.
2018-10-23 10:52:26 +02:00
Anthony Laibe 41eb23df82
Adding file contracts 2018-10-23 10:51:24 +02:00
Anthony Laibe ea9939c03a
WIP: style fiddle 2018-10-23 10:51:24 +02:00
Pascal Precht de901b73fc
chore(modules/storage): make process launcher callback optional
We aren't always interested in calling a function after the storage
process has been launched, so passing a callback should be optional.
2018-10-23 10:50:41 +02:00
Anthony Laibe 41176f0f70
Add id to process logs 2018-10-23 10:50:41 +02:00
Pascal Precht daf1d7269d
refactor: rename Unauthenticated to Login
This also removes the previously introduced `LoginLayout` component as
chances are very low that we'll need the layout for anything else then the
login.
2018-10-23 10:50:41 +02:00
emizzle aa4bc0fe4d
Fix for logs showing a string as an array
Some strings were being logged as
```
[w,r,i,t,i,n,g, ,f,i,l,e, ,,[,2,m,,[,1,m,.,e,m,b,a,r,k,/,s,t,a,t,s,.,r,e,p,o,r,t,,[,2,2,m,,[,2,2,m]
```
The fix was applied to the `normalizeInput` method which simply returns if the input was a `typeof` string.
2018-10-23 10:50:40 +02:00
Pascal Precht 0baf0526b1
feat(containers/AppContainers): make use of new LoginLayout 2018-10-23 10:50:40 +02:00
Pascal Precht c1b9760502
refactor(components/Unauthenticated): use CoreUI instead of Tabler 2018-10-23 10:50:40 +02:00