add redux store bindings in main page
This commit is contained in:
parent
4218928a7b
commit
ee972b10c8
5 changed files with 31 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { Component } from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-case-result',
|
selector: 'app-case-result',
|
||||||
|
@ -9,7 +9,9 @@ import { Component } from '@angular/core';
|
||||||
export class CaseResult {
|
export class CaseResult {
|
||||||
|
|
||||||
|
|
||||||
|
@Input() case: any = {};
|
||||||
public activeTab: string = ''
|
public activeTab: string = ''
|
||||||
|
|
||||||
selectCaseTab(activeTab: string) {
|
selectCaseTab(activeTab: string) {
|
||||||
console.log('todo')
|
console.log('todo')
|
||||||
this.activeTab = activeTab
|
this.activeTab = activeTab
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<header>
|
<header>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="title-box">
|
<div class="title-box">
|
||||||
Work stoppage case for CFM56-7B engine (ESN: 802379)...
|
{{ appState.resumeTitle }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<input class="search" placeholder="Use keywords for a precise research" type="text">
|
<input class="search" placeholder="Use keywords for a precise research" type="text">
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs-results">
|
<div class="tabs-results">
|
||||||
11 cases found, 3 cases suggested
|
{{ appState.similarCases.length }} cases found, 3 cases suggested
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (displayedTab == 'similar-cases') {
|
@if (displayedTab == 'similar-cases') {
|
||||||
|
@ -70,10 +70,10 @@
|
||||||
<div class="row cases-results">
|
<div class="row cases-results">
|
||||||
|
|
||||||
<!-- boucle des résultats-->
|
<!-- boucle des résultats-->
|
||||||
<app-case-result></app-case-result>
|
@for (case of appState.similarCases; track case.id) {
|
||||||
<app-case-result></app-case-result>
|
|
||||||
<app-case-result></app-case-result>
|
<app-case-result [case]="case"></app-case-result>
|
||||||
<app-case-result></app-case-result>
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {FiltersGroup} from '../../../../../my-workspace/projects/sae-lib/filters/filters-group/filters-group';
|
|
||||||
import {BotTalks} from '../../../../../my-workspace/projects/sae-lib/chatbot/bot-talks/bot-talks';
|
import {BotTalks} from '../../../../../my-workspace/projects/sae-lib/chatbot/bot-talks/bot-talks';
|
||||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
||||||
import {CaseResult} from './case-result/case-result';
|
import {CaseResult} from './case-result/case-result';
|
||||||
import {BottomNavigation} from '../../shared/navigation/bottom-navigation/bottom-navigation';
|
import {BottomNavigation} from '../../shared/navigation/bottom-navigation/bottom-navigation';
|
||||||
|
import {StateInterface} from '../../redux/reducers';
|
||||||
|
import {Store} from '@ngrx/store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-similar-cases',
|
selector: 'app-similar-cases',
|
||||||
imports: [
|
imports: [
|
||||||
FiltersGroup,
|
|
||||||
BotTalks,
|
BotTalks,
|
||||||
// ReactiveFormsModule,
|
// ReactiveFormsModule,
|
||||||
CaseResult,
|
CaseResult,
|
||||||
|
@ -22,4 +21,12 @@ export class SimilarCases {
|
||||||
public searchInput: string = '';
|
public searchInput: string = '';
|
||||||
public displayedTab: 'similar-cases' | 'technical-manual' = 'similar-cases';
|
public displayedTab: 'similar-cases' | 'technical-manual' = 'similar-cases';
|
||||||
|
|
||||||
|
public appState: any = {};
|
||||||
|
|
||||||
|
constructor(private store: Store<StateInterface>) {
|
||||||
|
this.store.select(state => state.app).subscribe(app => {
|
||||||
|
this.appState = app;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ export const initialState: StateInterface = {
|
||||||
backendAPIRoot: "",
|
backendAPIRoot: "",
|
||||||
demoMode: true,
|
demoMode: true,
|
||||||
fromText: "",
|
fromText: "",
|
||||||
|
fromFile: "",
|
||||||
toText: "",
|
toText: "",
|
||||||
filters: {
|
filters: {
|
||||||
engineType: {
|
engineType: {
|
||||||
|
@ -34,10 +35,15 @@ export const initialState: StateInterface = {
|
||||||
selectedList: {}
|
selectedList: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
similarCases: {},
|
similarCases: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
searchInput: "",
|
searchInput: "",
|
||||||
enableAiSuggestion: false,
|
enableAiSuggestion: false,
|
||||||
technicalManuals: [],
|
technicalManuals: [],
|
||||||
|
resumeTitle: "Work stoppage case for CFM56-7B engine (ESN: 802379)...",
|
||||||
admin: {
|
admin: {
|
||||||
pendingUsers: {},
|
pendingUsers: {},
|
||||||
users: {},
|
users: {},
|
||||||
|
|
|
@ -99,6 +99,7 @@ export interface StateInterface {
|
||||||
app: {
|
app: {
|
||||||
demoMode: boolean;
|
demoMode: boolean;
|
||||||
backendAPIRoot: string;
|
backendAPIRoot: string;
|
||||||
|
fromFile: string,
|
||||||
fromText: string,
|
fromText: string,
|
||||||
toText: string,
|
toText: string,
|
||||||
filters: {
|
filters: {
|
||||||
|
@ -109,10 +110,11 @@ export interface StateInterface {
|
||||||
technicalManual: SelectFilterType,
|
technicalManual: SelectFilterType,
|
||||||
onOffWing: SelectFilterType,
|
onOffWing: SelectFilterType,
|
||||||
}
|
}
|
||||||
similarCases: object;
|
similarCases: any;
|
||||||
searchInput: string;
|
searchInput: string;
|
||||||
enableAiSuggestion: boolean;
|
enableAiSuggestion: boolean;
|
||||||
technicalManuals: Array<technicalManualType>;
|
technicalManuals: Array<technicalManualType>;
|
||||||
|
resumeTitle: string;
|
||||||
admin: {
|
admin: {
|
||||||
pendingUsers: object;
|
pendingUsers: object;
|
||||||
users: object;
|
users: object;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue