mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-] update library to use new js-api 3.0.0 (#4097)
This commit is contained in:
committed by
Eugenio Romano
parent
2acd1b4e26
commit
3ef7d3b7ea
@@ -12,6 +12,7 @@ module.exports = function (config) {
|
||||
proxies: {
|
||||
'/base/assets/': '/base/lib/process-services-cloud/src/lib/assets/',
|
||||
'/assets/adf-core/i18n/en.json': '/base/lib/core/i18n/en.json',
|
||||
'/assets/adf-core/i18n/en-GB.json': '/base/lib/core/i18n/en.json',
|
||||
'/app.config.json': '/base/lib/config/app.config.json'
|
||||
},
|
||||
plugins: [
|
||||
|
@@ -6,7 +6,7 @@
|
||||
"entryFile": "src/public-api.ts",
|
||||
"flatModuleFile": "adf-process-services-cloud",
|
||||
"umdModuleIds": {
|
||||
"alfresco-js-api": "alfresco-js-api"
|
||||
"@alfresco/js-api": "@alfresco/js-ap"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import { Observable, from, throwError } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, LogService } from '@alfresco/adf-core';
|
||||
import { Oauth2Auth } from '@alfresco/js-api';
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
|
||||
@Injectable()
|
||||
@@ -39,24 +40,21 @@ export class AppsProcessCloudService {
|
||||
* @returns The list of deployed apps
|
||||
*/
|
||||
getDeployedApplicationsByStatus(status: string): Observable<ApplicationInstanceModel[]> {
|
||||
const api: any = this.apiService.getInstance().oauth2Auth;
|
||||
api.basePath = this.contextRoot;
|
||||
const path = 'alfresco-deployment-service/v1/applications';
|
||||
const httpMethod = 'GET', pathParams = {}, queryParams = {},
|
||||
headerParams = {}, formParams = {}, bodyParam = {}, authNames = [],
|
||||
const api: Oauth2Auth = this.apiService.getInstance().oauth2Auth;
|
||||
const path = `${this.contextRoot}/alfresco-deployment-service/v1/applications`;
|
||||
const pathParams = {}, queryParams = {},
|
||||
headerParams = {}, formParams = {}, bodyParam = {},
|
||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
||||
return from(api.callApi(
|
||||
path, httpMethod,
|
||||
pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||
authNames, contentTypes, accepts, [], ''
|
||||
))
|
||||
|
||||
return from(api.callCustomApi(path, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||
contentTypes, accepts))
|
||||
.pipe(
|
||||
map((apps: Array<{}>) => {
|
||||
return apps.filter((app: ApplicationInstanceModel) => app.status === status)
|
||||
.map((app) => {
|
||||
return new ApplicationInstanceModel(app);
|
||||
});
|
||||
}
|
||||
return apps.filter((app: ApplicationInstanceModel) => app.status === status)
|
||||
.map((app) => {
|
||||
return new ApplicationInstanceModel(app);
|
||||
});
|
||||
}
|
||||
),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
|
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export * from './components/process-list-cloud.component';
|
||||
export * from './models/process-cloud-query-request.model';
|
||||
export * from './models/process-cloud-preset.model';
|
||||
export * from './models/process-list-sorting.model';
|
||||
export * from './process-list-cloud.module';
|
@@ -25,7 +25,7 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import { processCloudPresetsDefaultModel } from '../models/process-cloud-preset.model';
|
||||
import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model';
|
||||
import { ProcessListCloudSortingModel } from '../models/process-list-sorting.model';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
@Component({
|
||||
selector: 'adf-cloud-process-list',
|
||||
templateUrl: './process-list-cloud.component.html',
|
||||
@@ -221,7 +221,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
||||
if (!this.isListEmpty()) {
|
||||
let dataRow: any = null;
|
||||
if (taskIdSelected) {
|
||||
dataRow = this.rows.find((currentRow: MinimalNodeEntity) => {
|
||||
dataRow = this.rows.find((currentRow: NodeEntry) => {
|
||||
return currentRow.entry.id === taskIdSelected;
|
||||
});
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ export class ProcessListCloudService {
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
null, queryParams, null,
|
||||
null, null, null, this.contentTypes,
|
||||
this.accepts, Object, null, null)
|
||||
null, null, this.contentTypes,
|
||||
this.accepts, null, null)
|
||||
);
|
||||
} else {
|
||||
this.logService.error('Appname is mandatory for querying task');
|
||||
|
@@ -51,7 +51,7 @@ export class StartProcessCloudService {
|
||||
|
||||
return from(this.alfrescoApiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
null, null, null,
|
||||
null, null,
|
||||
null, null, null,
|
||||
this.contentTypes, this.accepts,
|
||||
this.returnType, null, null)
|
||||
@@ -83,14 +83,14 @@ export class StartProcessCloudService {
|
||||
|
||||
return from(this.alfrescoApiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'POST',
|
||||
null, null, null,
|
||||
null, null,
|
||||
null, requestPayload, null,
|
||||
this.contentTypes, this.accepts,
|
||||
this.returnType, null, null)
|
||||
).pipe(
|
||||
map((processInstance) => new ProcessInstanceCloud(processInstance)),
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
).pipe(
|
||||
map((processInstance) => new ProcessInstanceCloud(processInstance)),
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
private handleProcessError(error: any) {
|
||||
|
@@ -38,16 +38,16 @@ export class StartTaskCloudService {
|
||||
createNewTask(taskDetails: TaskDetailsCloudModel): Observable<TaskDetailsCloudModel> {
|
||||
let queryUrl = this.buildCreateTaskUrl(taskDetails.appName);
|
||||
const bodyParam = JSON.stringify(this.buildRequestBody(taskDetails));
|
||||
const httpMethod = 'POST', pathParams = {}, queryParams = {}, headerParams = {},
|
||||
formParams = {}, authNames = [], contentTypes = ['application/json'], accepts = ['application/json'];
|
||||
const pathParams = {}, queryParams = {}, headerParams = {},
|
||||
formParams = {}, contentTypes = ['application/json'], accepts = ['application/json'];
|
||||
|
||||
return from(
|
||||
this.apiService
|
||||
.getInstance()
|
||||
.oauth2Auth.callCustomApi(
|
||||
queryUrl, httpMethod, pathParams, queryParams,
|
||||
headerParams, formParams, bodyParam, authNames,
|
||||
contentTypes, accepts, Object, null, null)
|
||||
queryUrl, 'POST', pathParams, queryParams,
|
||||
headerParams, formParams, bodyParam,
|
||||
contentTypes, accepts, null, null)
|
||||
).pipe(
|
||||
map((response: StartTaskCloudResponseModel) => {
|
||||
return new TaskDetailsCloudModel(response.entry);
|
||||
|
@@ -24,7 +24,7 @@ import { taskPresetsCloudDefaultModel } from '../models/task-preset-cloud.model'
|
||||
import { TaskQueryCloudRequestModel } from '../models/filter-cloud-model';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { TaskListCloudService } from '../services/task-list-cloud.service';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { TaskListCloudSortingModel } from '../models/task-list-sorting.model';
|
||||
|
||||
@Component({
|
||||
@@ -216,7 +216,7 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
||||
if (!this.isListEmpty()) {
|
||||
let dataRow: any = null;
|
||||
if (taskIdSelected) {
|
||||
dataRow = this.rows.find((currentRow: MinimalNodeEntity) => {
|
||||
dataRow = this.rows.find((currentRow: NodeEntry) => {
|
||||
return currentRow.entry.id === taskIdSelected;
|
||||
});
|
||||
}
|
||||
|
@@ -43,8 +43,8 @@ export class TaskListCloudService {
|
||||
return from(this.apiService.getInstance()
|
||||
.oauth2Auth.callCustomApi(queryUrl, 'GET',
|
||||
null, queryParams, null,
|
||||
null, null, null, ['application/json'],
|
||||
['application/json'], Object, null, null)
|
||||
null, null, ['application/json'],
|
||||
['application/json'], null, null)
|
||||
);
|
||||
} else {
|
||||
this.logService.error('Appname is mandatory for querying task');
|
||||
|
Reference in New Issue
Block a user