Skip to content

Commit

Permalink
when adding tags in tag management, random colors are given by defaul…
Browse files Browse the repository at this point in the history
…t. (#1412)
  • Loading branch information
prolevel1 authored Dec 10, 2023
1 parent 186e195 commit f6c786d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web-app/src/app/pojo/Tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ export class Tag {
id!: number;
name!: string;
value!: string;
color: string = '#ff4081';
color: string = this.getRandomColor();
// 标记类型 0:监控自动生成(monitorId,monitorName) 1: 用户生成 2: 系统预置
type!: number;
creator!: string;
modifier!: string;
gmtCreate!: number;
gmtUpdate!: number;

private getRandomColor(): string {
const colorArray = Array.from({ length: 6 }, () => '0123456789ABCDEF'[Math.floor(Math.random() * 16)]);
const colorCode = `#${colorArray.join('')}`;
return colorCode;
}
}

0 comments on commit f6c786d

Please sign in to comment.