Skip to content

Commit

Permalink
Refactor microdocs-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
steven166 committed Feb 6, 2017
1 parent d161046 commit 24f24ae
Show file tree
Hide file tree
Showing 39 changed files with 1,449 additions and 174 deletions.
88 changes: 17 additions & 71 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,96 +1,42 @@
def tag = input message: 'Tag', parameters: [string(defaultValue: '', description: 'Tag', name: 'TAG')]
node {
stage('Checkout Git'){
git url: '[email protected]:MaxxtonGroup/microdocs.git', branch: 'development'
stash name: 'source'
}
stage('Build microdocs-core'){
unstash 'source'
dir ('microdocs-core-ts'){
sh 'echo "Installing npm dependencies"'
sh 'npm version $TAG'
sh 'npm install'
sh 'echo "Publishing to private NPM registry"'
sh 'npm run prepublish'
dir ('dist'){
stash name: 'microdocs-core-dist'
}
}
}
stage('Publish microdocs-core'){
unstash 'microdocs-core-dist'
dir ('microdocs-core-ts'){
try{
sh 'npm unpublish @maxxton/microdocs-core@$TAG'
}catch(Exception e){}
sh 'npm publish dist'
}
}
stage('Build microdocs-cli'){
unstash 'source'
dir ('microdocs-cli'){
sh 'echo "Installing npm dependencies"'
sh 'npm version $TAG'
sh 'npm install --save @maxxton/microdocs-core@$TAG'
sh 'npm install'
sh 'echo "Publishing to private NPM registry"'
sh 'npm run prepublish'
dir ('dist'){
stash name: 'microdocs-cli-dist'
}
}
}
stage('Publish microdocs-cli'){
unstash 'microdocs-cli-dist'
dir ('microdocs-cli') {
try{
sh 'npm unpublish @maxxton/microdocs-cli@$TAG'
}catch(Exception e){}
sh 'npm publish'
}
git url: '[email protected]:MaxxtonGroup/microdocs.git', branch: 'master'
}
stage('Build microdocs-server'){
unstash 'source'
dir ('microdocs-server'){
sh 'echo "Installing npm dependencies"'
sh 'npm version $TAG'
sh 'npm install --save @maxxton/microdocs-core@$TAG'
sh 'npm install'
sh 'echo "Publishing to private NPM registry"'
sh 'npm run package-distribution'
sh 'npm version ' + tag
sh 'npm run prepublish'
sh 'cp .npmrc dist/.npmrc'
dir ('dist'){
sh 'npm install --prod'
stash name: 'microdocs-server-dist'
}
}
}
stage('Build microdocs-ui'){
unstash 'source'
dir ('microdocs-ui'){
sh 'echo "Installing npm dependencies"'
sh 'npm version $TAG'
sh 'npm install --save @maxxton/microdocs-core@$TAG'
sh 'npm install @maxxton/[email protected] --save-dev'
sh 'npm install'
sh 'echo "Publishing to private NPM registry"'
sh 'npm run package-distribution'
dir ('dist'){
stash name: 'microdocs-ui-dist'
}
sh 'npm version ' + tag
sh './node_modules/.bin/ng build --prod'
}
}
stage('Build microdocs-ui'){
dir ('microdocs-ui'){
sh 'npm install'
sh 'npm version ' + tag
sh 'ng build --prod'
}
}
stage('Build docker image'){
unstash 'source'
unstash 'microdocs-server-dist'
unstash 'microdocs-ui-dist'
sh 'bash docker rmi maxxton/microdocs:$TAG || true'
sh 'bash docker rmi maxxton/microdocs:' + tag + ' || true'
sh 'bash docker rmi maxxton/microdocs:latest || true'
sh 'docker build --tag=maxxton/microdocs:$TAG --no-cache .'
sh 'docker build --tag=maxxton/microdocs:' + tag + ' --no-cache .'
}
stage('Public docker image'){
sh 'docker login --email $DOCKERHUB_EMAIL --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASSWORD'
sh 'docker push maxxton/microdocs:$TAG'
sh 'docker tag maxxton/microdocs:$TAG maxxton/microdocs:latest'
sh 'docker push maxxton/microdocs:' + tag;
sh 'docker tag maxxton/microdocs:' + tag + ' maxxton/microdocs:latest'
sh 'docker push maxxton/microdocs:latest'
}
}
3 changes: 3 additions & 0 deletions microdocs-server/data/config/scripts/global.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports.default = {
info: {
color: 'pink'
},
dependencies: {
'{dependencyTitle}': {
paths: {
Expand Down
2 changes: 1 addition & 1 deletion microdocs-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"author": "Steven Hermans ([email protected])",
"license": "MIT",
"dependencies": {
"@maxxton/microdocs-core": "1.7.0",
"@maxxton/microdocs-core": "1.7.1",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"express-handlebars": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class ProjectJsonRepository implements ProjectRepository {
}
project.dependencies = convertedDependencies;
}
project.info = new ProjectInfo(title, project.info.group, version, project.info.versions, project.info.links, project.info.description, project.info.sourceLink, project.info.publishTime, project.info.updateTime);
project.info = new ProjectInfo(title, project.info.group, version, project.info.versions, project.info.links, project.info.description, project.info.sourceLink, project.info.publishTime, project.info.updateTime, project.info.color);
return project;
}
return null;
Expand Down
3 changes: 3 additions & 0 deletions microdocs-server/src/repositories/json/report-json.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export class ReportJsonRepository implements ReportRepository {
if(project.info.updateTime){
projectInfo.updateTime = project.info.updateTime;
}
if(project.info.color){
projectInfo.color = project.info.color;
}
project.info = projectInfo;

// find links
Expand Down
3 changes: 2 additions & 1 deletion microdocs-server/src/services/aggregation/funcs/tree.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export function buildTree( pipe:Pipe<any> ):ProjectTree {
}

function buildNode( pipe:Pipe<any>, projectInfo:ProjectInfo ):ProjectNode {
let projectNode = new ProjectNode( projectInfo.title, undefined, projectInfo.group, projectInfo.version, projectInfo.getVersions() );
let projectNode = new ProjectNode( projectInfo.title, undefined, projectInfo.group, projectInfo.version, projectInfo.getVersions());
projectNode.color = projectInfo.color;

// load project
let project = pipe.getPrevProject( projectNode.title, projectNode.version );
Expand Down
4 changes: 3 additions & 1 deletion microdocs-ui/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
"dev-standalone": "environments/environment.prod.ts",
"prod": "environments/environment.prod.ts",
"standalone": "environments/environment.prod.ts"
}
}
],
Expand Down
5 changes: 3 additions & 2 deletions microdocs-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "microdocs-ui",
"version": "0.0.0",
"version": "1.6.9",
"license": "MIT",
"angular-cli": {},
"scripts": {
Expand All @@ -23,9 +23,10 @@
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"@maxxton/angular-rest": "^1.0.0",
"@maxxton/microdocs-core": "^1.7.0",
"@maxxton/microdocs-core": "1.7.1",
"angular2-prettyjson": "^2.0.3",
"core-js": "^2.4.1",
"d3": "^3.5.17",
"hammerjs": "^2.0.8",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
Expand Down
12 changes: 12 additions & 0 deletions microdocs-ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import { PathHighlightComponent } from "./components/path-highlight/path-highlig
import { ProblemBoxComponent } from "./components/problem-box/problem-box.component";
import { BodyRenderComponent } from "./components/body-render/body-render.component";
import { ModelComponent } from "./components/model/model.component";
import { DependencyGraphComponent } from "./components/dependency-graph/dependency-graph.component";
import { WelcomeComponent } from "./components/welcome/welcome.component";
import { ImportDialogComponent } from "./components/import-dialog/import-dialog.component";
import { ExportDialogComponent } from "./components/export-dialog/export-dialog.component";

@NgModule({
declarations: [
Expand All @@ -46,6 +50,10 @@ import { ModelComponent } from "./components/model/model.component";
ProblemBoxComponent,
BodyRenderComponent,
ModelComponent,
DependencyGraphComponent,
WelcomeComponent,
ImportDialogComponent,
ExportDialogComponent,

SortByHttpMethodPipe,
SortByKeyPipe,
Expand All @@ -54,6 +62,10 @@ import { ModelComponent } from "./components/model/model.component";
EmptyPipe,
ObjectIteratorPipe
],
entryComponents: [
ImportDialogComponent,
ExportDialogComponent
],
imports: [
BrowserModule,
FormsModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="grid-container page-content">
<template [ngIf]="empty">
<!--<welcome-panel></welcome-panel>-->
<div class="page-content">
<template [ngIf]="empty && !loading">
<welcome></welcome>
</template>
<template [ngIf]="!empty">
<!--<card title="Projects Overview" [sectionClass]="'card-section content'" [canHide]="true">-->
<!--<dependency-graph [nodes]="nodes" [env]="env"></dependency-graph>-->
<!--</card>-->
<template [ngIf]="!empty && !loading">
<simple-card text="Projects Overview" [paper]="true">
<dependency-graph [nodes]="nodes" [env]="env"></dependency-graph>
</simple-card>
</template>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.page-content{
margin: 2rem auto 0 8rem;
width: auto !important;
max-width: 1200px !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ import {Router} from "@angular/router";

@Component({
selector: 'dashboard',
providers: [],
// templateUrl: 'dashboard.component.html'
template: 'dashboard'
templateUrl: 'dashboard.component.html',
styleUrls: ['dashboard.component.scss']
})

export class DashboardComponent {

loading:boolean = true;
empty:boolean = false;
nodes:Subject<ProjectTree> = new ReplaySubject<ProjectTree>(1);

constructor(private projectService:ProjectService, private router:Router){
this.projectService.getProjects().subscribe(notification => {
notification.do(data => {
this.loading = false;
this.nodes.next(data as ProjectTree);
if ((data as ProjectTree).projects) {
this.empty = (data as ProjectTree).projects.length == 0;
Expand Down
7 changes: 7 additions & 0 deletions microdocs-ui/src/app/components/dependency-graph/d3.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module 'd3'{
export const select:any;
export const behavior:any;
export const layout:any;
export const values:any;
export const event:any;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="graph" [class.small]="small">
<div class="container" (window:resize)="onResize($event)"></div>
<div class="option-bar" *ngIf="showOptionBar">
<div class="dropdown" [class.expanded]="dropdownExpanded">
<div class="dropdown-header" (click)="dropdownExpanded = !dropdownExpanded">
<md-icon>keyboard_arrow_up</md-icon>
<span>Groups</span>
</div>
<div class="overlay-wrapper">
<div class="overlay">
<div class="overlay-item" *ngFor="let group of groupToggles" (click)="toggleGroup(group)">
<md-icon>{{group.visible ? 'check_box' : 'check_box_outline_blank'}}</md-icon>
<span class="title">{{group.name}}</span>
</div>
</div>
</div>
</div>
<div class="show-versions-button option-button" [class.selected]="showVersions" (click)="toggleShowVersions()">
<md-icon>{{showVersions ? 'call_split' : 'call_merge'}}</md-icon>
<span>Show different used versions</span>
</div>
<div class="show-inherit-button option-button" [class.selected]="!showInheritance" (click)="toggleShowInheritance()">
<md-icon>{{'device_hub' }}</md-icon>
<span>Combine inheritance into one node</span>
</div>
</div>
</div>
Loading

0 comments on commit 24f24ae

Please sign in to comment.