Merge pull request #4 from williamwbwse/yingde-SentiSight

Yingde senti sight
This commit is contained in:
Trinity X Solution 2023-02-15 16:38:27 +08:00 committed by GitHub
commit ae277e4d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 304 additions and 27 deletions

View file

@ -1,18 +1,11 @@
{ {
"root": true, "root": true,
"ignorePatterns": [ "ignorePatterns": ["projects/**/*"],
"projects/**/*"
],
"overrides": [ "overrides": [
{ {
"files": [ "files": ["*.ts"],
"*.ts"
],
"parserOptions": { "parserOptions": {
"project": [ "project": ["tsconfig.json", "e2e/tsconfig.json"],
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true "createDefaultProgram": true
}, },
"extends": [ "extends": [
@ -34,6 +27,7 @@
"type": "element" "type": "element"
} }
], ],
"@angular-eslint/no-empty-lifecycle-method": "off",
"@angular-eslint/directive-selector": [ "@angular-eslint/directive-selector": [
"error", "error",
{ {
@ -45,12 +39,8 @@
} }
}, },
{ {
"files": [ "files": ["*.html"],
"*.html" "extends": ["plugin:@angular-eslint/template/recommended"],
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {} "rules": {}
} }
] ]

View file

@ -7,4 +7,4 @@
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"> <ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)">
</ng2-smart-table> </ng2-smart-table>
</nb-card-body> </nb-card-body>
</nb-card> </nb-card>

File diff suppressed because one or more lines are too long

View file

@ -4,6 +4,11 @@ import { Routes, RouterModule } from '@angular/router';
import { SettingsComponent } from './settings.component'; import { SettingsComponent } from './settings.component';
import { KeywordsDictionaryComponent } from './keywordsdictionary/keywordsdictionary.component'; import { KeywordsDictionaryComponent } from './keywordsdictionary/keywordsdictionary.component';
import { ImageSimilarityComponent } from './imagesimilarity/imagesimilarity.component'; import { ImageSimilarityComponent } from './imagesimilarity/imagesimilarity.component';
import { HoverEnlargeImageComponent } from '../shares/hover-enlarge-image/hover-enlarge-image.component';
import { CommonModule } from '@angular/common';
import { LabelScoreComponent } from '../shares/label-score/label-score.component';
import { CheckboxComponent } from '../shares/checkbox/checkbox.component';
import { FormsModule } from '@angular/forms';
const routes: Routes = [{ const routes: Routes = [{
path: '', path: '',
@ -21,7 +26,12 @@ const routes: Routes = [{
}]; }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], declarations: [
HoverEnlargeImageComponent,
LabelScoreComponent,
CheckboxComponent
],
imports: [RouterModule.forChild(routes), CommonModule, FormsModule],
exports: [RouterModule], exports: [RouterModule],
}) })
export class SettingsRoutingModule { } export class SettingsRoutingModule { }

View file

@ -0,0 +1 @@
<input type="checkbox" [(ngModel)]="isChecked">

View file

@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { CheckboxComponent } from './checkbox.component';
describe('CheckboxComponent', () => {
let component: CheckboxComponent;
let fixture: ComponentFixture<CheckboxComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CheckboxComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CheckboxComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ngx-checkbox',
templateUrl: './checkbox.component.html',
styleUrls: ['./checkbox.component.scss']
})
export class CheckboxComponent implements OnInit {
isChecked = false;
constructor() { }
ngOnInit() {
}
}

View file

@ -0,0 +1,7 @@
<div (mouseenter)="showOverlay = true" (mouseleave)="showOverlay = false">
<img src="https://via.placeholder.com/150x150">
<div [ngClass]="{'overlay': true, 'show': showOverlay }">
<img src="https://via.placeholder.com/300x300">
</div>
</div>

View file

@ -0,0 +1,30 @@
div {
position: relative;
display: inline-block;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.5);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.5s;
width: 300px;
height: 300px;
z-index: 1;
}
.show {
opacity: 1;
}
img {
max-width: 100%;
max-height: 100%;
}

View file

@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { HoverEnlargeImageComponent } from './hover-enlarge-image.component';
describe('HoverEnlargeImageComponent', () => {
let component: HoverEnlargeImageComponent;
let fixture: ComponentFixture<HoverEnlargeImageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HoverEnlargeImageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HoverEnlargeImageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ngx-hover-enlarge-image',
templateUrl: './hover-enlarge-image.component.html',
styleUrls: ['./hover-enlarge-image.component.scss']
})
export class HoverEnlargeImageComponent implements OnInit {
showOverlay = false;
constructor() { }
ngOnInit() {
}
}

View file

@ -0,0 +1,16 @@
<div *ngFor="let image of images" (click)="toggleSelection(image)" class="grid-item">
<div *ngFor="let labelscore of image.labelscore">
<div class="d-flex">
<ngx-checkbox></ngx-checkbox>
<div style="width: max-content;">{{labelscore.label}}</div>
</div>
<div class="progress-container">
<div class="progress-bar" [ngStyle]="{'width': labelscore.score + '%'}"></div>
<div class="progress-percentage">{{labelscore.score}}%</div>
</div>
</div>
</div>

View file

@ -0,0 +1,46 @@
.progress-container {
width: 100%;
height: 20px;
background-color: #ddd;
border-radius: 10px;
// overflow: hidden;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.progress-bar {
height: 100%;
background-color: lightblue;
}
.progress-percentage {
position: absolute;
right: 10px;
font-size: 16px;
}
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
}
.grid-item {
background-color: #ddd;
height: 150px;
display: block;
align-items: center;
justify-content: center;
}
.selected {
background-color: blue;
}
.grid-item img {
max-width: 100%;
max-height: 100%;
}

