mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
add missing app instance types (#6513)
This commit is contained in:
parent
6f937a75ec
commit
c46bbaac47
@ -22,7 +22,7 @@ import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
import { AppDetailsCloudComponent } from './app-details-cloud.component';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { AppListCloudModule } from '../app-list-cloud.module';
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
import { DEFAULT_APP_INSTANCE_THEME } from '../models/application-instance.model';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('AppDetailsCloudComponent', () => {
|
||||
@ -65,7 +65,7 @@ describe('AppDetailsCloudComponent', () => {
|
||||
const theme = fixture.nativeElement.querySelector('.adf-app-listgrid-item-card').getAttribute('ng-reflect-ng-class');
|
||||
const icon = fixture.nativeElement.querySelector('.adf-app-listgrid-item-card-logo-icon');
|
||||
|
||||
expect(theme).toEqual(ApplicationInstanceModel.DEFAULT_THEME);
|
||||
expect(theme).toEqual(DEFAULT_APP_INSTANCE_THEME);
|
||||
expect(icon).toBeTruthy();
|
||||
});
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
import { ApplicationInstanceModel, DEFAULT_APP_INSTANCE_ICON, DEFAULT_APP_INSTANCE_THEME } from '../models/application-instance.model';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-app-details',
|
||||
@ -30,29 +30,21 @@ export class AppDetailsCloudComponent {
|
||||
applicationInstance: ApplicationInstanceModel;
|
||||
|
||||
@Output()
|
||||
selectedApp: EventEmitter<ApplicationInstanceModel> = new EventEmitter<ApplicationInstanceModel>();
|
||||
|
||||
constructor() {}
|
||||
selectedApp = new EventEmitter<ApplicationInstanceModel>();
|
||||
|
||||
/**
|
||||
* Pass the selected app as next
|
||||
* @param app
|
||||
*/
|
||||
public onSelectApp(app: ApplicationInstanceModel): void {
|
||||
onSelectApp(app: ApplicationInstanceModel): void {
|
||||
this.selectedApp.emit(app);
|
||||
}
|
||||
|
||||
public getTheme() {
|
||||
if ( !this.applicationInstance.theme ) {
|
||||
return ApplicationInstanceModel.DEFAULT_THEME;
|
||||
}
|
||||
return this.applicationInstance.theme;
|
||||
getTheme(): string {
|
||||
return this.applicationInstance.theme || DEFAULT_APP_INSTANCE_THEME;
|
||||
}
|
||||
|
||||
public getIcon() {
|
||||
if ( !this.applicationInstance.icon ) {
|
||||
return ApplicationInstanceModel.DEFAULT_ICON;
|
||||
}
|
||||
return this.applicationInstance.icon;
|
||||
getIcon(): string {
|
||||
return this.applicationInstance.icon || DEFAULT_APP_INSTANCE_ICON;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
|
||||
/** Emitted when an app entry is clicked. */
|
||||
@Output()
|
||||
appClick: EventEmitter<ApplicationInstanceModel> = new EventEmitter<ApplicationInstanceModel>();
|
||||
appClick = new EventEmitter<ApplicationInstanceModel>();
|
||||
|
||||
apps$: Observable<any>;
|
||||
loadingError$ = new Subject<boolean>();
|
||||
@ -104,7 +104,6 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
* Return true if the layout type is GRID
|
||||
*/
|
||||
isGrid(): boolean {
|
||||
|
||||
return this.layoutType === AppListCloudComponent.LAYOUT_GRID;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
export let fakeApplicationInstance = [
|
||||
new ApplicationInstanceModel(
|
||||
{ name: 'application-new-1', createdAt: '2018-09-21T12:31:39.000Z', status: 'Running', theme: 'theme-2', icon: 'favorite_border' }),
|
||||
new ApplicationInstanceModel(
|
||||
{ name: 'application-new-2', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending', theme: 'theme-2', icon: 'favorite_border' }),
|
||||
new ApplicationInstanceModel(
|
||||
{ name: 'application-new-3', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending' })
|
||||
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
|
||||
export const fakeApplicationInstance: ApplicationInstanceModel[] = [
|
||||
{ name: 'application-new-1', createdAt: '2018-09-21T12:31:39.000Z', status: 'Running', theme: 'theme-2', icon: 'favorite_border' },
|
||||
{ name: 'application-new-2', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending', theme: 'theme-2', icon: 'favorite_border' },
|
||||
{ name: 'application-new-3', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending' }
|
||||
];
|
||||
|
@ -15,28 +15,42 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class ApplicationInstanceModel {
|
||||
export const DEFAULT_APP_INSTANCE_THEME = 'theme-2';
|
||||
export const DEFAULT_APP_INSTANCE_ICON = 'favorite_border';
|
||||
|
||||
public static DEFAULT_THEME: string = 'theme-2';
|
||||
public static DEFAULT_ICON: string = 'favorite_border';
|
||||
|
||||
name: string;
|
||||
createdAt: any;
|
||||
status: string;
|
||||
export interface ApplicationInstanceModel {
|
||||
name?: string;
|
||||
createdAt?: any;
|
||||
status?: string;
|
||||
theme?: string;
|
||||
icon?: string;
|
||||
description?: string;
|
||||
connectors?: any;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.name = obj.name ? obj.name : null;
|
||||
this.status = obj.status ? obj.status : null;
|
||||
this.createdAt = obj.createdAt ? obj.createdAt : null;
|
||||
this.theme = obj.theme;
|
||||
this.icon = obj.icon;
|
||||
this.description = obj.description ? obj.description : null;
|
||||
this.connectors = obj.connectors ? obj.connectors : null;
|
||||
}
|
||||
}
|
||||
descriptor?: Descriptor;
|
||||
}
|
||||
|
||||
export interface Descriptor {
|
||||
name?: string;
|
||||
projectId?: string;
|
||||
releaseId?: string;
|
||||
releaseVersion?: number;
|
||||
security?: DescriptorSecurity[];
|
||||
infrastructure?: DescriptorInfrastructure;
|
||||
variables?: DescriptorVariables;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
export interface DescriptorSecurity {
|
||||
role: string;
|
||||
groups: string[];
|
||||
users: string[];
|
||||
}
|
||||
|
||||
export interface DescriptorVariables {
|
||||
[key: string]: any;
|
||||
connectors?: { [key: string]: any; };
|
||||
}
|
||||
|
||||
export interface DescriptorInfrastructure {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule }
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { AppsProcessCloudService } from './apps-process-cloud.service';
|
||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@ -56,7 +55,7 @@ describe('AppsProcessCloudService', () => {
|
||||
spyOn(appConfigService, 'get').and.returnValue([]);
|
||||
service.loadApps();
|
||||
service.getDeployedApplicationsByStatus('fake').subscribe(
|
||||
(res: ApplicationInstanceModel[]) => {
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('application-new-1');
|
||||
@ -70,7 +69,7 @@ describe('AppsProcessCloudService', () => {
|
||||
spyOn(appConfigService, 'get').and.returnValue([fakeApplicationInstance[0]]);
|
||||
service.loadApps();
|
||||
service.getDeployedApplicationsByStatus('fake').subscribe(
|
||||
(res: ApplicationInstanceModel[]) => {
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(1);
|
||||
expect(res[0]).toEqual(fakeApplicationInstance[0]);
|
||||
|
@ -71,9 +71,7 @@ export class AppsProcessCloudService {
|
||||
contentTypes, accepts))
|
||||
.pipe(
|
||||
map((applications: any) => {
|
||||
return applications.list.entries.map((application) => {
|
||||
return new ApplicationInstanceModel(application.entry);
|
||||
});
|
||||
return applications.list.entries.map((application) => application.entry);
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
|
@ -19,7 +19,6 @@ import { OnChanges, SimpleChanges, OnInit, OnDestroy, Directive, Input, Output,
|
||||
import { FilterOptions, TaskFilterAction, TaskFilterProperties } from '../../models/filter-cloud.model';
|
||||
import { TaskCloudService } from './../../../services/task-cloud.service';
|
||||
import { AppsProcessCloudService } from './../../../../app/services/apps-process-cloud.service';
|
||||
import { ApplicationInstanceModel } from './../../../../app/models/application-instance.model';
|
||||
import { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
|
||||
import moment, { Moment } from 'moment';
|
||||
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
||||
@ -219,7 +218,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
|
||||
getRunningApplications() {
|
||||
this.appsProcessCloudService
|
||||
.getDeployedApplicationsByStatus(BaseEditTaskFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
||||
.subscribe((applications) => {
|
||||
if (applications && applications.length > 0) {
|
||||
applications.map((application) => {
|
||||
this.applicationNames.push({ label: application.name, value: application.name });
|
||||
|
Loading…
x
Reference in New Issue
Block a user