Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate knora-api-js-lib #215

Merged
merged 63 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
acf1d2f
chore: First steps to use knora-api-js-lib and new core module
kilchenmann Nov 3, 2019
8a9482b
chore(landing page): Update knora app title
kilchenmann Nov 3, 2019
c166f69
Revert "chore(landing page): Update knora app title"
kilchenmann Nov 3, 2019
301b8f1
refactor(main): Update app title
kilchenmann Nov 3, 2019
76d9a2a
chore(main): New method to get projecs
kilchenmann Nov 3, 2019
064b7fb
fix(help): Get knora version with new config
kilchenmann Nov 3, 2019
b7adec0
chore(project): New method to get projec
kilchenmann Nov 3, 2019
7e43394
chore(project): New method to get project
kilchenmann Nov 3, 2019
4caf6ab
refactor(project): Clean up
kilchenmann Nov 3, 2019
ea2165f
feat(header): Login / logout
kilchenmann Nov 3, 2019
7732a9a
refactor: Clean up @knora/api imports
kilchenmann Nov 4, 2019
a9067bc
chore(user): Update user status
kilchenmann Nov 5, 2019
bd6bb84
chore: More on knora-api-js-lib integration
kilchenmann Nov 7, 2019
131ac76
chore: More on knora-api-js-lib integration
kilchenmann Nov 7, 2019
eba263f
chore: Update config
kilchenmann Nov 8, 2019
f6d60c1
chore: More on knora-api-js-lib integration
kilchenmann Nov 8, 2019
cfe0a74
chore: More on knora-api-js-lib integration
kilchenmann Nov 8, 2019
004a2c6
chore: More on knora-api-js-lib integration
kilchenmann Nov 8, 2019
0ed96cb
refactor: Response instead of result
kilchenmann Nov 8, 2019
a0a596c
refactor: Clean up imports
kilchenmann Nov 8, 2019
3fa119b
test: Refactor test settings
kilchenmann Nov 8, 2019
040715c
test: Refactor test settings
kilchenmann Nov 8, 2019
0b6e954
chore: Using latest knora-ui/core module
kilchenmann Nov 9, 2019
bfb5e67
chore: Using latest knora-ui/core module
kilchenmann Nov 9, 2019
8d9eda2
chore: Project form
kilchenmann Nov 9, 2019
8d3a5b6
refactor: Delete unused session validation
kilchenmann Nov 12, 2019
e40608b
test: Update travis config
kilchenmann Nov 12, 2019
aeed5d3
test: Update travis config
kilchenmann Nov 12, 2019
204cd94
test: Update travis config
kilchenmann Nov 12, 2019
ee4c0fc
test: Try to fix test
kilchenmann Nov 12, 2019
7f05152
style(user): No margin in tab
kilchenmann Nov 15, 2019
d47f2ec
fix: Make service method angular conform
kilchenmann Nov 15, 2019
815e143
chore: Set title with "Knora App"
kilchenmann Nov 15, 2019
a287d8b
fix: Update project (hack)
kilchenmann Nov 15, 2019
ca44410
fix: Update project (hack)
kilchenmann Nov 15, 2019
447a502
fix: Session validation
kilchenmann Nov 15, 2019
153158d
refactor(user): Remove console.log
kilchenmann Nov 15, 2019
a1ed7ce
refactor: Remove @knora/authentication
kilchenmann Nov 15, 2019
a8dd1c0
chore(admin): Try to create or edit user and project
kilchenmann Nov 18, 2019
70892ff
fix(user): Create / update user
kilchenmann Nov 19, 2019
b43d427
fix: Using @knora/api wip/100-optional-properties
kilchenmann Nov 19, 2019
8f9bc8f
fix: Project form to edit / create projects
kilchenmann Nov 19, 2019
9aa68e7
fix: Project form to edit / create projects
kilchenmann Nov 19, 2019
8c30b90
test: Update travis and circleci config
kilchenmann Nov 19, 2019
bdc6fd7
test: Fix some tests
kilchenmann Nov 19, 2019
9b62f17
refactor: Clean up code
kilchenmann Nov 25, 2019
ca7ceb7
style: Fix header style issue on mobile device
kilchenmann Nov 25, 2019
1453b6a
chore(workspace): Show res toolbar
kilchenmann Nov 29, 2019
336d805
Merge branch 'master' into wip/integrate-knora-api-js-lib
kilchenmann Dec 5, 2019
19b4591
docs: Update README and config
kilchenmann Dec 6, 2019
f9e3f23
test: Improve tests
kilchenmann Dec 6, 2019
c2a21f3
style(search): Style fix for FF
kilchenmann Dec 6, 2019
c367f88
feat: Project admin is able to add existing users
kilchenmann Dec 6, 2019
db2aa35
fix: Disable project admin to create system admin
kilchenmann Dec 6, 2019
636d86f
chore: Fix new @knora/core implementation
kilchenmann Dec 9, 2019
ef47f0a
fix: Bug fix in user profile
kilchenmann Dec 9, 2019
0b98f89
feat: Show sysAdmin info on user profile
kilchenmann Dec 9, 2019
f80dc10
test: Fix tests
kilchenmann Dec 10, 2019
c7adb5a
feat: Show own project admin status in list of projects
kilchenmann Dec 10, 2019
77ba029
fix: Bug fix after deactivate own account
kilchenmann Dec 10, 2019
d8b4759
chore: Update footer
kilchenmann Dec 10, 2019
767d7b0
test: Fix broken tests
kilchenmann Dec 10, 2019
25c2c2d
fix: Fix typo error
kilchenmann Dec 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ jobs:
working_directory: ~/repo

