Skip to content

Commit

Permalink
MWPW-151416 - [LocUI] skip URL validation Language tiles (#2379)
Browse files Browse the repository at this point in the history
check validation is done on a url before showing an error
  • Loading branch information
Sartxi authored May 29, 2024
1 parent fc42d51 commit 475f4f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions libs/blocks/locui/url/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ function Actions({ item }) {
const isDisabled = (status) => (!status || status !== 200 ? ' disabled' : '');
const itemUrl = urls.value.find((url) => url.pathname === item.value.path
|| url.langstore.pathname === item.value.path);
const disableExcel = itemUrl?.valid !== undefined && !itemUrl.valid;
return html`
<div class=locui-url-source-actions>
<button
disabled=${item.value.edit?.status === 404}
class="locui-url-action locui-url-action-edit${isExcel}${!itemUrl?.valid ? ' disabled' : ''}"
onClick=${(e) => { if (itemUrl.valid) openWord(e, item); }}>Edit</button>
class="locui-url-action locui-url-action-edit${isExcel}${disableExcel ? ' disabled' : ''}"
onClick=${(e) => { if (!disableExcel) openWord(e, item); }}>Edit</button>
<button
class="locui-url-action locui-url-action-view${isDisabled(item.value.preview?.status)}"
onClick=${(e) => { if (itemUrl.valid) handleAction(e, item, true); }}>Preview</button>
Expand Down
5 changes: 3 additions & 2 deletions libs/blocks/locui/url/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import Tabs from './tabs.js';
export default function Url({ suffix, item }) {
const sourcePath = item.pathname;
const langstorePath = item.langstore?.pathname;
const urlHasError = item.valid !== undefined && !item.valid;

return html`
<li class="locui-url${!item.valid ? ' error' : ''}">
<li class="locui-url${urlHasError ? ' error' : ''}">
<h3 class=locui-url-label>Path</h3>
<p class=locui-url-path>${sourcePath}${!item.valid ? html`<span>NOT FOUND</span>` : ''}</p>
<p class=locui-url-path>${sourcePath}${urlHasError ? html`<span>NOT FOUND</span>` : ''}</p>
<div class="locui-url-tab-group locui-url-tab-group-cols-${suffix.length}">
<${Tabs} suffix=${suffix[0]} path=${sourcePath} />
${langstorePath && html`
Expand Down

0 comments on commit 475f4f4

Please sign in to comment.