mapping
This commit is contained in:
@@ -11,6 +11,7 @@ import type {
|
||||
UmbTreeElement,
|
||||
UmbTreeSelectionConfiguration,
|
||||
} from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbTemporaryFileRepository } from '@umbraco-cms/backoffice/temporary-file';
|
||||
|
||||
interface UmbDictionaryItemPreview {
|
||||
id: string;
|
||||
@@ -45,12 +46,12 @@ export class UmbImportDictionaryModalLayout extends UmbModalBaseElement<
|
||||
#fileReader;
|
||||
#fileNodes!: NodeListOf<ChildNode>;
|
||||
#fileContent: Array<UmbDictionaryItemPreview> = [];
|
||||
#dictionaryImportRepository: UmbDictionaryImportRepository;
|
||||
#dictionaryImportRepository = new UmbDictionaryImportRepository(this);
|
||||
#temporaryFileRepository = new UmbTemporaryFileRepository(this);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.#dictionaryImportRepository = new UmbDictionaryImportRepository(this);
|
||||
this.#fileReader = new FileReader();
|
||||
|
||||
this.#fileReader.onload = (e) => {
|
||||
@@ -135,13 +136,12 @@ export class UmbImportDictionaryModalLayout extends UmbModalBaseElement<
|
||||
e.preventDefault();
|
||||
const formData = new FormData(this._form);
|
||||
const file = formData.get('file') as File;
|
||||
|
||||
if (!file) throw new Error('File is missing');
|
||||
|
||||
this.#fileReader.readAsText(file);
|
||||
this._temporaryFileId = UmbId.new();
|
||||
|
||||
this.#dictionaryImportRepository.upload(this._temporaryFileId, file);
|
||||
this.#temporaryFileRepository.upload(this._temporaryFileId, file);
|
||||
}
|
||||
|
||||
#onParentChange() {
|
||||
|
||||
@@ -13,11 +13,4 @@ export class UmbDictionaryRepository extends UmbBaseController implements UmbApi
|
||||
async list(skip = 0, take = 1000) {
|
||||
return this.#detailSource.list(skip, take);
|
||||
}
|
||||
|
||||
async upload(UmbId: string, file: File) {
|
||||
if (!UmbId) throw new Error('UmbId is missing');
|
||||
if (!file) throw new Error('File is missing');
|
||||
|
||||
return this.#temporaryFileRepository.upload(UmbId, file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ export class UmbUserServerDataSource implements UmbDetailDataSource<UmbUserDetai
|
||||
);
|
||||
|
||||
if (data) {
|
||||
// TODO: What do we do about the initial password?
|
||||
return this.read(data);
|
||||
// TODO: what do we do with the initial password?
|
||||
return this.read(data.user.id);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
Reference in New Issue
Block a user