mapping
This commit is contained in:
@@ -6,9 +6,9 @@ import { UmbMockEntityDetailManager } from '../utils/entity/entity-detail.manage
|
||||
import type { UmbMockUserModel } from './user.data.js';
|
||||
import { data } from './user.data.js';
|
||||
import { UmbId } from '@umbraco-cms/backoffice/id';
|
||||
import type { UmbCurrentUser } from '@umbraco-cms/backoffice/current-user';
|
||||
import type {
|
||||
CreateUserRequestModel,
|
||||
CurrentUserResponseModel,
|
||||
InviteUserRequestModel,
|
||||
PagedUserResponseModel,
|
||||
UpdateUserGroupsOnUserRequestModel,
|
||||
@@ -49,7 +49,7 @@ class UmbUserMockDB extends UmbEntityMockDbBase<UmbMockUserModel> {
|
||||
* @return {*} {UmbLoggedInUser}
|
||||
* @memberof UmbUserData
|
||||
*/
|
||||
getCurrentUser(): UmbCurrentUser {
|
||||
getCurrentUser(): CurrentUserResponseModel {
|
||||
const firstUser = this.data[0];
|
||||
const permissions = firstUser.userGroupIds?.length ? umbUserGroupMockDb.getPermissions(firstUser.userGroupIds) : [];
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export class UmbDocumentWorkspaceContext
|
||||
|
||||
readonly variants = this.#currentData.asObservablePart((data) => data?.variants || []);
|
||||
readonly urls = this.#currentData.asObservablePart((data) => data?.urls || []);
|
||||
readonly templateId = this.#currentData.asObservablePart((data) => data?.template?.id || null);
|
||||
readonly templateId = this.#currentData.asObservablePart((data) => data?.template?.unique || null);
|
||||
|
||||
readonly structure = new UmbContentTypePropertyStructureManager(this, new UmbDocumentTypeDetailRepository(this));
|
||||
readonly splitView = new UmbWorkspaceSplitViewManager();
|
||||
@@ -149,9 +149,9 @@ export class UmbDocumentWorkspaceContext
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
async setPropertyValue<PropertyValueType = unknown>(
|
||||
async setPropertyValue<UmbDocumentValueModel = unknown>(
|
||||
alias: string,
|
||||
value: PropertyValueType,
|
||||
value: UmbDocumentValueModel,
|
||||
variantId?: UmbVariantId,
|
||||
) {
|
||||
const entry = { ...variantId?.toObject(), alias, value };
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import type { CSSResultGroup} from '@umbraco-cms/backoffice/external/lit';
|
||||
import type { CSSResultGroup } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import type {
|
||||
UmbModalManagerContext} from '@umbraco-cms/backoffice/modal';
|
||||
import {
|
||||
UMB_MODAL_MANAGER_CONTEXT,
|
||||
UMB_CURRENT_USER_MODAL,
|
||||
} from '@umbraco-cms/backoffice/modal';
|
||||
import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
|
||||
import { UMB_MODAL_MANAGER_CONTEXT, UMB_CURRENT_USER_MODAL } from '@umbraco-cms/backoffice/modal';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { UMB_CURRENT_USER_CONTEXT, type UmbCurrentUser } from '@umbraco-cms/backoffice/current-user';
|
||||
import { UMB_CURRENT_USER_CONTEXT, type UmbCurrentUserModel } from '@umbraco-cms/backoffice/current-user';
|
||||
|
||||
@customElement('umb-current-user-header-app')
|
||||
export class UmbCurrentUserHeaderAppElement extends UmbLitElement {
|
||||
@state()
|
||||
private _currentUser?: UmbCurrentUser;
|
||||
private _currentUser?: UmbCurrentUserModel;
|
||||
|
||||
#currentUserContext?: typeof UMB_CURRENT_USER_CONTEXT.TYPE;
|
||||
#modalManagerContext?: UmbModalManagerContext;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_USER_GROUP_ENTITY_TYPE } from '../index.js';
|
||||
import { UMB_USER_GROUP_WORKSPACE_CONTEXT } from './user-group-workspace.context.js';
|
||||
import type { UmbUserInputElement } from '@umbraco-cms/backoffice/user';
|
||||
import type { UUIInputElement} from '@umbraco-cms/backoffice/external/uui';
|
||||
import type { UUIInputElement } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UUIInputEvent } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { css, html, nothing, customElement, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { UmbUserItemModel } from '../../repository/index.js';
|
||||
import { UmbUserPickerContext } from './user-input.context.js';
|
||||
import { css, html, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { FormControlMixin } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import type { UserItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { splitStringToArray } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
@customElement('umb-user-input')
|
||||
@@ -67,7 +67,7 @@ export class UmbUserInputElement extends FormControlMixin(UmbLitElement) {
|
||||
}
|
||||
|
||||
@state()
|
||||
private _items?: Array<UserItemResponseModel>;
|
||||
private _items?: Array<UmbUserItemModel>;
|
||||
|
||||
#pickerContext = new UmbUserPickerContext(this);
|
||||
|
||||
@@ -111,12 +111,12 @@ export class UmbUserInputElement extends FormControlMixin(UmbLitElement) {
|
||||
`;
|
||||
}
|
||||
|
||||
private _renderItem(item: UserItemResponseModel) {
|
||||
if (!item.id) return;
|
||||
private _renderItem(item: UmbUserItemModel) {
|
||||
if (!item.unique) return;
|
||||
return html`
|
||||
<uui-ref-node-user name=${ifDefined(item.name)}>
|
||||
<uui-action-bar slot="actions">
|
||||
<uui-button @click=${() => this.#pickerContext.requestRemoveItem(item.id!)} label="Remove ${item.name}"
|
||||
<uui-button @click=${() => this.#pickerContext.requestRemoveItem(item.unique)} label="Remove ${item.name}"
|
||||
>Remove</uui-button
|
||||
>
|
||||
</uui-action-bar>
|
||||
|
||||
@@ -2,9 +2,8 @@ import {
|
||||
UMB_DISABLE_USER_REPOSITORY_ALIAS,
|
||||
UMB_ENABLE_USER_REPOSITORY_ALIAS,
|
||||
UMB_UNLOCK_USER_REPOSITORY_ALIAS,
|
||||
UMB_USER_REPOSITORY_ALIAS,
|
||||
} from '../repository/manifests.js';
|
||||
import { UMB_USER_ENTITY_TYPE } from '../entity.js';
|
||||
UMB_USER_DETAIL_REPOSITORY_ALIAS,
|
||||
} from '../repository/index.js';
|
||||
import { UMB_USER_COLLECTION_ALIAS } from '../collection/manifests.js';
|
||||
import { UmbEnableUserEntityBulkAction } from './enable/enable.action.js';
|
||||
import { UmbSetGroupUserEntityBulkAction } from './set-group/set-group.action.js';
|
||||
@@ -22,7 +21,7 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
api: UmbSetGroupUserEntityBulkAction,
|
||||
meta: {
|
||||
label: 'SetGroup',
|
||||
repositoryAlias: UMB_USER_REPOSITORY_ALIAS,
|
||||
repositoryAlias: UMB_USER_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { SetAvatarRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UserResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbDataSourceErrorResponse } from '@umbraco-cms/backoffice/repository';
|
||||
@@ -12,22 +13,28 @@ export class UmbUserAvatarServerDataSource {
|
||||
|
||||
/**
|
||||
* Creates an avatar for the user with the given id based on a temporary uploaded file
|
||||
* @param {string} id
|
||||
* @param {string} fileId
|
||||
* @param {string} unique
|
||||
* @param {string} fileUnique
|
||||
* @return {*} {Promise<UmbDataSourceErrorResponse>}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
createAvatar(id: string, fileId: string): Promise<UmbDataSourceErrorResponse> {
|
||||
return tryExecuteAndNotify(this.#host, UserResource.postUserAvatarById({ id, requestBody: { file: fileId } }));
|
||||
createAvatar(unique: string, fileUnique: string): Promise<UmbDataSourceErrorResponse> {
|
||||
const requestBody: SetAvatarRequestModel = {
|
||||
file: {
|
||||
id: fileUnique,
|
||||
},
|
||||
};
|
||||
|
||||
return tryExecuteAndNotify(this.#host, UserResource.postUserAvatarById({ id: unique, requestBody }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the avatar for the user with the given id
|
||||
* @param {string} id
|
||||
* @param {string} unique
|
||||
* @return {*} {Promise<UmbDataSourceErrorResponse>}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
deleteAvatar(id: string): Promise<UmbDataSourceErrorResponse> {
|
||||
return tryExecuteAndNotify(this.#host, UserResource.deleteUserAvatarById({ id }));
|
||||
deleteAvatar(unique: string): Promise<UmbDataSourceErrorResponse> {
|
||||
return tryExecuteAndNotify(this.#host, UserResource.deleteUserAvatarById({ id: unique }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,6 @@ export class UmbUserDetailStore extends UmbDetailStoreBase<UmbUserDetailModel> {
|
||||
constructor(host: UmbControllerHostElement) {
|
||||
super(host, UMB_USER_DETAIL_STORE_CONTEXT.toString());
|
||||
}
|
||||
|
||||
withPropertyEditorUiAlias(propertyEditorUiAlias: string) {
|
||||
// TODO: Use a model for the data-type tree items: ^^Most likely it should be parsed to the UmbEntityTreeStore as a generic type.
|
||||
return this._data.asObservablePart((items) => items.filter((item) => item.editorUiAlias === propertyEditorUiAlias));
|
||||
}
|
||||
}
|
||||
|
||||
export const UMB_USER_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbUserDetailStore>('UmbUserDetailStore');
|
||||
|
||||
Reference in New Issue
Block a user