+
+ /** Random RGB color code generator @public */
+ public generateColor(): string {
+ const x: number = Math.floor(Math.random() * this.colorStringLength);
+ const y: number = Math.floor(Math.random() * this.colorStringLength);
+ const z: number = Math.floor(Math.random() * this.colorStringLength);
+ return 'rgb(' + x + ',' + y + ',' + z + ')';
+ }
+
+ /** Add custom name/tag to the dropdown @public */
+ public addCustomTag(tag: string): string {
+ return tag;
+ }
+
+ /** Fetch file extension @public */
+ public fetchFileExtension(fileInfo: FileList): string {
+ return fileInfo[0].name.substring(fileInfo[0].name.lastIndexOf('.') + 1);
+ }
+
+ /** Get domain name @private */
+ public getDomainName(): Observable<TYPESECTION[]> {
+ return this.restService.getResource(environment.DOMAIN_URL).pipe(map((domains: DOMAINS): TYPESECTION[] => {
+ const domainList: TYPESECTION[] = [];
+ try {
+ let domainNames: string[] = [];
+ if (!isNullOrUndefined(domains.project_domain_name)) {
+ domainNames = domainNames.concat(domains.project_domain_name.split(','));
+ }
+ if (!isNullOrUndefined(domains.user_domain_name)) {
+ domainNames = domainNames.concat(domains.user_domain_name.split(','));
+ }
+ domainNames = Array.from(new Set(domainNames));
+ if (domainNames.length > 0) {
+ domainNames.forEach((domainName: string): void => {
+ if (!domainName.endsWith(':ro')) {
+ domainList.push({ title: domainName, value: domainName });
+ }
+ });
+ }
+ return domainList;
+ } catch (e) {
+ return domainList;
+ }
+ }));
+ }
+