View file

@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { LabelScoreComponent } from './label-score.component';
describe('LabelScoreComponent', () => {
let component: LabelScoreComponent;
let fixture: ComponentFixture<LabelScoreComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LabelScoreComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LabelScoreComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,41 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ngx-label-score',
templateUrl: './label-score.component.html',
styleUrls: ['./label-score.component.scss']
})
export class LabelScoreComponent implements OnInit {
selectedImage!: number;
showOverlay = false;
constructor() { }
ngOnInit() {
}
images = [
{ id: 1, url: 'https://via.placeholder.com/150x150', selected: false, labelscore: [{ "label": "live-casino", "score": 99.6 }, { "label": "baccarat", "score": 96.8 }, { "label": "roulette", "score": 94.2 }, { "label": "dragon-tiger", "score": 80.5 }, { "label": "sicbo", "score": 22.2 }, { "label": "slot", "score": 12.3 }] },
// { id: 2, url: 'https://via.placeholder.com/150x150', selected: false, labelscore: [{ "label": "live-casino", "score": 99.6 }, { "label": "baccarat", "score": 96.8 }, { "label": "roulette", "score": 94.2 }, { "label": "dragon-tiger", "score": 80.5 }, { "label": "sicbo", "score": 22.2 }, { "label": "slot", "score": 12.3 }] },
// { id: 3, url: 'https://via.placeholder.com/150x150', selected: false, labelscore: [{ "label": "live-casino", "score": 99.6 }, { "label": "baccarat", "score": 96.8 }, { "label": "roulette", "score": 94.2 }, { "label": "dragon-tiger", "score": 80.5 }, { "label": "sicbo", "score": 22.2 }, { "label": "slot", "score": 12.3 }] },
];
toggleImageSelection(mImage: any) {
// console.log(mImage)
// this.images.forEach(image => {
// if (image.id === mImage.imageId) {
// image.selected = !image.selected;
// }
// });
}
toggleSelection(image: any) {
image.selected = !image.selected;
}
}