[ACS-5571] Remove unused WebScript component (#8752)

* ACS-5571 Remove unused WebScript component

* [ACS-5571] revert wrong file deletion
This commit is contained in:
Grzegorz Jaśkowski
2024-04-15 15:45:51 +02:00
committed by GitHub
parent 22da251c02
commit 7cef7a2688
28 changed files with 0 additions and 670 deletions

View File

@@ -23,7 +23,6 @@ import { CoreModule, SearchTextModule, provideTranslations } from '@alfresco/adf
import { MaterialModule } from './material.module';
import { TagModule } from './tag/tag.module';
import { WebScriptModule } from './webscript/webscript.module';
import { DocumentListModule } from './document-list/document-list.module';
import { UploadModule } from './upload/upload.module';
import { SearchModule } from './search/search.module';
@@ -59,7 +58,6 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
CoreModule,
TagModule,
CommonModule,
WebScriptModule,
FormsModule,
ReactiveFormsModule,
DialogModule,
@@ -94,7 +92,6 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
exports: [
ContentPipeModule,
TagModule,
WebScriptModule,
DocumentListModule,
ContentUserInfoModule,
UploadModule,

View File

@@ -268,9 +268,6 @@
"ERROR": "خطأ في التحميل"
}
},
"WEBSCRIPT": {
"ERROR": "تعذر إتمام الإجراء. شارك هذه الرسالة مع فريق تكنولوجيا المعلومات لديك: حدث خطأ أثناء إلغاء تسلسل{{data}} كـ {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Chyba při nahrávání"
}
},
"WEBSCRIPT": {
"ERROR": "Akci nelze dokončit. Sdělte oddělení IT následující zprávu: Chyba při deserializaci „{{data}}“ ({{contentType}})."
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Uploadfejl"
}
},
"WEBSCRIPT": {
"ERROR": "Handlingen kunne ikke fuldføres. Giv følgende meddelelse til din it-afdeling: Fejl under deserialisering af {{data}} som {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Fehler beim Hochladen"
}
},
"WEBSCRIPT": {
"ERROR": "Vorgang konnte nicht durchgeführt werden. Geben Sie diese Meldung an Ihr IT-Team weiter: Fehler bei Deserialisierung von {{data}} als {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Upload error"
}
},
"WEBSCRIPT": {
"ERROR": "Couldn't complete the action. Share this message with your IT Team: Error during the deserialization of {{data}} as {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Error de carga"
}
},
"WEBSCRIPT": {
"ERROR": "No se ha podido finalizar la acción. Comparta este mensaje con el equipo de TI: Error durante la deserialización {{data}} como {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Latausvirhe"
}
},
"WEBSCRIPT": {
"ERROR": "Toiminnon suorittaminen ei onnistu. Ilmoita IT-tuelle seuraava ilmoitus: kohteen {{data}} sarjoituksen poistamisessa muotoon {{contentType}} tapahtui virhe"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Erreur d'importation"
}
},
"WEBSCRIPT": {
"ERROR": "Impossible de terminer l'action. Transférez le message suivant au service informatique : erreur pendant la désérialisation de {{data}} en tant que {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Carica errore"
}
},
"WEBSCRIPT": {
"ERROR": "Impossibile completare l'azione. Condividi il messaggio con il team IT: Errore durante la deserializzazione di {{data}} come {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "アップロードエラー"
}
},
"WEBSCRIPT": {
"ERROR": "処理を完了できませんでした。次のメッセージを IT 担当者に伝えてください: {{data}} を {{contentType}} としてシリアル化解除中にエラーが発生しました"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Opplastingsfeil"
}
},
"WEBSCRIPT": {
"ERROR": "Kan ikke fullføre handlingen. Del denne meldingen med IT-teamet: Feil under deserialisering av {{data}} som {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Uploadfout"
}
},
"WEBSCRIPT": {
"ERROR": "Kan de actie niet voltooien. Geef het volgende bericht door aan het IT-team: Fout bij de deserialisatie van {{data}} als {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Błąd przesyłania"
}
},
"WEBSCRIPT": {
"ERROR": "Nie można wykonać czynności. Udostępnij zespołowi IT następujący komunikat: Błąd podczas deserializacji {{data}} jako {{contentType}}."
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Erro ao carregar"
}
},
"WEBSCRIPT": {
"ERROR": "Não foi possível concluir a ação. Compartilhe esta mensagem com a Equipe de TI: Erro durante a desserialização de {{data}} como {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Ошибка загрузки"
}
},
"WEBSCRIPT": {
"ERROR": "Не удалось выполнить действие. Покажите IT-специалистам следующее сообщение: ошибка во время десериализации {{data}} в виде {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "Uppladdningsfel"
}
},
"WEBSCRIPT": {
"ERROR": "Kunde inte slutföra åtgärden. Dela det här meddelandet med din IT-avdelning: Fel under deserialisering av {{data}} som {{contentType}}"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -268,9 +268,6 @@
"ERROR": "上传错误"
}
},
"WEBSCRIPT": {
"ERROR": "无法完成该操作。将此信息告知您的 IT 团队:将 {{data}} 反序列化为 {{contentType}} 过程中出错"
},
"SEARCH": {
"CONTROL": {},
"BUTTON": {

View File

@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 './public-api';

View File

@@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 './webscript.component';
export * from './webscript.module';

View File

@@ -1,16 +0,0 @@
<div *ngIf="showData">
<div *ngIf="contentType === 'JSON'" id="webscript-data-JSON">{{data | json}}</div>
<div *ngIf="contentType === 'HTML'" id="webscript-data-HTML" [innerHTML]="data"></div>
<div *ngIf="contentType === 'TEXT'" id="webscript-data-TEXT">{{data}}</div>
<div *ngIf="isDataTableContent()">
<adf-datatable id="webscript-datatable-wrapper" [data]="data"></adf-datatable>
<div>
<div *ngIf="showError" id="error">{{'WEBSCRIPT.ERROR' | translate: {
data: data,
contentType: contentType
}
}}
</div>
</div>
</div>
</div>

View File

@@ -1,196 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppConfigService } from '@alfresco/adf-core';
import { WebscriptComponent } from './webscript.component';
import { ContentTestingModule } from '../testing/content.testing.module';
declare let jasmine: any;
describe('WebscriptComponent', () => {
let component: WebscriptComponent;
let fixture: ComponentFixture<WebscriptComponent>;
let element: HTMLElement;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ContentTestingModule]
});
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
fixture = TestBed.createComponent(WebscriptComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
component = fixture.componentInstance;
component.scriptPath = 'fakePath';
component.showData = true;
fixture.detectChanges();
});
describe('View', () => {
it('html wrapper should be present', () => {
expect(element.querySelector('#webscript-html-wrapper')).toBeDefined();
});
it('wrapper should be hide if showData is false', () => {
expect(element.querySelector('#webscript-html-wrapper')).toBeDefined();
});
it('JSON datatable wrapper should be present', () => {
expect(element.querySelector('#webscript-json-wrapper')).toBeDefined();
});
it('plain text datatable wrapper should be present', () => {
expect(element.querySelector('#webscript-plaintext-wrapper')).toBeDefined();
});
});
describe('Content tests', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('url should be the one configured by the input param', (done) => {
component.scriptPath = 'sample/folder/Company%20Home';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/service/sample/folder/Company%20Home');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: '<div></div>'
});
});
it('TEXT response should be displayed', (done) => {
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'TEXT';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(element.querySelector('#webscript-data-TEXT').innerHTML).toBe('text test');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/html',
responseText: 'text test'
});
});
it('JSON response should be displayed', (done) => {
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'JSON';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[0].name).toBe('Name 1');
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[1].name).toBe('Name 2');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: [
{ id: 1, name: 'Name 1' },
{ id: 2, name: 'Name 2' }
]
});
});
it('datatable response should be displayed', (done) => {
// reset MDL handler
window['componentHandler'] = null;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
done();
});
const dataTable = {
data: [
{ id: 1, name: 'Name 1' },
{ id: 2, name: 'Name 2' }
],
schema: [
{
type: 'text',
key: 'id',
title: 'Id',
sortable: true
},
{
type: 'text',
key: 'name',
title: 'Name',
sortable: true
}
]
};
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: dataTable
});
});
it('datatable response should be displayed also if no schema is provided', (done) => {
// reset MDL handler
window['componentHandler'] = null;
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE';
component.ngOnChanges().then(() => {
fixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
done();
});
const dataTable = {
data: [
{ id: 1, name: 'Name 1' },
{ id: 2, name: 'Name 2' }
]
};
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: dataTable
});
});
});
});

