Skip to content

Commit 6db0101

Browse files
authored
feat(ui): all shared module component on push (#4425)
1 parent 5febad4 commit 6db0101

File tree

63 files changed

+464
-701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+464
-701
lines changed

engine/api/feature/flipping.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ const (
1212
// FeatEnableTracing is the opencensus tracing feature id
1313
FeatEnableTracing = "cds:tracing"
1414

15-
// FeatWNode wnode workflow representation
16-
FeatWNode = "cds:wnode"
17-
1815
cacheFeatureKey = "feature:"
1916
)
2017

@@ -33,7 +30,7 @@ type ProjectFeatures struct {
3330

3431
// List all features
3532
func List() []string {
36-
return []string{FeatWNode, FeatEnableTracing}
33+
return []string{FeatEnableTracing}
3734
}
3835

3936
// Init initialize Izanami client

engine/api/workflow/dao_audit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func InsertAudit(db gorp.SqlExecutor, a *sdk.AuditWorkflow) error {
1919
// LoadAudits Load audits for the given workflow
2020
func LoadAudits(db gorp.SqlExecutor, workflowID int64) ([]sdk.AuditWorkflow, error) {
2121
query := `
22-
SELECT * FROM workflow_audit WHERE workflow_id = $1
22+
SELECT * FROM workflow_audit WHERE workflow_id = $1 ORDER BY created DESC
2323
`
2424
var audits []auditWorkflow
2525
if _, err := db.Select(&audits, query, workflowID); err != nil {

sdk/workflow.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (label *Label) Validate() error {
244244
return WrapError(fmt.Errorf("Label must have a name"), "IsValid>")
245245
}
246246
if label.Color == "" {
247-
bytes := make([]byte, 4)
247+
bytes := make([]byte, 3)
248248
if _, err := rand.Read(bytes); err != nil {
249249
return WrapError(err, "IsValid> Cannot create random color")
250250
}

ui/src/app/shared/audit/list/audit.list.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { Component, EventEmitter, Input, Output } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22
import { AuditWorkflow } from 'app/model/audit.model';
33
import { Item } from 'app/shared/diff/list/diff.list.component';
44
import { Column, ColumnType } from 'app/shared/table/data-table.component';
55

66
@Component({
77
selector: 'app-audit-list',
88
templateUrl: './audit.list.html',
9-
styleUrls: ['./audit.list.scss']
9+
styleUrls: ['./audit.list.scss'],
10+
changeDetection: ChangeDetectionStrategy.OnPush
1011
})
1112
export class AuditListComponent {
1213
@Input() audits: Array<AuditWorkflow>;

ui/src/app/shared/breadcrumb/breadcrumb.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22

33
export class PathItem {
44
icon: string;
@@ -12,7 +12,8 @@ export class PathItem {
1212
@Component({
1313
selector: 'app-breadcrumb',
1414
templateUrl: './breadcrumb.html',
15-
styleUrls: ['./breadcrumb.scss']
15+
styleUrls: ['./breadcrumb.scss'],
16+
changeDetection: ChangeDetectionStrategy.OnPush
1617
})
1718
export class BreadcrumbComponent {
1819
@Input() path: Array<PathItem>;

ui/src/app/shared/button/confirm/confirm.button.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import {Component, EventEmitter, Input, Output} from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22

33
@Component({
44
selector: 'app-confirm-button',
55
templateUrl: './confirm.button.html',
6-
styleUrls: ['./confirm.button.scss']
6+
styleUrls: ['./confirm.button.scss'],
7+
changeDetection: ChangeDetectionStrategy.OnPush
78
})
89
export class ConfirmButtonComponent {
910
@Input() loading = false;

ui/src/app/shared/button/upload/upload.button.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import {Component, EventEmitter, Input, Output} from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22

33
@Component({
44
selector: 'app-upload-button',
55
templateUrl: './upload.button.html',
6-
styleUrls: ['./upload.button.scss']
6+
styleUrls: ['./upload.button.scss'],
7+
changeDetection: ChangeDetectionStrategy.OnPush
78
})
89
export class UploadButtonComponent {
910

ui/src/app/shared/chart/chart.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import {Component, Input} from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22
import { GraphConfiguration } from 'app/model/graph.model';
33

44
@Component({
55
selector: 'app-chart',
66
templateUrl: './chart.html',
7-
styleUrls: ['./chart.scss']
7+
styleUrls: ['./chart.scss'],
8+
changeDetection: ChangeDetectionStrategy.OnPush
89
})
910
export class ChartComponentComponent {
1011

ui/src/app/shared/commit/commit.list.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { Component, Input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22
import { Commit } from 'app/model/repositories.model';
33
import { Table } from 'app/shared/table/table';
44

55
@Component({
66
selector: 'app-commit-list',
77
templateUrl: './commit.list.html',
8-
styleUrls: ['./commit.list.scss']
8+
styleUrls: ['./commit.list.scss'],
9+
changeDetection: ChangeDetectionStrategy.OnPush
910
})
1011
export class CommitListComponent extends Table<Commit> {
1112
@Input() commits: Array<Commit>;

ui/src/app/shared/diff/item/diff.item.component.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
1+
import {
2+
ChangeDetectionStrategy,
3+
ChangeDetectorRef,
4+
Component,
5+
Input,
6+
OnChanges,
7+
OnInit,
8+
ViewChild
9+
} from '@angular/core';
210
import { ThemeStore } from 'app/service/theme/theme.store';
311
import { AutoUnsubscribe } from 'app/shared/decorator/autoUnsubscribe';
412
import * as JsDiff from 'diff';
513
import { Subscription } from 'rxjs';
14+
import { finalize } from 'rxjs/operators';
615

716
export class Mode {
817
static UNIFIED = 'unified';
@@ -12,7 +21,8 @@ export class Mode {
1221
@Component({
1322
selector: 'app-diff-item',
1423
templateUrl: './diff.item.html',
15-
styleUrls: ['./diff.item.scss']
24+
styleUrls: ['./diff.item.scss'],
25+
changeDetection: ChangeDetectionStrategy.OnPush
1626
})
1727
@AutoUnsubscribe()
1828
export class DiffItemComponent implements OnInit, OnChanges {
@@ -31,7 +41,7 @@ export class DiffItemComponent implements OnInit, OnChanges {
3141
themeSubscription: Subscription;
3242

3343
constructor(
34-
private _theme: ThemeStore
44+
private _theme: ThemeStore, private _cd: ChangeDetectorRef
3545
) { }
3646

3747
ngOnInit() {
@@ -45,7 +55,9 @@ export class DiffItemComponent implements OnInit, OnChanges {
4555
lineNumbers: true
4656
};
4757

48-
this.themeSubscription = this._theme.get().subscribe(t => {
58+
this.themeSubscription = this._theme.get()
59+
.pipe(finalize(() => this._cd.markForCheck()))
60+
.subscribe(t => {
4961
this.codeMirrorConfig.theme = t === 'night' ? 'darcula' : 'default';
5062
if (this.codeLeft && this.codeLeft.instance) {
5163
this.codeLeft.instance.setOption('theme', this.codeMirrorConfig.theme);

ui/src/app/shared/diff/list/diff.list.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22
import { Mode } from 'app/shared/diff/item/diff.item.component';
33

44
export class Item {
@@ -13,7 +13,8 @@ export class Item {
1313
@Component({
1414
selector: 'app-diff-list',
1515
templateUrl: './diff.list.html',
16-
styleUrls: ['./diff.list.scss']
16+
styleUrls: ['./diff.list.scss'],
17+
changeDetection: ChangeDetectionStrategy.OnPush
1718
})
1819
export class DiffListComponent {
1920
mode: Mode = Mode.UNIFIED;

ui/src/app/shared/favorite-cards/favorite-cards.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, EventEmitter, Input, Output } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22
import { Store } from '@ngxs/store';
33
import { Bookmark } from 'app/model/bookmark.model';
44
import { NavbarProjectData } from 'app/model/navbar.model';
@@ -9,7 +9,8 @@ import { finalize } from 'rxjs/operators';
99
@Component({
1010
selector: 'app-favorite-cards',
1111
templateUrl: './favorite-cards.component.html',
12-
styleUrls: ['./favorite-cards.component.scss']
12+
styleUrls: ['./favorite-cards.component.scss'],
13+
changeDetection: ChangeDetectionStrategy.OnPush
1314
})
1415
export class FavoriteCardsComponent {
1516

@@ -49,6 +50,9 @@ export class FavoriteCardsComponent {
4950
constructor(private store: Store) { }
5051

5152
updateFav(fav: NavbarProjectData) {
53+
if (!fav || !fav.type) {
54+
return;
55+
}
5256
let key = fav.key + fav.workflow_name;
5357
if (this.loading[key]) {
5458
return;

ui/src/app/shared/keys/form/keys.form.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
22
import { Key, KeyType } from 'app/model/keys.model';
33
import { KeyEvent } from 'app/shared/keys/key.event';
44
import cloneDeep from 'lodash-es/cloneDeep';
55

66
@Component({
77
selector: 'app-keys-form',
88
templateUrl: './keys.form.html',
9-
styleUrls: ['./keys.form.scss']
9+
styleUrls: ['./keys.form.scss'],
10+
changeDetection: ChangeDetectionStrategy.OnPush
1011
})
1112
export class KeysFormComponent implements OnInit {
1213

ui/src/app/shared/keys/form/keys.form.html

+12-10
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@
1616
</div>
1717
<div class="seven wide field">
1818
<label>{{ 'keys_type' | translate }}</label>
19-
<sui-select class="selection"
20-
name="type"
21-
[(ngModel)]="newKey.type"
22-
[options]="keyTypes"
23-
[isSearchable]="true"
24-
#selectKeyType>
25-
<sui-select-option *ngFor="let t of selectKeyType.filteredOptions" [value]="t">
26-
</sui-select-option>
27-
</sui-select>
19+
<ng-container *ngIf="keyTypes">
20+
<sui-select class="selection"
21+
name="type"
22+
[(ngModel)]="newKey.type"
23+
[options]="keyTypes"
24+
[isSearchable]="true"
25+
#selectKeyType>
26+
<sui-select-option *ngFor="let t of selectKeyType.filteredOptions" [value]="t">
27+
</sui-select-option>
28+
</sui-select>
29+
</ng-container>
2830
</div>
2931
<div class="two wide right aligned field">
3032
<button class="ui green button" type="button" [class.loading]="loading" [disabled]="loading || newKey.name === ''" (click)="addKey()">{{ 'btn_add' | translate }}</button>
3133
</div>
3234
</div>
3335
</div>
34-
</div>
36+
</div>

ui/src/app/shared/keys/list/keys.list.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, EventEmitter, Input, Output } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22
import { Key } from 'app/model/keys.model';
33
import { PermissionValue } from 'app/model/permission.model';
44
import { Warning } from 'app/model/warning.model';
@@ -8,7 +8,8 @@ import { Table } from 'app/shared/table/table';
88
@Component({
99
selector: 'app-keys-list',
1010
templateUrl: './keys.list.html',
11-
styleUrls: ['./keys.list.scss']
11+
styleUrls: ['./keys.list.scss'],
12+
changeDetection: ChangeDetectionStrategy.OnPush
1213
})
1314
export class KeysListComponent extends Table<Key> {
1415
@Input() keys: Array<Key>;

ui/src/app/shared/labels/edit/labels.edit.component.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, ViewChild } from '@angular/core';
1+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, ViewChild } from '@angular/core';
22
import { Store } from '@ngxs/store';
33
import { ModalTemplate, SuiActiveModal, SuiModalService, TemplateModalConfig } from '@richardlt/ng2-semantic-ui';
44
import { PermissionValue } from 'app/model/permission.model';
@@ -10,10 +10,20 @@ import { finalize } from 'rxjs/operators';
1010
@Component({
1111
selector: 'app-labels-edit',
1212
templateUrl: './labels.edit.component.html',
13-
styleUrls: ['./labels.edit.component.scss']
13+
styleUrls: ['./labels.edit.component.scss'],
14+
changeDetection: ChangeDetectionStrategy.OnPush
1415
})
1516
export class LabelsEditComponent {
16-
@Input() project: Project;
17+
_project: Project;
18+
@Input('project') set project(data: Project) {
19+
this._project = data;
20+
if (this._project) {
21+
this.labels = cloneDeep(this.project.labels);
22+
}
23+
}
24+
get project() {
25+
return this._project;
26+
}
1727

1828
@ViewChild('labelsEditModal', {static: false})
1929
public labelsEditModal: ModalTemplate<boolean, boolean, void>;
@@ -27,7 +37,8 @@ export class LabelsEditComponent {
2737

2838
constructor(
2939
private store: Store,
30-
private _suiService: SuiModalService
40+
private _suiService: SuiModalService,
41+
private _cd: ChangeDetectorRef
3142
) {
3243

3344
}
@@ -37,7 +48,6 @@ export class LabelsEditComponent {
3748
return;
3849
}
3950
this.newLabel = new Label();
40-
this.labels = cloneDeep(this.project.labels);
4151
this.modalConfig = new TemplateModalConfig<boolean, boolean, void>(this.labelsEditModal);
4252
this.modalConfig.mustScroll = true;
4353
this.modal = this._suiService.open(this.modalConfig);
@@ -63,6 +73,7 @@ export class LabelsEditComponent {
6373
})).pipe(finalize(() => {
6474
this.loading = false;
6575
this.newLabel = new Label();
76+
this._cd.markForCheck();
6677
})).subscribe(() => {
6778
if (close) {
6879
this.modal.approve(true);

ui/src/app/shared/modal/confirm/confirm.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
22
import { ModalTemplate, SuiActiveModal, SuiModalService, TemplateModalConfig } from '@richardlt/ng2-semantic-ui';
33

44
@Component({
55
selector: 'app-confirm-modal',
66
templateUrl: './confirm.html',
7-
styleUrls: ['./confirm.scss']
7+
styleUrls: ['./confirm.scss'],
8+
changeDetection: ChangeDetectionStrategy.OnPush
89
})
910
export class ConfirmModalComponent {
1011
@Input() title: string;

ui/src/app/shared/modal/delete/delete.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
22
import { ModalTemplate, SuiActiveModal, SuiModalService, TemplateModalConfig } from '@richardlt/ng2-semantic-ui';
33

44
@Component({
55
selector: 'app-delete-modal',
66
templateUrl: './delete.html',
7-
styleUrls: ['./delete.scss']
7+
styleUrls: ['./delete.scss'],
8+
changeDetection: ChangeDetectionStrategy.OnPush
89
})
910
export class DeleteModalComponent {
1011
@Input() title: string;

ui/src/app/shared/modal/warning/warning.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
2-
import {SemanticModalComponent} from 'ng-semantic/ng-semantic';
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
2+
import { SemanticModalComponent } from 'ng-semantic/ng-semantic';
33

44
@Component({
55
selector: 'app-warning-modal',
66
templateUrl: './warning.html',
7-
styleUrls: ['./warning.scss']
7+
styleUrls: ['./warning.scss'],
8+
changeDetection: ChangeDetectionStrategy.OnPush
89
})
910
export class WarningModalComponent {
1011

0 commit comments

Comments
 (0)