Skip to content

Commit abef61f

Browse files
committed
chore(editor lib): add stories for OnlineServiceResourceInputComponent
1 parent 669d9ec commit abef61f

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import {
2+
applicationConfig,
3+
componentWrapperDecorator,
4+
Meta,
5+
StoryObj,
6+
} from '@storybook/angular'
7+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
8+
import { importProvidersFrom } from '@angular/core'
9+
import { OnlineServiceResourceInputComponent } from './online-service-resource-input.component'
10+
import { provideI18n } from '@geonetwork-ui/util/i18n'
11+
12+
export default {
13+
title: 'Elements/OnlineServiceResourceInputComponent',
14+
component: OnlineServiceResourceInputComponent,
15+
decorators: [
16+
applicationConfig({
17+
providers: [importProvidersFrom(BrowserAnimationsModule), provideI18n()],
18+
}),
19+
componentWrapperDecorator(
20+
(story) =>
21+
`<div class="border border-gray-300 w-[800px] p-[16px]" style="margin: auto;">${story}</div>`
22+
),
23+
],
24+
argTypes: {
25+
serviceChange: { action: 'serviceChange' },
26+
},
27+
} as Meta<OnlineServiceResourceInputComponent>
28+
29+
const emptyService = {
30+
type: 'service' as const,
31+
url: undefined,
32+
accessServiceProtocol: 'ogcFeatures' as const,
33+
}
34+
35+
export const Default: StoryObj<OnlineServiceResourceInputComponent> = {
36+
args: {
37+
service: { ...emptyService },
38+
},
39+
}
40+
41+
export const FeaturesOnly: StoryObj<OnlineServiceResourceInputComponent> = {
42+
args: {
43+
service: { ...emptyService },
44+
featuresOnly: true,
45+
},
46+
}
47+
48+
export const WithProtocolHint: StoryObj<OnlineServiceResourceInputComponent> = {
49+
args: {
50+
service: { ...emptyService },
51+
protocolHint:
52+
'Select the protocol that matches your service endpoint type.',
53+
},
54+
}
55+
56+
export const WithPrefilledWmsService: StoryObj<OnlineServiceResourceInputComponent> =
57+
{
58+
args: {
59+
service: {
60+
type: 'service',
61+
url: new URL('https://my.ogc.server/wms'),
62+
accessServiceProtocol: 'wms',
63+
identifierInService: 'mylayer',
64+
},
65+
},
66+
}
67+
68+
export const WithPrefilledWfsService: StoryObj<OnlineServiceResourceInputComponent> =
69+
{
70+
args: {
71+
service: {
72+
type: 'service',
73+
url: new URL('https://my.ogc.server/wfs'),
74+
accessServiceProtocol: 'wfs',
75+
identifierInService: 'mylayer',
76+
},
77+
},
78+
}
79+
80+
export const ModifyMode: StoryObj<OnlineServiceResourceInputComponent> = {
81+
args: {
82+
service: {
83+
type: 'service',
84+
url: new URL('https://my.ogc.server/wms'),
85+
accessServiceProtocol: 'wms',
86+
identifierInService: 'mylayer',
87+
},
88+
modifyMode: true,
89+
},
90+
}
91+
92+
export const Disabled: StoryObj<OnlineServiceResourceInputComponent> = {
93+
args: {
94+
service: {
95+
type: 'service',
96+
url: new URL('https://my.ogc.server/wms'),
97+
accessServiceProtocol: 'wms',
98+
identifierInService: 'mylayer',
99+
},
100+
disabled: true,
101+
},
102+
}
103+
104+
export const FeaturesOnlyWithPrefilledWfs: StoryObj<OnlineServiceResourceInputComponent> =
105+
{
106+
args: {
107+
service: {
108+
type: 'service',
109+
url: new URL('https://my.ogc.server/wfs'),
110+
accessServiceProtocol: 'wfs',
111+
identifierInService: 'mylayer',
112+
},
113+
featuresOnly: true,
114+
},
115+
}

0 commit comments

Comments
 (0)