mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-8366: Move CoreAutomationService to demo shell app (#9935)
This commit is contained in:
@@ -27,8 +27,6 @@ import { DataTableComponent, ShowHeaderMode } from './datatable.component';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { DataColumnListComponent } from '../../data-column/data-column-list.component';
|
||||
import { DataColumnComponent } from '../../data-column/data-column.component';
|
||||
import { domSanitizerMock } from '../../../mock/dom-sanitizer-mock';
|
||||
import { matIconRegistryMock } from '../../../mock/mat-icon-registry-mock';
|
||||
import { CdkDrag, CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { By } from '@angular/platform-browser';
|
||||
@@ -40,6 +38,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
class CustomColumnTemplateComponent {
|
||||
@ViewChild('tmplRef', { static: true }) templateRef: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-custom-column-header-component',
|
||||
template: ` <ng-template #tmplRef> CUSTOM HEADER </ng-template> `
|
||||
@@ -633,7 +632,7 @@ describe('DataTable', () => {
|
||||
});
|
||||
|
||||
it('should initialize default adapter', () => {
|
||||
const table = new DataTableComponent(null, null, matIconRegistryMock, domSanitizerMock);
|
||||
const table = TestBed.createComponent(DataTableComponent).componentInstance;
|
||||
expect(table.data).toBeUndefined();
|
||||
table.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
expect(table.data).toEqual(jasmine.any(ObjectDataTableAdapter));
|
||||
|
@@ -1,28 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class AlfrescoApiMock {
|
||||
login() {
|
||||
return Promise.resolve('TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
|
||||
}
|
||||
|
||||
logout() {
|
||||
return Promise.resolve('logout');
|
||||
}
|
||||
|
||||
changeConfig() {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
export const domSanitizerMock = {
|
||||
bypassSecurityTrustResourceUrl: () => {}
|
||||
} as any as DomSanitizer;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
|
||||
export const matIconRegistryMock = {
|
||||
addSvgIconInNamespace: () => {}
|
||||
} as any as MatIconRegistry;
|
@@ -15,7 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './alfresco-api.mock';
|
||||
export * from './cookie.service.mock';
|
||||
export * from './event.mock';
|
||||
export * from './translation.service.mock';
|
||||
@@ -25,7 +24,6 @@ export * from './form/form.component.mock';
|
||||
export * from './form/form-definition.mock';
|
||||
export * from './form/form-definition-readonly.mock';
|
||||
export * from './form/form-definition-visibility.mock';
|
||||
export * from './form/start-form.component.mock';
|
||||
export * from './form/form.service.mock';
|
||||
export * from './form/widget-visibility.service.mock';
|
||||
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const userAccessMock = {
|
||||
globalAccess: {
|
||||
roles: [
|
||||
'MOCK_GLOBAL_USER_ROLE'
|
||||
]
|
||||
},
|
||||
applicationAccess: [
|
||||
{
|
||||
name: 'mockApp1',
|
||||
roles: [
|
||||
'MOCK_USER_ROLE_APP_1'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'mockApp2',
|
||||
roles: [
|
||||
'MOCK_USER_ROLE_APP_2'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'mockApp3',
|
||||
roles: [
|
||||
'MOCK_USER_ROLE_APP_3',
|
||||
'MOCK_ADMIN_ROLE_APP_3'
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
@@ -1,84 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { DemoForm } from '../mock/form/demo-form.mock';
|
||||
import { AuthenticationService } from '../auth/services/authentication.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CoreAutomationService {
|
||||
|
||||
public forms = new DemoForm();
|
||||
|
||||
constructor(
|
||||
private appConfigService: AppConfigService,
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private userPreferencesService: UserPreferencesService,
|
||||
private storageService: StorageService,
|
||||
private auth: AuthenticationService
|
||||
) {
|
||||
}
|
||||
|
||||
setup() {
|
||||
const adfProxy = window['adf'] || {};
|
||||
|
||||
adfProxy.getConfigField = (field: string): any => this.appConfigService.get(field);
|
||||
|
||||
adfProxy.setConfigField = (field: string, value: string) => {
|
||||
this.appConfigService.config[field] = JSON.parse(value);
|
||||
};
|
||||
|
||||
adfProxy.setStorageItem = (key: string, data: string) => {
|
||||
this.storageService.setItem(key, data);
|
||||
};
|
||||
|
||||
adfProxy.removeStorageItem = (key: string) => {
|
||||
this.storageService.removeItem(key);
|
||||
};
|
||||
|
||||
adfProxy.getStorageItem = (key: string): string => this.storageService.getItem(key);
|
||||
|
||||
adfProxy.setUserPreference = (key: string, data: any) => {
|
||||
this.userPreferencesService.set(key, data);
|
||||
};
|
||||
|
||||
adfProxy.setFormInEditor = (json: string) => {
|
||||
this.forms.formDefinition = JSON.parse(json);
|
||||
};
|
||||
|
||||
adfProxy.setCloudFormInEditor = (json: string) => {
|
||||
this.forms.cloudFormDefinition = JSON.parse(json);
|
||||
};
|
||||
|
||||
adfProxy.clearStorage = () => {
|
||||
this.storageService.clear();
|
||||
};
|
||||
|
||||
adfProxy.apiReset = () => {
|
||||
this.alfrescoApiService.reset();
|
||||
this.auth.reset();
|
||||
};
|
||||
|
||||
window['adf'] = adfProxy;
|
||||
}
|
||||
}
|
@@ -17,4 +17,3 @@
|
||||
|
||||
export * from './setup-test-bed';
|
||||
export * from './core.testing.module';
|
||||
export * from './automation.service';
|
||||
|
Reference in New Issue
Block a user