mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[MIGRATION] - Solving a funny comment issue part 2
This commit is contained in:
@@ -133,7 +133,7 @@ describe('NodeRestoreDirective', () => {
|
|||||||
|
|
||||||
describe('notification', () => {
|
describe('notification', () => {
|
||||||
it('should notify on multiple fails', (done) => {
|
it('should notify on multiple fails', (done) => {
|
||||||
const error = { message: '{ "error": { /* empty */ } }' };
|
const error = { message: '{ "error": { } }' };
|
||||||
|
|
||||||
directiveInstance.restore.subscribe((event: any) => {
|
directiveInstance.restore.subscribe((event: any) => {
|
||||||
expect(event.message).toEqual('CORE.RESTORE_NODE.PARTIAL_PLURAL');
|
expect(event.message).toEqual('CORE.RESTORE_NODE.PARTIAL_PLURAL');
|
||||||
|
@@ -176,7 +176,9 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
@ViewChild('tagNameInput')
|
@ViewChild('tagNameInput')
|
||||||
private tagNameInputElement: ElementRef;
|
private tagNameInputElement: ElementRef;
|
||||||
|
|
||||||
constructor(private tagService: TagService, private notificationService: NotificationService) { /* empty */ }
|
constructor(private tagService: TagService, private notificationService: NotificationService) {
|
||||||
|
/* empty */
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.tagNameControl.valueChanges
|
this.tagNameControl.valueChanges
|
||||||
@@ -374,7 +376,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private validateSpecialCharacters(tagNameControl: FormControl<string>): TagNameControlErrors | null {
|
private validateSpecialCharacters(tagNameControl: FormControl<string>): TagNameControlErrors | null {
|
||||||
const specialSymbolsRegex = /[{ /* empty */ }()^':"\\|<>/?]/;
|
const specialSymbolsRegex = /[{}()^':"\\|<>/?]/;
|
||||||
return tagNameControl.value.length && specialSymbolsRegex.test(tagNameControl.value) ? { specialCharacters: true } : null;
|
return tagNameControl.value.length && specialSymbolsRegex.test(tagNameControl.value) ? { specialCharacters: true } : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,8 +32,12 @@ import { StorageService } from '@alfresco/adf-core';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StorageFeaturesService implements IFeaturesService, IWritableFeaturesService {
|
export class StorageFeaturesService implements IFeaturesService, IWritableFeaturesService {
|
||||||
private currentFlagState: WritableFlagChangeset = { /* empty */ };
|
private currentFlagState: WritableFlagChangeset = {
|
||||||
private flags = new BehaviorSubject<WritableFlagChangeset>({ /* empty */ });
|
/* empty */
|
||||||
|
};
|
||||||
|
private flags = new BehaviorSubject<WritableFlagChangeset>({
|
||||||
|
/* empty */
|
||||||
|
});
|
||||||
private flags$ = this.flags.asObservable();
|
private flags$ = this.flags.asObservable();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -51,7 +55,7 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(): Observable<WritableFlagChangeset> {
|
init(): Observable<WritableFlagChangeset> {
|
||||||
const storedFlags = JSON.parse(this.storageService.getItem(this.storageKey) || '{ /* empty */ }');
|
const storedFlags = JSON.parse(this.storageService.getItem(this.storageKey) || '{}');
|
||||||
const initialFlagChangeSet = FlagSetParser.deserialize(storedFlags);
|
const initialFlagChangeSet = FlagSetParser.deserialize(storedFlags);
|
||||||
this.flags.next(initialFlagChangeSet);
|
this.flags.next(initialFlagChangeSet);
|
||||||
return of(initialFlagChangeSet);
|
return of(initialFlagChangeSet);
|
||||||
@@ -70,11 +74,17 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur
|
|||||||
}
|
}
|
||||||
|
|
||||||
setFlag(key: string, value: any): void {
|
setFlag(key: string, value: any): void {
|
||||||
let fictive = { /* empty */ };
|
let fictive = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
if (!this.currentFlagState[key]) {
|
if (!this.currentFlagState[key]) {
|
||||||
fictive = { fictive: true };
|
fictive = { fictive: true };
|
||||||
} else {
|
} else {
|
||||||
fictive = this.currentFlagState[key]?.fictive ? { fictive: true } : { /* empty */ };
|
fictive = this.currentFlagState[key]?.fictive
|
||||||
|
? { fictive: true }
|
||||||
|
: {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.flags.next({
|
this.flags.next({
|
||||||
@@ -104,22 +114,29 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur
|
|||||||
fictive: true
|
fictive: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
{ /* empty */ }
|
{
|
||||||
|
/* empty */
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeFlags(flags: FlagChangeset): void {
|
mergeFlags(flags: FlagChangeset): void {
|
||||||
const mergedFlags: WritableFlagChangeset = Object.keys(flags).reduce((acc, key) => {
|
const mergedFlags: WritableFlagChangeset = Object.keys(flags).reduce(
|
||||||
const current = this.currentFlagState[key]?.current;
|
(acc, key) => {
|
||||||
return {
|
const current = this.currentFlagState[key]?.current;
|
||||||
...acc,
|
return {
|
||||||
[key]: {
|
...acc,
|
||||||
current: current ?? flags[key].current,
|
[key]: {
|
||||||
previous: current ?? null
|
current: current ?? flags[key].current,
|
||||||
}
|
previous: current ?? null
|
||||||
};
|
}
|
||||||
}, { /* empty */ });
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/* empty */
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Object.keys(this.currentFlagState)
|
Object.keys(this.currentFlagState)
|
||||||
.filter((key) => !flags[key])
|
.filter((key) => !flags[key])
|
||||||
|
@@ -22,7 +22,6 @@ import { Logger } from '../../utils/logger';
|
|||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
export class GroupIdentityService {
|
export class GroupIdentityService {
|
||||||
|
|
||||||
api: ApiService;
|
api: ApiService;
|
||||||
|
|
||||||
constructor(api: ApiService) {
|
constructor(api: ApiService) {
|
||||||
@@ -42,7 +41,9 @@ export class GroupIdentityService {
|
|||||||
async createGroup(groupName: string): Promise<any> {
|
async createGroup(groupName: string): Promise<any> {
|
||||||
const path = '/groups';
|
const path = '/groups';
|
||||||
const method = 'POST';
|
const method = 'POST';
|
||||||
const queryParams = { /* empty */ };
|
const queryParams = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
const postBody = {
|
const postBody = {
|
||||||
name: `${groupName}-${browser.params.groupSuffix}`
|
name: `${groupName}-${browser.params.groupSuffix}`
|
||||||
};
|
};
|
||||||
@@ -53,8 +54,12 @@ export class GroupIdentityService {
|
|||||||
async deleteGroup(groupId: string): Promise<any> {
|
async deleteGroup(groupId: string): Promise<any> {
|
||||||
const path = `/groups/${groupId}`;
|
const path = `/groups/${groupId}`;
|
||||||
const method = 'DELETE';
|
const method = 'DELETE';
|
||||||
const queryParams = { /* empty */ };
|
const queryParams = {
|
||||||
const postBody = { /* empty */ };
|
/* empty */
|
||||||
|
};
|
||||||
|
const postBody = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -69,15 +74,18 @@ export class GroupIdentityService {
|
|||||||
const path = `/groups`;
|
const path = `/groups`;
|
||||||
const method = 'GET';
|
const method = 'GET';
|
||||||
const queryParams = { search: groupName };
|
const queryParams = { search: groupName };
|
||||||
const postBody = { /* empty */ };
|
const postBody = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
|
|
||||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||||
|
|
||||||
Logger.log(`Data ${JSON.stringify(data)}`);
|
Logger.log(`Data ${JSON.stringify(data)}`);
|
||||||
|
|
||||||
return data[0]; Logger.error('Group not found');
|
return data[0];
|
||||||
|
Logger.error('Group not found');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
/* ignore */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,7 +97,9 @@ export class GroupIdentityService {
|
|||||||
|
|
||||||
const path = `/groups/${groupId}/role-mappings/realm`;
|
const path = `/groups/${groupId}/role-mappings/realm`;
|
||||||
const method = 'POST';
|
const method = 'POST';
|
||||||
const queryParams = { /* empty */ };
|
const queryParams = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
const postBody = [{ id: roleId, name: roleName }];
|
const postBody = [{ id: roleId, name: roleName }];
|
||||||
|
|
||||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||||
@@ -107,7 +117,9 @@ export class GroupIdentityService {
|
|||||||
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
|
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
|
||||||
const path = `/groups/${groupId}/role-mappings/clients/${clientId}`;
|
const path = `/groups/${groupId}/role-mappings/clients/${clientId}`;
|
||||||
const method = 'POST';
|
const method = 'POST';
|
||||||
const queryParams = { /* empty */ };
|
const queryParams = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
const postBody = [
|
const postBody = [
|
||||||
{
|
{
|
||||||
id: roleId,
|
id: roleId,
|
||||||
@@ -130,10 +142,11 @@ export class GroupIdentityService {
|
|||||||
const path = `/clients`;
|
const path = `/clients`;
|
||||||
const method = 'GET';
|
const method = 'GET';
|
||||||
const queryParams = { clientId: applicationName };
|
const queryParams = { clientId: applicationName };
|
||||||
const postBody = { /* empty */ };
|
const postBody = {
|
||||||
|
/* empty */
|
||||||
|
};
|
||||||
|
|
||||||
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||||
return data[0].id;
|
return data[0].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,7 @@ export class LoginPage {
|
|||||||
try {
|
try {
|
||||||
currentUrl = await browser.getCurrentUrl();
|
currentUrl = await browser.getCurrentUrl();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
/* empty */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentUrl || currentUrl.indexOf(this.loginUrl) === -1) {
|
if (!currentUrl || currentUrl.indexOf(this.loginUrl) === -1) {
|
||||||
@@ -87,7 +88,7 @@ export class LoginPage {
|
|||||||
if (oauth2 && oauth2.silentLogin === false) {
|
if (oauth2 && oauth2.silentLogin === false) {
|
||||||
Logger.log(`Login SSO`);
|
Logger.log(`Login SSO`);
|
||||||
await this.clickOnSSOButton();
|
await this.clickOnSSOButton();
|
||||||
}else{
|
} else {
|
||||||
Logger.log(`Login SSO silent login`);
|
Logger.log(`Login SSO silent login`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user