Skip to content

Commit 620ce93

Browse files
committed
rename archived item dialog
1 parent c41bd11 commit 620ce93

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

frontend/src/features/archived-items/item-metadata-editor.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { localized, msg } from "@lit/localize";
22
import { serialize } from "@shoelace-style/shoelace/dist/utilities/form.js";
33
import Fuse from "fuse.js";
4+
import { html } from "lit";
45
import { customElement, property, state } from "lit/decorators.js";
56

7+
import { BtrixElement } from "@/classes/BtrixElement";
68
import type {
79
TagInputEvent,
810
Tags,
@@ -12,7 +14,6 @@ import { type CollectionsChangeEvent } from "@/features/collections/collections-
1214
import type { ArchivedItem } from "@/types/crawler";
1315
import { type WorkflowTag, type WorkflowTags } from "@/types/workflow";
1416
import { maxLengthValidator } from "@/utils/form";
15-
import LiteElement, { html } from "@/utils/LiteElement";
1617

1718
/**
1819
* Usage:
@@ -30,7 +31,7 @@ import LiteElement, { html } from "@/utils/LiteElement";
3031
*/
3132
@customElement("btrix-item-metadata-editor")
3233
@localized()
33-
export class CrawlMetadataEditor extends LiteElement {
34+
export class CrawlMetadataEditor extends BtrixElement {
3435
@property({ type: Object })
3536
crawl?: ArchivedItem;
3637

@@ -78,7 +79,7 @@ export class CrawlMetadataEditor extends LiteElement {
7879
render() {
7980
return html`
8081
<btrix-dialog
81-
.label=${msg("Edit Metadata")}
82+
.label=${msg("Edit Archived Item")}
8283
.open=${this.open}
8384
@sl-show=${() => (this.isDialogVisible = true)}
8485
@sl-after-hide=${() => (this.isDialogVisible = false)}
@@ -125,11 +126,11 @@ export class CrawlMetadataEditor extends LiteElement {
125126
@tags-change=${(e: TagsChangeEvent) =>
126127
(this.tagsToSave = e.detail.tags)}
127128
></btrix-tag-input>
128-
<div class="mt-4">
129+
<div class="mt-7">
129130
<btrix-collections-add
130131
.initialCollections=${this.crawl.collectionIds}
131132
.configId=${"temp"}
132-
label=${msg("Add to Collection")}
133+
label=${msg("Include in Collection")}
133134
@collections-change=${(e: CollectionsChangeEvent) =>
134135
(this.collectionsToSave = e.detail.collections)}
135136
>
@@ -166,7 +167,7 @@ export class CrawlMetadataEditor extends LiteElement {
166167
private async fetchTags() {
167168
if (!this.crawl) return;
168169
try {
169-
const { tags } = await this.apiFetch<WorkflowTags>(
170+
const { tags } = await this.api.fetch<WorkflowTags>(
170171
`/orgs/${this.crawl.oid}/crawlconfigs/tagCounts`,
171172
);
172173

@@ -220,7 +221,7 @@ export class CrawlMetadataEditor extends LiteElement {
220221
this.isSubmittingUpdate = true;
221222

222223
try {
223-
const data = await this.apiFetch<{ updated: boolean }>(
224+
const data = await this.api.fetch<{ updated: boolean }>(
224225
`/orgs/${this.crawl.oid}/all-crawls/${this.crawl.id}`,
225226
{
226227
method: "PATCH",
@@ -233,15 +234,15 @@ export class CrawlMetadataEditor extends LiteElement {
233234
}
234235

235236
this.dispatchEvent(new CustomEvent("updated"));
236-
this.notify({
237+
this.notify.toast({
237238
message: msg("Successfully saved crawl details."),
238239
variant: "success",
239240
icon: "check2-circle",
240241
id: "crawl-details-update-status",
241242
});
242243
this.requestClose();
243244
} catch (e) {
244-
this.notify({
245+
this.notify.toast({
245246
message: msg("Sorry, couldn't save crawl details at this time."),
246247
variant: "danger",
247248
icon: "exclamation-octagon",

frontend/src/pages/org/archived-item-detail/archived-item-detail.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ export class ArchivedItemDetail extends BtrixElement {
420420
class="text-base"
421421
name="pencil"
422422
@click=${this.openMetadataEditor}
423-
label=${msg("Edit Metadata")}
423+
label=${msg("Edit Archived Item")}
424424
></sl-icon-button>
425425
`,
426426
)}
@@ -430,9 +430,24 @@ export class ArchivedItemDetail extends BtrixElement {
430430
)}
431431
</div>
432432
<div class="col-span-1 row-span-1 flex flex-col">
433-
${this.renderPanel(msg("Collections"), this.renderCollections(), [
434-
tw`rounded-lg border p-4`,
435-
])}
433+
${this.renderPanel(
434+
html`
435+
${this.renderTitle(msg("Collections"))}
436+
${when(
437+
this.isCrawler,
438+
() => html`
439+
<sl-icon-button
440+
class="text-base"
441+
name="pencil"
442+
@click=${this.openMetadataEditor}
443+
label=${msg("Edit Archived Item")}
444+
></sl-icon-button>
445+
`,
446+
)}
447+
`,
448+
this.renderCollections(),
449+
[tw`rounded-lg border p-4`],
450+
)}
436451
</div>
437452
</div>
438453
`;
@@ -658,7 +673,7 @@ export class ArchivedItemDetail extends BtrixElement {
658673
}}
659674
>
660675
<sl-icon name="pencil" slot="prefix"></sl-icon>
661-
${msg("Edit Metadata")}
676+
${msg("Edit Archived Item")}
662677
</sl-menu-item>
663678
<sl-divider></sl-divider>
664679
`,

frontend/src/pages/org/archived-items.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ export class CrawlsList extends BtrixElement {
593593
}}
594594
>
595595
<sl-icon name="pencil" slot="prefix"></sl-icon>
596-
${msg("Edit Metadata")}
596+
${msg("Edit Archived Item")}
597597
</sl-menu-item>
598598
<sl-divider></sl-divider>
599599
`,

0 commit comments

Comments
 (0)