steps:
- run: sudo npm install yalc -g
- run: cd ~ && git clone -b master https://github.com/dasch-swiss/knora-api-js-lib.git && cd knora-api-js-lib && npm install && npm run yalc-publish
- run: cd ~ && git clone -b api-js-lib/develop https://github.com/dasch-swiss/knora-ui.git && cd knora-ui && yalc add @knora/api && yarn install && yarn build-and-publish-prod
- run: cd ~/repo
- checkout

# Download and cache dependencies
Expand All @@ -21,6 +25,7 @@ jobs:
&& yarn --version \
&& git --version

- run: yarn yalc-add-modules
- run: yarn install

- save_cache:
Expand Down
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ cache:
addons:
chrome: stable

install: yarn install --prod=false
install:
  - yarn global add @angular/cli
  - yarn global add yalc
- cd ~ && git clone -b master https://github.com/dasch-swiss/knora-api-js-lib.git && cd knora-api-js-lib && npm install && npm run yalc-publish
- cd ~ && git clone -b api-js-lib/develop https://github.com/dasch-swiss/knora-ui.git && cd knora-ui && yalc add @knora/api && yarn install && yarn build-and-publish-prod
- cd $TRAVIS_BUILD_DIR

script:
- yarn yalc-add-modules
- yarn test-ci
- docker build .
- docker build .
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Knora app

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ddfe61cdc2a14c3b89e34d2f49cd64fa)](https://www.codacy.com/manual/dasch-swiss/Knora-app?utm_source=github.com&utm_medium=referral&utm_content=dasch-swiss/knora-app&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ddfe61cdc2a14c3b89e34d2f49cd64fa)](https://www.codacy.com/manual/dasch-swiss/Knora-app?utm_source=github.com&utm_medium=referral&utm_content=dasch-swiss/knora-app&utm_campaign=Badge_Grade)
[![Build Status](https://travis-ci.com/dasch-swiss/knora-app.svg?branch=master)](https://travis-ci.com/dasch-swiss/knora-app)
[![CircleCI](https://circleci.com/gh/dasch-swiss/knora-app.svg?style=svg)](https://circleci.com/gh/dasch-swiss/knora-app)

Expand All @@ -12,14 +12,13 @@ It's a system for annotation and linkage of sources in arts and humanities.
This project was generated with
[Angular CLI](https://github.com/angular/angular-cli) version 8.0.6 and [Node](https://nodejs.org/en/) version 10.13.0.

**Required version of Knora: ^[9.0.0](https://github.com/dhlab-basel/Knora/releases/tag/v9.0.0)**
**Required version of Knora: ^[10.0.0](https://github.com/dhlab-basel/Knora/releases/tag/v10.0.0)**

Developed by the [DaSCH Team](https://dasch.swiss) in Basel.


## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app
Run `ng serve` for a dev server. Navigate to `http://0.0.0.0:4200/`. The app
will automatically reload if you change any of the source files.

## Code scaffolding
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"e2e": "ng e2e",
"build-prod": "ng build --prod --build-optimizer",
"test-ci": "ng test --watch=false --browsers=ChromeHeadless",
"yalc-add-modules": "rm -rf .yalc/@knora && yalc add @knora/action && yalc add @knora/authentication && yalc add @knora/core && yalc add @knora/search && yalc add @knora/viewer && yarn install --prod=false"
"yalc-add-modules": "rm -rf .yalc/@knora && yalc add @knora/api && yalc add @knora/action && yalc add @knora/core && yalc add @knora/search && yalc add @knora/viewer && yarn install --prod=false"
},
"private": true,
"dependencies": {
Expand All @@ -30,11 +30,11 @@
"@angular/platform-browser": "~8.2.7",
"@angular/platform-browser-dynamic": "~8.2.7",
"@angular/router": "~8.2.7",
"@knora/action": "9.4.0",
"@knora/authentication": "9.4.0",
"@knora/core": "9.4.0",
"@knora/search": "9.4.0",
"@knora/viewer": "9.4.0",
"@knora/action": "file:.yalc/@knora/action",
"@knora/api": "file:.yalc/@knora/api",
"@knora/core": "file:.yalc/@knora/core",
"@knora/search": "file:.yalc/@knora/search",
"@knora/viewer": "file:.yalc/@knora/viewer",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"core-js": "^2.5.4",
Expand Down
9 changes: 1 addition & 8 deletions src/app/app-global.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { MenuItem } from './main/declarations/menu-item';
import { StringLiteral } from '@knora/core';
import { StringLiteral } from '@knora/api';

export class AppGlobal {

// iri base url TODO: should we move this base to the KnoraConstants in knora-ui core?
public static iriBase: string = 'http://rdfh.ch/';
public static iriProjectsBase: string = AppGlobal.iriBase + 'projects/';
public static iriUsersBase: string = AppGlobal.iriBase + 'users/';
public static iriListsBase: string = AppGlobal.iriBase + 'lists/';


// project navigation
public static projectNav: MenuItem[] = [
{
Expand Down
106 changes: 70 additions & 36 deletions src/app/app-init.service.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,87 @@
import { Injectable } from '@angular/core';
import { KuiCoreConfig } from '@knora/core';


export interface IAppConfig {

env: {
name: string;
};
ontologyIRI: string;
apiURL: string;
externalApiURL: string;
iiifURL: string;
appURL: string;
appName: string;
localData: string;
pagingLimit: number;
startComponent: string;
}
import { KnoraApiConfig, KnoraApiConnection } from '@knora/api';
import { KuiConfig } from '@knora/core';

@Injectable()
export class AppInitService {

static settings: IAppConfig;
static coreConfig: KuiCoreConfig;
static knoraApiConnection: KnoraApiConnection;

constructor() {
}
static knoraApiConfig: KnoraApiConfig;

static kuiConfig: KuiConfig;

Init() {
constructor() { }

init() {

return new Promise<void>((resolve, reject) => {
// console.log('AppInitService.init() called');
// do your initialisation stuff here

const data = <IAppConfig>window['tempConfigStorage'];
// console.log('AppInitService: json', data);
AppInitService.settings = data;
// init knora-ui configuration
AppInitService.kuiConfig = window['tempConfigStorage'] as KuiConfig;

AppInitService.coreConfig = <KuiCoreConfig>{
name: AppInitService.settings.appName,
api: AppInitService.settings.apiURL,
media: AppInitService.settings.iiifURL,
app: AppInitService.settings.appURL,
ontologyIRI: AppInitService.settings.ontologyIRI
};
// init knora-api configuration
AppInitService.knoraApiConfig = new KnoraApiConfig(
AppInitService.kuiConfig.knora.apiProtocol,
AppInitService.kuiConfig.knora.apiHost,
AppInitService.kuiConfig.knora.apiPort
);

// console.log('AppInitService: finished');
// set knora-api connection configuration
AppInitService.knoraApiConnection = new KnoraApiConnection(AppInitService.knoraApiConfig);

resolve();
});
}
}



// import { Injectable } from '@angular/core';
// import { KnoraApiConfig, KnoraApiConnection } from '@knora/api';
// import { KuiConfig } from '@knora/core';

// @Injectable()
// export class AppInitService {

// // we cannot make readonly properties because we assign them later, so make properties that are only accessible in this class!
// private _knoraApiConnection: KnoraApiConnection;
// get knoraApiConnection(): KnoraApiConnection {
// return this._knoraApiConnection;
// }

// private _knoraApiConfig: KnoraApiConfig;
// get knoraApiConfig(): KnoraApiConfig {
// return this._knoraApiConfig;
// }

// private _kuiConfig: KuiConfig;
// get kuiConfig(): KuiConfig {
// return this._kuiConfig;
// }

// constructor() { }

// // small i, TypeScript convention
// init() {

// return new Promise<void>((resolve, reject) => {

// // init knora-ui configuration
// this._kuiConfig = window['tempConfigStorage'] as KuiConfig;
// // consider the use of json2typescript here, it can throw errors for you if there is a config issue

// // init knora-api configuration
// this._knoraApiConfig = new KnoraApiConfig(
// this._kuiConfig.knora.apiProtocol,
// this._kuiConfig.knora.apiHost,
// this._kuiConfig.knora.apiPort
// );

// // set knora-api connection configuration
// this._knoraApiConnection = new KnoraApiConnection(this._knoraApiConfig);

// resolve();
// });
// }
// }
19 changes: 12 additions & 7 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from '@knora/authentication';

import { AuthGuard } from './main/guard/auth.guard';
import { ErrorComponent } from './main/error/error.component';
import { LoginComponent } from './main/login/login.component';
import { MainComponent } from './main/main.component';
import { HelpComponent } from './main/help/help.component';
import { CookiePolicyComponent } from './main/cookie-policy/cookie-policy.component';

// project
import { BoardComponent } from './project/board/board.component';
import { CollaborationComponent } from './project/collaboration/collaboration.component';
import { OntologyComponent } from './project/ontology/ontology.component';
import { ProjectComponent } from './project/project.component';
import { PermissionComponent } from './project/permission/permission.component';
import { ListComponent } from './project/list/list.component';

// user
import { ProfileComponent } from './user/profile/profile.component';
import { UserComponent } from './user/user.component';
Expand All @@ -19,18 +25,17 @@ import { DashboardComponent } from './user/dashboard/dashboard.component';
import { AdvancedSearchComponent } from './workspace/search/advanced-search/advanced-search.component';
import { ExpertSearchComponent } from './workspace/search/expert-search/expert-search.component';
import { ResultsComponent } from './workspace/results/results.component';
import { ResourceComponent } from './workspace/resource/resource.component';

import { DesignQuestionComponent } from './dev/design-question/design-question.component';
// system
import { SystemComponent } from './system/system.component';
import { ProjectsComponent } from './system/projects/projects.component';
import { UsersComponent } from './system/users/users.component';
import { StatusComponent } from './system/status/status.component';
import { ResourceComponent } from './workspace/resource/resource.component';
import { CookiePolicyComponent } from './main/cookie-policy/cookie-policy.component';
import { GroupsComponent } from './system/groups/groups.component';
import { PermissionComponent } from './project/permission/permission.component';
import { ListComponent } from './project/list/list.component';
import { HelpComponent } from './main/help/help.component';

// developer
import { DesignQuestionComponent } from './dev/design-question/design-question.component';

const routes: Routes = [
{
Expand Down
15 changes: 12 additions & 3 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar';
import { RouterTestingModule } from '@angular/router/testing';
import { KuiActionModule } from '@knora/action';
import { KuiCoreConfig, KuiCoreConfigToken } from '@knora/core';
import { KnoraApiConnection } from '@knora/api';
import { KnoraApiConfigToken, KnoraApiConnectionToken } from '@knora/core';
import { KuiSearchModule } from '@knora/search';
import { TranslateModule } from '@ngx-translate/core';
import { TestConfig } from 'test.config';
import { AppInitService } from './app-init.service';
import { AppComponent } from './app.component';
import { HeaderComponent } from './main/header/header.component';
import { SelectLanguageComponent } from './main/select-language/select-language.component';
import { UserMenuComponent } from './user/user-menu/user-menu.component';

describe('AppComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
Expand All @@ -35,9 +39,14 @@ describe('AppComponent', () => {
TranslateModule.forRoot()
],
providers: [
AppInitService,
{
provide: KnoraApiConfigToken,
useValue: TestConfig.ApiConfig
},
{
provide: KuiCoreConfigToken,
useValue: KuiCoreConfig
provide: KnoraApiConnectionToken,
useValue: new KnoraApiConnection(TestConfig.ApiConfig)
}
]
}).compileComponents();
Expand Down
8 changes: 3 additions & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { AuthenticationService } from '@knora/authentication';

@Component({
selector: 'app-root',
Expand All @@ -11,13 +10,12 @@ export class AppComponent implements OnInit {

session: boolean = false;

constructor (private _titleService: Title,
private _auth: AuthenticationService) {
constructor(
private _titleService: Title) {

// set the page title
this._titleService.setTitle('Knora User Interface | Research Layer');
this._titleService.setTitle('Knora App | DaSCH\'s generic user interface');

this.session = this._auth.session();
}

ngOnInit() {
Expand Down
20 changes: 13 additions & 7 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { KuiActionModule } from '@knora/action';
import { KuiAuthenticationModule, JwtInterceptor, WithCredentialsInterceptor } from '@knora/authentication';
import { KuiCoreConfigToken, KuiCoreModule } from '@knora/core';
import { KuiCoreModule, KuiConfigToken, KnoraApiConfigToken, KnoraApiConnectionToken } from '@knora/core';
import { KuiSearchModule } from '@knora/search';
import { KuiViewerModule } from '@knora/viewer';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
Expand Down Expand Up @@ -79,7 +78,7 @@ export function HttpLoaderFactory(httpClient: HttpClient) {

export function initializeApp(appInitService: AppInitService) {
return (): Promise<any> => {
return appInitService.Init();
return appInitService.init();
};
}

Expand Down Expand Up @@ -150,7 +149,6 @@ export function initializeApp(appInitService: AppInitService) {
FlexLayoutModule,
HttpClientModule,
KuiActionModule,
KuiAuthenticationModule,
KuiCoreModule,
KuiSearchModule,
KuiViewerModule,
Expand All @@ -175,8 +173,16 @@ export function initializeApp(appInitService: AppInitService) {
multi: true
},
{
provide: KuiCoreConfigToken,
useFactory: () => AppInitService.coreConfig
provide: KuiConfigToken,
useFactory: () => AppInitService.kuiConfig
},
{
provide: KnoraApiConfigToken,
useFactory: () => AppInitService.knoraApiConfig
},
{
provide: KnoraApiConnectionToken,
useFactory: () => AppInitService.knoraApiConnection
}
],
bootstrap: [AppComponent]
Expand Down
Loading