Silviu Popa d28c8dccc8 [ADF-3920] Process Service Cloud render card with default theme and i… (#4219)
* [ADF-3920] Process Service Cloud render card with default theme and icon if missing

* [ADF-3920] Process Service Cloud card rendering with default theme and icon

* [ADF-3920] - Remove import from index in spec file

* Fix unit tests

* [ADF-3920] - add complete name on unit test

* [ADF-3920] - add unit test to verify input object for app-details-cloud
2019-02-01 13:37:58 +00:00

59 lines
1.6 KiB
TypeScript

/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* 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 { Component, Input, Output, EventEmitter } from '@angular/core';
import { ApplicationInstanceModel } from '../models/application-instance.model';
@Component({
selector: 'adf-cloud-app-details',
templateUrl: './app-details-cloud.component.html',
styleUrls: ['./app-details-cloud.component.scss']
})
export class AppDetailsCloudComponent {
@Input()
applicationInstance: ApplicationInstanceModel;
@Output()
selectedApp: EventEmitter<ApplicationInstanceModel> = new EventEmitter<ApplicationInstanceModel>();
constructor() {}
/**
* Pass the selected app as next
* @param app
*/
public onSelectApp(app: ApplicationInstanceModel): void {
this.selectedApp.emit(app);
}
public getTheme() {
if ( !this.applicationInstance.theme ) {
return ApplicationInstanceModel.DEFAULT_THEME;
}
return this.applicationInstance.theme;
}
public getIcon() {
if ( !this.applicationInstance.icon ) {
return ApplicationInstanceModel.DEFAULT_ICON;
}
return this.applicationInstance.icon;
}
}