aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogItemDetails.stories.js
blob: c0de0eeb799d5a554bd85a0cba6aab69f0b0e21a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { select, withKnobs } from '@kadira/storybook-addon-knobs';
import CatalogItemDetails from './CatalogItemDetails.jsx';
import { catalogItemTypes } from './onboardingCatalog/OnboardingCatalogConstants.js';
import { FinalizedLicenseModelFactory } from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
import { versionStatus } from 'sdc-app/common/helpers/ItemsHelperConstants.js';

const stories = storiesOf('CatalogTiles', module);
stories.addDecorator(withKnobs);

const types = [
    catalogItemTypes.LICENSE_MODEL,
    catalogItemTypes.SOFTWARE_PRODUCT
];

function selectType() {
    return select('Item type', types, types[0]);
}

let vlm = {
    ...FinalizedLicenseModelFactory.build({ name: 'Test-VLM' }),
    itemStatus: versionStatus.DRAFT
};
let certifiedVlm = { ...vlm, itemStatus: versionStatus.CERTIFIED };

stories.add('preview', () => (
    <div className="catalog-view">
        <div className="catalog-list">
            <div className="catalog-items">
                <CatalogItemDetails
                    catalogItemData={vlm}
                    catalogItemTypeClass={selectType()}
                    onSelect={action('onSelect')}
                    onMigrate={action('onMigrate')}
                />
                <CatalogItemDetails
                    catalogItemData={certifiedVlm}
                    catalogItemTypeClass={selectType()}
                    onSelect={action('onSelect')}
                    onMigrate={action('onMigrate')}
                />
            </div>
        </div>
    </div>
));