Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "wordpress-plugins/real-cookie-banner/src/public/ts/components/config/scanner/listItem"

Index

Variables

Variables

Const ScannerListItem

ScannerListItem: FC<{ item: ScannerResultExternalUrl }> = observer(({ item }) => {const [expanded, setExpanded] = useState(false);const {data: { host, foundOnSitesCount, tags, ignored },inactive,blockedStatus,blockedStatusText,busy} = item;const { scannerStore } = useStores();const toggleExpandExternalUrls = useCallback(() => {setExpanded(!expanded);}, [host, expanded]);const scanAllAgain = useCallback(async () => {const allSourceUrls = [];try {await scannerStore.fetchResultAllExternals(item);scannerStore.resultAllExternalUrls.get(item.data.host).forEach((item) => {allSourceUrls.push(item.data.sourceUrl);});await scannerStore.addUrlsToQueue({urls: allSourceUrls,purgeUnused: false});await Promise.all([scannerStore.fetchResultExternals(), refreshQueue()]);} catch (e) {if (e instanceof Error) {console.log(e);}}}, [item]);return (<><List.ItemitemID={host}actions={[<ScannerExternalUrlActionPopover key="handle" item={item} />,ignored && (<Popconfirmkey="delete"title={__("Are you sure that you want to restore this entry?")}placement="bottomRight"onConfirm={() => {item.ignore(false);setExpanded(false);}}okText={__("Restore")}cancelText={__("Cancel")}overlayStyle={{ maxWidth: 350 }}><a style={{ cursor: "pointer" }}>{__("Restore")}</a></Popconfirm>),!inactive && (<Popconfirmkey="delete"title={__("Are you sure that you want to ignore this entry?")}placement="bottomRight"onConfirm={() => {item.ignore();setExpanded(false);}}okText={__("Ignore")}cancelText={__("Cancel")}overlayStyle={{ maxWidth: 350 }}><a style={{ cursor: "pointer" }}>{__("Ignore")}</a></Popconfirm>),<><a style={{ cursor: "pointer" }} onClick={scanAllAgain}>{__("Scan these pages again")}</a></>].filter(Boolean)}style={{ opacity: inactive && !expanded ? 0.6 : 1 }}><Spin spinning={busy}><List.Item.Metatitle={<span>{host}{" "}{tags.map((tag) => (<Tag key={tag}>{`<${tag} />`}</Tag>))}{ignored && <Tag>{__("Ignored")}</Tag>}{blockedStatus !== "none" && (<Tag color={blockedStatus === "partial" ? "warning" : "success"}>{blockedStatusText}</Tag>)}</span>}description={<button className="button-link" onClick={toggleExpandExternalUrls}>{expanded? __("Close"): _n("Embeds found on %d page","Embeds found on %d pages",foundOnSitesCount,foundOnSitesCount)}</button>}/></Spin></List.Item>{expanded && (<ScannerAllExternalUrlsTableinstance={item}reload={expanded && foundOnSitesCount > 0}reloadDependencies={[expanded, foundOnSitesCount]}style={{ marginTop: "-6px" }}/>)}</>);})

Generated using TypeDoc