@conduction/nextcloud-vue 2.120.0 → 2.121.0
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/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +53 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +546 -523
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/useNamedSource.js +9 -0
- package/dist/esm/components/CnIndexPage/useNamedSource.js.map +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +9 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +214 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +125 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue.js +9 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue.js.map +1 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue2.js +163 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue3.js +131 -0
- package/dist/esm/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnSchemaRulesWidget/schemaRules.js +127 -0
- package/dist/esm/components/CnSchemaRulesWidget/schemaRules.js.map +1 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue.js +9 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue.js.map +1 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue2.js +82 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue2.js.map +1 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue3.js +61 -0
- package/dist/esm/components/CnSearchIndexStatus/CnSearchIndexStatus.vue3.js.map +1 -0
- package/dist/esm/components/CnSearchIndexStatus/searchIndexStatus.js +60 -0
- package/dist/esm/components/CnSearchIndexStatus/searchIndexStatus.js.map +1 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue.js +10 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue.js.map +1 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue2.js +226 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue2.js.map +1 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue3.js +126 -0
- package/dist/esm/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue3.js.map +1 -0
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +42 -32
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
- package/dist/esm/composables/indexSources.js +116 -16
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +42 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +42 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +147 -0
- package/dist/esm/utils/libraryWidgetKeys.js +1 -0
- package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +14135 -12578
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +147 -0
- package/l10n/en.json +42 -1
- package/l10n/nl.json +42 -1
- package/package.json +1 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +74 -3
- package/src/components/CnIndexPage/useNamedSource.js +9 -0
- package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +335 -0
- package/src/components/CnReadinessChecklist/index.js +9 -0
- package/src/components/CnSchemaRulesWidget/CnSchemaRulesWidget.vue +300 -0
- package/src/components/CnSchemaRulesWidget/index.js +10 -0
- package/src/components/CnSchemaRulesWidget/schemaRules.js +123 -0
- package/src/components/CnSearchIndexStatus/CnSearchIndexStatus.vue +160 -0
- package/src/components/CnSearchIndexStatus/index.js +10 -0
- package/src/components/CnSearchIndexStatus/searchIndexStatus.js +56 -0
- package/src/components/CnShippedConfigurationSection/CnShippedConfigurationSection.vue +328 -0
- package/src/components/CnShippedConfigurationSection/index.js +9 -0
- package/src/components/CnWidgetGrid/registerDashboardWidgets.js +10 -0
- package/src/components/index.js +4 -0
- package/src/composables/indexSources.js +116 -16
- package/src/css/index-page.css +7 -0
- package/src/index.js +4 -0
- package/src/utils/libraryWidgetKeys.js +1 -0
|
@@ -37,6 +37,7 @@ import CnRelatedObjectsWidgetForm from '../CnRelatedObjectsWidgetForm/CnRelatedO
|
|
|
37
37
|
import CnRetentionWidget from '../CnRetentionWidget/CnRetentionWidget.vue'
|
|
38
38
|
import CnSavedViewWidget2 from '../CnSavedViewWidget/CnSavedViewWidget.vue'
|
|
39
39
|
import CnSavedViewWidgetForm2 from '../CnSavedViewWidgetForm/CnSavedViewWidgetForm.vue'
|
|
40
|
+
import CnSchemaRulesWidget from '../CnSchemaRulesWidget/CnSchemaRulesWidget.vue'
|
|
40
41
|
import CnStackedBarWidget from '../CnStackedBarWidget/CnStackedBarWidget.vue'
|
|
41
42
|
import CnStackedBarWidgetForm from '../CnStackedBarWidgetForm/CnStackedBarWidgetForm.vue'
|
|
42
43
|
import CnStagesWidget from '../CnStagesWidget/CnStagesWidget.vue'
|
|
@@ -311,6 +312,15 @@ registerDashboardWidget('retention', {
|
|
|
311
312
|
ownsTitle: true,
|
|
312
313
|
})
|
|
313
314
|
|
|
315
|
+
registerDashboardWidget('schema-rules', {
|
|
316
|
+
renderer: CnSchemaRulesWidget,
|
|
317
|
+
form: null,
|
|
318
|
+
defaultContent: { register: '', schema: '', objectId: '' },
|
|
319
|
+
displayName: 'Schema rules',
|
|
320
|
+
icon: 'ScaleBalance',
|
|
321
|
+
surfaces: ['detail-page'],
|
|
322
|
+
})
|
|
323
|
+
|
|
314
324
|
registerDashboardWidget('plan', {
|
|
315
325
|
renderer: CnPlanWidget,
|
|
316
326
|
form: null,
|
package/src/components/index.js
CHANGED
|
@@ -464,3 +464,7 @@ export { CnBrandStripe } from './CnBrandStripe/index.js'
|
|
|
464
464
|
export { CnDuplicateWarning } from './CnDuplicateWarning/index.js'
|
|
465
465
|
export { CnEndpointNotice } from './CnEndpointNotice/index.js'
|
|
466
466
|
export { CnCountTablesReport } from './CnCountTablesReport/index.js'
|
|
467
|
+
export { CnShippedConfigurationSection } from './CnShippedConfigurationSection/index.js'
|
|
468
|
+
export { CnSearchIndexStatus } from './CnSearchIndexStatus/index.js'
|
|
469
|
+
export { CnSchemaRulesWidget } from './CnSchemaRulesWidget/index.js'
|
|
470
|
+
export { CnReadinessChecklist } from './CnReadinessChecklist/index.js'
|
|
@@ -737,6 +737,14 @@ function readRowsPath(body, path) {
|
|
|
737
737
|
return String(path).split('.').reduce((value, key) => (value && typeof value === 'object' ? value[key] : undefined), body)
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
+
/**
|
|
741
|
+
* The `sourceConfig` keys the endpoint source reads itself; every other key
|
|
742
|
+
* goes along as a query parameter.
|
|
743
|
+
*
|
|
744
|
+
* @type {Array<string>}
|
|
745
|
+
*/
|
|
746
|
+
const ENDPOINT_SOURCE_KEYS = ['url', 'rowsPath', 'totalPath', 'searchParam', 'searchFields', 'notePath', 'noteText', 'refusedText']
|
|
747
|
+
|
|
740
748
|
/**
|
|
741
749
|
* The endpoint source: rows from an app's own endpoint
|
|
742
750
|
* (`entitySource: "endpoint"`), for a list that is not OpenRegister objects,
|
|
@@ -759,25 +767,46 @@ function readRowsPath(body, path) {
|
|
|
759
767
|
* request with that tab's filter, its total read at `sourceConfig.totalPath`
|
|
760
768
|
* (`total` by default), else the number of rows the answer holds.
|
|
761
769
|
*
|
|
770
|
+
* Three more keys shape what the page says around the rows:
|
|
771
|
+
* - `searchParam`: the page's search box sends its term as this parameter
|
|
772
|
+
* (`sender`), so the endpoint does the searching.
|
|
773
|
+
* - `notePath` and `noteText`: a value read off the answer (`filterOrder`) and
|
|
774
|
+
* the sentence it is said in ("Filters run in this order: {order}", its one
|
|
775
|
+
* placeholder taking the value); a list
|
|
776
|
+
* is joined with commas. Shown above the rows.
|
|
777
|
+
* - `refusedText`: what a refused load (403) says when the endpoint gave no
|
|
778
|
+
* `message` of its own. A refusal is not an empty list, so the page shows it
|
|
779
|
+
* instead of the rows, and a failed load is not one either.
|
|
780
|
+
* - `searchFields`: the filters the endpoint takes, in the same shape a
|
|
781
|
+
* registered source declares them (`{ status: { param: 'status', single:
|
|
782
|
+
* true } }`), so a filter strip or sidebar on the page narrows the
|
|
783
|
+
* endpoint's query.
|
|
784
|
+
*
|
|
785
|
+
* @param {object} [declared] The page's `sourceConfig`, for `searchParam` and `searchFields`.
|
|
786
|
+
* @param {object} [context] The page's helpers; `translate` is the app's catalogue.
|
|
762
787
|
* @return {object} The source adapter.
|
|
763
788
|
* @spec openspec/changes/index-endpoint-source/specs/index-page/spec.md#requirement-an-index-page-can-list-rows-from-an-app-endpoint
|
|
764
789
|
*/
|
|
765
|
-
function endpointSource() {
|
|
766
|
-
const state = reactive({ rows: [], loading: false })
|
|
790
|
+
function endpointSource(declared = {}, context = {}) {
|
|
791
|
+
const state = reactive({ rows: [], loading: false, refusal: '', failed: false, note: '' })
|
|
792
|
+
const translate = typeof context.translate === 'function' ? context.translate : (text) => text
|
|
793
|
+
const searchParam = typeof declared.searchParam === 'string' && declared.searchParam !== '' ? declared.searchParam : null
|
|
794
|
+
const searchFields = declared.searchFields && typeof declared.searchFields === 'object' && !Array.isArray(declared.searchFields) ? declared.searchFields : null
|
|
767
795
|
let seq = 0
|
|
768
796
|
let warned = false
|
|
769
797
|
|
|
770
798
|
/**
|
|
771
|
-
* The query parameters for a config: every key but the
|
|
772
|
-
* empty values left out, a list joined by
|
|
799
|
+
* The query parameters for a config: every key but the source's own
|
|
800
|
+
* (`url`, the paths, the texts), empty values left out, a list joined by
|
|
801
|
+
* commas.
|
|
773
802
|
*
|
|
774
|
-
* @param {object}
|
|
803
|
+
* @param {object} config The config.
|
|
775
804
|
* @return {object} The parameters.
|
|
776
805
|
*/
|
|
777
|
-
const paramsOf = (
|
|
806
|
+
const paramsOf = (config) => {
|
|
778
807
|
const params = {}
|
|
779
|
-
for (const [key, value] of Object.entries(
|
|
780
|
-
if (value === undefined || value === null || value === '') {
|
|
808
|
+
for (const [key, value] of Object.entries(config)) {
|
|
809
|
+
if (ENDPOINT_SOURCE_KEYS.includes(key) || value === undefined || value === null || value === '') {
|
|
781
810
|
continue
|
|
782
811
|
}
|
|
783
812
|
params[key] = Array.isArray(value) ? value.join(',') : (typeof value === 'object' ? JSON.stringify(value) : value)
|
|
@@ -797,15 +826,61 @@ function endpointSource() {
|
|
|
797
826
|
return typeof url === 'string' && url !== '' && !Object.hasOwn(config, 'entitySource')
|
|
798
827
|
}
|
|
799
828
|
|
|
829
|
+
/**
|
|
830
|
+
* The note read off an answer, in the page's sentence.
|
|
831
|
+
*
|
|
832
|
+
* @param {object} body The response body.
|
|
833
|
+
* @param {string} [path] Where the value sits.
|
|
834
|
+
* @param {string} [text] The sentence, with one `{placeholder}` where the value goes.
|
|
835
|
+
* @return {string} The note, or '' when there is nothing to say.
|
|
836
|
+
*/
|
|
837
|
+
const noteOf = (body, path, text) => {
|
|
838
|
+
if (!path || !body || typeof body !== 'object' || Array.isArray(body)) {
|
|
839
|
+
return ''
|
|
840
|
+
}
|
|
841
|
+
const raw = readRowsPath(body, path)
|
|
842
|
+
const value = Array.isArray(raw) ? raw.filter((v) => v !== null && v !== undefined && v !== '').join(', ') : (raw === null || raw === undefined ? '' : String(raw))
|
|
843
|
+
if (value === '') {
|
|
844
|
+
return ''
|
|
845
|
+
}
|
|
846
|
+
return text ? translate(text).replace(/\{\w+\}/, value) : value
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* The sentence a refused load is said in: the endpoint's own, else the
|
|
851
|
+
* page's, else the library's.
|
|
852
|
+
*
|
|
853
|
+
* @param {object} body The refusal's body.
|
|
854
|
+
* @param {string} [text] The page's `refusedText`.
|
|
855
|
+
* @return {string} The sentence.
|
|
856
|
+
*/
|
|
857
|
+
const refusalOf = (body, text) => {
|
|
858
|
+
if (body && typeof body.message === 'string' && body.message.trim() !== '') {
|
|
859
|
+
return body.message
|
|
860
|
+
}
|
|
861
|
+
return text ? translate(text) : t('nextcloud-vue', 'You may not read this list.')
|
|
862
|
+
}
|
|
863
|
+
|
|
800
864
|
return {
|
|
865
|
+
/**
|
|
866
|
+
* The parameter the page's search term is sent as, or null when this
|
|
867
|
+
* endpoint takes no search.
|
|
868
|
+
*/
|
|
869
|
+
searchParam,
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* The page filters this endpoint takes, and the parameter each becomes.
|
|
873
|
+
*/
|
|
874
|
+
searchFields,
|
|
875
|
+
|
|
801
876
|
/**
|
|
802
877
|
* Fetch the rows.
|
|
803
878
|
*
|
|
804
879
|
* @param {object} config The page's source config with the tab filter merged in.
|
|
805
|
-
* @return {Promise<void>} Resolves when loaded; a failed request leaves no rows and rethrows.
|
|
880
|
+
* @return {Promise<void>} Resolves when loaded or refused; a failed request leaves no rows and rethrows.
|
|
806
881
|
*/
|
|
807
882
|
load: async (config) => {
|
|
808
|
-
const { url, rowsPath,
|
|
883
|
+
const { url, rowsPath, notePath, noteText, refusedText } = config || {}
|
|
809
884
|
const mine = ++seq
|
|
810
885
|
if (!requestable(config)) {
|
|
811
886
|
state.rows = []
|
|
@@ -817,7 +892,7 @@ function endpointSource() {
|
|
|
817
892
|
}
|
|
818
893
|
return
|
|
819
894
|
}
|
|
820
|
-
const params = paramsOf(
|
|
895
|
+
const params = paramsOf(config)
|
|
821
896
|
state.loading = true
|
|
822
897
|
try {
|
|
823
898
|
const { default: axios } = await import('@nextcloud/axios')
|
|
@@ -826,12 +901,22 @@ function endpointSource() {
|
|
|
826
901
|
const rows = Array.isArray(body) ? body : readRowsPath(body, rowsPath || 'results')
|
|
827
902
|
if (mine === seq) {
|
|
828
903
|
state.rows = Array.isArray(rows) ? rows : []
|
|
904
|
+
state.refusal = ''
|
|
905
|
+
state.failed = false
|
|
906
|
+
state.note = noteOf(body, notePath, noteText)
|
|
829
907
|
}
|
|
830
908
|
} catch (error) {
|
|
831
|
-
if (mine
|
|
832
|
-
|
|
909
|
+
if (mine !== seq) {
|
|
910
|
+
return
|
|
911
|
+
}
|
|
912
|
+
state.rows = []
|
|
913
|
+
state.note = ''
|
|
914
|
+
const refused = error && error.response && error.response.status === 403
|
|
915
|
+
state.refusal = refused ? refusalOf(error.response.data, refusedText) : ''
|
|
916
|
+
state.failed = !refused
|
|
917
|
+
if (!refused) {
|
|
918
|
+
throw error
|
|
833
919
|
}
|
|
834
|
-
throw error
|
|
835
920
|
} finally {
|
|
836
921
|
if (mine === seq) {
|
|
837
922
|
state.loading = false
|
|
@@ -850,9 +935,9 @@ function endpointSource() {
|
|
|
850
935
|
if (!requestable(config)) {
|
|
851
936
|
return Number.NaN
|
|
852
937
|
}
|
|
853
|
-
const { url, rowsPath, totalPath
|
|
938
|
+
const { url, rowsPath, totalPath } = config
|
|
854
939
|
const { default: axios } = await import('@nextcloud/axios')
|
|
855
|
-
const res = await axios.get(generateUrl(url), { params: paramsOf(
|
|
940
|
+
const res = await axios.get(generateUrl(url), { params: paramsOf(config) })
|
|
856
941
|
const body = res ? res.data : null
|
|
857
942
|
const total = body && typeof body === 'object' && !Array.isArray(body) ? readRowsPath(body, totalPath || 'total') : undefined
|
|
858
943
|
if (typeof total === 'number' && Number.isFinite(total)) {
|
|
@@ -871,6 +956,21 @@ function endpointSource() {
|
|
|
871
956
|
* @return {boolean} Whether a load is in flight.
|
|
872
957
|
*/
|
|
873
958
|
loading: () => state.loading,
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* @return {string} The sentence the last load was refused with, or ''.
|
|
962
|
+
*/
|
|
963
|
+
refusal: () => state.refusal,
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* @return {boolean} Whether the last load failed for another reason than a refusal.
|
|
967
|
+
*/
|
|
968
|
+
failed: () => state.failed,
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* @return {string} The note read off the last answer, or ''.
|
|
972
|
+
*/
|
|
973
|
+
note: () => state.note,
|
|
874
974
|
}
|
|
875
975
|
}
|
|
876
976
|
|
package/src/css/index-page.css
CHANGED
|
@@ -222,6 +222,13 @@
|
|
|
222
222
|
color: var(--color-text-maxcontrast);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/* A note the named source read off its answer, above the rows. */
|
|
226
|
+
.cn-index-page__source-note {
|
|
227
|
+
margin: 0 0 8px;
|
|
228
|
+
color: var(--color-text-maxcontrast);
|
|
229
|
+
font-size: 0.9em;
|
|
230
|
+
}
|
|
231
|
+
|
|
225
232
|
.cn-index-page__scope-heading {
|
|
226
233
|
display: flex;
|
|
227
234
|
flex-direction: column;
|
package/src/index.js
CHANGED
|
@@ -275,6 +275,7 @@ export {
|
|
|
275
275
|
CnQuicklinksWidget,
|
|
276
276
|
CnQuicklinksWidgetForm,
|
|
277
277
|
CnRadioCardsWidget,
|
|
278
|
+
CnReadinessChecklist,
|
|
278
279
|
CnRecordListWidget,
|
|
279
280
|
CnRedactionEditor,
|
|
280
281
|
CnReferencePreview,
|
|
@@ -304,6 +305,8 @@ export {
|
|
|
304
305
|
CnSavedViewWidgetForm,
|
|
305
306
|
CnSaveViewDialog,
|
|
306
307
|
CnSchemaFormDialog,
|
|
308
|
+
CnSchemaRulesWidget,
|
|
309
|
+
CnSearchIndexStatus,
|
|
307
310
|
CnSearchPage,
|
|
308
311
|
CnSearchSelect,
|
|
309
312
|
CnSectionsWidget,
|
|
@@ -315,6 +318,7 @@ export {
|
|
|
315
318
|
CnSettingsPage,
|
|
316
319
|
CnSettingsSection,
|
|
317
320
|
CnSetupWizard,
|
|
321
|
+
CnShippedConfigurationSection,
|
|
318
322
|
CnSignatureCapture,
|
|
319
323
|
CnSpendAnalyticsWidget,
|
|
320
324
|
CnSpendAnalyticsWidgetForm,
|