Skip to content

Commit 4e8ac56

Browse files
authored
Merge branch 'main' into i704
2 parents 4ad6ebf + 41e25a0 commit 4e8ac56

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

blocks/edit/da-library/da-library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class DaLibrary extends LitElement {
386386
data-src="${this._blockPreviewPath}"
387387
src="${this._blockPreviewPath}"
388388
@load=${this.handlePreviewLoad}
389-
allow="clipboard-write *"></iframe>` : html`<div style="margin: 0 24px">${error || 'This block / template has not been previewed.'}</div>`}
389+
allow="clipboard-write *"></iframe>` : html`<div style="margin: 0 24px">${error || 'This block/template has not been previewed.'}</div>`}
390390
</da-dialog>
391391
`;
392392
}

blocks/start/start.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,16 @@ div.text-container {
163163
}
164164

165165
p.error-text {
166-
color: #d73220;
167-
font-weight: 800;
168-
margin: 12px;
166+
justify-self: center;
167+
color: #fff;
168+
font-weight: 700;
169+
margin-block: 24px;
169170
text-align: center;
171+
background: rgb(215 50 32 / 44%);
172+
width: 600px;
173+
border-radius: 8px;
174+
padding: 6px 0;
175+
box-sizing: border-box;
170176
}
171177

172178
div.template-container {

blocks/start/start.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ class DaStart extends LitElement {
117117
showDone: { state: true },
118118
_goText: { state: true },
119119
_statusText: { state: true },
120+
_errorText: { state: true },
120121
_templates: { state: true },
121122
_loading: { state: true },
123+
_disableCreate: { state: true },
122124
};
123125

124126
constructor() {
@@ -156,6 +158,8 @@ class DaStart extends LitElement {
156158
goToNextStep(e) {
157159
this.showOpen = false;
158160
this.showDone = false;
161+
this._errorText = undefined;
162+
this._disableCreate = undefined;
159163
e.preventDefault();
160164
this.activeStep = this.activeStep === 3 ? 1 : this.activeStep += 1;
161165
}
@@ -164,7 +168,15 @@ class DaStart extends LitElement {
164168
const { code, content } = this._templates.find((tpl) => tpl.selected) || this._templates[0];
165169
const hasDemo = !code.includes('aem-boilerplate');
166170
if (hasDemo) {
167-
e.target.disabled = true;
171+
this._disableCreate = true;
172+
173+
const resp = await daFetch(`${DA_ORIGIN}/list/${this.org}/${this.site}`);
174+
const json = await resp.json();
175+
if (json.length > 0) {
176+
this._errorText = 'The target site is not empty. Choose no demo content or a different site.';
177+
this._disableCreate = undefined;
178+
return;
179+
}
168180

169181
const setStatus = (text) => { this._statusText = text; };
170182

@@ -288,8 +300,8 @@ class DaStart extends LitElement {
288300
${this._loading ? html`<span class="spinner"></span>` : 'Go'}
289301
</button>
290302
</form>
303+
${this._errorText ? html`<p class="error-text">${this._errorText}</p>` : nothing}
291304
<div class="text-container">
292-
<p class="error-text">${this._errorText ? this._errorText : nothing}</p>
293305
<p>Paste your AEM codebase URL above.</p>
294306
<p>Don't have one, yet? Pick a template below.</p>
295307
</div>
@@ -335,8 +347,9 @@ class DaStart extends LitElement {
335347
`)}
336348
</ul>
337349
</div>
350+
${this._errorText ? html`<p class="error-text">${this._errorText}</p>` : nothing}
338351
<div class="step-3-actions">
339-
<button class="da-login-button con-button blue button-xl" @click=${this.goToSite}>${this._goText}</button>
352+
<button class="da-login-button con-button blue button-xl" @click=${this.goToSite} ?disabled=${this._disableCreate}>${this._goText}</button>
340353
<p>${this._statusText ? this._statusText : nothing}</p>
341354
</div>
342355
</div>

0 commit comments

Comments
 (0)