marcura
v0.1.615
Published
PortLog Common UI
Downloads
32
Readme
PortLog Common UI
Install
$ npm i --save marcura
Usage
angular.module('your.app.name', [
//...
'ui.marcura'
//...
]);
Providers
Instruction Config
Set router state names for manager and creator/editor component.
Components relay on provided router state names:
// Setup
import {IInstructionConfigProvider} from 'marcura';
...
app.config((InstructionConfigProvider: IInstructionConfigProvider): void => {
'ngInject';
InstructionConfigProvider.config.router.manager = 'app.instruction.manager';
InstructionConfigProvider.config.router.creator = 'app.instruction.creator';
});
// Usage
import {IInstructionConfig} from 'marcura';
...
class InstructionController implements angular.IComponentController {
constructor(private InstructionConfig: IInstructionConfig,
private $state: angular.ui.IStateService) {
'ngInject';
}
...
public create(): void {
this.$state.go(this.InstructionConfig.router.creator);
}
}
Instruction Filter Assignee
Set default items and state for filters available on instruction list.
// Setup
import {Assignee, IInstructionFilterAssigneeProvider} from 'marcura';
...
app.config((instructionFilterAssigneeProvider: IInstructionFilterAssigneeProvider): void => {
'ngInject';
console.log(instructionFilterAssigneeProvider.assignees);
// >> [{ name: 'Chartering', id: 2 },{ name: 'Operator', id: 3 },{ name: 'Master', id: 0 }]
//Set default select for 'Chartering'
// Remember to think in immutable way!
const assignees: Assignees[] = [].concat(instructionFilterAssigneeProvider.assignees);
const assignee: Assignee = assignees[0];
assignee.checked = true;
/*
* Or shorter
* assignees[0].checked = true;
*/
instructionFilterAssigneeProvider.setAssignees(assignees);
});
// Usage
import {Assignee} from 'marcura'
class InstructionFilterController implment angular.IComponentController {
constructor(private instructionFilterAssignee: Assignee[]) {
'ngInject';
}
}
Developement
PLO
or PLC
is required to be able to swiftly develop library. Of course any app that imports marcura
will work, but portlog apps already have environment that enables some building to be done quicker.
The project is written in AngularJS with Typescript and component approach. Syles are written in sass with Bootstrap and PostCSS for autoprefixing.
Project dependencies
Core
- Angular 1.6.x
- Angular Material
- Typescript
- jQuery
- lodash
- Bootstrap
- animate.css
Additional Libraries
- marcura-ui
- mdi
- moment
- pikaday
- quill
- select2
- tslib
Developement wokflow
library = marcura-common-ui
(this repository)
app = any app that uses marcura
library as depedency
- Clone git repository.
- Run
npm install
&&npm link
in the main folder of the library. - In the local version of
PLO
orPLC
runnpm link marcura
to link the app to the local version of library. - Run that locally linked app (
PLO
orPLC
) in developement mode so you can viewmarcura
library elements inside of this app. - Modify
marcura-common-ui
in any way you need. - Run
npm link
from the root of the library to rebuilt and relink it. - Rebuild app you were using locally as the base for library. (In
PLO
andPLC
you can usenpm run dev:fresh
to rebuild the vendor of both apps uing the newmarcura
library. The script runs also dev developement for those apps). - View the changes you've made in
marcura
library in the base app.
Deployment
- Make sure you have the newest version from
master
. - Commit you changes to
master
. (preferably through PR first) - Run
npm login
. - Run
npm version patch
. - Run
npm publish
. - NPM publish creates a commit with updated version in
package.json
-push
it tomaster
. - Update the version of
marcura
library in any apps that uses it to the new one just created and push to repository. - Redeploy the apps.
Steps to do a Hotfix for common-ui (1st draft - needs editing):
- So the process is that you create hotfix branches on both apps, make sure it works properly on both applications, then you publish the hotfix branch to npm
- You have to merge the hotfix branch on common-ui after the hotfix is deployed and you have to update the marcura versions in the hot fix branches of both apps
- Then you send a message in the global chat to everyone, telling them that they cannot deploy anything to cuat for plo and plc
- Then, after publishing the hotfix branch of common-ui to npm, you have to deploy the hotfix branches of both apps to cuat
- Then you ask Mayuri to test both applications, specify the feature that you made to her so she knows what to prioritse in her tests
- After she approves both apps, then deploy both apps to production
- Then merge all the hotfix branches into master for all the apps including common-ui
- Publish common-ui again to npm from master this time
- Then update the marcura versions on plo and plc, and then deploy both app to cuat on the master branch