Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] Stage to Main #2879

Merged
merged 6 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ module.exports = {
files: ['test/**/*.js'],
rules: { 'no-console': 0 },
},
{
// Override for nala test
files: ['nala/**/*.js', 'nala/**/*.test.js'],
rules: {
'no-console': 0,
'import/no-extraneous-dependencies': 0,
'max-len': 0,
'chai-friendly/no-unused-expressions': 0,
'no-plusplus': 0,
},
},
],
ignorePatterns: [
'/libs/deps/*',
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/run-nala-default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Nala Tests

on:
push:
branches:
- stage
- main
pull_request:
branches:
- stage
- main
types: [opened, synchronize, reopened]

jobs:
run-nala-tests:
name: Running Nala E2E UI Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Set execute permission for nalarun.sh
run: chmod +x ./nala/utils/pr.run.sh

- name: Run Nala Tests via pr.run.sh
run: ./nala/utils/pr.run.sh
env:
labels: ${{ join(github.event.pull_request.labels.*.name, ' ') }}
branch: ${{ github.event.pull_request.head.ref }}
repoName: ${{ github.repository }}
prUrl: ${{ github.event.pull_request.head.repo.html_url }}
prOrg: ${{ github.event.pull_request.head.repo.owner.login }}
prRepo: ${{ github.event.pull_request.head.repo.name }}
prBranch: ${{ github.event.pull_request.head.ref }}
prBaseBranch: ${{ github.event.pull_request.base.ref }}
GITHUB_ACTION_PATH: ${{ github.workspace }}
IMS_EMAIL: ${{ secrets.IMS_EMAIL }}
IMS_PASS: ${{ secrets.IMS_PASS }}
1 change: 0 additions & 1 deletion .github/workflows/run-nala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
jobs:
action:
name: Running E2E & IT
if: contains(github.event.pull_request.labels.*.name, 'run-nala')
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .hlxignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.*
*.md
test/*
nala
build/*
LICENSE
web-test-runner.config.mjs
Expand Down
9 changes: 5 additions & 4 deletions libs/blocks/article-header/article-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ function openPopup(e) {
}

async function buildAuthorInfo(authorEl, bylineContainer) {
const { href, textContent } = authorEl;
const { textContent } = authorEl;
const link = authorEl.href || authorEl.dataset.authorPage;
const config = getConfig();
const base = config.miloLibs || config.codeRoot;
const authorImg = createTag('div', { class: 'article-author-image' });
authorImg.style.backgroundImage = `url(${base}/blocks/article-header/adobe-logo.svg)`;
bylineContainer.prepend(authorImg);

const doc = await validateAuthorUrl(href);
const doc = await validateAuthorUrl(link);
if (!doc) {
const p = createTag('p', null, textContent);
authorEl.replaceWith(p);
Expand All @@ -48,7 +49,7 @@ async function buildAuthorInfo(authorEl, bylineContainer) {

const img = doc.querySelector('img');
if (img) {
img.setAttribute('alt', authorEl.textContent);
img.setAttribute('alt', textContent);
authorImg.append(img);
if (!img.complete) {
img.addEventListener('load', () => {
Expand Down Expand Up @@ -197,7 +198,7 @@ export default async function init(blockEl) {
bylineContainer.firstElementChild.classList.add('article-byline-info');

const authorContainer = bylineContainer.firstElementChild.firstElementChild;
const authorEl = authorContainer.querySelector('a');
const authorEl = authorContainer.firstElementChild;
authorContainer.classList.add('article-author');

buildAuthorInfo(authorEl, bylineContainer);
Expand Down
17 changes: 6 additions & 11 deletions libs/blocks/bulk-publish-v2/components/bulk-publisher.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './job-process.js';
import { LitElement, html } from '../../../deps/lit-all.min.js';
import { getSheet } from '../../../../tools/utils/utils.js';
import { authenticate, getPublishable, startJob } from '../services.js';
import { authenticate, startJob } from '../services.js';
import { getConfig } from '../../../utils/utils.js';
import {
delay,
Expand Down Expand Up @@ -95,8 +95,7 @@ class BulkPublish2 extends LitElement {
this.validateUrls();
}

setJobErrors(jobErrors, authErrors) {
const errors = [...jobErrors, ...authErrors];
setJobErrors(errors) {
const urls = [];
errors.forEach((error) => {
const matched = this.urls.filter((url) => {
Expand Down Expand Up @@ -324,8 +323,7 @@ class BulkPublish2 extends LitElement {
class="panel-title"
@click=${handleToggle}>
<span class="title">
${this.jobs.length ? html`<strong>${this.jobs.length}</strong>` : ''}
Job Result${this.jobs.length > 1 ? 's' : ''}
Job Results
</span>
<div class="jobs-tools${showList}">
<div
Expand Down Expand Up @@ -382,17 +380,16 @@ class BulkPublish2 extends LitElement {
async submit() {
if (!this.isDisabled()) {
this.processing = 'started';
const { authorized, unauthorized } = await getPublishable(this);
const job = await startJob({
urls: authorized,
urls: this.urls,
process: this.process.toLowerCase(),
useBulk: this.user.permissions[this.process]?.useBulk ?? false,
});
const { complete, error } = processJobResult(job);
this.jobs = [...this.jobs, ...complete];
this.processing = complete.length ? 'job' : false;
if (error.length || unauthorized.length) {
this.setJobErrors(error, unauthorized);
if (error.length) {
this.setJobErrors(error);
} else {
if (this.mode === 'full') this.openJobs = true;
this.reset();
Expand All @@ -410,7 +407,6 @@ class BulkPublish2 extends LitElement {

renderPromptLoader() {
setTimeout(() => {
/* c8 ignore next 4 */
const loader = this.renderRoot.querySelector('.load-indicator');
const message = this.renderRoot.querySelector('.message');
loader?.classList.add('hide');
Expand All @@ -431,7 +427,6 @@ class BulkPublish2 extends LitElement {
const canUse = Object.values(this.user.permissions).filter((perms) => perms.canUse);
if (canUse.length) return html``;
message = 'Current user is not authorized to use Bulk Publishing Tool';
/* c8 ignore next 3 */
} else {
message = 'Please sign in to AEM sidekick to continue';
}
Expand Down
25 changes: 0 additions & 25 deletions libs/blocks/bulk-publish-v2/services.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import userCanPublishPage from '../../tools/utils/publish.js';
import {
PROCESS_TYPES,
getErrorText,
Expand Down Expand Up @@ -247,32 +246,8 @@ const updateRetry = async ({ queue, urls, process }) => {
return newQueue;
};

// publish authentication service
const getPublishable = async ({ urls, process, user }) => {
let publishable = { authorized: [], unauthorized: [] };
if (!isLive(process)) {
publishable.authorized = urls;
} else {
const { permissions, profile } = user;
const live = { permissions: ['read'] };
if (permissions?.publish?.canUse) {
live.permissions.push('write');
}
publishable = await urls.reduce(async (init, url) => {
const result = await init;
const detail = { webPath: new URL(url).pathname, live, profile };
const { canPublish, message } = await userCanPublishPage(detail);
if (canPublish) result.authorized.push(url);
else result.unauthorized.push({ href: url, message });
return result;
}, Promise.resolve(publishable));
}
return publishable;
};

export {
authenticate,
getPublishable,
pollJobStatus,
startJob,
updateRetry,
Expand Down
1 change: 1 addition & 0 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ class Gnav {
${isDesktop.matches ? '' : this.decorateSearch()}
${this.elements.mainNav}
${isDesktop.matches ? this.decorateSearch() : ''}
${getConfig().searchEnabled === 'on' ? toFragment`<div class="feds-client-search"></div>` : ''}
</div>
`;

Expand Down
10 changes: 7 additions & 3 deletions libs/blocks/hero-marquee/hero-marquee.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ function parseKeyString(str) {
return result;
}

function loadContentType(el, key, classes) {
async function loadContentType(el, key, classes) {
if (classes !== undefined && classes.length) el.classList.add(...classes);
switch (key) {
case 'bgcolor':
decorateBg(el);
break;
case 'lockup':
decorateLockupRow(el, classes);
await decorateLockupRow(el, classes);
break;
case 'qrcode':
decorateQr(el);
Expand Down Expand Up @@ -237,6 +237,7 @@ export default async function init(el) {
}
});

const promiseArr = [];
[...rows].forEach(async (row) => {
const cols = row.querySelectorAll(':scope > div');
const firstCol = cols[0];
Expand All @@ -248,12 +249,15 @@ export default async function init(el) {
firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block');
firstCol.remove();
cols[1].classList.add('row-wrapper');
if (contentTypes.includes(parsed.key)) loadContentType(row, parsed.key, parsed.classes);
if (contentTypes.includes(parsed.key)) {
promiseArr.push(loadContentType(row, parsed.key, parsed.classes));
}
} else {
row.classList.add('norm');
decorateBlockHrs(row);
decorateButtons(row, 'button-xl');
}
});
decorateTextOverrides(el, ['-heading', '-body', '-detail'], mainCopy);
await Promise.all(promiseArr);
}
2 changes: 1 addition & 1 deletion libs/navigation/navigation.js
JackySun9 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const blockConfig = [
name: 'global-navigation',
targetEl: 'header',
appendType: 'prepend',
params: ['imsClientId'],
params: ['imsClientId', 'searchEnabled'],
},
{
key: 'footer',
Expand Down
32 changes: 0 additions & 32 deletions libs/tools/utils/publish.js

This file was deleted.

Loading
Loading