Skip to content

Commit 7989e5a

Browse files
authored
Feature/add GitHub workflow (#111)
* Create dockerhub.yml * add lint file * add requested changes * use yarn instead of npm to run lint checks for the CI * fix codestyle * reformat again * fix linting
1 parent 4cb0b20 commit 7989e5a

File tree

10 files changed

+131
-65
lines changed

10 files changed

+131
-65
lines changed

.github/workflows/dockerhub.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Push docker images to Dockerhub
2+
3+
on:
4+
push:
5+
branches: master
6+
tags:
7+
- "v*.*.*"
8+
9+
jobs:
10+
multi:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v1
17+
- name: Set output
18+
id: vars
19+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v1
22+
- name: Login to DockerHub
23+
uses: docker/login-action@v1
24+
with:
25+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
26+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
27+
28+
- name: Build and push latest Pattern Atlas UI
29+
if: ${{ steps.vars.outputs.tag == 'master' }}
30+
uses: docker/build-push-action@v2
31+
with:
32+
context: .
33+
push: true
34+
tags: patternatlas/pattern-atlas-ui:latest
35+
36+
- name: Build and push version of Pattern Atlas UI
37+
if: ${{ steps.vars.outputs.tag != 'master' }}
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
push: true
42+
tags: patternatlas/pattern-atlas-ui:${{ steps.vars.outputs.tag }}

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run-linters:
7+
name: Run linters
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Check out Git repository
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: 12
18+
19+
# ESLint and Prettier must be in `package.json`
20+
- name: Install Node.js dependencies
21+
run: npm install
22+
23+
- name: Run linters
24+
run: yarn lint-ci

src/app/admin-management/admin-management-detail/admin-management-detail.component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ export class AdminManagementDetailComponent implements OnInit {
3939

4040
createForm() {
4141
this.userForm = this.userFormBuilder.group({
42-
name: [this.user.name, Validators.required],
43-
email: [this.user.email, [Validators.required, Validators.email]],
44-
userRoles: [this.user.roles],
45-
password: ['', Validators.required],
46-
confirmPassword: ['']
47-
},
48-
{
49-
validator: ValidatePassword
50-
});
42+
name: [this.user.name, Validators.required],
43+
email: [this.user.email, [Validators.required, Validators.email]],
44+
userRoles: [this.user.roles],
45+
password: ['', Validators.required],
46+
confirmPassword: ['']
47+
},
48+
{
49+
validator: ValidatePassword
50+
});
5151
}
5252

5353
checkPasswords(control: AbstractControl) {

src/app/authentication/_services/authentication.service.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ export class AuthenticationService {
115115

116116
this.http.post<any>(environment.tokenUrl, params).subscribe(token => {
117117

118-
const accessToken = token[accessTokenKey];
119-
const refreshToken = token[refreshTokenKey];
118+
const accessToken = token[accessTokenKey];
119+
const refreshToken = token[refreshTokenKey];
120120

121-
localStorage.setItem(accessTokenKey, accessToken);
122-
localStorage.setItem(refreshTokenKey, refreshToken);
121+
localStorage.setItem(accessTokenKey, accessToken);
122+
localStorage.setItem(refreshTokenKey, refreshToken);
123123

124-
this.accessTokenSubject.next(accessToken);
125-
},
126-
error => console.error('Error getToken(): ', error)
124+
this.accessTokenSubject.next(accessToken);
125+
},
126+
error => console.error('Error getToken(): ', error)
127127
);
128128
}
129129
}
@@ -137,33 +137,33 @@ export class AuthenticationService {
137137
.set('refresh_token', `${this.getRefreshToken()}`)
138138
this.http.post<any>('http://localhost:8081/oauth/token', params).subscribe(token => {
139139

140-
const accessToken = token[accessTokenKey];
141-
const refreshToken = token[refreshTokenKey];
140+
const accessToken = token[accessTokenKey];
141+
const refreshToken = token[refreshTokenKey];
142142

143-
localStorage.setItem(accessTokenKey, accessToken);
144-
localStorage.setItem(refreshTokenKey, refreshToken);
143+
localStorage.setItem(accessTokenKey, accessToken);
144+
localStorage.setItem(refreshTokenKey, refreshToken);
145145

146-
this.accessTokenSubject.next(accessToken);
147-
},
148-
error => {
149-
console.error('Error getToken via refreshToken: ', error)
146+
this.accessTokenSubject.next(accessToken);
147+
},
148+
error => {
149+
console.error('Error getToken via refreshToken: ', error)
150150

151-
}
151+
}
152152
);
153153
}
154154

155155
getUserInfo() {
156156
this.http.get<PAUser>('http://localhost:8081/user_info').subscribe(user => {
157157

158-
console.log('UserInfo: ', user);
159-
this.userSubject.next(user);
160-
this.roleSubject.next(user.roles);
158+
console.log('UserInfo: ', user);
159+
this.userSubject.next(user);
160+
this.roleSubject.next(user.roles);
161161

162-
},
163-
error => {
164-
console.error('Error getToken via refreshToken: ', error)
162+
},
163+
error => {
164+
console.error('Error getToken via refreshToken: ', error)
165165

166-
}
166+
}
167167
);
168168
}
169169

