1
1
import { localized , msg } from "@lit/localize" ;
2
2
import { serialize } from "@shoelace-style/shoelace/dist/utilities/form.js" ;
3
3
import Fuse from "fuse.js" ;
4
+ import { html } from "lit" ;
4
5
import { customElement , property , state } from "lit/decorators.js" ;
5
6
7
+ import { BtrixElement } from "@/classes/BtrixElement" ;
6
8
import type {
7
9
TagInputEvent ,
8
10
Tags ,
@@ -12,7 +14,6 @@ import { type CollectionsChangeEvent } from "@/features/collections/collections-
12
14
import type { ArchivedItem } from "@/types/crawler" ;
13
15
import { type WorkflowTag , type WorkflowTags } from "@/types/workflow" ;
14
16
import { maxLengthValidator } from "@/utils/form" ;
15
- import LiteElement , { html } from "@/utils/LiteElement" ;
16
17
17
18
/**
18
19
* Usage:
@@ -30,7 +31,7 @@ import LiteElement, { html } from "@/utils/LiteElement";
30
31
*/
31
32
@customElement ( "btrix-item-metadata-editor" )
32
33
@localized ( )
33
- export class CrawlMetadataEditor extends LiteElement {
34
+ export class CrawlMetadataEditor extends BtrixElement {
34
35
@property ( { type : Object } )
35
36
crawl ?: ArchivedItem ;
36
37
@@ -78,7 +79,7 @@ export class CrawlMetadataEditor extends LiteElement {
78
79
render ( ) {
79
80
return html `
80
81
< btrix-dialog
81
- .label =${ msg ( "Edit Metadata " ) }
82
+ .label =${ msg ( "Edit Archived Item " ) }
82
83
.open =${ this . open }
83
84
@sl-show=${ ( ) => ( this . isDialogVisible = true ) }
84
85
@sl-after-hide=${ ( ) => ( this . isDialogVisible = false ) }
@@ -125,11 +126,11 @@ export class CrawlMetadataEditor extends LiteElement {
125
126
@tags-change=${ ( e : TagsChangeEvent ) =>
126
127
( this . tagsToSave = e . detail . tags ) }
127
128
> </ btrix-tag-input >
128
- < div class ="mt-4 ">
129
+ < div class ="mt-7 ">
129
130
< btrix-collections-add
130
131
.initialCollections =${ this . crawl . collectionIds }
131
132
.configId =${ "temp" }
132
- label=${ msg ( "Add to Collection" ) }
133
+ label=${ msg ( "Include in Collection" ) }
133
134
@collections-change=${ ( e : CollectionsChangeEvent ) =>
134
135
( this . collectionsToSave = e . detail . collections ) }
135
136
>
@@ -166,7 +167,7 @@ export class CrawlMetadataEditor extends LiteElement {
166
167
private async fetchTags ( ) {
167
168
if ( ! this . crawl ) return ;
168
169
try {
169
- const { tags } = await this . apiFetch < WorkflowTags > (
170
+ const { tags } = await this . api . fetch < WorkflowTags > (
170
171
`/orgs/${ this . crawl . oid } /crawlconfigs/tagCounts` ,
171
172
) ;
172
173
@@ -220,7 +221,7 @@ export class CrawlMetadataEditor extends LiteElement {
220
221
this . isSubmittingUpdate = true ;
221
222
222
223
try {
223
- const data = await this . apiFetch < { updated : boolean } > (
224
+ const data = await this . api . fetch < { updated : boolean } > (
224
225
`/orgs/${ this . crawl . oid } /all-crawls/${ this . crawl . id } ` ,
225
226
{
226
227
method : "PATCH" ,
@@ -233,15 +234,15 @@ export class CrawlMetadataEditor extends LiteElement {
233
234
}
234
235
235
236
this . dispatchEvent ( new CustomEvent ( "updated" ) ) ;
236
- this . notify ( {
237
+ this . notify . toast ( {
237
238
message : msg ( "Successfully saved crawl details." ) ,
238
239
variant : "success" ,
239
240
icon : "check2-circle" ,
240
241
id : "crawl-details-update-status" ,
241
242
} ) ;
242
243
this . requestClose ( ) ;
243
244
} catch ( e ) {
244
- this . notify ( {
245
+ this . notify . toast ( {
245
246
message : msg ( "Sorry, couldn't save crawl details at this time." ) ,
246
247
variant : "danger" ,
247
248
icon : "exclamation-octagon" ,
0 commit comments