Skip to content

Commit

Permalink
Merge branch 'master' into SHIBUI-1263
Browse files Browse the repository at this point in the history
  • Loading branch information
dima767 committed Jun 25, 2019
2 parents 17e995c + e644e3d commit 42e7a7d
Show file tree
Hide file tree
Showing 93 changed files with 2,572 additions and 1,084 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.springframework.transaction.PlatformTransactionManager
import spock.lang.Specification

import java.time.LocalDateTime
import java.time.ZonedDateTime


@DataJpaTest
Expand Down Expand Up @@ -51,7 +52,7 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {
versions.size() == 1
versions[0].id
versions[0].creator
versions[0].date < LocalDateTime.now()
versions[0].date < ZonedDateTime.now()

when: 'Second version'
ed.serviceProviderName = 'SP2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.internet2.tier.shibboleth.admin.ui.domain.versioning;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -8,7 +9,7 @@
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Represents version information of any versioned entity in the system.
Expand All @@ -25,7 +26,8 @@ public class Version implements Serializable {

private String creator;

private LocalDateTime date;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private ZonedDateTime date;

private static final long serialVersionUID = 3429591830989243421L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javax.persistence.PersistenceContext;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
Expand Down Expand Up @@ -52,8 +53,8 @@ public List<Version> findVersionsForEntityDescriptor(String resourceId) {
((PrincipalAwareRevisionEntity) it).getPrincipalUserName(),
((PrincipalAwareRevisionEntity) it).getRevisionDate()
.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime());
.atOffset(ZoneOffset.UTC)
.toZonedDateTime());
})
.sorted(comparing(Version::getDate))
.collect(toList());
Expand Down
6 changes: 6 additions & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ label.filter-name=Filter Name
label.filter-enabled=Filter Enabled
label.filter-target=FilterTarget
label.filter-type=Filter Type
label.option=Option
label.value=Value
label.binding-type=Binding Type
label.sign-assertion=Sign Assertions
Expand Down Expand Up @@ -384,6 +385,11 @@ label.email=Email
label.role=Role
label.delete=Delete?

label.title=Title
label.enabled=Enabled
label.author=Author
label.creation-date=Creation Date

label.metadata-resolver-history=Metadata resolver history
label.metadata-version-history=Metadata Version History
label.select-version=Select Version
Expand Down
1 change: 1 addition & 0 deletions backend/src/main/resources/metadata-sources-ui-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
},
"attributeRelease": {
"type": "array",
"title": "label.attribute-release",
"description": "Attribute release table - select the attributes you want to release (default unchecked)",
"widget": {
"id": "checklist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,40 @@ package edu.internet2.tier.shibboleth.admin.ui.domain.versioning

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import groovy.json.JsonSlurper
import spock.lang.Specification

import java.time.LocalDateTime
import java.time.Month
import java.time.ZonedDateTime

class VersionJsonSerializationBasicTests extends Specification {

ObjectMapper mapper

JsonSlurper jsonSlurper

def setup() {
mapper = new ObjectMapper()
mapper.registerModule(new JavaTimeModule())
jsonSlurper = new JsonSlurper()
}

def "Verify basic Version JSON serialization"() {
given:
def staticDate = LocalDateTime.of(2019, Month.MAY,20,15,0,0)
def staticDate = ZonedDateTime.parse("2019-05-20T15:00:00.574Z")
def version = new Version('2', 'kramer', staticDate)
def expectedJson = """
{
"id": "2",
"creator": "kramer",
"date": "2019-05-20T15:00"
"date": "2019-05-20T15:00:00.574Z"
}
"""
def expectedJsonMap = jsonSlurper.parseText(expectedJson)

when:
def deSerialized = mapper.readValue(expectedJson, Version)
def deSerializedJsonMap = jsonSlurper.parseText(mapper.writeValueAsString(version))

then:
deSerialized == version
deSerializedJsonMap.date == expectedJsonMap.date
}
}
13 changes: 13 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test --code-coverage --source-map=false",
"test": "ng test --code-coverage --source-map=true",
"lint": "ng lint",
"e2e": "ng e2e",
"build:static": "node-sass src/static.scss ./dist/unsecured/static.css",
Expand Down Expand Up @@ -43,6 +43,7 @@
"deepmerge": "^2.2.1",
"file-saver": "^1.3.3",
"font-awesome": "^4.7.0",
"ngx-infinite-scroll": "^7.2.0",
"ngx-schema-form": "^2.2.0-beta.1",
"rxjs": "^6.5.1",
"rxjs-compat": "^6.5.1",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</ul>
</div>
</nav>
<main>
<main class="pad-content">
<router-outlet></router-outlet>
<notification-list></notification-list>
</main>
Expand Down
12 changes: 12 additions & 0 deletions ui/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ nav.navbar {
max-height: 60px;
}
}

@media only screen and (min-width: 1024px) {
.pad-content {
padding: 1rem 3rem;
}
}

@media only screen and (min-width: 1200px) {
.pad-content {
padding: 2rem 5rem;
}
}
130 changes: 130 additions & 0 deletions ui/src/app/metadata/configuration/action/configuration.action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { Action } from '@ngrx/store';
import { Metadata } from '../../domain/domain.type';
import { Schema } from '../model/schema';
import { Wizard } from '../../../wizard/model';

export enum ConfigurationActionTypes {
LOAD_METADATA_REQUEST = '[Metadata Configuration] Load Metadata Request',
LOAD_METADATA_SUCCESS = '[Metadata Configuration] Load Metadata Success',
LOAD_METADATA_ERROR = '[Metadata Configuration] Load Metadata Error',

LOAD_SCHEMA_REQUEST = '[Metadata Configuration] Load Schema Request',
LOAD_SCHEMA_SUCCESS = '[Metadata Configuration] Load Schema Success',
LOAD_SCHEMA_ERROR = '[Metadata Configuration] Load Schema Error',

LOAD_XML_REQUEST = '[Metadata Configuration] Load XML Request',
LOAD_XML_SUCCESS = '[Metadata Configuration] Load XML Success',
LOAD_XML_ERROR = '[Metadata Configuration] Load XML Error',

SET_METADATA = '[Metadata Configuration] Set Metadata Model',
SET_DEFINITION = '[Metadata Configuration] Set Metadata Definition',
SET_SCHEMA = '[Metadata Configuration] Set Metadata Schema',
SET_XML = '[Metadata Configuration] Set Metadata Xml',

DOWNLOAD_XML = '[Metadata Configuration] Download Metadata Xml',

CLEAR = '[Metadata Configuration] Clear'
}

export class LoadMetadataRequest implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_REQUEST;

constructor(public payload: { id: string, type: string }) { }
}

