Skip to content

Commit

Permalink
Merge pull request #76 from e-gov/release/v7.5
Browse files Browse the repository at this point in the history
Release/v7.5
  • Loading branch information
KristjanKruusRIA authored Mar 14, 2019
2 parents 193dd20 + 7a40d93 commit 1f66fc8
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Service
public class IssueService {

private static final int WORK_DAYS_UNTIL_DEADLINE = 20;
public static final int WORK_DAYS_UNTIL_DEADLINE = 20;

public static final Function<Comment, Issue> COMMENT_TO_ISSUE = comment -> {
if (comment == null) {
Expand Down
8 changes: 4 additions & 4 deletions backend/src/main/java/ee/ria/riha/service/util/DateUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package ee.ria.riha.service.util;

import ee.ria.riha.domain.model.NationalHoliday;
import ee.ria.riha.domain.model.NationalHolidays;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
Expand All @@ -8,9 +11,6 @@
import java.util.Set;
import java.util.stream.Collectors;

import ee.ria.riha.domain.model.NationalHoliday;
import ee.ria.riha.domain.model.NationalHolidays;

public class DateUtils {

public static final Set<LocalDate> daysOffWork = NationalHolidays.get().stream()
Expand All @@ -25,7 +25,7 @@ public static LocalDate getDecisionDeadline(Date from, int workDaysToAdd) {

LocalDate date = from.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
int dayCount = 0;
while (dayCount <= workDaysToAdd) {
while (dayCount < workDaysToAdd) {
date = date.plusDays(1);
if (isWorkDay(date)) {
dayCount++;
Expand Down
29 changes: 29 additions & 0 deletions backend/src/test/java/ee/ria/riha/service/util/DateUtilsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ee.ria.riha.service.util;

import ee.ria.riha.service.IssueService;
import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class DateUtilsTest {

@Test
public void getDecisionDeadline() throws ParseException {

SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");

LocalDate decisionDeadline = DateUtils.getDecisionDeadline(dateFormat.parse("28-01-2019"), IssueService.WORK_DAYS_UNTIL_DEADLINE);
assertThat(decisionDeadline.format(dateTimeFormatter), is("25-02-2019"));

decisionDeadline = DateUtils.getDecisionDeadline(dateFormat.parse("11-03-2019"), IssueService.WORK_DAYS_UNTIL_DEADLINE);
assertThat(decisionDeadline.format(dateTimeFormatter), is("08-04-2019"));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</div>
<div *ngIf="isAuditVisible() && system.hasAuditInfo()" class="form-group">
<strong>Auditeeritud viimati {{ system.getLatestAuditDate() | date:'y-MM-dd'}}</strong>
<strong>(<span *ngIf="system.getLatestAuditResolution() && classifiers.security_level[system.getLatestAuditResolution()]" class="text-success">{{classifiers.audit_resolution_type[system.getLatestAuditResolution()].value}}</span>)</strong>
<strong>
(<span *ngIf="system.getLatestAuditResolution() && classifiers.audit_resolution_type[system.getLatestAuditResolution()]"
class="{{getLatestAuditionCssClass(system.getLatestAuditResolution())}}">{{classifiers.audit_resolution_type[system.getLatestAuditResolution()].value}}</span>)</strong>
</div>
<div *ngIf="allowEdit && !system.hasAuditInfo()" class="form-group">
Auditeerimise info puudub
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, EventEmitter, OnInit, Input, Output } from '@angular/core';
import { ModalHelperService } from '../../../services/modal-helper.service';
import { System } from '../../../models/system';
import { GeneralHelperService } from '../../../services/general-helper.service';
import { SystemsService } from '../../../services/systems.service';
import { ToastrService } from 'ngx-toastr';
import { ProducerEditSecurityComponent } from '../../producer-edit/producer-edit-security/producer-edit-security.component';
import { EnvironmentService, classifiers } from '../../../services/environment.service';
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ModalHelperService} from '../../../services/modal-helper.service';
import {System} from '../../../models/system';
import {GeneralHelperService} from '../../../services/general-helper.service';
import {SystemsService} from '../../../services/systems.service';
import {ToastrService} from 'ngx-toastr';
import {ProducerEditSecurityComponent} from '../../producer-edit/producer-edit-security/producer-edit-security.component';
import {classifiers, EnvironmentService} from '../../../services/environment.service';

@Component({
selector: 'app-producer-details-security',
Expand All @@ -24,6 +24,19 @@ export class ProducerDetailsSecurityComponent implements OnInit {
return this.environmentService.getUserMatrix().hasApproverRole || this.allowEdit;
}

getLatestAuditionCssClass(auditionCode) {

if (auditionCode === 'PASSED_WITHOUT_REMARKS') {
return 'text-success';
} else if (auditionCode === 'PASSED_WITH_REMARKS') {
return 'text-primary';
} else if (auditionCode === 'DID_NOT_PASS') {
return 'text-danger';
} else {
return '';
}
}

openSecurityEdit(content) {
this.systemsService.getSystem(this.system.details.short_name).then( res => {
let system = new System(res.json());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#linkType="ngModel"
[(ngModel)]="data.type"
name="linkType" required>
<option [value]="''" disabled selected>Vali veebiviide liik...</option>
<option [value]="''" disabled selected>Vali veebiviite liik...</option>
<option *ngFor="let type of generalHelperService.toArray(classifiers.document_types)" [value]="type.code" selected>{{ type.value }}</option>
</select>
</div>
Expand Down Expand Up @@ -121,7 +121,7 @@
#linkTypeEdit="ngModel"
[(ngModel)]="documents[i].type"
name="{{'linkType' + i}}" required>
<option [value]="''" disabled selected>Vali veebiviide liik...</option>
<option [value]="''" disabled selected>Vali veebiviite liik...</option>
<option *ngFor="let type of generalHelperService.toArray(classifiers.document_types)" [value]="type.code" selected>{{ type.value }}</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="col-12">
<button class="btn btn-success pull-right" (click)="createStandardRealisationSystem(addForm)">
<i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp;Salvesta</button>
<button class="btn btn-default pull-right" (click)="closeModal()">Tühista</button>
<button class="btn btn-default pull-right margin-right-20" (click)="closeModal()">Tühista</button>
</div>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<div class="col-lg-3 col-md-3 col-sm-6 col-12">
<div class="form-group">
<label for="name-input">Nimi</label>
<input class="form-control" (keyup.enter)="getOwnSystems()" [(ngModel)]="filters.name" type="text" id="name-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.name" type="text" id="name-input">
</div>
<div class="form-group">
<label for="x-road-status-input">X-teega liidestumine</label>
<select id="x-road-status-input" class="form-control"
(keyup.enter)="getOwnSystems()"
(keyup.enter)="search()"
[(ngModel)]="filters.xRoadStatus">
<option [value]="''">kõik</option>
<option [value]="'null'">määramata</option>
Expand Down Expand Up @@ -40,12 +40,12 @@
<div class="col-lg-3 col-md-3 col-sm-6 col-12">
<div class="form-group">
<label for="name-input">Lühinimi</label>
<input class="form-control" (keyup.enter)="getOwnSystems()" [(ngModel)]="filters.shortName" type="text" id="short-name-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.shortName" type="text" id="short-name-input">
</div>
<div class="form-group">
<label for="development-status-input">Arendamise staatus</label>
<select id="development-status-input" class="form-control"
(keyup.enter)="getOwnSystems()"
(keyup.enter)="search()"
[(ngModel)]="filters.developmentStatus">
<option [value]="''">kõik</option>
<option [value]="'null'">määramata</option>
Expand Down Expand Up @@ -76,20 +76,20 @@
<div class="col-lg-3 col-md-3 col-sm-6 col-12">
<div class="form-group">
<label for="topics-input">Märksõna</label>
<input class="form-control" (keyup.enter)="getOwnSystems()" [(ngModel)]="filters.topic" type="text" id="topics-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.topic" type="text" id="topics-input">
</div>
<div class="form-group">
<label for="purpose-input">Eesmärk</label>
<input class="form-control" (keyup.enter)="getOwnSystems()" [(ngModel)]="filters.purpose" type="text" id="purpose-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.purpose" type="text" id="purpose-input">
</div>
<div class="form-group" *ngIf="showUserAndOrganizationFilters">
<label for="owner-name-input">Omaniku nimi</label>
<input class="form-control" (keyup.enter)="getSystems()" [(ngModel)]="filters.ownerName" type="text" id="owner-name-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.ownerName" type="text" id="owner-name-input">
</div>
<div class="form-group">
<label for="approval-status">Kooskõlastamise staatus</label>
<select id="approval-status" class="form-control"
(keyup.enter)="getOwnSystems()"
(keyup.enter)="search()"
[(ngModel)]="filters.lastPositiveApprovalRequestType">
<option [value]="''">kõik</option>
<option [value]="classifiers.issue_type.AUTOMATICALLY_REGISTERED.code">registreeritud</option>
Expand All @@ -107,26 +107,26 @@
<div class="form-group">
<label for="system-status-input">Infosüsteemi staatus</label>
<select id="system-status-input" class="form-control"
(keyup.enter)="getOwnSystems()"
(keyup.enter)="search()"
[(ngModel)]="filters.systemStatus">
<option [value]="''">kõik</option>
<option [value]="'null'">määramata</option><option *ngFor="let type of generalHelperService.toArray(classifiers.system_status)" [value]="type.code" selected>{{ type.value }}</option>
</select>
</div>
<div class="form-group">
<label for="stored-data-input">Põhiandmed</label>
<input class="form-control" (keyup.enter)="getOwnSystems()" [(ngModel)]="filters.storedData" type="text" id="stored-data-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.storedData" type="text" id="stored-data-input">
</div>
<div class="form-group" *ngIf="showUserAndOrganizationFilters">
<label for="owner-code-input">Omaniku registrikood</label>
<input class="form-control" (keyup.enter)="getSystems()" [(ngModel)]="filters.ownerCode" type="text" id="owner-code-input">
<input class="form-control" (keyup.enter)="search()" [(ngModel)]="filters.ownerCode" type="text" id="owner-code-input">
</div>
</div>
</div>
<div class="actions-bar mt-2 mb-1">
<div class="buttons pull-right">
<button type="button" class="btn btn-default" (click)="clearFiltersAndRefresh()">Tühjenda</button>
<button type="button" class="btn btn-primary" (click)="getOwnSystems()"><i class="fa fa-search" aria-hidden="true"></i> Otsi</button>
<button type="button" class="btn btn-primary" (click)="search()"><i class="fa fa-search" aria-hidden="true"></i> Otsi</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export class ProducerSearchFilterComponent implements OnInit {
dateCreatedFrom: string,
dateCreatedTo: string,
dateUpdatedFrom: string,
dateUpdatedTo: string
dateUpdatedTo: string,
ownerName: string,
ownerCode: string
};

classifiers = classifiers;
Expand All @@ -42,7 +44,7 @@ export class ProducerSearchFilterComponent implements OnInit {
performSearch = new EventEmitter();


getOwnSystems() {
search() {
this.performSearch.next(this.filters);
}

Expand All @@ -53,8 +55,7 @@ export class ProducerSearchFilterComponent implements OnInit {

getFilters(): any {
let params = this.generalHelperService.cloneObject(this.filters);
delete params.ownerName;
delete params.ownerCode;

if (params.dateCreatedFrom) {
params.dateCreatedFrom = this.systemsService.dateObjToTimestamp(params.dateCreatedFrom, true);
}
Expand Down Expand Up @@ -94,7 +95,9 @@ export class ProducerSearchFilterComponent implements OnInit {
dateCreatedFrom: '',
dateCreatedTo: '',
dateUpdatedFrom: '',
dateUpdatedTo: ''
dateUpdatedTo: '',
ownerName: '',
ownerCode: '',
};
}

Expand Down Expand Up @@ -124,7 +127,10 @@ export class ProducerSearchFilterComponent implements OnInit {
dateCreatedFrom: this.systemsService.timestampToDateObj(params['dateCreatedFrom']),
dateCreatedTo: this.systemsService.timestampToDateObj(params['dateCreatedTo']),
dateUpdatedFrom: this.systemsService.timestampToDateObj(params['dateUpdatedFrom']),
dateUpdatedTo: this.systemsService.timestampToDateObj(params['dateUpdatedTo'])
dateUpdatedTo: this.systemsService.timestampToDateObj(params['dateUpdatedTo']),
ownerName: params['ownerName'] || '',
ownerCode: params['ownerCode'] || ''

};
});
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
.margin-right-10 {
margin-right: 10px;
}

.margin-right-20 {
margin-right: 20px;
}

0 comments on commit 1f66fc8

Please sign in to comment.