Skip to content

Commit 7428ddc

Browse files
authored
Merge pull request #2295 from umbraco/v15/feature/emm-section-conditions
Move section conditions to section package
2 parents 2f18e01 + eaa4468 commit 7428ddc

File tree

8 files changed

+40
-42
lines changed

8 files changed

+40
-42
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ManifestTypes } from '../models/index.js';
2-
import { manifest as sectionAliasConditionManifest } from './section-alias.condition.js';
2+
33
import { manifest as switchConditionManifest } from './switch.condition.js';
44

5-
export const manifests: Array<ManifestTypes> = [sectionAliasConditionManifest, switchConditionManifest];
5+
export const manifests: Array<ManifestTypes> = [switchConditionManifest];

src/packages/core/extension-registry/conditions/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import type { CollectionAliasConditionConfig } from '../../collection/collection-alias.manifest.js';
22
import type { CollectionBulkActionPermissionConditionConfig } from '../../collection/collection-bulk-action-permission.manifest.js';
3-
import type { SectionAliasConditionConfig } from './section-alias.condition.js';
43
import type { SwitchConditionConfig } from './switch.condition.js';
54
import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api';
65

76
export type ConditionTypes =
87
| CollectionAliasConditionConfig
98
| CollectionBulkActionPermissionConditionConfig
10-
| SectionAliasConditionConfig
119
| SwitchConditionConfig
1210
| UmbConditionConfigBase;
1311

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './section-user-permission.condition.js';
1+
export type * from './types.js';
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { UmbSectionAliasCondition } from './section-alias.condition.js';
2+
import { UmbSectionUserPermissionCondition } from './section-user-permission.condition.js';
3+
4+
export const manifests: Array<UmbExtensionManifest> = [
5+
{
6+
type: 'condition',
7+
name: 'Section User Permission Condition',
8+
alias: 'Umb.Condition.SectionUserPermission',
9+
api: UmbSectionUserPermissionCondition,
10+
},
11+
{
12+
type: 'condition',
13+
name: 'Section Alias Condition',
14+
alias: 'Umb.Condition.SectionAlias',
15+
api: UmbSectionAliasCondition,
16+
},
17+
];
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { UmbConditionBase } from './condition-base.controller.js';
1+
import { UmbConditionBase } from '../../extension-registry/conditions/condition-base.controller.js';
2+
import type { SectionAliasConditionConfig } from './types.js';
23
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
3-
import type {
4-
ManifestCondition,
5-
UmbConditionConfigBase,
6-
UmbConditionControllerArguments,
7-
UmbExtensionCondition,
8-
} from '@umbraco-cms/backoffice/extension-api';
4+
import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api';
95
import { UMB_SECTION_CONTEXT } from '@umbraco-cms/backoffice/section';
106

117
export class UmbSectionAliasCondition
@@ -35,24 +31,3 @@ export class UmbSectionAliasCondition
3531
}
3632
}
3733
}
38-
39-
export type SectionAliasConditionConfig = UmbConditionConfigBase<'Umb.Condition.SectionAlias'> & {
40-
/**
41-
* Define the section that this extension should be available in
42-
* @example "Umb.Section.Content"
43-
*/
44-
match: string;
45-
/**
46-
* Define one or more workspaces that this extension should be available in
47-
* @example
48-
* ["Umb.Section.Content", "Umb.Section.Media"]
49-
*/
50-
oneOf?: Array<string>;
51-
};
52-
53-
export const manifest: ManifestCondition = {
54-
type: 'condition',
55-
name: 'Section Alias Condition',
56-
alias: 'Umb.Condition.SectionAlias',
57-
api: UmbSectionAliasCondition,
58-
};

src/packages/core/section/conditions/section-user-permission.condition.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,3 @@ export class UmbSectionUserPermissionCondition extends UmbControllerBase impleme
2727
});
2828
}
2929
}
30-
31-
export const manifest = {
32-
type: 'condition',
33-
name: 'Section User Permission Condition',
34-
alias: 'Umb.Condition.SectionUserPermission',
35-
api: UmbSectionUserPermissionCondition,
36-
};

src/packages/core/section/conditions/types.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@ export type UmbSectionUserPermissionConditionConfig = UmbConditionConfigBase<'Um
1010
match: string;
1111
};
1212

13+
export type SectionAliasConditionConfig = UmbConditionConfigBase<'Umb.Condition.SectionAlias'> & {
14+
/**
15+
* Define the section that this extension should be available in
16+
* @example "Umb.Section.Content"
17+
*/
18+
match: string;
19+
/**
20+
* Define one or more workspaces that this extension should be available in
21+
* @example
22+
* ["Umb.Section.Content", "Umb.Section.Media"]
23+
*/
24+
oneOf?: Array<string>;
25+
};
26+
1327
declare global {
1428
interface UmbExtensionConditionMap {
1529
UmbSectionUserPermissionConditionConfig: UmbSectionUserPermissionConditionConfig;
30+
UmbSectionAliasConditionConfig: SectionAliasConditionConfig;
1631
}
1732
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { manifest as sectionUserPermissionConditionManifest } from './conditions/section-user-permission.condition.js';
1+
import { manifests as sectionUserPermissionConditionManifests } from './conditions/manifests.js';
22
import { manifests as repositoryManifests } from './repository/manifests.js';
33

44
export const manifests: Array<UmbExtensionManifest> = [
@@ -8,6 +8,6 @@ export const manifests: Array<UmbExtensionManifest> = [
88
name: 'Section Picker Modal',
99
element: () => import('./section-picker-modal/section-picker-modal.element.js'),
1010
},
11-
sectionUserPermissionConditionManifest,
11+
...sectionUserPermissionConditionManifests,
1212
...repositoryManifests,
1313
];

0 commit comments

Comments
 (0)