Skip to content

Commit

Permalink
Merge branch 'main' into CHARTS-10173
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmadom authored Dec 28, 2024
2 parents 22cb035 + 793e3fe commit 6a1a425
Show file tree
Hide file tree
Showing 87 changed files with 632 additions and 422 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/delete-e2e-report.yml

This file was deleted.

49 changes: 15 additions & 34 deletions .github/workflows/e2e_tests_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ jobs:
(github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure')
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
contents: read
pull-requests: write
steps:
- name: Checkout GitHub Pages Branch
- name: Checkout main
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Set Git User
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
ref: main
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v6
with:
Expand All @@ -36,37 +30,24 @@ jobs:
run: |
echo "HTML_REPORT_URL_PATH=$(cat playwright-report/report-link)" >> "$GITHUB_ENV"
echo "REPORT_PR_NUMBER=$(cat playwright-report/report-pr)" >> "$GITHUB_ENV"
- name: Move report to commit folder
run: mkdir -p ${{ env.HTML_REPORT_URL_PATH }} && mv playwright-report/report ${{ env.HTML_REPORT_URL_PATH }}/report
- name: Push HTML Report
- name: Upload HTML Report
timeout-minutes: 3
# commit report, then try push-rebase-loop until it's able to merge the HTML report to the gh-pages branch
# this is necessary when this job is running at least twice at the same time (e.g. through two pushes at the same time)
run: |
git add .
git commit -m "workflow: add HTML report for ${{ env.HTML_REPORT_URL_PATH }}"
while true; do
git pull --rebase
if [ $? -ne 0 ]; then
echo "Failed to rebase. Please review manually."
exit 1
fi
git push
if [ $? -eq 0 ]; then
echo "Successfully pushed HTML report to repo."
exit 0
fi
done
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.E2E_REPORT_S3_ACCESS_KEY }}
aws_secret_access_key: ${{ secrets.E2E_REPORT_S3_SECRET_KEY}}
aws_bucket: ${{ vars.E2E_REPORT_S3_BUCKET }}
endpoint: ${{ vars.E2E_REPORT_S3_ENDPOINT }}
source_dir: playwright-report/report
destination_dir: ${{ env.HTML_REPORT_URL_PATH }}/report
- name: Output Report URL as Worfklow Annotation
run: |
FULL_HTML_REPORT_URL=https://datalens-tech.github.io/datalens-ui/${{ env.HTML_REPORT_URL_PATH }}/report
FULL_HTML_REPORT_URL=https://${{ vars.E2E_REPORT_S3_BUCKET }}.${{ vars.E2E_REPORT_HTML_ENDPOINT }}/${{ env.HTML_REPORT_URL_PATH }}/report
echo "FULL_HTML_REPORT_URL=${FULL_HTML_REPORT_URL}" >> "$GITHUB_ENV"
echo "::notice title=📋 Published Playwright Test Report::$FULL_HTML_REPORT_URL"
- name: Create Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: e2e-report
number: ${{ env.REPORT_PR_NUMBER }}
message: '[E2E Report](https://datalens-tech.github.io/datalens-ui/${{ env.HTML_REPORT_URL_PATH }}/report) is ready.'
message: '[E2E Report](${{ env.FULL_HTML_REPORT_URL }}) is ready.'
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@node-rs/crc32": "^1.7.2",
"ajv": "^8.12.0",
"axios": "^1.7.7",
"axios-retry": "^3.2.0",
"axios-retry": "^3.9.1",
"clipboard-copy": "^3.2.0",
"cookie-session": "^2.1.0",
"d3": "^7.8.5",
Expand Down
14 changes: 0 additions & 14 deletions src/@types/axios.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/@types/nodekit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface SharedAppConfig {
redis: RedisConfig | null;
apiPrefix: string;
preloadList?: string[];
releaseVersion?: string;
}