src/app/core/component/cardrenderer/card-renderer.component.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ export class CardRendererComponent {
4242
}
4343
})
4444
.afterClosed().subscribe(dialoganswer => {
45-
if (dialoganswer) {
46-
this.patternService.deletePattern(pattern._links.self.href)
47-
.subscribe(
48-
value => {
49-
this.handlePatternDelete(pattern);
50-
this.toasterService.pop('success', 'Pattern deleted!');
51-
},
52-
error => {
53-
this.toasterService.pop('error', 'Could not delete pattern!', 'A Pattern can only be deleted if it is not a part of any Pattern Views');
54-
}
55-
);
56-
}
57-
});
45+
if (dialoganswer) {
46+
this.patternService.deletePattern(pattern._links.self.href)
47+
.subscribe(
48+
value => {
49+
this.handlePatternDelete(pattern);
50+
this.toasterService.pop('success', 'Pattern deleted!');
51+
},
52+
error => {
53+
this.toasterService.pop('error', 'Could not delete pattern!', 'A Pattern can only be deleted if it is not a part of any Pattern Views');
54+
}
55+
);
56+
}
57+
});
5858

5959
}
6060

src/app/core/default-pl-renderer/default-pl-renderer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export class DefaultPlRendererComponent implements OnInit, OnDestroy {
225225
description: res.description,
226226
relationType: res.type,
227227
isDelete: true, //indicates that the dialog is called from the linked removedRemoved method --> not create,
228-
// but a delete / edit operation
228+
// but a delete / edit operation
229229
}
230230
});
231231
dialogRef.afterClosed().subscribe((dialogResult) => {

src/app/core/directives/emit-event-on-added-edge.directive.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { debounceTime, takeUntil } from 'rxjs/operators';
77
})
88
export class EmitEventOnAddedEdgeDirective implements OnInit, OnDestroy {
99
@Output('onAddedEdge') edgeAddedEventEmitter = new EventEmitter<any>(); // eslint-disable-line
10-
// @angular-eslint/no-output-rename
10+
// @angular-eslint/no-output-rename
1111
@Output('onRemovedEdge') edgeRemovedEventEmitter = new EventEmitter<any>(); // eslint-disable-line
12-
// @angular-eslint/no-output-rename
12+
// @angular-eslint/no-output-rename
1313
@Output('onClickedNode') nodeClickedEventEmitter = new EventEmitter<any>(); // eslint-disable-line
14-
// @angular-eslint/no-output-rename
14+
// @angular-eslint/no-output-rename
1515
@Output('onClickedBackground') backgroundClickedEventEmitter = new EventEmitter<any>(); // eslint-disable-line
16-
// @angular-eslint/no-output-rename
16+
// @angular-eslint/no-output-rename
1717
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
1818
@Output('onNodePositionChange') onNodePositionChangeEventEmitter = new EventEmitter<any>(); // eslint-disable-line
19-
// @angular-eslint/no-output-rename
19+
// @angular-eslint/no-output-rename
2020

2121
constructor() {
2222
}

src/app/core/directives/emit-event-on-keyup.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class EmitEventOnKeyupDirective implements OnInit, OnDestroy {
1111
}
1212

1313
@Output('onKeyup') keyUpEventEmitter = new EventEmitter<any>(); // eslint-disable-line
14-
// @angular-eslint/no-output-rename
14+
// @angular-eslint/no-output-rename
1515

1616
private clicks = new Subject();
1717

src/app/pattern-language-management/create-pattern/create-pattern.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export class CreatePatternComponent implements OnInit {
4747
className: 'fa fa-subscript',
4848
title: 'Add Formula',
4949
}, {
50-
name: 'pattern-link',
51-
action: (editor) => {
52-
this.addPatternReference(editor);
50+
name: 'pattern-link',
51+
action: (editor) => {
52+
this.addPatternReference(editor);
53+
},
54+
className: 'fa fab fa-product-hunt',
55+
title: 'Reference Pattern',
5356
},
54-
className: 'fa fab fa-product-hunt',
55-
title: 'Reference Pattern',
56-
},
5757
'|', // Separator
5858
MarkdownEditorUtils.helpButton
5959
],

src/app/pattern-view-management/pattern-view-management/pattern-view-management.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ export class PatternViewManagementComponent implements OnInit {
7878
}).afterClosed().subscribe(dialogAnswer => {
7979
if (dialogAnswer) {
8080
this.patternViewService.deletePatternView(patternView).subscribe((response) => {
81-
for (let i = 0; i < this.patternViewResponse._embedded.patternViews.length; i++) {
82-
this.patternViewResponse._embedded.patternViews[i].id === patternView.id ? this.patternViewResponse._embedded.patternViews.splice(i, 1) : null;
83-
}
84-
this.toastService.pop('success', 'Pattern View deleted!');
85-
},
86-
(error) => {
87-
this.toastService.pop('error', 'Pattern View could not be deleted!');
81+
for (let i = 0; i < this.patternViewResponse._embedded.patternViews.length; i++) {
82+
this.patternViewResponse._embedded.patternViews[i].id === patternView.id ? this.patternViewResponse._embedded.patternViews.splice(i, 1) : null;
8883
}
84+
this.toastService.pop('success', 'Pattern View deleted!');
85+
},
86+
(error) => {
87+
this.toastService.pop('error', 'Pattern View could not be deleted!');
88+
}
8989
);
9090
}
9191
})

0 commit comments

Comments
 (0)