mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[AAE-8200] - Add a way to hide personal files and configure a landing… (#2494)
* [AAE-8200] - Add a way to hide personal files and configure a landing page * Move global variable inside the function used * Rename plugin content service variable * Fix lint * Fix comments
This commit is contained in:
parent
32bb39cf9c
commit
1bc4613f2a
@ -50,7 +50,7 @@ env:
|
|||||||
- APP_CONFIG_OAUTH2_HOST=http://localhost:4200/auth/realms/alfresco
|
- APP_CONFIG_OAUTH2_HOST=http://localhost:4200/auth/realms/alfresco
|
||||||
- APP_CONFIG_OAUTH2_CLIENTID=alfresco
|
- APP_CONFIG_OAUTH2_CLIENTID=alfresco
|
||||||
- APP_CONFIG_PLUGIN_AOS=true
|
- APP_CONFIG_PLUGIN_AOS=true
|
||||||
- APP_CONFIG_CONTENT_SERVICE=true
|
- APP_CONFIG_PLUGIN_CONTENT_SERVICE=true
|
||||||
- APP_CONFIG_OAUTH2_IMPLICIT_FLOW=true
|
- APP_CONFIG_OAUTH2_IMPLICIT_FLOW=true
|
||||||
- APP_CONFIG_OAUTH2_SILENT_LOGIN=true
|
- APP_CONFIG_OAUTH2_SILENT_LOGIN=true
|
||||||
- APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=/
|
- APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=/
|
||||||
|
@ -34,7 +34,7 @@ ENV APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI="{protocol}//{hostname}{:port}/
|
|||||||
ENV APP_CONFIG_OAUTH2_REDIRECT_LOGIN="/"
|
ENV APP_CONFIG_OAUTH2_REDIRECT_LOGIN="/"
|
||||||
ENV APP_CONFIG_OAUTH2_REDIRECT_LOGOUT="/"
|
ENV APP_CONFIG_OAUTH2_REDIRECT_LOGOUT="/"
|
||||||
ENV APP_CONFIG_PLUGIN_AOS=true
|
ENV APP_CONFIG_PLUGIN_AOS=true
|
||||||
ENV APP_CONFIG_CONTENT_SERVICE=true
|
ENV APP_CONFIG_PLUGIN_CONTENT_SERVICE=true
|
||||||
|
|
||||||
COPY docker/default.conf.template /etc/nginx/templates/
|
COPY docker/default.conf.template /etc/nginx/templates/
|
||||||
COPY docker/docker-entrypoint.d/* /docker-entrypoint.d/
|
COPY docker/docker-entrypoint.d/* /docker-entrypoint.d/
|
||||||
|
@ -30,4 +30,4 @@ APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=/
|
|||||||
# CONTENT - ALFRESCO OFFICE SERVICES PLUGIN RELATED
|
# CONTENT - ALFRESCO OFFICE SERVICES PLUGIN RELATED
|
||||||
APP_CONFIG_PLUGIN_AOS=true
|
APP_CONFIG_PLUGIN_AOS=true
|
||||||
# ALFRESCO CONTENT SERVICE RELATED
|
# ALFRESCO CONTENT SERVICE RELATED
|
||||||
APP_CONFIG_CONTENT_SERVICE=true
|
APP_CONFIG_PLUGIN_CONTENT_SERVICE=true
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
"providers": "${APP_CONFIG_PROVIDER}",
|
"providers": "${APP_CONFIG_PROVIDER}",
|
||||||
"authType": "${APP_CONFIG_AUTH_TYPE}",
|
"authType": "${APP_CONFIG_AUTH_TYPE}",
|
||||||
"loginRoute": "login",
|
"loginRoute": "login",
|
||||||
"plugins":{
|
"plugins": {
|
||||||
"aosPlugin" : ${APP_CONFIG_PLUGIN_AOS},
|
"aosPlugin": ${APP_CONFIG_PLUGIN_AOS},
|
||||||
"contentService": ${APP_CONFIG_CONTENT_SERVICE}
|
"contentService": ${APP_CONFIG_PLUGIN_CONTENT_SERVICE}
|
||||||
},
|
},
|
||||||
"oauth2": {
|
"oauth2": {
|
||||||
"host": "${APP_CONFIG_OAUTH2_HOST}",
|
"host": "${APP_CONFIG_OAUTH2_HOST}",
|
||||||
|
@ -66,6 +66,7 @@ import { CreateFromTemplateDialogComponent } from './dialogs/node-template/creat
|
|||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { DetailsComponent } from './components/details/details.component';
|
import { DetailsComponent } from './components/details/details.component';
|
||||||
import { ContentUrlService } from './services/content-url.service';
|
import { ContentUrlService } from './services/content-url.service';
|
||||||
|
import { HomeComponent } from './components/home/home.component';
|
||||||
|
|
||||||
import { registerLocaleData } from '@angular/common';
|
import { registerLocaleData } from '@angular/common';
|
||||||
import localeFr from '@angular/common/locales/fr';
|
import localeFr from '@angular/common/locales/fr';
|
||||||
@ -146,7 +147,8 @@ registerLocaleData(localeSv);
|
|||||||
FavoritesComponent,
|
FavoritesComponent,
|
||||||
RecentFilesComponent,
|
RecentFilesComponent,
|
||||||
SharedFilesComponent,
|
SharedFilesComponent,
|
||||||
CreateFromTemplateDialogComponent
|
CreateFromTemplateDialogComponent,
|
||||||
|
HomeComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AppConfigService, useClass: DebugAppConfigService },
|
{ provide: AppConfigService, useClass: DebugAppConfigService },
|
||||||
|
@ -37,6 +37,7 @@ import { FavoritesComponent } from './components/favorites/favorites.component';
|
|||||||
import { RecentFilesComponent } from './components/recent-files/recent-files.component';
|
import { RecentFilesComponent } from './components/recent-files/recent-files.component';
|
||||||
import { SharedFilesComponent } from './components/shared-files/shared-files.component';
|
import { SharedFilesComponent } from './components/shared-files/shared-files.component';
|
||||||
import { DetailsComponent } from './components/details/details.component';
|
import { DetailsComponent } from './components/details/details.component';
|
||||||
|
import { HomeComponent } from './components/home/home.component';
|
||||||
|
|
||||||
export const APP_ROUTES: Routes = [
|
export const APP_ROUTES: Routes = [
|
||||||
{
|
{
|
||||||
@ -77,8 +78,7 @@ export const APP_ROUTES: Routes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
redirectTo: `/personal-files`,
|
component: HomeComponent
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'personal-files',
|
path: 'personal-files',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<adf-layout-header
|
<adf-layout-header
|
||||||
[logo]="logo$ | async"
|
[logo]="logo$ | async"
|
||||||
[redirectUrl]="'/personal-files'"
|
[redirectUrl]="landingPage"
|
||||||
[tooltip]="appName$ | async"
|
[tooltip]="appName$ | async"
|
||||||
[color]="headerColor$ | async"
|
[color]="headerColor$ | async"
|
||||||
[title]="appName$ | async"
|
[title]="appName$ | async"
|
||||||
|
@ -30,6 +30,7 @@ import { ContentActionRef } from '@alfresco/adf-extensions';
|
|||||||
import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath, getHeaderTextColor } from '@alfresco/aca-shared/store';
|
import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath, getHeaderTextColor } from '@alfresco/aca-shared/store';
|
||||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
@ -49,14 +50,16 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
|
|||||||
headerColor$: Observable<any>;
|
headerColor$: Observable<any>;
|
||||||
headerTextColor$: Observable<string>;
|
headerTextColor$: Observable<string>;
|
||||||
logo$: Observable<string>;
|
logo$: Observable<string>;
|
||||||
|
landingPage: string;
|
||||||
|
|
||||||
actions: Array<ContentActionRef> = [];
|
actions: Array<ContentActionRef> = [];
|
||||||
|
|
||||||
constructor(store: Store<AppStore>, private appExtensions: AppExtensionService) {
|
constructor(store: Store<AppStore>, private appExtensions: AppExtensionService, private appConfigService: AppConfigService) {
|
||||||
this.headerColor$ = store.select(getHeaderColor);
|
this.headerColor$ = store.select(getHeaderColor);
|
||||||
this.headerTextColor$ = store.select(getHeaderTextColor);
|
this.headerTextColor$ = store.select(getHeaderTextColor);
|
||||||
this.appName$ = store.select(getAppName);
|
this.appName$ = store.select(getAppName);
|
||||||
this.logo$ = store.select(getLogoPath);
|
this.logo$ = store.select(getLogoPath);
|
||||||
|
this.landingPage = this.appConfigService.get('landingPage', '/personal-files');
|
||||||
|
|
||||||
store.select(getHeaderImagePath).subscribe((path) => {
|
store.select(getHeaderImagePath).subscribe((path) => {
|
||||||
document.body.style.setProperty('--header-background-image', `url('${path}')`);
|
document.body.style.setProperty('--header-background-image', `url('${path}')`);
|
||||||
|
41
app/src/app/components/home/home.component.spec.ts
Normal file
41
app/src/app/components/home/home.component.spec.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { HomeComponent } from './home.component';
|
||||||
|
import { AppConfigService, AppConfigServiceMock, setupTestBed } from '@alfresco/adf-core';
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
|
describe('HomeComponent', () => {
|
||||||
|
let appConfig: AppConfigService;
|
||||||
|
let fixture: ComponentFixture<HomeComponent>;
|
||||||
|
let router: Router;
|
||||||
|
|
||||||
|
setupTestBed({
|
||||||
|
imports: [HttpClientModule, RouterTestingModule],
|
||||||
|
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(HomeComponent);
|
||||||
|
router = TestBed.inject(Router);
|
||||||
|
appConfig = TestBed.inject(AppConfigService);
|
||||||
|
appConfig.config = Object.assign(appConfig.config, {
|
||||||
|
landingPage: '/my-mock-landing-page'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should navigate to the landing page from the app config', () => {
|
||||||
|
const navigateSpy = spyOn(router, 'navigateByUrl');
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(navigateSpy).toHaveBeenCalledWith('/my-mock-landing-page');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should navigate to personal files by default when there is no landingPage defined', () => {
|
||||||
|
appConfig.config = {};
|
||||||
|
const navigateSpy = spyOn(router, 'navigateByUrl');
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(navigateSpy).toHaveBeenCalledWith('/personal-files');
|
||||||
|
});
|
||||||
|
});
|
42
app/src/app/components/home/home.component.ts
Normal file
42
app/src/app/components/home/home.component.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||||
|
*
|
||||||
|
* This file is part of the Alfresco Example Content Application.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: ''
|
||||||
|
})
|
||||||
|
export class HomeComponent implements OnInit {
|
||||||
|
readonly DEFAULT_LANDING_PAGE = '/personal-files';
|
||||||
|
|
||||||
|
constructor(private appConfig: AppConfigService, private router: Router) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
const landingPage = this.appConfig.get('landingPage', this.DEFAULT_LANDING_PAGE);
|
||||||
|
this.router.navigateByUrl(landingPage);
|
||||||
|
}
|
||||||
|
}
|
@ -233,7 +233,10 @@
|
|||||||
"icon": "folder",
|
"icon": "folder",
|
||||||
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
|
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
|
||||||
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
|
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
|
||||||
"route": "personal-files"
|
"route": "personal-files",
|
||||||
|
"rules": {
|
||||||
|
"visible": "app.isContentServiceEnabled"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "app.navbar.libraries.menu",
|
"id": "app.navbar.libraries.menu",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user