export interface SharedAppDynamicConfig {
Expand Down
1 change: 1 addition & 0 deletions src/i18n-keysets/component.aside-header.view/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"label_about": "About",
"label_account": "Account",
"label_app-version": "Version",
"label_collections": "Collections and workbooks",
"label_docs": "Documentation",
"label_github": "GitHub",
Expand Down
1 change: 1 addition & 0 deletions src/i18n-keysets/component.aside-header.view/ru.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"label_about": "О сервисе",
"label_account": "Учётная запись",
"label_app-version": "Версия",
"label_collections": "Коллекции и воркбуки",
"label_docs": "Документация",
"label_github": "GitHub",
Expand Down
1 change: 1 addition & 0 deletions src/server/app-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {AppInstallation, AppMode} from '../shared';
const mode = process.env.APP_MODE;
export const appInstallation = process.env.APP_INSTALLATION;
export const appEnv = process.env.APP_ENV;
export const releaseVersion = process.env.RELEASE_VERSION;

export const isFullMode = mode === AppMode.Full;
export const isDatalensMode = mode === AppMode.Datalens;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {IncomingHttpHeaders, OutgoingHttpHeaders} from 'http';
import querystring from 'querystring';
import url from 'url';

import type {Request} from '@gravity-ui/expresskit';
import type {AppContext} from '@gravity-ui/nodekit';
import {REQUEST_ID_PARAM_NAME} from '@gravity-ui/nodekit';
import {isObject, isString} from 'lodash';
Expand Down Expand Up @@ -60,8 +59,7 @@ type PromiseWithAbortController = [Promise<unknown>, AbortController];
type DataFetcherOptions = {
chartsEngine: ChartsEngine;
sources: Record<string, Source | string>;
req: Request;
ctx?: AppContext;
ctx: AppContext;
postprocess?:
| ((
data: Record<string, DataFetcherResult>,
Expand All @@ -73,6 +71,17 @@ type DataFetcherOptions = {
userLogin?: string | null;
iamToken?: string | null;
workbookId?: WorkbookId;
isEmbed?: boolean;
zitadelParams?: ZitadelParams | undefined;
originalReqHeaders: DataFetcherOriginalReqHeaders;
adapterContext: AdapterContext;
};

export type DataFetcherOriginalReqHeaders = {
xRealIP: IncomingHttpHeaders['x-real-ip'];
xForwardedFor: IncomingHttpHeaders['x-forwarded-for'];
xChartsFetcherVia: IncomingHttpHeaders['x-charts-fetcher-via'];
referer: IncomingHttpHeaders['referer'];
};

type DataFetcherRequestOptions = {
Expand Down Expand Up @@ -176,19 +185,18 @@ export class DataFetcher {
static fetch({
chartsEngine,
sources,
req,
ctx,
postprocess = null,
subrequestHeaders,
userId,
userLogin,
iamToken,
workbookId,
isEmbed = false,
zitadelParams,
originalReqHeaders,
adapterContext,
}: DataFetcherOptions): Promise<Record<string, DataFetcherResult>> {
// TODO: remove aftex extension will be migrated
if (ctx === undefined) {
ctx = req.ctx;
}
const fetchingTimeout = chartsEngine.config.fetchingTimeout || DEFAULT_FETCHING_TIMEOUT;

const fetchingStartTime = Date.now();
Expand All @@ -209,27 +217,9 @@ export class DataFetcher {
const queue = new PQueue({concurrency: CONCURRENT_REQUESTS_LIMIT});
const fetchPromisesList: (() => unknown)[] = [];

const isEmbed = req.headers[DL_EMBED_TOKEN_HEADER] !== undefined;

const zitadelParams = ctx.config.isZitadelEnabled
? {
accessToken: req.user?.accessToken,
serviceUserAccessToken: req.serviceUserAccessToken,
}
: undefined;

const originalReqHeaders = {
xRealIP: req.headers['x-real-ip'],
xForwardedFor: req.headers['x-forwarded-for'],
xChartsFetcherVia: req.headers['x-charts-fetcher-via'],
referer: req.headers.referer,
};
const adapterContext: AdapterContext = {
headers: {
['x-forwarded-for']: req.headers['x-forwarded-for'],
cookie: req.headers.cookie,
},
};
if (!originalReqHeaders || !adapterContext) {
throw new Error('Missing original request headers or adapter context');
}

Object.keys(sources).forEach((sourceName) => {
const source = sources[sourceName];
Expand All @@ -251,8 +241,9 @@ export class DataFetcher {
workbookId,
isEmbed,
zitadelParams,
originalReqHeaders,
adapterContext,
originalReqHeaders:
originalReqHeaders as DataFetcherOriginalReqHeaders,
adapterContext: adapterContext as AdapterContext,
})
: {
sourceId: sourceName,
Expand Down Expand Up @@ -297,12 +288,12 @@ export class DataFetcher {

failed[result.sourceId] = filterObjectWhitelist(
entry,
chartsEngine.config.runResponseWhitelist,
ctx.config.runResponseWhitelist,
);
} else {
fetched[result.sourceId] = filterObjectWhitelist(
result,
chartsEngine.config.runResponseWhitelist,
ctx.config.runResponseWhitelist,
) as DataFetcherResult;
}
});
Expand Down Expand Up @@ -486,16 +477,11 @@ export class DataFetcher {
workbookId?: WorkbookId;
isEmbed: boolean;
zitadelParams: ZitadelParams | undefined;
originalReqHeaders: {
xRealIP: IncomingHttpHeaders['x-real-ip'];
xForwardedFor: IncomingHttpHeaders['x-forwarded-for'];
xChartsFetcherVia: IncomingHttpHeaders['x-charts-fetcher-via'];
referer: IncomingHttpHeaders['referer'];
};
originalReqHeaders: DataFetcherOriginalReqHeaders;
adapterContext: AdapterContext;
}) {
const singleFetchingTimeout =
chartsEngine.config.singleFetchingTimeout || DEFAULT_SINGLE_FETCHING_TIMEOUT;
ctx.config.singleFetchingTimeout || DEFAULT_SINGLE_FETCHING_TIMEOUT;

const onDataFetched = chartsEngine.telemetryCallbacks.onDataFetched || (() => {});
const onDataFetchingFailed =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {Request} from '@gravity-ui/expresskit';
import type {AppContext} from '@gravity-ui/nodekit';
import {flow} from 'lodash';

import type {ChartsEngine} from '../../index';
import type {HooksContext} from '../../types';

export class HookError extends Error {
hookError: {
Expand Down Expand Up @@ -52,15 +52,15 @@ export class ProcessorHooks {
}

async init({
req,
config,
isEditMode,
ctx,
hooksContext,
}: {
req: Request;
config: Record<string, any>;
isEditMode: boolean;
ctx: AppContext;
hooksContext: HooksContext;
}) {
let hrStart;

Expand All @@ -71,10 +71,10 @@ export class ProcessorHooks {
try {
ctx.log(`Hook ${hookName} init`);
const hook = processHook.init({
req,
config,
isEditMode,
ctx,
hooksContext,
});
ctx.log(`Hook ${hookName} process`);
await hook.process();
Expand Down
Loading

0 comments on commit 6a1a425

Please sign in to comment.