diff --git a/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.html.ts b/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.html.ts index 6c12fee4d..cf55c2dfc 100644 --- a/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.html.ts +++ b/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.html.ts @@ -18,7 +18,7 @@ export const CREATE_EDIT_LABEL_TEMPLATE: string = ` - + diff --git a/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.ts b/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.ts index a326f216b..bcfec64eb 100644 --- a/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.ts +++ b/src/ui_ng/lib/src/create-edit-label/create-edit-label.component.ts @@ -31,6 +31,7 @@ import {LabelService} from "../service/label.service"; import {ErrorHandler} from "../error-handler/error-handler"; import {NgForm} from "@angular/forms"; import {Subject} from "rxjs/Subject"; +import {LabelColor} from "../shared/shared.const"; @Component({ selector: 'hbr-create-edit-label', @@ -48,8 +49,6 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy { checkOnGoing: boolean; isLabelNameExist = false; - labelColor = ['#00ab9a', '#9da3db', '#be90d6', '#9b0d54', '#f52f22', '#747474', '#0095d3', '#f38b00', ' #62a420', '#89cbdf', '#004a70', '#9460b8']; - nameChecker = new Subject(); labelForm: NgForm; @@ -88,6 +87,10 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy { this.nameChecker.unsubscribe(); } + get labelColor() { + return LabelColor; + } + initLabel(): Label { return { name: '', diff --git a/src/ui_ng/lib/src/label-piece/label-piece.component.ts b/src/ui_ng/lib/src/label-piece/label-piece.component.ts index 4c82b00cc..d00234eaf 100644 --- a/src/ui_ng/lib/src/label-piece/label-piece.component.ts +++ b/src/ui_ng/lib/src/label-piece/label-piece.component.ts @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core'; +import {Component, Input, Output, OnInit, EventEmitter, OnChanges} from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; @@ -20,6 +20,7 @@ import 'rxjs/add/operator/distinctUntilChanged'; import { LABEL_PIEICE_TEMPLATE, LABEL_PIEICE_STYLES } from './label-piece.template'; import {Label} from "../service/interface"; +import {LabelColor} from "../shared/shared.const"; @Component({ @@ -28,10 +29,17 @@ import {Label} from "../service/interface"; template: LABEL_PIEICE_TEMPLATE }) -export class LabelPieceComponent implements OnInit { +export class LabelPieceComponent implements OnInit, OnChanges { @Input() label: Label; @Input() labelWidth: number; + labelColor: {[key: string]: string}; - ngOnInit(): void { + ngOnChanges(): void { + if (this.label) { + let color = this.label.color; + this.labelColor = LabelColor.find(data => data.color === color); + } } + + ngOnInit(): void { } } \ No newline at end of file diff --git a/src/ui_ng/lib/src/label-piece/label-piece.template.ts b/src/ui_ng/lib/src/label-piece/label-piece.template.ts index 573625e83..a21852a33 100644 --- a/src/ui_ng/lib/src/label-piece/label-piece.template.ts +++ b/src/ui_ng/lib/src/label-piece/label-piece.template.ts @@ -3,7 +3,7 @@ */ export const LABEL_PIEICE_TEMPLATE: string = ` -