export class LoadMetadataSuccess implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_SUCCESS;

constructor(public payload: Metadata) { }
}

export class LoadMetadataError implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_ERROR;

constructor(public payload: any) { }
}

export class LoadSchemaRequest implements Action {
readonly type = ConfigurationActionTypes.LOAD_SCHEMA_REQUEST;

constructor(public payload: string) { }
}

export class LoadSchemaSuccess implements Action {
readonly type = ConfigurationActionTypes.LOAD_SCHEMA_SUCCESS;

constructor(public payload: Schema) { }
}

export class LoadSchemaError implements Action {
readonly type = ConfigurationActionTypes.LOAD_SCHEMA_ERROR;

constructor(public payload: any) { }
}

export class LoadXmlRequest implements Action {
readonly type = ConfigurationActionTypes.LOAD_XML_REQUEST;

constructor(public payload: string) { }
}

export class LoadXmlSuccess implements Action {
readonly type = ConfigurationActionTypes.LOAD_XML_SUCCESS;

constructor(public payload: string) { }
}

export class LoadXmlError implements Action {
readonly type = ConfigurationActionTypes.LOAD_XML_ERROR;

constructor(public payload: any) { }
}

export class SetMetadata implements Action {
readonly type = ConfigurationActionTypes.SET_METADATA;

constructor(public payload: Metadata) { }
}

export class SetDefinition implements Action {
readonly type = ConfigurationActionTypes.SET_DEFINITION;

constructor(public payload: Wizard<Metadata>) { }
}

export class SetSchema implements Action {
readonly type = ConfigurationActionTypes.SET_SCHEMA;

constructor(public payload: Schema) { }
}

export class SetXml implements Action {
readonly type = ConfigurationActionTypes.SET_XML;

constructor(public payload: string) { }
}

export class DownloadXml implements Action {
readonly type = ConfigurationActionTypes.DOWNLOAD_XML;
}

export class ClearConfiguration implements Action {
readonly type = ConfigurationActionTypes.CLEAR;
}

export type ConfigurationActionsUnion =
| LoadMetadataRequest
| LoadMetadataSuccess
| LoadMetadataError
| LoadSchemaRequest
| LoadSchemaSuccess
| LoadSchemaError
| LoadXmlRequest
| LoadXmlSuccess
| LoadXmlError
| SetMetadata
| SetDefinition
| SetSchema
| SetXml
| DownloadXml
| ClearConfiguration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<div>
<ng-container *ngIf="property.items.type === 'object'">
<div class="p-2" role="term" [translate]="property.name">{{ property.name }}</div>
<div class="p-2" *ngIf="property.value && property.value.length">
<div *ngFor="let value of property.value; let i = index;" class="mb-2 bg-lighter">
<div *ngFor="let prop of getKeys(property.items); let n = index;"
class="d-flex p-2">
<div class="w-50">
<span [class.invisible]="n">{{ i + 1 }}.&nbsp;</span>
<span [translate]="property.items.properties[prop].title">{{ property.items.properties[prop].title }}</span>
</div>
<div class="w-50" [ngbPopover]="value[prop]" triggers="mouseenter:mouseleave" container="body" placement="left">
{{ value[prop] }}
</div>
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="property.items.type === 'string'" [ngSwitch]="getItemType(property.items)">
<ng-container *ngSwitchCase="'datalist'">
<ng-template [ngTemplateOutlet]="listref"></ng-template>
</ng-container>
<ng-container *ngSwitchCase="'select'">
<ng-template [ngTemplateOutlet]="listref"></ng-template>
</ng-container>
<ng-container *ngSwitchDefault>
<div *ngFor="let attr of attributeList$ | async" class="d-flex justify-content-between border-bottom border-light">
<span class="w-50 p-2" role="term" [translate]="attr.label">{{ attr.label }}</span>
<div class="w-50 p-2">
<span *ngIf="property.value && property.value.indexOf(attr.key) > -1" translate="value.true">
true
</span>
<span *ngIf="!property.value || !(property.value.indexOf(attr.key) > -1)" translate="value.false">
false
</span>
</div>
</div>
</ng-container>
</ng-container>
</div>
<ng-template #listref>
<div class="d-flex border-bottom border-light">
<span class="w-50 p-2" role="term" [translate]="property.name">{{ property.name }}</span>
<p class="text-secondary w-50 p-2" *ngIf="!property.value || !property.value.length">&mdash;</p>
<ul class="list-unstyled w-50 py-2" *ngIf="property.value && property.value.length">
<li *ngFor="let item of property.value">
{{ item }}
</li>
</ul>
</div>
</ng-template>
Loading

0 comments on commit 42e7a7d

Please sign in to comment.