Skip to content

Commit

Permalink
chore(edit-content): add docs #30216
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes committed Nov 8, 2024
1 parent b850bff commit 6a85a90
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ import { catchError } from 'rxjs/operators';

import { DotResourceLinksService } from '@dotcms/data-access';
import { DotCMSBaseTypesContentTypes, DotCMSContentlet } from '@dotcms/dotcms-models';
import {
DotPreviewResourceLink,
UploadedFile
} from '@dotcms/edit-content/models/dot-edit-content-file.model';
import {
DotTempFileThumbnailComponent,
DotFileSizeFormatPipe,
DotMessagePipe,
DotCopyButtonComponent
} from '@dotcms/ui';

import {
DotPreviewResourceLink,
UploadedFile
} from '../../../../models/dot-edit-content-file.model';
import { getFileMetadata } from '../../utils';

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { NgClass } from '@angular/common';
import { ChangeDetectionStrategy, Component, input } from '@angular/core';

import { UIMessage } from '@dotcms/edit-content/models/dot-edit-content-file.model';
import { DotMessagePipe } from '@dotcms/ui';

import { UIMessage } from '../../../../models/dot-edit-content-file.model';

@Component({
selector: 'dot-file-field-ui-message',
standalone: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import { InputTextModule } from 'primeng/inputtext';

import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators';

import { UploadedFile } from '@dotcms/edit-content/models/dot-edit-content-file.model';
import { DotMessagePipe, DotFieldValidationMessageComponent } from '@dotcms/ui';

import { FormFileEditorStore } from './store/form-file-editor.store';

import { UploadedFile } from '../../../../models/dot-edit-content-file.model';

type DialogProps = {
allowFileNameEdit: boolean;
userMonacoOptions: Partial<MonacoEditorConstructionOptions>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import { ButtonModule } from 'primeng/button';
import { DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog';
import { InputTextModule } from 'primeng/inputtext';

import { INPUT_TYPES } from '@dotcms/edit-content/models/dot-edit-content-file.model';
import { DotMessagePipe, DotFieldValidationMessageComponent, DotValidators } from '@dotcms/ui';

import { FormImportUrlStore } from './store/form-import-url.store';

import { INPUT_TYPE } from '../../../dot-edit-content-text-field/utils';

@Component({
selector: 'dot-form-import-url',
standalone: true,
Expand All @@ -38,7 +37,7 @@ export class DotFormImportUrlComponent implements OnInit {
readonly #formBuilder = inject(FormBuilder);
readonly #dialogRef = inject(DynamicDialogRef);
readonly #dialogConfig = inject(
DynamicDialogConfig<{ inputType: INPUT_TYPE; acceptedFiles: string[] }>
DynamicDialogConfig<{ inputType: INPUT_TYPES; acceptedFiles: string[] }>
);
#abortController: AbortController | null = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,21 @@ export class DotDataViewComponent {
*/
$loading = input.required<boolean>({ alias: 'loading' });

/**
* Signal representing the number of rows per page in the data view.
*
* @type {number}
*/
$rowsPerPage = signal<number>(9);

/**
* Reactive model holding the currently selected product.
* Can be a `DotCMSContentlet` or `null`.
*/
$selectedProduct = model<DotCMSContentlet | null>(null);

/**
* Emits the selected `DotCMSContentlet` when a row is selected.
*/
onRowSelect = output<DotCMSContentlet>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export class DotSideBarComponent {
*/
$fakeColumns = signal<string[]>(Array.from({ length: 50 }).map((_) => this.getPercentage()));

/**
* Reactive model representing the currently selected file.
*/
$selectedFile = model<TreeNode | null>(null);

/**
Expand All @@ -75,6 +78,13 @@ export class DotSideBarComponent {
*/
onNodeSelect = output<TreeNodeExpandEvent>();

/**
* Computed property representing the component's state.
*
* @returns An object containing:
* - `folders`: An array of folders obtained from `$folders()`.
* - `selectedFile`: A signal of the selected file, initialized to the file whose `data.identifier` matches `SYSTEM_HOST_ID`.
*/
$state = computed(() => {
const folders = this.$folders();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export class DotSelectExistingFileComponent implements OnInit {
this.#dialogRef.close();
}

/**
* Retrieves the selected content from the store, fetches it by ID using the upload service,
* and closes the dialog with the retrieved content.
*/
addContent(): void {
const content = this.store.selectedContent();
this.#uploadService.getContentById(content.identifier).subscribe((content) => {
Expand Down

0 comments on commit 6a85a90

Please sign in to comment.