mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[AAE-8202][AAE-8203] - Add a way to hide new button actions and search bar (#2506)
This commit is contained in:
parent
1bc4613f2a
commit
c3bd24e582
@ -9,7 +9,7 @@
|
||||
>
|
||||
<div class="adf-toolbar--spacer adf-toolbar-divider"></div>
|
||||
|
||||
<aca-search-input></aca-search-input>
|
||||
<aca-search-input *ngIf="isContentServiceEnabled()"></aca-search-input>
|
||||
|
||||
<adf-toolbar-divider></adf-toolbar-divider>
|
||||
|
||||
|
@ -33,6 +33,7 @@ import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { AppSearchInputModule } from '../search/search-input.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
describe('AppHeaderComponent', () => {
|
||||
let component: AppHeaderComponent;
|
||||
@ -93,4 +94,29 @@ describe('AppHeaderComponent', () => {
|
||||
tick();
|
||||
expect(component.actions).toEqual(actions);
|
||||
}));
|
||||
|
||||
describe('Search input', () => {
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
it('should search be present when contentService is enabled', () => {
|
||||
fixture.detectChanges();
|
||||
const searchInput = fixture.debugElement.query(By.css('.aca-search-input'));
|
||||
|
||||
expect(searchInput).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should search not be present when contentService is disabled', () => {
|
||||
localStorage.setItem('contentService', 'false');
|
||||
fixture.detectChanges();
|
||||
const searchInput = fixture.debugElement.query(By.css('.aca-search-input'));
|
||||
|
||||
expect(searchInput).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -31,6 +31,7 @@ import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath,
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { isContentServiceEnabled } from '@alfresco/aca-shared/rules';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@ -79,6 +80,10 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
isContentServiceEnabled(): boolean {
|
||||
return isContentServiceEnabled();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
|
@ -143,7 +143,8 @@
|
||||
"click": "UPLOAD_FILES"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
"enabled": "app.navigation.folder.canUpload",
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -157,13 +158,17 @@
|
||||
"click": "UPLOAD_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
"enabled": "app.navigation.folder.canUpload",
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.separator.1",
|
||||
"type": "separator",
|
||||
"order": 300
|
||||
"order": 300,
|
||||
"rules": {
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.folder",
|
||||
@ -176,7 +181,8 @@
|
||||
"click": "CREATE_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canCreate"
|
||||
"enabled": "app.navigation.folder.canCreate",
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -187,12 +193,18 @@
|
||||
"icon": "create_new_folder",
|
||||
"actions": {
|
||||
"click": "CREATE_LIBRARY"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.separator.2",
|
||||
"type": "separator",
|
||||
"order": 650
|
||||
"order": 650,
|
||||
"rules": {
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.fileFromTemplate",
|
||||
@ -205,7 +217,8 @@
|
||||
"click": "FILE_FROM_TEMPLATE"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
"enabled": "app.navigation.folder.canUpload",
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -219,7 +232,8 @@
|
||||
"click": "FOLDER_FROM_TEMPLATE"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
"enabled": "app.navigation.folder.canUpload",
|
||||
"visible": "app.isContentServiceEnabled"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user