View File

@@ -1,137 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ObjectDataTableAdapter, AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { WebscriptApi } from '@alfresco/js-api';
/**
* @deprecated Webscript component has never been turned into a product and has no UI/UX and no use cases in ACA/ADW/ACC.
*/
@Component({
selector: 'adf-webscript-get',
templateUrl: './webscript.component.html'
})
export class WebscriptComponent implements OnChanges {
_webscriptApi: WebscriptApi;
get webscriptApi(): WebscriptApi {
this._webscriptApi = this._webscriptApi ?? new WebscriptApi(this.apiService.getInstance());
return this._webscriptApi;
}
/** (required) Path to the webscript (as defined by webscript). */
@Input()
scriptPath: string;
/** Arguments to pass to the webscript. */
@Input()
scriptArgs: any;
/** Toggles whether to show or hide the data. */
@Input()
showData: boolean = true;
/** Path where the application is deployed */
@Input()
contextRoot: string = 'alfresco';
/** Path that the webscript service is mapped to. */
@Input()
servicePath: string = 'service';
/**
* Content type to interpret the data received from the webscript.
* Can be "JSON" , "HTML" , "DATATABLE" or "TEXT"
*/
@Input()
contentType: string = 'TEXT';
/**
* Emitted when the operation succeeds. You can get the plain data from
* the webscript through the **success** event parameter and use it as you
* need in your application.
*/
@Output()
success = new EventEmitter();
data: any = undefined;
showError: boolean = false;
constructor(private apiService: AlfrescoApiService,
private logService: LogService) {
}
ngOnChanges() {
if (this.showData) {
this.clean();
}
return new Promise<void>((resolve, reject) => {
this.webscriptApi.executeWebScript('GET', this.scriptPath, this.scriptArgs, this.contextRoot, this.servicePath).then((webScriptData) => {
this.data = webScriptData;
if (this.showData) {
if (this.contentType === 'DATATABLE') {
this.data = this.showDataAsDataTable(webScriptData);
}
}
this.success.emit(this.data);
resolve();
}, (error) => {
this.logService.log('Error' + error);
reject(error);
});
});
}
/**
* show the data in a ng2-alfresco-datatable
*
* @param data data
* @returns the data as datatable
*/
showDataAsDataTable(data: any) {
const datatableData: any = null;
try {
if (!data.schema) {
data.schema = ObjectDataTableAdapter.generateSchema(data.data);
}
if (data.schema && data.schema.length > 0) {
this.data = new ObjectDataTableAdapter(data.data, data.schema);
}
} catch (error) {
this.logService.error('error during the cast as datatable');
}
return datatableData;
}
clean() {
this.data = undefined;
}
isDataTableContent() {
return this.contentType === 'DATATABLE';
}
}

View File

@@ -1,41 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { CoreModule } from '@alfresco/adf-core';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MaterialModule } from '../material.module';
import { WebscriptComponent } from './webscript.component';
/**
* @deprecated Webscript component has never been turned into a product and has no UI/UX and no use cases in ACA/ADW/ACC.
*/
@NgModule({
imports: [
CommonModule,
MaterialModule,
CoreModule
],
exports: [
WebscriptComponent
],
declarations: [
WebscriptComponent
]
})
export class WebScriptModule {}

View File

@@ -17,7 +17,6 @@
export * from './lib/directives/index';
export * from './lib/tag/index';
export * from './lib/webscript/index';
export * from './lib/document-list/index';
export * from './lib/content-user-info/index';
export * from './lib/upload/index';