diff --git a/frontend/src/app/features/assets/pages/assets-page.component.html b/frontend/src/app/features/assets/pages/assets-page.component.html index 237d0e4ec..817c5823a 100644 --- a/frontend/src/app/features/assets/pages/assets-page.component.html +++ b/frontend/src/app/features/assets/pages/assets-page.component.html @@ -54,8 +54,13 @@ -
- +
+ +
diff --git a/frontend/src/app/shared/components/assets/asset.component.html b/frontend/src/app/shared/components/assets/asset.component.html index a1a8c9ef4..3369e7863 100644 --- a/frontend/src/app/shared/components/assets/asset.component.html +++ b/frontend/src/app/shared/components/assets/asset.component.html @@ -34,7 +34,7 @@ - + @@ -143,7 +143,7 @@ - diff --git a/frontend/src/app/shared/components/assets/asset.component.ts b/frontend/src/app/shared/components/assets/asset.component.ts index e0f8d9090..2dcdb1c98 100644 --- a/frontend/src/app/shared/components/assets/asset.component.ts +++ b/frontend/src/app/shared/components/assets/asset.component.ts @@ -50,6 +50,9 @@ export class AssetComponent extends StatefulComponent implements OnInit { @Input() public folderId?: string; + @Input() + public folderIcon?: boolean | null | undefined; + @Input() public removeMode?: boolean | null; diff --git a/frontend/src/app/shared/components/assets/assets-list.component.html b/frontend/src/app/shared/components/assets/assets-list.component.html index be7c07af6..c16e042f4 100644 --- a/frontend/src/app/shared/components/assets/assets-list.component.html +++ b/frontend/src/app/shared/components/assets/assets-list.component.html @@ -16,8 +16,8 @@ -
-
+
+
{{ 'common.folders' | sqxTranslate }}
@@ -72,13 +72,14 @@ cdkDrag [cdkDragData]="asset" [cdkDragDisabled]="isDisabled || !asset.canMove" + [allTags]="tags" [asset]="asset" [assetsState]="assetsState" [isListView]="isListView" [isDisabled]="isDisabled" [isSelectable]="!!selectedIds" [isSelected]="isSelected(asset)" - [allTags]="tags" + [folderIcon]="showFolderIcon && path.length === 0" (select)="select.emit(asset)" (delete)="deleteAsset(asset)" (selectFolder)="selectFolder(asset)"> diff --git a/frontend/src/app/shared/components/assets/assets-list.component.ts b/frontend/src/app/shared/components/assets/assets-list.component.ts index 642bd97d1..0f3ae6372 100644 --- a/frontend/src/app/shared/components/assets/assets-list.component.ts +++ b/frontend/src/app/shared/components/assets/assets-list.component.ts @@ -39,6 +39,9 @@ export class AssetsListComponent extends StatefulComponent { @Input() public selectedIds?: {}; + @Input() + public showFolderIcon?: boolean | null = true; + @Input() public showPager?: boolean | null = true; diff --git a/frontend/src/app/shared/state/assets.state.ts b/frontend/src/app/shared/state/assets.state.ts index 0b1fa6aeb..70fe959ea 100644 --- a/frontend/src/app/shared/state/assets.state.ts +++ b/frontend/src/app/shared/state/assets.state.ts @@ -66,7 +66,7 @@ export abstract class AssetsStateBase extends State { this.project(x => x.tagsSelected); public tags = - this.projectFrom(this.tagsUnsorted, getSortedTags); + this.projectFrom(this.tagsUnsorted, getTagsSorted); public tagsNames = this.projectFrom(this.tagsUnsorted, getTagNames); @@ -98,9 +98,6 @@ export abstract class AssetsStateBase extends State { public path = this.project(x => x.path); - public pathAvailable = - this.project(x => x.path.length > 0); - public parentFolder = this.project(x => getParent(x.path)); @@ -432,6 +429,10 @@ function getTagNames(tags: object): ReadonlyArray { return Object.keys(tags); } +function getTagsSorted(tags: { [name: string]: number }) { + return Object.keys(tags).sort(compareStrings).map(name => ({ name, count: tags[name] })); +} + function isReferrerError(error?: ErrorDto) { return error?.errorCode === 'OBJECT_REFERENCED'; } @@ -480,20 +481,24 @@ function createQuery(snapshot: Snapshot, noSlowTotal: boolean) { const result: any = { take: pageSize, skip: pageSize * page, noSlowTotal }; - const tags = Object.keys(tagsSelected); - if (Types.isString(ref)) { result.ref = ref; - } else if (Types.isString(query?.fullText) || tags.length > 0) { - if (query) { - result.query = query; - } + } else { + const tags = getTagNames(tagsSelected); + const hasTags = tags.length > 0; + const hasQuery = Types.isString(query?.fullText) && query?.fullText; - if (tags.length > 0) { - result.tags = tags; + if (hasQuery || hasTags) { + if (hasQuery) { + result.query = query; + } + + if (hasTags) { + result.tags = tags; + } + } else { + result.parentId = snapshot.parentId; } - } else { - result.parentId = snapshot.parentId; } if (page > 0 && total > 0) { @@ -511,10 +516,6 @@ function getParent(path: ReadonlyArray) { } } -function getSortedTags(tags: { [name: string]: number }) { - return Object.keys(tags).sort(compareStrings).map(name => ({ name, count: tags[name] })); -} - @Injectable() export class AssetsState extends AssetsStateBase { constructor(