Skip to content

Commit bc421a5

Browse files
committed
set unique label
1 parent 06a805b commit bc421a5

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Recommended additional extensions that improve the development process and inter
4444

4545
- **Processor.** ARMv7 or ARMv8;
4646
- **OS version.** Linux distribution based on Ubuntu 20.04 LTS or later (Focal Fossa), or Debian 10.11 or later (Buster). It is recommended to use the distribution kit [Armbian](https://www.armbian.com/ "Armbian - Linux for ARM development boards").
47+
- **Software.** OpenSSH SSH server.
4748

4849
## Getting started
4950

README_ru.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
## Системные требования для устройства
4444

4545
- **Процессор.** ARMv7 или ARMv8;
46-
- **Версия ОС.** Linux дистрибутив построенный на основе Ubuntu версии не ниже 20.04 LTS (Focal Fossa), или на основе Debian версии не ниже 10.11 (Buster). Рекомендуется использовать дистрибутив [Armbian](https://www.armbian.com/ "Armbian – Linux for ARM development boards").
46+
- **Версия ОС.** Linux дистрибутив построенный на основе Ubuntu версии не ниже 20.04 LTS (Focal Fossa), или на основе Debian версии не ниже 10.11 (Buster). Рекомендуется использовать дистрибутив [Armbian](https://www.armbian.com/ "Armbian – Linux for ARM development boards");
47+
- **ПО.** SSH-сервер OpenSSH.
4748

4849
## Быстрый старт
4950

src/Entity/EntityBaseAttribute.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export class EntityBaseAttribute {
2323
private _author:string="";
2424
public get Author(): string {
2525
return this._author;}
26-
private _label:string="";
27-
public get Label(): string {
28-
return this._label;}
26+
public Label: string="";
2927
private _detail:string="";
3028
public get Detail(): string {
3129
return this._detail;}
@@ -70,7 +68,7 @@ export class EntityBaseAttribute {
7068
this._releaseDate=new Date(obj.releaseDate);
7169
this._forVersionExt=obj.forVersionExt;
7270
this._author=obj.author;
73-
this._label=obj.label;
71+
this.Label=obj.label;
7472
this._detail=obj.detail;
7573
this._description=obj.description;
7674
this._language=obj.language;

src/Entity/EntityCollection.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export abstract class EntityCollection <A extends EntityBaseAttribute, T extends
4242
public Add(value:T):boolean
4343
{
4444
try {
45+
//unique label
46+
if(!this.isUniqueLabel(value.Attributes.Label)) {
47+
value.Attributes.Label=`[${value.Attributes.Id}] ${value.Attributes.Label}`;
48+
}
4549
this._items.set(value.Attributes.Id,value);
4650
return true;
4751
} catch (err: any){
@@ -395,6 +399,16 @@ export abstract class EntityCollection <A extends EntityBaseAttribute, T extends
395399
if (fs.existsSync(dir)) fs.emptyDirSync(dir);
396400
}
397401

402+
private isUniqueLabel(searchLabel:string):boolean
403+
{
404+
searchLabel=searchLabel.toLocaleLowerCase();
405+
for (let [key, value] of this._items.entries()) {
406+
if (value.Attributes.Label.toLocaleLowerCase() === searchLabel)
407+
return false;
408+
}
409+
return true;
410+
}
411+
398412
}
399413

400414
//TODO убрать, заменить на Interface IConfig

0 commit comments

Comments
 (0)