Adds version listing model

This commit is contained in:
apapachristou 2020-07-09 14:28:55 +03:00
parent d8d11c5394
commit cc04364600
4 changed files with 31 additions and 5 deletions

View File

@ -0,0 +1,5 @@
export interface VersionListingModel {
id: string;
groupId: string;
version: number;
}

View File

@ -20,6 +20,7 @@ import { RequestItem } from '../../query/request-item';
import { BaseHttpService } from '../http/base-http.service';
import { ConfigurationService } from '../configuration/configuration.service';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { VersionListingModel } from '@app/core/model/version/version-listing.model';
@Injectable()
export class DmpService {
@ -57,6 +58,10 @@ export class DmpService {
return this.http.get<DmpOverviewModel>(this.actionUrl + 'publicOverview/' + id, { headers: this.headers })
}
getAllVersions(id: string): Observable<VersionListingModel[]> {
return this.http.get<VersionListingModel[]>(this.actionUrl + 'versions/' + id, { headers: this.headers })
}
unlock(id: String): Observable<DmpModel> {
return this.http.get<DmpModel>(this.actionUrl + id + '/unlock', { headers: this.headers });
}

View File

@ -30,10 +30,15 @@
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}}
</div>
<button class="d-flex mr-4 version-btn label2-txt"
<!-- <button class="d-flex mr-4 version-btn label2-txt"
(click)="viewVersions(dmp.groupId, dmp.label)">
{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
</button> -->
<mat-form-field appearance="fill">
<mat-select>
<mat-option *ngFor="let version of versions" [value]="version">{{'DMP-LISTING.VERSION' | translate}} {{version.version}}</mat-option>
</mat-select>
</mat-form-field>
<div class="d-flex mr-4">{{'GENERAL.STATUSES.EDIT' | translate}} :
{{dmp.modifiedTime | date:"longDate"}}
</div>
@ -426,4 +431,4 @@
</div>
</div>
</div>
-->
-->

View File

@ -35,6 +35,7 @@ import { LockService } from '@app/core/services/lock/lock.service';
import { ReturnStatement, ConditionalExpr } from '@angular/compiler';
import { LockModel } from '@app/core/model/lock/lock.model';
import { Guid } from '@common/types/guid';
import { VersionListingModel } from '@app/core/model/version/version-listing.model';
@Component({
selector: 'app-dmp-overview',
@ -54,6 +55,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
hasDOIToken = false;
lockStatus: Boolean;
textMessage: any;
versions: VersionListingModel[];
@ViewChild('doi', { static: false })
doi: ElementRef;
@ -94,6 +96,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmp = data;
this.checkLockStatus(this.dmp.id);
this.setIsUserOwner();
this.getAllVersions(this.dmp);
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DMPS'), url: "/plans" });
breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/overview/' + this.dmp.id });
@ -117,6 +120,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmp = data;
this.checkLockStatus(this.dmp.id);
this.setIsUserOwner();
this.getAllVersions(this.dmp);
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS'), url: "/explore-plans" });
breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/publicOverview/' + this.dmp.id });
@ -374,6 +378,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
});
}
getAllVersions(dmp: DmpOverviewModel) {
this.dmpService.getAllVersions(dmp.id)
.pipe(takeUntil(this._destroyed))
.subscribe(items => {
this.versions = items;
});
}
showConfirmationDOIDialog(dmp: DmpOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
@ -585,7 +596,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
const list= this.dmp.users;
const list = this.dmp.users;
const index = this.dmp.users.indexOf(user);
if (index > -1) {
this.dmp.users.splice(index, 1);
@ -619,7 +630,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
}
// advancedClicked() {