mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Added messages and menu links + tests
This commit is contained in:
@@ -1316,6 +1316,8 @@
|
||||
|
||||
"menu.section.icon.pin": "Pin sidebar",
|
||||
|
||||
"menu.section.icon.processes": "Processes menu section",
|
||||
|
||||
"menu.section.icon.registries": "Registries menu section",
|
||||
|
||||
"menu.section.icon.statistics_task": "Statistics Task menu section",
|
||||
@@ -1342,6 +1344,8 @@
|
||||
|
||||
"menu.section.new_item_version": "Item Version",
|
||||
|
||||
"menu.section.new_process": "Process",
|
||||
|
||||
|
||||
|
||||
"menu.section.pin": "Pin sidebar",
|
||||
@@ -1350,6 +1354,10 @@
|
||||
|
||||
|
||||
|
||||
"menu.section.processes": "Processes",
|
||||
|
||||
|
||||
|
||||
"menu.section.registries": "Registries",
|
||||
|
||||
"menu.section.registries_format": "Format",
|
||||
@@ -1534,38 +1542,81 @@
|
||||
|
||||
|
||||
|
||||
"process.page.detail.arguments" : "Arguments",
|
||||
"process.new.select-parameters": "Parameters",
|
||||
|
||||
"process.page.detail.arguments.empty" : "This process doesn't contain any arguments",
|
||||
"process.new.cancel": "Cancel",
|
||||
|
||||
"process.page.detail.back" : "Back",
|
||||
"process.new.submit": "Submit",
|
||||
|
||||
"process.page.detail.output" : "Process Output",
|
||||
"process.new.select-script": "Script",
|
||||
|
||||
"process.page.detail.output.alert" : "Work in progress - Process output is not available yet",
|
||||
"process.new.select-script.placeholder": "Choose a script...",
|
||||
|
||||
"process.page.detail.output-files" : "Output Files",
|
||||
"process.new.select-script.required": "Script is required",
|
||||
|
||||
"process.page.detail.output-files.empty" : "This process doesn't contain any output files",
|
||||
"process.new.parameter.file.upload-button": "Select file...",
|
||||
|
||||
"process.page.detail.script" : "Script",
|
||||
"process.new.parameter.file.required": "Please select a file",
|
||||
|
||||
"process.page.detail.title" : "Process: {{ id }} - {{ name }}",
|
||||
"process.new.parameter.string.required": "Parameter value is required",
|
||||
|
||||
"process.page.overview.table.finish" : "Finish time",
|
||||
"process.new.parameter.type.value": "value",
|
||||
|
||||
"process.page.overview.table.id" : "Process ID",
|
||||
"process.new.parameter.type.file": "file",
|
||||
|
||||
"process.page.overview.table.name" : "Name",
|
||||
"process.new.parameter.required.missing": "The following parameters are required but still missing:",
|
||||
|
||||
"process.page.overview.table.start" : "Start time",
|
||||
"process.new.notification.success.title": "Success",
|
||||
|
||||
"process.page.overview.table.status" : "Status",
|
||||
"process.new.notification.success.content": "The process was successfully created",
|
||||
|
||||
"process.page.overview.table.user" : "User",
|
||||
"process.new.notification.error.title": "Error",
|
||||
|
||||
"process.page.overview.title": "Processes Overview",
|
||||
"process.new.notification.error.content": "An error occurred while creating this process",
|
||||
|
||||
"process.new.header": "Create a new process",
|
||||
|
||||
"process.new.title": "Create a new process",
|
||||
|
||||
"process.new.breadcrumbs": "Create a new process",
|
||||
|
||||
|
||||
|
||||
"process.detail.arguments" : "Arguments",
|
||||
|
||||
"process.detail.arguments.empty" : "This process doesn't contain any arguments",
|
||||
|
||||
"process.detail.back" : "Back",
|
||||
|
||||
"process.detail.output" : "Process Output",
|
||||
|
||||
"process.detail.output.alert" : "Work in progress - Process output is not available yet",
|
||||
|
||||
"process.detail.output-files" : "Output Files",
|
||||
|
||||
"process.detail.output-files.empty" : "This process doesn't contain any output files",
|
||||
|
||||
"process.detail.script" : "Script",
|
||||
|
||||
"process.detail.title" : "Process: {{ id }} - {{ name }}",
|
||||
|
||||
|
||||
|
||||
"process.overview.table.finish" : "Finish time",
|
||||
|
||||
"process.overview.table.id" : "Process ID",
|
||||
|
||||
"process.overview.table.name" : "Name",
|
||||
|
||||
"process.overview.table.start" : "Start time",
|
||||
|
||||
"process.overview.table.status" : "Status",
|
||||
|
||||
"process.overview.table.user" : "User",
|
||||
|
||||
"process.overview.title": "Processes Overview",
|
||||
|
||||
"process.overview.breadcrumbs": "Processes Overview",
|
||||
|
||||
|
||||
"profile.breadcrumbs": "Update Profile",
|
||||
@@ -1648,44 +1699,6 @@
|
||||
|
||||
|
||||
|
||||
"process.new.select-parameters": "Parameters",
|
||||
|
||||
"process.new.cancel": "Cancel",
|
||||
|
||||
"process.new.submit": "Submit",
|
||||
|
||||
"process.new.select-script": "Script",
|
||||
|
||||
"process.new.select-script.placeholder": "Choose a script...",
|
||||
|
||||
"process.new.select-script.required": "Script is required",
|
||||
|
||||
"process.new.parameter.file.upload-button": "Select file...",
|
||||
|
||||
"process.new.parameter.file.required": "Please select a file",
|
||||
|
||||
"process.new.parameter.string.required": "Parameter value is required",
|
||||
|
||||
"process.new.parameter.type.value": "value",
|
||||
|
||||
"process.new.parameter.type.file": "file",
|
||||
|
||||
"process.new.parameter.required.missing": "The following parameters are required but still missing:",
|
||||
|
||||
"process.new.notification.success.title": "Success",
|
||||
|
||||
"process.new.notification.success.content": "The process was successfully created",
|
||||
|
||||
"process.new.notification.error.title": "Error",
|
||||
|
||||
"process.new.notification.error.content": "An error occurred while creating this process",
|
||||
|
||||
"process.new.header": "Create a new process",
|
||||
|
||||
"process.new.title": "Create a new process",
|
||||
|
||||
|
||||
|
||||
"publication.listelement.badge": "Publication",
|
||||
|
||||
"publication.page.description": "Description",
|
||||
|
@@ -145,11 +145,17 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
this.modalService.open(CreateItemParentSelectorComponent);
|
||||
}
|
||||
} as OnClickMenuItemModel,
|
||||
// model: {
|
||||
// type: MenuItemType.LINK,
|
||||
// text: 'menu.section.new_item',
|
||||
// link: '/submit'
|
||||
// } as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'new_process',
|
||||
parentID: 'new',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.new_process',
|
||||
link: '/processes/new'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'new_item_version',
|
||||
@@ -439,6 +445,18 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
icon: 'cogs',
|
||||
index: 9
|
||||
},
|
||||
{
|
||||
id: 'processes',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.processes',
|
||||
link: '/processes'
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'terminal',
|
||||
index: 10
|
||||
},
|
||||
];
|
||||
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
|
||||
|
||||
|
@@ -1,21 +1,38 @@
|
||||
import { I18nBreadcrumbResolver } from './i18n-breadcrumb.resolver';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
|
||||
describe('I18nBreadcrumbResolver', () => {
|
||||
describe('resolve', () => {
|
||||
let resolver: I18nBreadcrumbResolver;
|
||||
let i18nBreadcrumbService: any;
|
||||
let i18nKey: string;
|
||||
let path: string;
|
||||
let route: any;
|
||||
let parentSegment;
|
||||
let segment;
|
||||
let expectedPath;
|
||||
beforeEach(() => {
|
||||
i18nKey = 'example.key';
|
||||
path = 'rest.com/path/to/breadcrumb';
|
||||
parentSegment = 'path';
|
||||
segment = 'breadcrumb';
|
||||
route = {
|
||||
data: { breadcrumbKey: i18nKey },
|
||||
routeConfig: {
|
||||
path: segment
|
||||
},
|
||||
parent: {
|
||||
routeConfig: {
|
||||
path: parentSegment
|
||||
}
|
||||
} as any
|
||||
};
|
||||
expectedPath = new URLCombiner(parentSegment, segment).toString();
|
||||
i18nBreadcrumbService = {};
|
||||
resolver = new I18nBreadcrumbResolver(i18nBreadcrumbService);
|
||||
});
|
||||
|
||||
it('should resolve the breadcrumb config', () => {
|
||||
const resolvedConfig = resolver.resolve({ data: { breadcrumbKey: i18nKey }, url: [path] } as any, {} as any);
|
||||
const expectedConfig = { provider: i18nBreadcrumbService, key: i18nKey, url: path };
|
||||
const resolvedConfig = resolver.resolve(route, {} as any);
|
||||
const expectedConfig = { provider: i18nBreadcrumbService, key: i18nKey, url: expectedPath };
|
||||
expect(resolvedConfig).toEqual(expectedConfig);
|
||||
});
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<div class="container" *ngVar="(processRD$ | async)?.payload as process">
|
||||
<h2>{{'process.page.detail.title' | translate:{ id: process?.processId, name: process?.scriptName } }}</h2>
|
||||
<h2>{{'process.detail.title' | translate:{ id: process?.processId, name: process?.scriptName } }}</h2>
|
||||
|
||||
<ds-process-detail-field id="process-name" [title]="'process.page.detail.script'">
|
||||
<ds-process-detail-field id="process-name" [title]="'process.detail.script'">
|
||||
<div>{{ process?.scriptName }}</div>
|
||||
</ds-process-detail-field>
|
||||
|
||||
<ds-process-detail-field *ngIf="process?.parameters && process?.parameters?.length > 0" id="process-arguments" [title]="'process.page.detail.arguments'">
|
||||
<ds-process-detail-field *ngIf="process?.parameters && process?.parameters?.length > 0" id="process-arguments" [title]="'process.detail.arguments'">
|
||||
<div *ngFor="let argument of process?.parameters">{{ argument?.name }} {{ argument?.value }}</div>
|
||||
</ds-process-detail-field>
|
||||
|
||||
<div *ngVar="(filesRD$ | async)?.payload?.page as files">
|
||||
<ds-process-detail-field *ngIf="files && files?.length > 0" id="process-files" [title]="'process.page.detail.output-files'">
|
||||
<ds-process-detail-field *ngIf="files && files?.length > 0" id="process-files" [title]="'process.detail.output-files'">
|
||||
<div *ngFor="let file of files">
|
||||
<span><a [href]="file?._links?.content?.href">{{getFileName(file)}}</a></span>
|
||||
<span>({{file?.sizeBytes | dsFileSize}})</span>
|
||||
@@ -18,9 +18,9 @@
|
||||
</ds-process-detail-field>
|
||||
</div>
|
||||
|
||||
<!--<ds-process-detail-field id="process-output" [title]="'process.page.detail.output'">-->
|
||||
<!--<pre class="font-weight-bold text-secondary bg-light p-3">{{'process.page.detail.output.alert' | translate}}</pre>-->
|
||||
<!--<ds-process-detail-field id="process-output" [title]="'process.detail.output'">-->
|
||||
<!--<pre class="font-weight-bold text-secondary bg-light p-3">{{'process.detail.output.alert' | translate}}</pre>-->
|
||||
<!--</ds-process-detail-field>-->
|
||||
|
||||
<a class="btn btn-light mt-3" [routerLink]="'/processes'">{{'process.page.detail.back' | translate}}</a>
|
||||
<a class="btn btn-light mt-3" [routerLink]="'/processes'">{{'process.detail.back' | translate}}</a>
|
||||
</div>
|
||||
|
@@ -9,7 +9,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { FileValueAccessorDirective } from '../../../../../shared/utils/file-value-accessor.directive';
|
||||
import { FileValidator } from '../../../../../shared/utils/require-file.validator';
|
||||
|
||||
‡describe('FileValueInputComponent', () => {
|
||||
describe('FileValueInputComponent', () => {
|
||||
let component: FileValueInputComponent;
|
||||
let fixture: ComponentFixture<FileValueInputComponent>;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h2>{{'process.page.overview.title' | translate}}</h2>
|
||||
<h2>{{'process.overview.title' | translate}}</h2>
|
||||
<ds-pagination *ngIf="(processesRD$ | async)?.payload?.totalElements > 0"
|
||||
[paginationOptions]="pageConfig"
|
||||
[pageInfoState]="(processesRD$ | async)?.payload"
|
||||
@@ -10,12 +10,12 @@
|
||||
<table class="table table-striped table-hover table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{'process.page.overview.table.id' | translate}}</th>
|
||||
<th scope="col">{{'process.page.overview.table.name' | translate}}</th>
|
||||
<th scope="col">{{'process.page.overview.table.user' | translate}}</th>
|
||||
<th scope="col">{{'process.page.overview.table.start' | translate}}</th>
|
||||
<th scope="col">{{'process.page.overview.table.finish' | translate}}</th>
|
||||
<th scope="col">{{'process.page.overview.table.status' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.id' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.name' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.user' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.start' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.finish' | translate}}</th>
|
||||
<th scope="col">{{'process.overview.table.status' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
40
src/app/process-page/process-breadcrumb.resolver.spec.ts
Normal file
40
src/app/process-page/process-breadcrumb.resolver.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ProcessBreadcrumbResolver } from './process-breadcrumb.resolver';
|
||||
import { Process } from './processes/process.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../shared/testing/utils';
|
||||
import { ProcessDataService } from '../core/data/processes/process-data.service';
|
||||
|
||||
describe('ProcessBreadcrumbResolver', () => {
|
||||
describe('resolve', () => {
|
||||
let resolver: ProcessBreadcrumbResolver;
|
||||
let processDataService: ProcessDataService;
|
||||
let processBreadcrumbService: any;
|
||||
let process: Process;
|
||||
let id: string;
|
||||
let path: string;
|
||||
beforeEach(() => {
|
||||
id = '12345';
|
||||
process = Object.assign(new Process(), { id });
|
||||
path = 'rest.com/path/to/breadcrumb/12345';
|
||||
processBreadcrumbService = {};
|
||||
processDataService = {
|
||||
findById: () => createSuccessfulRemoteDataObject$(process)
|
||||
} as any;
|
||||
resolver = new ProcessBreadcrumbResolver(processBreadcrumbService, processDataService);
|
||||
});
|
||||
|
||||
it('should resolve the breadcrumb config', (done) => {
|
||||
const resolvedConfig = resolver.resolve({ data: { breadcrumbKey: process }, params: { id: id} } as any, {url: path} as any);
|
||||
const expectedConfig = { provider: processBreadcrumbService, key: process, url: path};
|
||||
resolvedConfig.subscribe((config) => {
|
||||
expect(config).toEqual(expectedConfig);
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it('should resolve throw an error when no breadcrumbKey is defined', () => {
|
||||
expect(() => {
|
||||
resolver.resolve({ data: {} } as any, undefined)
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
});
|
36
src/app/process-page/process-breadcrumbs.service.spec.ts
Normal file
36
src/app/process-page/process-breadcrumbs.service.spec.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import { ProcessBreadcrumbsService } from './process-breadcrumbs.service';
|
||||
import { Breadcrumb } from '../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { Process } from './processes/process.model';
|
||||
|
||||
describe('ProcessBreadcrumbsService', () => {
|
||||
let service: ProcessBreadcrumbsService;
|
||||
let exampleId;
|
||||
let exampleScriptName;
|
||||
let exampleProcess;
|
||||
let exampleURL;
|
||||
|
||||
function init() {
|
||||
exampleId = '12345';
|
||||
exampleScriptName = 'Example Script';
|
||||
exampleProcess = Object.assign(new Process(), {processId: exampleId, scriptName: exampleScriptName});
|
||||
exampleURL = 'example.com';
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = new ProcessBreadcrumbsService();
|
||||
});
|
||||
|
||||
describe('getBreadcrumbs', () => {
|
||||
it('should return a breadcrumb based on a id and scriptName of the process', () => {
|
||||
const breadcrumbs = service.getBreadcrumbs(exampleProcess, exampleURL);
|
||||
getTestScheduler().expectObservable(breadcrumbs).toBe('(a|)', { a: [new Breadcrumb(exampleId + ' - ' + exampleScriptName, exampleURL)] });
|
||||
})
|
||||
});
|
||||
});
|
@@ -14,7 +14,7 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||
{
|
||||
path: '',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
data: { breadcrumbKey: 'process' },
|
||||
data: { breadcrumbKey: 'process.overview' },
|
||||
canActivate: [AuthenticatedGuard],
|
||||
children: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user