mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-10117] Deprecate ADF Storybook and custom Docker builds (#11207)
This commit is contained in:
@@ -1,2 +1 @@
|
||||
.storybook
|
||||
coverage
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
var rootPath = require('../../../.storybook/main');
|
||||
|
||||
module.exports = {
|
||||
rootMain: rootPath,
|
||||
stories: [...rootPath.stories, '../**/*.stories.@(js|jsx|ts|tsx)'],
|
||||
|
||||
staticDirs: [
|
||||
...rootPath.staticDirs,
|
||||
{ from: __dirname + '/../src/lib/i18n', to: 'assets/adf-core/i18n' },
|
||||
{ from: __dirname + '/../src/lib/assets/images', to: 'assets/images' }
|
||||
],
|
||||
|
||||
addons: ['@storybook/addon-essentials', ...rootPath.addons],
|
||||
|
||||
framework: {
|
||||
name: '@storybook/angular',
|
||||
options: {}
|
||||
},
|
||||
|
||||
docs: {}
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
import { addons } from '@storybook/manager-api';
|
||||
import alfrescoTheme from '../../../.storybook/alfrescoTheme';
|
||||
|
||||
addons.setConfig({
|
||||
theme: alfrescoTheme
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
export const parameters = {
|
||||
docs: { inlineStories: true },
|
||||
controls: { expanded: true }
|
||||
};
|
||||
export const tags = ['autodocs', 'autodocs'];
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true
|
||||
|
||||
},
|
||||
|
||||
"exclude": ["../**/*.spec.ts" ],
|
||||
"include": ["../src/**/*", "*.js"]
|
||||
}
|
||||
@@ -9,7 +9,6 @@ Contains a variety of components, directives and services used throughout ADF
|
||||
- [Documentation](#documentation)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Install](#install)
|
||||
- [Storybook](#storybook)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
@@ -34,21 +33,6 @@ necessary configuration, see this [page](https://github.com/Alfresco/alfresco-ng
|
||||
npm install @alfresco/adf-content-services
|
||||
```
|
||||
|
||||
## Storybook
|
||||
|
||||
In case you would like to aggregate all the stories from content services library use
|
||||
|
||||
```
|
||||
nx run content-services:storybook
|
||||
```
|
||||
And navigate to `http://localhost:4400/`.
|
||||
|
||||
To create a Storybook content services library build use
|
||||
|
||||
```
|
||||
nx run content-services:build-storybook
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[Apache Version 2.0](https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE)
|
||||
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 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 { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DownloadZipDialogComponent } from './download-zip.dialog';
|
||||
import { zipNode, downloadEntry } from './mock/download-zip-data.mock';
|
||||
import { FileDownloadStatus } from '@alfresco/js-api';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-download-zip-dialog-storybook',
|
||||
template: `<button mat-raised-button (click)="openDialog()">Open dialog</button>`,
|
||||
standalone: true,
|
||||
imports: [MatButtonModule]
|
||||
})
|
||||
export class DownloadZipDialogStorybookComponent implements OnInit, OnChanges {
|
||||
@Input()
|
||||
showLoading: boolean;
|
||||
|
||||
constructor(private dialog: MatDialog) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setEntryStatus(this.showLoading);
|
||||
}
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.setEntryStatus(this.showLoading);
|
||||
}
|
||||
|
||||
setEntryStatus(isLoading: boolean) {
|
||||
if (!isLoading) {
|
||||
downloadEntry.entry.status = FileDownloadStatus.DONE;
|
||||
} else {
|
||||
downloadEntry.entry.status = FileDownloadStatus.IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
openDialog() {
|
||||
this.dialog.open(DownloadZipDialogComponent, {
|
||||
minWidth: '50%',
|
||||
data: {
|
||||
nodeIds: [zipNode.entry.id]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 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 { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component';
|
||||
import { AlfrescoApiServiceMock, ContentApiMock, DownloadZipMockService, NodesApiMock } from './mock/download-zip-service.mock';
|
||||
import { DownloadZipService } from './services/download-zip.service';
|
||||
import { ContentService } from '../../common/services/content.service';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { importProvidersFrom } from '@angular/core';
|
||||
import { CoreStoryModule } from '../../../../../core/src/public-api';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
|
||||
export default {
|
||||
component: DownloadZipDialogStorybookComponent,
|
||||
title: 'Core/Dialog/Download ZIP Dialog',
|
||||
decorators: [
|
||||
moduleMetadata({
|
||||
imports: [MatButtonModule, MatDialogModule, HttpClientTestingModule, DownloadZipDialogStorybookComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: AlfrescoApiService,
|
||||
useClass: AlfrescoApiServiceMock
|
||||
},
|
||||
{
|
||||
provide: DownloadZipService,
|
||||
useClass: DownloadZipMockService
|
||||
},
|
||||
{
|
||||
provide: ContentService,
|
||||
useClass: ContentApiMock
|
||||
},
|
||||
{
|
||||
provide: NodesApiService,
|
||||
useClass: NodesApiMock
|
||||
}
|
||||
]
|
||||
}),
|
||||
applicationConfig({
|
||||
providers: [importProvidersFrom(CoreStoryModule)]
|
||||
})
|
||||
],
|
||||
argTypes: {
|
||||
showLoading: {
|
||||
control: {
|
||||
type: 'boolean'
|
||||
},
|
||||
table: {
|
||||
category: 'Story controls',
|
||||
type: {
|
||||
summary: 'boolean'
|
||||
},
|
||||
defaultValue: {
|
||||
summary: 'false'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
args: {
|
||||
showLoading: false
|
||||
}
|
||||
} as Meta<DownloadZipDialogStorybookComponent>;
|
||||
|
||||
export const DownloadZIPDialog: StoryFn<DownloadZipDialogStorybookComponent> = (args) => ({
|
||||
props: args
|
||||
});
|
||||
DownloadZIPDialog.parameters = { layout: 'centered' };
|
||||
@@ -1,33 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 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 { DownloadEntry } from '@alfresco/js-api';
|
||||
|
||||
export const zipNode = {
|
||||
entry: {
|
||||
name: 'files.zip',
|
||||
contentUrl: './assets/files.zip',
|
||||
id: 'files_in_zip'
|
||||
}
|
||||
};
|
||||
|
||||
export const downloadEntry: DownloadEntry = {
|
||||
entry: {
|
||||
id: 'entryId',
|
||||
status: 'DONE'
|
||||
}
|
||||
};
|
||||
@@ -1,93 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 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 { DownloadBodyCreate, DownloadEntry, DownloadsApi, Node } from '@alfresco/js-api';
|
||||
import { from, Observable, of, ReplaySubject, Subject } from 'rxjs';
|
||||
import { catchError } from 'rxjs/internal/operators/catchError';
|
||||
import { zipNode, downloadEntry } from './download-zip-data.mock';
|
||||
|
||||
export class AlfrescoApiServiceMock {
|
||||
nodeUpdated = new Subject<Node>();
|
||||
alfrescoApiInitialized = new ReplaySubject<boolean>(1);
|
||||
alfrescoApi = new AlfrescoApiMock();
|
||||
|
||||
load() {}
|
||||
getInstance = () => this.alfrescoApi;
|
||||
}
|
||||
|
||||
class AlfrescoApiMock {
|
||||
core = new CoreMock();
|
||||
content = new ContentApiMock();
|
||||
|
||||
isOauthConfiguration = () => true;
|
||||
isLoggedIn = () => true;
|
||||
isEcmConfiguration = () => true;
|
||||
}
|
||||
|
||||
export class ContentApiMock {
|
||||
getContentUrl = (): string => zipNode.entry.contentUrl;
|
||||
}
|
||||
|
||||
class CoreMock {
|
||||
downloadsApi = new DownloadsApiMock();
|
||||
nodesApi = new NodesApiMock();
|
||||
}
|
||||
|
||||
export class NodesApiMock {
|
||||
getNode = (): any => of(zipNode.entry);
|
||||
}
|
||||
|
||||
class DownloadsApiMock extends DownloadsApi {
|
||||
createDownload = (): Promise<DownloadEntry> => Promise.resolve(downloadEntry);
|
||||
|
||||
getDownload = (): Promise<DownloadEntry> => Promise.resolve(downloadEntry);
|
||||
cancelDownload = () => Promise.resolve(true);
|
||||
}
|
||||
|
||||
export class DownloadZipMockService {
|
||||
private _downloadsApi: DownloadsApi;
|
||||
get downloadsApi(): DownloadsApi {
|
||||
this._downloadsApi = this._downloadsApi ?? new DownloadsApiMock();
|
||||
return this._downloadsApi;
|
||||
}
|
||||
|
||||
createDownload(payload: DownloadBodyCreate): Observable<DownloadEntry> {
|
||||
return from(this.downloadsApi.createDownload(payload)).pipe(catchError((err) => of(err)));
|
||||
}
|
||||
|
||||
getDownload(downloadId: string): Observable<DownloadEntry> {
|
||||
return from(this.downloadsApi.getDownload(downloadId));
|
||||
}
|
||||
|
||||
cancelDownload(downloadId: string) {
|
||||
this.downloadsApi.cancelDownload(downloadId);
|
||||
}
|
||||
|
||||
download(url: string, fileName: string) {
|
||||
if (url && fileName) {
|
||||
const link = document.createElement('a');
|
||||
|
||||
link.style.display = 'none';
|
||||
link.download = fileName;
|
||||
link.href = url;
|
||||
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommentModel, User } from '@alfresco/adf-core';
|
||||
import { EcmCompanyModel } from '../../common/models/ecm-company.model';
|
||||
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
||||
import { User } from '@alfresco/adf-core';
|
||||
|
||||
export const fakeUser1 = new User({
|
||||
enabled: true,
|
||||
@@ -90,120 +88,3 @@ export const fakeContentComment = {
|
||||
content: 'fake-comment-message'
|
||||
}
|
||||
};
|
||||
|
||||
const fakeCompany: EcmCompanyModel = {
|
||||
organization: '',
|
||||
address1: '',
|
||||
address2: '',
|
||||
address3: '',
|
||||
postcode: '',
|
||||
telephone: '',
|
||||
fax: '',
|
||||
email: ''
|
||||
};
|
||||
|
||||
const johnDoe: EcmUserModel = {
|
||||
id: '1',
|
||||
email: 'john.doe@alfresco.com',
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
company: fakeCompany,
|
||||
enabled: true,
|
||||
isAdmin: undefined,
|
||||
avatarId: '001'
|
||||
};
|
||||
|
||||
const janeEod: EcmUserModel = {
|
||||
id: '2',
|
||||
email: 'jane.eod@alfresco.com',
|
||||
firstName: 'Jane',
|
||||
lastName: 'Eod',
|
||||
company: fakeCompany,
|
||||
enabled: true,
|
||||
isAdmin: undefined
|
||||
};
|
||||
|
||||
const robertSmith: EcmUserModel = {
|
||||
id: '3',
|
||||
email: 'robert.smith@alfresco.com',
|
||||
firstName: 'Robert',
|
||||
lastName: 'Smith',
|
||||
company: fakeCompany,
|
||||
enabled: true,
|
||||
isAdmin: undefined
|
||||
};
|
||||
|
||||
export const testUser: EcmUserModel = {
|
||||
id: '44',
|
||||
email: 'test.user@hyland.com',
|
||||
firstName: 'Test',
|
||||
lastName: 'User',
|
||||
company: fakeCompany,
|
||||
enabled: true,
|
||||
isAdmin: undefined,
|
||||
avatarId: '044'
|
||||
};
|
||||
|
||||
export const getDateXMinutesAgo = (minutes: number) => new Date(new Date().getTime() - minutes * 60000);
|
||||
|
||||
export const commentsNodeData: CommentModel[] = [
|
||||
new CommentModel({
|
||||
id: 1,
|
||||
message: `I've done this component, is it cool?`,
|
||||
created: getDateXMinutesAgo(30),
|
||||
createdBy: new User(johnDoe),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 2,
|
||||
message: 'Yeah',
|
||||
created: getDateXMinutesAgo(15),
|
||||
createdBy: new User(janeEod),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 3,
|
||||
message: '+1',
|
||||
created: getDateXMinutesAgo(12),
|
||||
createdBy: new User(robertSmith),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 4,
|
||||
message: 'ty',
|
||||
created: new Date(),
|
||||
createdBy: new User(johnDoe),
|
||||
isSelected: false
|
||||
})
|
||||
];
|
||||
|
||||
export const commentsTaskData: CommentModel[] = [
|
||||
new CommentModel({
|
||||
id: 1,
|
||||
message: `I've done this task, what's next?`,
|
||||
created: getDateXMinutesAgo(30),
|
||||
createdBy: new User(johnDoe),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 2,
|
||||
message: `I've assigned you another one 🤠`,
|
||||
created: getDateXMinutesAgo(15),
|
||||
createdBy: new User(janeEod),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 3,
|
||||
message: '+1',
|
||||
created: getDateXMinutesAgo(12),
|
||||
createdBy: new User(robertSmith),
|
||||
isSelected: false
|
||||
}),
|
||||
new CommentModel({
|
||||
id: 4,
|
||||
message: 'Cheers',
|
||||
created: new Date(),
|
||||
createdBy: new User(johnDoe),
|
||||
isSelected: false
|
||||
})
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user