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 { AppDetailsCloudComponent } from './app-details-cloud.component';
|
||||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||||
import { AppListCloudModule } from '../app-list-cloud.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';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('AppDetailsCloudComponent', () => {
|
describe('AppDetailsCloudComponent', () => {
|
||||||
@ -65,7 +65,7 @@ describe('AppDetailsCloudComponent', () => {
|
|||||||
const theme = fixture.nativeElement.querySelector('.adf-app-listgrid-item-card').getAttribute('ng-reflect-ng-class');
|
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');
|
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();
|
expect(icon).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
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({
|
@Component({
|
||||||
selector: 'adf-cloud-app-details',
|
selector: 'adf-cloud-app-details',
|
||||||
@ -30,29 +30,21 @@ export class AppDetailsCloudComponent {
|
|||||||
applicationInstance: ApplicationInstanceModel;
|
applicationInstance: ApplicationInstanceModel;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
selectedApp: EventEmitter<ApplicationInstanceModel> = new EventEmitter<ApplicationInstanceModel>();
|
selectedApp = new EventEmitter<ApplicationInstanceModel>();
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass the selected app as next
|
* Pass the selected app as next
|
||||||
* @param app
|
* @param app
|
||||||
*/
|
*/
|
||||||
public onSelectApp(app: ApplicationInstanceModel): void {
|
onSelectApp(app: ApplicationInstanceModel): void {
|
||||||
this.selectedApp.emit(app);
|
this.selectedApp.emit(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTheme() {
|
getTheme(): string {
|
||||||
if ( !this.applicationInstance.theme ) {
|
return this.applicationInstance.theme || DEFAULT_APP_INSTANCE_THEME;
|
||||||
return ApplicationInstanceModel.DEFAULT_THEME;
|
|
||||||
}
|
|
||||||
return this.applicationInstance.theme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getIcon() {
|
getIcon(): string {
|
||||||
if ( !this.applicationInstance.icon ) {
|
return this.applicationInstance.icon || DEFAULT_APP_INSTANCE_ICON;
|
||||||
return ApplicationInstanceModel.DEFAULT_ICON;
|
|
||||||
}
|
|
||||||
return this.applicationInstance.icon;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
|||||||
|
|
||||||
/** Emitted when an app entry is clicked. */
|
/** Emitted when an app entry is clicked. */
|
||||||
@Output()
|
@Output()
|
||||||
appClick: EventEmitter<ApplicationInstanceModel> = new EventEmitter<ApplicationInstanceModel>();
|
appClick = new EventEmitter<ApplicationInstanceModel>();
|
||||||
|
|
||||||
apps$: Observable<any>;
|
apps$: Observable<any>;
|
||||||
loadingError$ = new Subject<boolean>();
|
loadingError$ = new Subject<boolean>();
|
||||||
@ -104,7 +104,6 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
|||||||
* Return true if the layout type is GRID
|
* Return true if the layout type is GRID
|
||||||
*/
|
*/
|
||||||
isGrid(): boolean {
|
isGrid(): boolean {
|
||||||
|
|
||||||
return this.layoutType === AppListCloudComponent.LAYOUT_GRID;
|
return this.layoutType === AppListCloudComponent.LAYOUT_GRID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* 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.
|
* 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';
|
export interface ApplicationInstanceModel {
|
||||||
public static DEFAULT_ICON: string = 'favorite_border';
|
name?: string;
|
||||||
|
createdAt?: any;
|
||||||
name: string;
|
status?: string;
|
||||||
createdAt: any;
|
|
||||||
status: string;
|
|
||||||
theme?: string;
|
theme?: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
connectors?: any;
|
connectors?: any;
|
||||||
|
descriptor?: Descriptor;
|
||||||
constructor(obj?: any) {
|
}
|
||||||
if (obj) {
|
|
||||||
this.name = obj.name ? obj.name : null;
|
export interface Descriptor {
|
||||||
this.status = obj.status ? obj.status : null;
|
name?: string;
|
||||||
this.createdAt = obj.createdAt ? obj.createdAt : null;
|
projectId?: string;
|
||||||
this.theme = obj.theme;
|
releaseId?: string;
|
||||||
this.icon = obj.icon;
|
releaseVersion?: number;
|
||||||
this.description = obj.description ? obj.description : null;
|
security?: DescriptorSecurity[];
|
||||||
this.connectors = obj.connectors ? obj.connectors : null;
|
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 { HttpErrorResponse } from '@angular/common/http';
|
||||||
import { AppsProcessCloudService } from './apps-process-cloud.service';
|
import { AppsProcessCloudService } from './apps-process-cloud.service';
|
||||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
|
||||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ describe('AppsProcessCloudService', () => {
|
|||||||
spyOn(appConfigService, 'get').and.returnValue([]);
|
spyOn(appConfigService, 'get').and.returnValue([]);
|
||||||
service.loadApps();
|
service.loadApps();
|
||||||
service.getDeployedApplicationsByStatus('fake').subscribe(
|
service.getDeployedApplicationsByStatus('fake').subscribe(
|
||||||
(res: ApplicationInstanceModel[]) => {
|
(res) => {
|
||||||
expect(res).toBeDefined();
|
expect(res).toBeDefined();
|
||||||
expect(res.length).toEqual(2);
|
expect(res.length).toEqual(2);
|
||||||
expect(res[0].name).toEqual('application-new-1');
|
expect(res[0].name).toEqual('application-new-1');
|
||||||
@ -70,7 +69,7 @@ describe('AppsProcessCloudService', () => {
|
|||||||
spyOn(appConfigService, 'get').and.returnValue([fakeApplicationInstance[0]]);
|
spyOn(appConfigService, 'get').and.returnValue([fakeApplicationInstance[0]]);
|
||||||
service.loadApps();
|
service.loadApps();
|
||||||
service.getDeployedApplicationsByStatus('fake').subscribe(
|
service.getDeployedApplicationsByStatus('fake').subscribe(
|
||||||
(res: ApplicationInstanceModel[]) => {
|
(res) => {
|
||||||
expect(res).toBeDefined();
|
expect(res).toBeDefined();
|
||||||
expect(res.length).toEqual(1);
|
expect(res.length).toEqual(1);
|
||||||
expect(res[0]).toEqual(fakeApplicationInstance[0]);
|
expect(res[0]).toEqual(fakeApplicationInstance[0]);
|
||||||
|
@ -71,9 +71,7 @@ export class AppsProcessCloudService {
|
|||||||
contentTypes, accepts))
|
contentTypes, accepts))
|
||||||
.pipe(
|
.pipe(
|
||||||
map((applications: any) => {
|
map((applications: any) => {
|
||||||
return applications.list.entries.map((application) => {
|
return applications.list.entries.map((application) => application.entry);
|
||||||
return new ApplicationInstanceModel(application.entry);
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
catchError((err) => this.handleError(err))
|
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 { FilterOptions, TaskFilterAction, TaskFilterProperties } from '../../models/filter-cloud.model';
|
||||||
import { TaskCloudService } from './../../../services/task-cloud.service';
|
import { TaskCloudService } from './../../../services/task-cloud.service';
|
||||||
import { AppsProcessCloudService } from './../../../../app/services/apps-process-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 { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
|
||||||
import moment, { Moment } from 'moment';
|
import moment, { Moment } from 'moment';
|
||||||
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
||||||
@ -219,7 +218,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
|
|||||||
getRunningApplications() {
|
getRunningApplications() {
|
||||||
this.appsProcessCloudService
|
this.appsProcessCloudService
|
||||||
.getDeployedApplicationsByStatus(BaseEditTaskFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
.getDeployedApplicationsByStatus(BaseEditTaskFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
||||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
.subscribe((applications) => {
|
||||||
if (applications && applications.length > 0) {
|
if (applications && applications.length > 0) {
|
||||||
applications.map((application) => {
|
applications.map((application) => {
|
||||||
this.applicationNames.push({ label: application.name, value: application.name });
|
this.applicationNames.push({ label: application.name, value: application.name });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user