- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
  
          Merged in feature/SHIBUI-1268 (pull request #329)
        
    SHIBUI-1268 Integrated header with version history Approved-by: Ryan Mathis <rmathis@unicon.net>
- Loading branch information
 
      Showing
      43 changed files
      with
      576 additions
      and
      206 deletions.
    
  
  There are no files selected for viewing
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
        
          
            52 changes: 52 additions & 0 deletions
          
          52 
        
  ui/src/app/metadata/configuration/action/history.action.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { Action } from '@ngrx/store'; | ||
| import { MetadataHistory } from '../model/history'; | ||
| 
     | 
||
| export enum HistoryActionTypes { | ||
| LOAD_HISTORY_REQUEST = '[Configuration History] Load History Request', | ||
| LOAD_HISTORY_SUCCESS = '[Configuration History] Load History Success', | ||
| LOAD_HISTORY_ERROR = '[Configuration History] Load History Error', | ||
| SET_HISTORY = '[Configuration History] Set History', | ||
| CLEAR_HISTORY = '[Configuration History] Clear History', | ||
| SELECT_VERSION = '[Configuration History] Select Version' | ||
| } | ||
| 
     | 
||
| export class LoadHistoryRequest implements Action { | ||
| readonly type = HistoryActionTypes.LOAD_HISTORY_REQUEST; | ||
| 
     | 
||
| constructor(public payload: { id: string, type: string }) { } | ||
| } | ||
| 
     | 
||
| export class LoadHistorySuccess implements Action { | ||
| readonly type = HistoryActionTypes.LOAD_HISTORY_SUCCESS; | ||
| 
     | 
||
| constructor(public payload: MetadataHistory) { } | ||
| } | ||
| 
     | 
||
| export class LoadHistoryError implements Action { | ||
| readonly type = HistoryActionTypes.LOAD_HISTORY_ERROR; | ||
| 
     | 
||
| constructor(public payload: any) { } | ||
| } | ||
| 
     | 
||
| export class SelectVersion implements Action { | ||
| readonly type = HistoryActionTypes.SELECT_VERSION; | ||
| constructor(public payload: string | null) { } | ||
| } | ||
| 
     | 
||
| export class SetHistory implements Action { | ||
| readonly type = HistoryActionTypes.SET_HISTORY; | ||
| 
     | 
||
| constructor(public payload: MetadataHistory) {} | ||
| } | ||
| 
     | 
||
| export class ClearHistory implements Action { | ||
| readonly type = HistoryActionTypes.CLEAR_HISTORY; | ||
| } | ||
| 
     | 
||
| export type HistoryActionsUnion = | ||
| | LoadHistoryRequest | ||
| | LoadHistorySuccess | ||
| | LoadHistoryError | ||
| | SetHistory | ||
| | ClearHistory | ||
| | SelectVersion; | 
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
        
          
            8 changes: 4 additions & 4 deletions
          
          8 
        
  ui/src/app/metadata/configuration/component/metadata-configuration.component.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
        
          
            19 changes: 19 additions & 0 deletions
          
          19 
        
  ui/src/app/metadata/configuration/component/metadata-header.component.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <div class="card enabled-status" *ngIf="version"> | ||
| <div class="card-body"> | ||
| <h2 class="card-title version-title"> | ||
| <translate-i18n key="label.version">Version</translate-i18n> {{ versionNumber }} | ||
| </h2> | ||
| <p class="card-text version-details"> | ||
| <translate-i18n key="label.saved">Saved</translate-i18n>  | ||
| <span class="save-date">{{ version.date | date }}</span>, | ||
| <translate-i18n key="label.by">by</translate-i18n>  | ||
| <span class="author">{{ version.creator }}</span> | ||
| </p> | ||
| <p class="card-text"> | ||
| <span class="badge badge-primary" *ngIf="isEnabled" translate="value.enabled">Enabled</span> | ||
|   | ||
| <span class="badge badge-danger" *ngIf="!isEnabled" translate="value.disabled">Disabled</span> | ||
| <span class="badge badge-primary" *ngIf="isCurrent" translate="value.current">Current</span> | ||
| </p> | ||
| </div> | ||
| </div> | 
        
          
            58 changes: 58 additions & 0 deletions
          
          58 
        
  ui/src/app/metadata/configuration/component/metadata-header.component.spec.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { Component, ViewChild } from '@angular/core'; | ||
| import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
| import { MockI18nModule } from '../../../../testing/i18n.stub'; | ||
| import { MetadataVersion } from '../model/version'; | ||
| import { MetadataHeaderComponent } from './metadata-header.component'; | ||
| 
     | 
||
| @Component({ | ||
| template: ` | ||
| <metadata-header | ||
| [isEnabled]="isEnabled" | ||
| [version]="version" | ||
| [versionNumber]="versionNumber" | ||
| [isCurrent]="isCurrent" | ||
| ></metadata-header> | ||
| ` | ||
| }) | ||
| class TestHostComponent { | ||
| @ViewChild(MetadataHeaderComponent) | ||
| public componentUnderTest: MetadataHeaderComponent; | ||
| 
     | 
||
| isEnabled = true; | ||
| 
     | 
||
| version: MetadataVersion = { | ||
| id: 'foo', | ||
| creator: 'foobar', | ||
| date: new Date().toDateString() | ||
| }; | ||
| versionNumber = 1; | ||
| isCurrent = false; | ||
| } | ||
| 
     | 
||
| describe('Metadata Header Component', () => { | ||
| 
     | 
||
| let fixture: ComponentFixture<TestHostComponent>; | ||
| let instance: TestHostComponent; | ||
| let app: MetadataHeaderComponent; | ||
| 
     | 
||
| beforeEach(async(() => { | ||
| TestBed.configureTestingModule({ | ||
| imports: [ | ||
| MockI18nModule | ||
| ], | ||
| declarations: [ | ||
| MetadataHeaderComponent, | ||
| TestHostComponent | ||
| ] | ||
| }).compileComponents(); | ||
| 
     | 
||
| fixture = TestBed.createComponent(TestHostComponent); | ||
| instance = fixture.componentInstance; | ||
| app = instance.componentUnderTest; | ||
| fixture.detectChanges(); | ||
| })); | ||
| 
     | 
||
| it('should accept a property input', async(() => { | ||
| expect(app).toBeTruthy(); | ||
| })); | ||
| }); | 
        
          
            19 changes: 19 additions & 0 deletions
          
          19 
        
  ui/src/app/metadata/configuration/component/metadata-header.component.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Component, Input } from '@angular/core'; | ||
| import { Metadata, MetadataTypes } from '../../domain/domain.type'; | ||
| import { MetadataVersion } from '../model/version'; | ||
| 
     | 
||
| @Component({ | ||
| selector: 'metadata-header', | ||
| templateUrl: './metadata-header.component.html', | ||
| styleUrls: [] | ||
| }) | ||
| 
     | 
||
| export class MetadataHeaderComponent { | ||
| @Input() isEnabled: boolean; | ||
| @Input() version: MetadataVersion; | ||
| @Input() versionNumber: number; | ||
| @Input() isCurrent: boolean; | ||
| 
     | 
||
| constructor() {} | ||
| } | ||
| 
     | 
  
    
      This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
      
      Oops, something went wrong.