Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(zio): add support for new zio routes (DEV-1636) (#898)
Co-authored-by: domsteinbach <36757218+domsteinbach@users.noreply.github.com>
Co-authored-by: Marcin Procyk <marcin.procyk@dasch.swiss>
  • Loading branch information
3 people committed Feb 3, 2023
1 parent 5f72fa9 commit d4e2a94
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 34 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
"@angular/platform-browser-dynamic": "^14.2.2",
"@angular/router": "^14.2.2",
"@ckeditor/ckeditor5-angular": "^4.0.0",
"@dasch-swiss/dsp-js": "^7.4.10",
"@dasch-swiss/dsp-js": "^7.5.0",
"@datadog/browser-rum": "^4.19.1",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "7.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app-init.service.spec.ts
Expand Up @@ -12,6 +12,7 @@ describe('AppInitService (dev)', () => {
apiProtocol: 'http',
apiHost: '0.0.0.0',
apiPort: 3333,
zioApiPort: 5555,
apiPath: 'mypath',
iiifProtocol: 'http',
iiifHost: '0.0.0.0',
Expand Down Expand Up @@ -81,6 +82,7 @@ describe('AppInitService (dev)', () => {
expect(service.dspApiConfig.apiProtocol).toEqual('http');
expect(service.dspApiConfig.apiHost).toEqual('0.0.0.0');
expect(service.dspApiConfig.apiPort).toEqual(3333);
expect(service.dspApiConfig.zioApiPort).toEqual(5555);
expect(service.dspApiConfig.apiPath).toEqual('mypath');
expect(service.dspIiifConfig.iiifProtocol).toEqual('http');
expect(service.dspIiifConfig.iiifHost).toEqual('0.0.0.0');
Expand Down Expand Up @@ -128,6 +130,7 @@ describe('AppInitService (dev)', () => {
expect(service.dspApiConfig.apiProtocol).toEqual('http');
expect(service.dspApiConfig.apiHost).toEqual('0.0.0.0');
expect(service.dspApiConfig.apiPort).toEqual(null);
expect(service.dspApiConfig.zioApiPort).toEqual(null);
expect(service.dspApiConfig.apiPath).toEqual('');
expect(service.dspApiConfig.jsonWebToken).toEqual('');
expect(service.dspApiConfig.logErrors).toEqual(false);
Expand Down Expand Up @@ -239,6 +242,7 @@ describe('AppInitService (prod)', () => {
apiProtocol: 'https',
apiHost: '0.0.0.0',
apiPort: undefined,
zioApiPort: undefined,
apiPath: '',
iiifProtocol: 'https',
iiifHost: '0.0.0.0',
Expand Down
2 changes: 2 additions & 0 deletions src/app/app-init.service.ts
Expand Up @@ -73,13 +73,15 @@ export class AppInitService {
// make input type safe
const apiPort = (typeof this._config.apiPort === 'number' ? this._config.apiPort : null);
const apiPath = (typeof this._config.apiPath === 'string' ? this._config.apiPath : '');
const zioApiPort = (typeof this._config.zioApiPort === 'number' ? this._config.zioApiPort : null);
const jsonWebToken = (typeof this._config.jsonWebToken === 'string' ? this._config.jsonWebToken : '');
const logErrors = (typeof this._config.logErrors === 'boolean' ? this._config.logErrors : false);

this._dspApiConfig = new KnoraApiConfig(
this._config.apiProtocol,
this._config.apiHost,
apiPort,
zioApiPort,
apiPath,
jsonWebToken,
logErrors
Expand Down
1 change: 1 addition & 0 deletions src/app/main/declarations/app-config.ts
Expand Up @@ -3,6 +3,7 @@ export interface IConfig {
apiProtocol: 'http' | 'https';
apiHost: string;
apiPort: number;
zioApiPort: number;
apiPath: string;
iiifProtocol: 'http' | 'https';
iiifHost: string;
Expand Down
Expand Up @@ -55,7 +55,7 @@ export class OntologyClassInstanceComponent implements OnChanges {
this.projectIri = this._projectService.uuidToIri(uuid);

this._route.params.subscribe(params => {
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri, false).subscribe(
(res: ApiResponseData<ProjectResponse>) => {
const shortcode = res.body.project.shortcode;
const iriBase = this._ontologyService.getIriBaseUrl();
Expand Down
Expand Up @@ -80,7 +80,7 @@ export class ListInfoFormComponent implements OnInit {
this._route.parent.paramMap.subscribe((params: Params) => {
this.projectUuid = params.get('uuid');

this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid)).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid), false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.projectIri = response.body.project.id;
},
Expand All @@ -100,7 +100,7 @@ export class ListInfoFormComponent implements OnInit {
this._route.firstChild.paramMap.subscribe((params: Params) => {
this.projectUuid = params.get('uuid');

this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid)).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid), false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.projectIri = response.body.project.id;
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/project/list/list.component.ts
Expand Up @@ -107,7 +107,7 @@ export class ListComponent implements OnInit {
// get feature toggle information if url contains beta
this.beta = (this._route.parent.snapshot.url[0].path === 'beta');
if (this.beta) {
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid)).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this._projectService.uuidToIri(this.projectUuid), false).subscribe(
(res: ApiResponseData<ProjectResponse>) => {
const shortcode = res.body.project.shortcode;

Expand Down
8 changes: 4 additions & 4 deletions src/app/project/project-form/project-form.component.ts
Expand Up @@ -158,7 +158,7 @@ export class ProjectFormComponent implements OnInit {
if (this.projectIri) {
// edit existing project
// get origin project data first
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri, false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
// save the origin project data in case of reset
this.project = response.body.project;
Expand All @@ -177,7 +177,7 @@ export class ProjectFormComponent implements OnInit {

// to avoid duplicate shortcodes or shortnames
// we have to create a list of already exisiting short codes and names
this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(response: ApiResponseData<ProjectsResponse>) => {

for (const project of response.body.projects) {
Expand Down Expand Up @@ -403,7 +403,7 @@ export class ProjectFormComponent implements OnInit {
i++;
}

this._dspApiConnection.admin.projectsEndpoint.createProject(projectData).subscribe(
this._dspApiConnection.admin.projectsEndpoint.createProject(projectData, false).subscribe(
(projectResponse: ApiResponseData<ProjectResponse>) => {
this.project = projectResponse.body.project;
this.buildForm(this.project);
Expand Down Expand Up @@ -488,7 +488,7 @@ export class ProjectFormComponent implements OnInit {
this.loading = true;
// update the cache
this._cache.del(this._projectService.iriToUuid(this.projectIri));
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.projectIri, false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.project = response.body.project;

Expand Down
2 changes: 1 addition & 1 deletion src/app/project/project.component.ts
Expand Up @@ -96,7 +96,7 @@ export class ProjectComponent implements OnInit {
this.loading = true;
// get current project data, project members and project groups
// and set the project cache here
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.iri).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.iri, false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.project = response.body.project;

Expand Down
Expand Up @@ -193,7 +193,7 @@ export class ProjectsListComponent implements OnInit {
this.refreshParent.emit();
// update project cache
this._cache.del(uuid);
this._cache.get(uuid, this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id));
this._cache.get(uuid, this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id, false));
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
Expand All @@ -213,7 +213,7 @@ export class ProjectsListComponent implements OnInit {
this.refreshParent.emit();
// update project cache
this._cache.del(uuid);
this._cache.get(uuid, this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id));
this._cache.get(uuid, this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id, false));
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
Expand Down
2 changes: 1 addition & 1 deletion src/app/system/projects/projects.component.ts
Expand Up @@ -102,7 +102,7 @@ export class ProjectsComponent implements OnInit {
} else {

// logged-in user is system admin (or guest): show all projects
this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(response: ApiResponseData<ProjectsResponse>) => {

// reset the lists:
Expand Down
2 changes: 1 addition & 1 deletion src/app/user/membership/membership.component.ts
Expand Up @@ -86,7 +86,7 @@ export class MembershipComponent implements OnInit {

this.projects = [];
// get all projects and filter by projects where the user is already member of
this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(response: ApiResponseData<ProjectsResponse>) => {

for (const p of response.body.projects) {
Expand Down
5 changes: 2 additions & 3 deletions src/app/user/overview/overview.component.ts
Expand Up @@ -61,9 +61,8 @@ export class OverviewComponent implements OnInit {
// system admin can create new projects and edit projects
// users not logged in can only view projects
if (this.sysAdmin || !this.session) {
this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(response: ApiResponseData<ProjectsResponse>) => {

// reset the lists:
this.userProjects = [];
this.otherProjects = [];
Expand Down Expand Up @@ -100,7 +99,7 @@ export class OverviewComponent implements OnInit {
}
}

this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(projectsResponse: ApiResponseData<ProjectsResponse>) => {

// get list of all projects the user is NOT a member of
Expand Down
Expand Up @@ -225,7 +225,7 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {

ngOnChanges(): void {
// get project information
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.resource.res.attachedToProject).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(this.resource.res.attachedToProject, false).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.project = response.body.project;
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/workspace/resource/services/project.service.ts
Expand Up @@ -56,7 +56,7 @@ export class ProjectService {
})
);
} else {
return this._dspApiConnection.admin.projectsEndpoint.getProjects().pipe(
return this._dspApiConnection.admin.projectsEndpoint.getProjects(false).pipe(
map((response: ApiResponseData<ProjectsResponse>) => {
for (const project of response.body.projects) {
if (project.status && project.id !== Constants.SystemProjectIRI && project.id !== Constants.DefaultSharedOntologyIRI) {
Expand Down
Expand Up @@ -196,7 +196,7 @@ export class FulltextSearchComponent implements OnInit, OnChanges, OnDestroy {
* get all public projects from DSP-API
*/
getAllProjects(): void {
this._dspApiConnection.admin.projectsEndpoint.getProjects().subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjects(false).subscribe(
(response: ApiResponseData<ProjectsResponse>) => {
this.projects = response.body.projects;
// this.loadSystem = false;
Expand All @@ -219,7 +219,7 @@ export class FulltextSearchComponent implements OnInit, OnChanges, OnDestroy {
* @param id Project Id
*/
getProject(id: string): void {
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id).subscribe(
this._dspApiConnection.admin.projectsEndpoint.getProjectByIri(id, false).subscribe(
(project: ApiResponseData<ProjectResponse>) => {
this.setProject(project.body.project);
},
Expand Down
1 change: 1 addition & 0 deletions src/config/config.dev.json
Expand Up @@ -3,6 +3,7 @@
"apiProtocol": "http",
"apiHost": "0.0.0.0",
"apiPort": 3333,
"zioApiPort": 5555,
"apiPath": "",
"iiifProtocol": "http",
"iiifHost": "0.0.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/config/config.prod.json
Expand Up @@ -3,6 +3,7 @@
"apiProtocol": "http",
"apiHost": "0.0.0.0",
"apiPort": 3333,
"zioApiPort": 5555,
"apiPath": "",
"iiifProtocol": "http",
"iiifHost": "0.0.0.0",
Expand Down

0 comments on commit d4e2a94

Please sign in to comment.