@crombolo/backoffice-host 0.53.2 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/approvals-tree.js +105 -0
- package/plugin/content-strip-items.js +20 -10
- package/plugin/definition-tree.js +157 -126
- package/plugin/dictionary-chip.js +233 -0
- package/plugin/dictionary-words-client.js +52 -0
- package/plugin/dictionary-words.js +196 -0
- package/plugin/form-word-input-model.js +33 -13
- package/plugin/form-word-input.js +21 -125
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/settings-cards.js +8 -1
- package/plugin/settings-section.js +43 -18
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/template-picker-modal.js +276 -0
- package/plugin/template-picker-model.js +77 -0
- package/plugin/template-picker.js +43 -0
- package/plugin/tsx-editors.js +5 -0
- package/plugin/tsx-highlighting.js +81 -0
- package/plugin/umbraco-package.json +96 -41
- package/plugin/workflow-client.js +3 -0
- package/plugin/workflow-designer.js +0 -7
- package/plugin/workflow-requests.js +111 -105
- package/plugin/workflow-send-condition.js +2 -0
- package/plugin/workflow-send-model.js +20 -0
- package/plugin/workflow-send-unpublish.js +2 -0
- package/plugin/workflow-send.js +231 -0
- package/plugin/workflow-tab.js +32 -86
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page's template picker shows (`template-picker.js`): every component as
|
|
3
|
+
* a tree of the folders `components/` keeps it in, each saying whether the page's
|
|
4
|
+
* content type allows it, and that tree narrowed to a search. A template's alias
|
|
5
|
+
* is its path, so its folders are the alias's parts before the last `/`. Pure, so
|
|
6
|
+
* each is tested on its own.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A component: `id` is its template's key, null while nothing names it.
|
|
11
|
+
* @typedef {{ id: string | null, name: string, alias: string, allowed: boolean }} TemplateItem
|
|
12
|
+
* @typedef {{ name: string, path: string, folders: TemplateFolder[], items: TemplateItem[] }} TemplateFolder
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** A component's name: the last part of its path. */
|
|
16
|
+
export const componentName = (alias) => alias.slice(alias.lastIndexOf('/') + 1)
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {{ id: string | null, name: string, alias: string }[]} templates
|
|
20
|
+
* @param {string[]} allowedIds
|
|
21
|
+
* @returns {TemplateFolder} the root: its own components, and its folders
|
|
22
|
+
*/
|
|
23
|
+
export function templateTree(templates, allowedIds) {
|
|
24
|
+
const allowed = new Set(allowedIds.map((id) => id.toLowerCase()))
|
|
25
|
+
const root = { name: '', path: '', folders: [], items: [] }
|
|
26
|
+
for (const template of templates) {
|
|
27
|
+
const parts = template.alias.split('/').slice(0, -1)
|
|
28
|
+
let at = root
|
|
29
|
+
for (const part of parts) {
|
|
30
|
+
const path = at.path ? `${at.path}/${part}` : part
|
|
31
|
+
let next = at.folders.find((folder) => folder.name === part)
|
|
32
|
+
if (!next) {
|
|
33
|
+
next = { name: part, path, folders: [], items: [] }
|
|
34
|
+
at.folders.push(next)
|
|
35
|
+
}
|
|
36
|
+
at = next
|
|
37
|
+
}
|
|
38
|
+
at.items.push({
|
|
39
|
+
...template,
|
|
40
|
+
allowed: template.id !== null && allowed.has(template.id.toLowerCase()),
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
const sort = (folder) => {
|
|
44
|
+
folder.folders.sort((a, b) => a.name.localeCompare(b.name))
|
|
45
|
+
folder.items.sort((a, b) => a.name.localeCompare(b.name))
|
|
46
|
+
for (const child of folder.folders) sort(child)
|
|
47
|
+
return folder
|
|
48
|
+
}
|
|
49
|
+
return sort(root)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The tree with only the components whose name or path holds `query`, and the
|
|
54
|
+
* folders that lead to them; the same tree for no query.
|
|
55
|
+
*
|
|
56
|
+
* @param {TemplateFolder} folder
|
|
57
|
+
* @param {string} query
|
|
58
|
+
* @returns {TemplateFolder}
|
|
59
|
+
*/
|
|
60
|
+
export function filterTree(folder, query) {
|
|
61
|
+
const q = query.trim().toLowerCase()
|
|
62
|
+
if (!q) return folder
|
|
63
|
+
const narrow = (at) => ({
|
|
64
|
+
...at,
|
|
65
|
+
items: at.items.filter(
|
|
66
|
+
(item) => item.name.toLowerCase().includes(q) || item.alias.toLowerCase().includes(q),
|
|
67
|
+
),
|
|
68
|
+
folders: at.folders.map(narrow).filter((f) => f.items.length > 0 || f.folders.length > 0),
|
|
69
|
+
})
|
|
70
|
+
return narrow(folder)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The content type's allowed templates with one more, as its update sends them. Pure. */
|
|
74
|
+
export function withAllowed(allowedTemplates, id) {
|
|
75
|
+
const list = allowedTemplates ?? []
|
|
76
|
+
return list.some((t) => t.id.toLowerCase() === id.toLowerCase()) ? list : [...list, { id }]
|
|
77
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page's template picker (the Info view's "Choose"): a panel that slides in, as
|
|
3
|
+
* Umbraco's pickers do, with every component in a tree of its folders
|
|
4
|
+
* (`template-picker-modal.js`). The fork asks for it through
|
|
5
|
+
* `umbCromboloHooks.pickTemplate`.
|
|
6
|
+
*/
|
|
7
|
+
import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user'
|
|
8
|
+
|
|
9
|
+
export const TEMPLATE_PICKER_MODAL = 'Crombolo.Modal.TemplatePicker'
|
|
10
|
+
const STRUCTURE = 'Crombolo.Section.Structure'
|
|
11
|
+
|
|
12
|
+
/** Whether the reader may change a content type: Structure, which Settings brings. */
|
|
13
|
+
async function mayChangeTypes(host) {
|
|
14
|
+
const context = await host.getContext?.(UMB_CURRENT_USER_CONTEXT).catch(() => undefined)
|
|
15
|
+
if (!context) return false
|
|
16
|
+
const user = await new Promise((resolve) => {
|
|
17
|
+
const subscription = context.currentUser.subscribe((current) => {
|
|
18
|
+
resolve(current)
|
|
19
|
+
queueMicrotask(() => subscription.unsubscribe())
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
return user?.isAdmin === true || (user?.allowedSections ?? []).includes(STRUCTURE)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const onInit = async (_host, extensionRegistry) => {
|
|
26
|
+
extensionRegistry.register({
|
|
27
|
+
type: 'modal',
|
|
28
|
+
alias: TEMPLATE_PICKER_MODAL,
|
|
29
|
+
name: 'Crombolo Template Picker',
|
|
30
|
+
element: () => import('./template-picker-modal.js'),
|
|
31
|
+
})
|
|
32
|
+
const [{ umbCromboloHooks }, { UmbModalToken, umbOpenModal }] = await Promise.all([
|
|
33
|
+
import('@umbraco-cms/backoffice/extension-registry'),
|
|
34
|
+
import('@umbraco-cms/backoffice/modal'),
|
|
35
|
+
])
|
|
36
|
+
const token = new UmbModalToken(TEMPLATE_PICKER_MODAL, {
|
|
37
|
+
modal: { type: 'sidebar', size: 'medium' },
|
|
38
|
+
})
|
|
39
|
+
umbCromboloHooks.pickTemplate = async (host, args) =>
|
|
40
|
+
umbOpenModal(host, token, {
|
|
41
|
+
data: { ...args, mayAllow: await mayChangeTypes(host) },
|
|
42
|
+
}).catch(() => undefined)
|
|
43
|
+
}
|
package/plugin/tsx-editors.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* (an import as well as a tag) and Razor's sections, are hidden.
|
|
12
12
|
*/
|
|
13
13
|
import { PartialViewService, TemplateService } from '@umbraco-cms/backoffice/external/backend-api'
|
|
14
|
+
import { highlightJsx } from './tsx-highlighting.js'
|
|
14
15
|
import { toTsxSnippet } from './tsx-snippets.js'
|
|
15
16
|
import {
|
|
16
17
|
fileBeingCreated,
|
|
@@ -120,6 +121,7 @@ async function typeLibs() {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
let loaded
|
|
124
|
+
let highlighted
|
|
123
125
|
|
|
124
126
|
/**
|
|
125
127
|
* Configures monaco's TypeScript service for TSX, and reports both monaco and
|
|
@@ -143,6 +145,9 @@ async function configureTsx() {
|
|
|
143
145
|
const ts = monaco.typescript ?? monaco.languages?.typescript
|
|
144
146
|
if (!ts) throw new Error('monaco exposes no TypeScript service')
|
|
145
147
|
const { JsxEmit, ModuleKind, ScriptTarget, typescriptDefaults } = ts
|
|
148
|
+
// Colours the markup, which monaco's TypeScript grammar leaves plain.
|
|
149
|
+
highlighted ??= highlightJsx(monaco)
|
|
150
|
+
await highlighted
|
|
146
151
|
const { libs, jsxImportSource } = await typeLibs()
|
|
147
152
|
// The site's `apps/site/tsconfig.json`, so that what the editor underlines
|
|
148
153
|
// is what `tsc` would report and nothing else — down to the JSX mode the
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colours JSX in a view's code editor. monaco's TypeScript highlighting has no
|
|
3
|
+
* rules for markup, so `<div className="x">` read as plain text in a TSX file;
|
|
4
|
+
* `withJsx` adds them to its grammar: tags, attributes and their values, and
|
|
5
|
+
* `{…}` inside markup, which is TypeScript again. A `<` right after a name is a
|
|
6
|
+
* type argument, `useState<string>`, never a tag: monaco's grammar matches from
|
|
7
|
+
* where it is and cannot look back, so the name and its `<` are read together. Pure.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** A name with `<` straight after it: a type argument, as in `useState<string>`. */
|
|
11
|
+
export const TYPE_ARGUMENTS = /([A-Za-z_$][\w$]*)(<)/
|
|
12
|
+
/** A tag starts at `<` and a name, or `<>` for a fragment. */
|
|
13
|
+
export const TAG_START = /(<)([A-Za-z_$][\w$.:-]*)(?=[\s/>])/
|
|
14
|
+
const FRAGMENT_START = /(<)(>)/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* monaco's TypeScript grammar, as its loader gives it, with JSX states added.
|
|
18
|
+
*
|
|
19
|
+
* @param {{ tokenizer: Record<string, unknown[]> } & Record<string, unknown>} language
|
|
20
|
+
*/
|
|
21
|
+
export function withJsx(language) {
|
|
22
|
+
const root = language.tokenizer.root ?? []
|
|
23
|
+
return {
|
|
24
|
+
...language,
|
|
25
|
+
tokenizer: {
|
|
26
|
+
...language.tokenizer,
|
|
27
|
+
root: [
|
|
28
|
+
[
|
|
29
|
+
TYPE_ARGUMENTS,
|
|
30
|
+
[{ cases: { '@keywords': 'keyword', '@default': 'identifier' } }, 'delimiter.bracket'],
|
|
31
|
+
],
|
|
32
|
+
[TAG_START, ['delimiter.html', { token: 'tag', next: '@jsxTag' }]],
|
|
33
|
+
[FRAGMENT_START, ['delimiter.html', { token: 'delimiter.html', next: '@jsxChildren' }]],
|
|
34
|
+
...root,
|
|
35
|
+
],
|
|
36
|
+
// Inside an opening tag: attributes until `>` (children follow) or `/>`.
|
|
37
|
+
jsxTag: [
|
|
38
|
+
[/\s+/, ''],
|
|
39
|
+
[/\/>/, { token: 'delimiter.html', next: '@pop' }],
|
|
40
|
+
[/>/, { token: 'delimiter.html', switchTo: '@jsxChildren' }],
|
|
41
|
+
[/[A-Za-z_$][\w$:-]*/, 'attribute.name'],
|
|
42
|
+
[/=/, 'delimiter'],
|
|
43
|
+
[/"[^"]*"/, 'attribute.value'],
|
|
44
|
+
[/'[^']*'/, 'attribute.value'],
|
|
45
|
+
[/\{/, { token: 'delimiter.bracket', next: '@jsxExpression' }],
|
|
46
|
+
],
|
|
47
|
+
// Between an opening tag and its closing one: text, nested tags, `{…}`.
|
|
48
|
+
jsxChildren: [
|
|
49
|
+
[
|
|
50
|
+
/(<\/)([A-Za-z_$][\w$.:-]*)?(>)/,
|
|
51
|
+
['delimiter.html', 'tag', { token: 'delimiter.html', next: '@pop' }],
|
|
52
|
+
],
|
|
53
|
+
[/(<)([A-Za-z_$][\w$.:-]*)/, ['delimiter.html', { token: 'tag', next: '@jsxTag' }]],
|
|
54
|
+
[/(<)(>)/, ['delimiter.html', { token: 'delimiter.html', next: '@jsxChildren' }]],
|
|
55
|
+
[/\{/, { token: 'delimiter.bracket', next: '@jsxExpression' }],
|
|
56
|
+
[/[^<{]+/, ''],
|
|
57
|
+
],
|
|
58
|
+
// TypeScript inside `{…}`, which may hold markup of its own.
|
|
59
|
+
jsxExpression: [
|
|
60
|
+
[/\{/, { token: 'delimiter.bracket', next: '@jsxExpression' }],
|
|
61
|
+
[/\}/, { token: 'delimiter.bracket', next: '@pop' }],
|
|
62
|
+
{ include: '@root' },
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Puts JSX into monaco's `typescript` grammar, once. monaco sets the grammar when
|
|
70
|
+
* a language is first used, so it is used first, and ours goes in after it.
|
|
71
|
+
*/
|
|
72
|
+
export async function highlightJsx(monaco) {
|
|
73
|
+
const typescript = monaco.languages.getLanguages().find((l) => l.id === 'typescript')
|
|
74
|
+
if (!typescript?.loader) return false
|
|
75
|
+
monaco.editor.createModel('', 'typescript').dispose()
|
|
76
|
+
const { language } = await typescript.loader()
|
|
77
|
+
// Let monaco's own registration, queued by the model above, land first.
|
|
78
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
79
|
+
monaco.languages.setMonarchTokensProvider('typescript', withJsx(language))
|
|
80
|
+
return true
|
|
81
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "../../backoffice-dist/dist/umbraco-package-schema.json",
|
|
3
3
|
"name": "Crombolo",
|
|
4
4
|
"id": "Crombolo.Core",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.54.1",
|
|
6
6
|
"allowPublicAccess": false,
|
|
7
7
|
"extensions": [
|
|
8
8
|
{
|
|
@@ -613,6 +613,41 @@
|
|
|
613
613
|
"forEntityTypes": ["document-type-root", "document-type-folder"],
|
|
614
614
|
"meta": { "icon": "icon-autofill", "label": "Form" }
|
|
615
615
|
},
|
|
616
|
+
{
|
|
617
|
+
"type": "menuItem",
|
|
618
|
+
"alias": "Crombolo.MenuItem.Forms",
|
|
619
|
+
"name": "Crombolo Forms In Structure",
|
|
620
|
+
"weight": 500,
|
|
621
|
+
"element": "/crombolo-plugin/definition-tree.js",
|
|
622
|
+
"meta": {
|
|
623
|
+
"menus": ["Umb.Menu.StructureSettings"],
|
|
624
|
+
"label": "Forms",
|
|
625
|
+
"icon": "icon-autofill",
|
|
626
|
+
"kind": "Forms"
|
|
627
|
+
},
|
|
628
|
+
"conditions": [
|
|
629
|
+
{ "alias": "Umb.Condition.SectionUserPermission", "match": "Crombolo.Section.Forms" }
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"type": "menuItem",
|
|
634
|
+
"alias": "Crombolo.MenuItem.Workflows",
|
|
635
|
+
"name": "Crombolo Workflows In Structure",
|
|
636
|
+
"weight": 450,
|
|
637
|
+
"element": "/crombolo-plugin/definition-tree.js",
|
|
638
|
+
"meta": {
|
|
639
|
+
"menus": ["Umb.Menu.StructureSettings"],
|
|
640
|
+
"label": "Workflows",
|
|
641
|
+
"icon": "icon-mindmap",
|
|
642
|
+
"kind": "Workflows"
|
|
643
|
+
},
|
|
644
|
+
"conditions": [
|
|
645
|
+
{
|
|
646
|
+
"alias": "Umb.Condition.SectionUserPermission",
|
|
647
|
+
"match": "Crombolo.Section.WorkflowSetup"
|
|
648
|
+
}
|
|
649
|
+
]
|
|
650
|
+
},
|
|
616
651
|
{
|
|
617
652
|
"type": "sectionSidebarApp",
|
|
618
653
|
"alias": "Crombolo.SectionSidebarApp.DefinitionTree",
|
|
@@ -702,6 +737,18 @@
|
|
|
702
737
|
"name": "Crombolo Sign-in Button",
|
|
703
738
|
"js": "/crombolo-plugin/branding/sign-in.js"
|
|
704
739
|
},
|
|
740
|
+
{
|
|
741
|
+
"type": "backofficeEntryPoint",
|
|
742
|
+
"alias": "Crombolo.EntryPoint.TemplatePicker",
|
|
743
|
+
"name": "Crombolo Template Picker In Folders",
|
|
744
|
+
"js": "/crombolo-plugin/template-picker.js"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"type": "backofficeEntryPoint",
|
|
748
|
+
"alias": "Crombolo.EntryPoint.DictionaryWords",
|
|
749
|
+
"name": "Crombolo Dictionary Words As Chips",
|
|
750
|
+
"js": "/crombolo-plugin/dictionary-words.js"
|
|
751
|
+
},
|
|
705
752
|
{
|
|
706
753
|
"type": "backofficeEntryPoint",
|
|
707
754
|
"alias": "Crombolo.EntryPoint.NotificationsDialog",
|
|
@@ -759,40 +806,14 @@
|
|
|
759
806
|
"meta": {
|
|
760
807
|
"label": "Approvals",
|
|
761
808
|
"pathname": "workflow"
|
|
762
|
-
}
|
|
763
|
-
"conditions": [{ "alias": "Crombolo.Condition.ApprovalsActive" }]
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
"type": "sectionView",
|
|
767
|
-
"alias": "Crombolo.SectionView.Workflow.Waiting",
|
|
768
|
-
"name": "Crombolo Workflow Waiting",
|
|
769
|
-
"element": "/crombolo-plugin/workflow-requests.js",
|
|
770
|
-
"elementName": "crombolo-workflow-waiting",
|
|
771
|
-
"weight": 400,
|
|
772
|
-
"meta": {
|
|
773
|
-
"label": "Waiting for me",
|
|
774
|
-
"pathname": "waiting",
|
|
775
|
-
"icon": "icon-inbox"
|
|
776
|
-
},
|
|
777
|
-
"conditions": [
|
|
778
|
-
{
|
|
779
|
-
"alias": "Umb.Condition.SectionAlias",
|
|
780
|
-
"match": "Crombolo.Section.Workflow"
|
|
781
|
-
}
|
|
782
|
-
]
|
|
809
|
+
}
|
|
783
810
|
},
|
|
784
811
|
{
|
|
785
|
-
"type": "
|
|
786
|
-
"alias": "Crombolo.
|
|
787
|
-
"name": "Crombolo
|
|
788
|
-
"element": "/crombolo-plugin/
|
|
789
|
-
"
|
|
790
|
-
"weight": 300,
|
|
791
|
-
"meta": {
|
|
792
|
-
"label": "In flight",
|
|
793
|
-
"pathname": "in-flight",
|
|
794
|
-
"icon": "icon-time"
|
|
795
|
-
},
|
|
812
|
+
"type": "sectionSidebarApp",
|
|
813
|
+
"alias": "Crombolo.SectionSidebarApp.ApprovalsTree",
|
|
814
|
+
"name": "Crombolo Approvals Tree",
|
|
815
|
+
"element": "/crombolo-plugin/approvals-tree.js",
|
|
816
|
+
"weight": 100,
|
|
796
817
|
"conditions": [
|
|
797
818
|
{
|
|
798
819
|
"alias": "Umb.Condition.SectionAlias",
|
|
@@ -802,15 +823,16 @@
|
|
|
802
823
|
},
|
|
803
824
|
{
|
|
804
825
|
"type": "sectionView",
|
|
805
|
-
"alias": "Crombolo.SectionView.Workflow.
|
|
806
|
-
"name": "Crombolo
|
|
826
|
+
"alias": "Crombolo.SectionView.Workflow.Requests",
|
|
827
|
+
"name": "Crombolo Approvals List",
|
|
807
828
|
"element": "/crombolo-plugin/workflow-requests.js",
|
|
808
|
-
"elementName": "crombolo-
|
|
809
|
-
"weight":
|
|
829
|
+
"elementName": "crombolo-approvals-list",
|
|
830
|
+
"weight": 400,
|
|
810
831
|
"meta": {
|
|
811
|
-
"label": "
|
|
812
|
-
"pathname": "
|
|
813
|
-
"
|
|
832
|
+
"label": "Approvals",
|
|
833
|
+
"pathname": "approvals",
|
|
834
|
+
"noTab": true,
|
|
835
|
+
"icon": "icon-inbox"
|
|
814
836
|
},
|
|
815
837
|
"conditions": [
|
|
816
838
|
{
|
|
@@ -837,10 +859,43 @@
|
|
|
837
859
|
"match": "Crombolo.Section.Forms"
|
|
838
860
|
},
|
|
839
861
|
{
|
|
840
|
-
"alias": "Umb.Condition.
|
|
862
|
+
"alias": "Umb.Condition.SectionUserPermission",
|
|
863
|
+
"match": "Crombolo.Section.WorkflowSetup"
|
|
841
864
|
}
|
|
842
865
|
]
|
|
843
866
|
},
|
|
867
|
+
{
|
|
868
|
+
"type": "condition",
|
|
869
|
+
"alias": "Crombolo.Condition.Document.MaySendForApproval",
|
|
870
|
+
"name": "Crombolo May Send For Approval Condition",
|
|
871
|
+
"api": "/crombolo-plugin/workflow-send-condition.js"
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
"type": "workspaceAction",
|
|
875
|
+
"kind": "default",
|
|
876
|
+
"alias": "Crombolo.WorkspaceAction.Document.SendForApproval",
|
|
877
|
+
"name": "Crombolo Send For Approval",
|
|
878
|
+
"weight": 75,
|
|
879
|
+
"api": "/crombolo-plugin/workflow-send.js",
|
|
880
|
+
"meta": { "label": "Send for approval", "look": "secondary" },
|
|
881
|
+
"conditions": [
|
|
882
|
+
{ "alias": "Umb.Condition.WorkspaceAlias", "match": "Umb.Workspace.Document" },
|
|
883
|
+
{ "alias": "Crombolo.Condition.Document.MaySendForApproval", "action": "publish" }
|
|
884
|
+
]
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"type": "workspaceActionMenuItem",
|
|
888
|
+
"kind": "default",
|
|
889
|
+
"alias": "Crombolo.WorkspaceActionMenuItem.Document.RequestUnpublish",
|
|
890
|
+
"name": "Crombolo Request Unpublish",
|
|
891
|
+
"weight": 5,
|
|
892
|
+
"api": "/crombolo-plugin/workflow-send-unpublish.js",
|
|
893
|
+
"forWorkspaceActions": "Umb.WorkspaceAction.Document.SaveAndPublish",
|
|
894
|
+
"meta": { "label": "Request unpublish", "icon": "icon-globe" },
|
|
895
|
+
"conditions": [
|
|
896
|
+
{ "alias": "Crombolo.Condition.Document.MaySendForApproval", "action": "unpublish" }
|
|
897
|
+
]
|
|
898
|
+
},
|
|
844
899
|
{
|
|
845
900
|
"type": "workspaceView",
|
|
846
901
|
"alias": "Crombolo.WorkspaceView.Document.Workflow",
|
|
@@ -28,6 +28,9 @@ export const decide = (requestKey, verb, body) =>
|
|
|
28
28
|
export const waitingForMe = () => call('waiting')
|
|
29
29
|
export const inFlight = () => call('in-flight')
|
|
30
30
|
export const finished = (skip = 0, take = 25) => call(`history?skip=${skip}&take=${take}`)
|
|
31
|
+
/** A page of requests: the pending, the decided, or both. */
|
|
32
|
+
export const requestList = ({ pending, decided }, skip = 0, take = 25) =>
|
|
33
|
+
call(`requests?pending=${pending}&decided=${decided}&skip=${skip}&take=${take}`)
|
|
31
34
|
export const listWorkflows = () => call('workflows')
|
|
32
35
|
export const previewWorkflow = (alias, workflow) =>
|
|
33
36
|
post(`workflows/${encodeURIComponent(alias)}/preview`, { workflow })
|
|
@@ -358,13 +358,7 @@ export default class CromboloWorkflowDesignerElement extends UmbLitElement {
|
|
|
358
358
|
|
|
359
359
|
#renderList() {
|
|
360
360
|
const { items, editable } = this._list
|
|
361
|
-
// The create button above the list, as the Created bundles view has it.
|
|
362
361
|
return html`<div class="list">
|
|
363
|
-
${
|
|
364
|
-
editable
|
|
365
|
-
? html`<uui-button class="create" color="default" look="outline" label="Create" @click=${() => this.#edit(blank())}>Create</uui-button>`
|
|
366
|
-
: nothing
|
|
367
|
-
}
|
|
368
362
|
${this._message ? html`<uui-box><p class="message">${this._message}</p></uui-box>` : nothing}
|
|
369
363
|
<uui-box headline="Workflows">
|
|
370
364
|
${this.#readOnly()}
|
|
@@ -669,7 +663,6 @@ export default class CromboloWorkflowDesignerElement extends UmbLitElement {
|
|
|
669
663
|
static styles = css`
|
|
670
664
|
:host { display: block; height: 100%; container-type: inline-size; }
|
|
671
665
|
.list { padding: var(--uui-size-layout-1); }
|
|
672
|
-
.create { margin-bottom: var(--uui-size-space-5); }
|
|
673
666
|
.actions { text-align: right; white-space: nowrap; }
|
|
674
667
|
uui-tab-group { --uui-tab-divider: var(--uui-color-border); border-left: 1px solid var(--uui-color-border); border-right: 1px solid var(--uui-color-border); }
|
|
675
668
|
.notice { margin-bottom: var(--uui-size-layout-1); }
|