Skip to content

Commit

Permalink
Merge branch 'main' into CHARTS-10260-update-chartkit
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 authored Oct 28, 2024
2 parents 95187c4 + 154a530 commit dff1f71
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 26 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/build_application_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ jobs:
build:
name: datalens-ui
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
if: ${{ github.event.workflow_run.conclusion == '' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: write
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.workflow_run.id != '' }}
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
- name: Extract commit ref from workflow
run: |
echo "COMMIT_REF=$(cat workflow_ref/ref || echo '${{ github.ref }}')" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
ref: ${{github.event.workflow_run.head_sha || github.ref}}
ref: ${{ env.COMMIT_REF || github.ref }}
- uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/e2e_build_application_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ jobs:
build:
name: datalens-ui
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
if: ${{ github.event.workflow_run.conclusion == '' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: write
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.workflow_run.id != '' }}
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
- name: Extract commit ref from workflow
run: |
echo "COMMIT_REF=$(cat workflow_ref/ref || echo '${{ github.ref }}')" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
ref: ${{github.event.workflow_run.head_sha || github.ref}}
ref: ${{ env.COMMIT_REF || github.ref }}
- uses: docker/setup-buildx-action@v3
- name: 'Get release build version'
run: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/publish_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,12 @@ jobs:
prerelease: false
- name: 'Success notify'
run: echo "Version bumped to '$TAG_NEW_VERSION' and pushed to remote repository"
- name: Save workflow ref
run: |
mkdir -p ./workflow_ref
echo "${{ env.NEW_BRANCH }}" > ./workflow_ref/ref
- uses: actions/upload-artifact@v3
with:
name: workflow_ref
path: ./workflow_ref/
retention-days: 30
9 changes: 9 additions & 0 deletions .github/workflows/publish_platform_hotfix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,12 @@ jobs:
prerelease: false
- name: 'Success notify'
run: echo "Version bumped to '$TAG_NEW_VERSION' and pushed to remote repository"
- name: Save workflow ref
run: |
mkdir -p ./workflow_ref
echo "${{ env.NEW_BRANCH }}" > ./workflow_ref/ref
- uses: actions/upload-artifact@v3
with:
name: workflow_ref
path: ./workflow_ref/
retention-days: 30
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 @@ -105,7 +105,7 @@
},
"devDependencies": {
"@gravity-ui/app-builder": "^0.13.0",
"@gravity-ui/components": "^3.12.1",
"@gravity-ui/components": "^3.12.3",
"@gravity-ui/date-components": "^2.10.2",
"@gravity-ui/eslint-config": "^3.2.0",
"@gravity-ui/icons": "^2.9.1",
Expand Down
31 changes: 16 additions & 15 deletions src/ui/components/RevisionsPanel/RevisionsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,16 @@ export type RevisionsPanelProps = {
const b = block('revisions-panel');
const i18n = I18n.keyset('component.revisions-panel.view');

const SCOPE_TEXTS: Record<string, string> = {
dash: i18n('label_dash'),
widget: i18n('label_chart'),
editor: i18n('label_editor'),
};
export const SCOPE_TEXTS_PANEL: Record<string, string> = {
dash: i18n('label_of-dash'),
widget: i18n('label_of-chart'),
editor: i18n('label_of-editor'),
};

export const lockedTextInfo = (loginOrId: string, scope: string) => {
const {getLoginById} = registry.common.functions.getAll();
const LoginById = getLoginById();

const showLogin = LoginById && loginOrId && loginOrId !== 'unknown';

const {getRevisionsPanelEntryScopesTexts} = registry.common.functions.getAll();

const scopeTexts = getRevisionsPanelEntryScopesTexts();

return (
<div>
{showLogin ? (
Expand All @@ -66,10 +59,10 @@ export const lockedTextInfo = (loginOrId: string, scope: string) => {
view="secondary"
/>
&nbsp;
{i18n('label_entry-is-editing-by', {scope: SCOPE_TEXTS[scope]})}
{i18n('label_entry-is-editing-by', {scope: scopeTexts[scope]?.scopeText || ''})}
</React.Fragment>
) : (
i18n('label_already-editing-entry', {scope: SCOPE_TEXTS[scope]})
i18n('label_already-editing-entry', {scope: scopeTexts[scope]?.scopeText || ''})
)}
</div>
);
Expand All @@ -84,6 +77,10 @@ type LockedTextInfoParams = {

export const setLockedTextInfo = ({loginOrId, scope, callback, onError}: LockedTextInfoParams) => {
return function (dispatch: AppDispatch) {
const {getRevisionsPanelEntryScopesTexts} = registry.common.functions.getAll();

const scopeTexts = getRevisionsPanelEntryScopesTexts();

dispatch(
openDialogConfirm({
onApply: () => {
Expand All @@ -108,7 +105,7 @@ export const setLockedTextInfo = ({loginOrId, scope, callback, onError}: LockedT
},
widthType: 'medium',
confirmHeaderText: getCapitalizedStr(
i18n('label_entry-is-editing', {scope: SCOPE_TEXTS[scope]}),
i18n('label_entry-is-editing', {scope: scopeTexts[scope]?.scopeText || ''}),
),
cancelButtonText: i18n('button_cancel'),
confirmButtonText: i18n('button_edit-anyway'),
Expand Down Expand Up @@ -203,7 +200,11 @@ const RevisionsPanel = ({
return null;
}

const scopeText = SCOPE_TEXTS_PANEL[scope] || '';
const {getRevisionsPanelEntryScopesTexts} = registry.common.functions.getAll();

const scopeTexts = getRevisionsPanelEntryScopesTexts();

const scopeText = scopeTexts[scope]?.panelText || '';
const date = moment(updatedAt).format(TIMESTAMP_FORMAT);

const {getLoginById} = registry.common.functions.getAll();
Expand Down
8 changes: 8 additions & 0 deletions src/ui/registry/units/common/functions-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,12 @@ export const commonFunctionsMap = {
getAllEntryScopes: makeFunctionTemplate<() => EntryScope[]>(),
getScopeTypeIcon: makeFunctionTemplate<(scope: EntryScope) => string | null>(),
getEntryScopesWithRevisionsList: makeFunctionTemplate<() => EntryScope[]>(),
getRevisionsPanelEntryScopesTexts: makeFunctionTemplate<
() => {
[key: string]: {
scopeText: string;
panelText: string;
};
}
>(),
} as const;
2 changes: 2 additions & 0 deletions src/ui/registry/units/common/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {getUpdatedUserSettings} from '../../../store/utils/user';
import {WorkbookEntriesTableTabs} from '../../../units/workbooks/components/Table/WorkbookEntriesTable/WorkbookEntriesTableTabs';
import {getAllEntryScopes} from '../../../utils/getAllEntryScopes';
import {getBasicActionPanelItems} from '../../../utils/getBasicActionPanelItems';
import {getRevisionsPanelEntryScopesTexts} from '../../../utils/getRevisionsPanelEntryScopesTexts';
import {getScopeTypeIcon} from '../../../utils/getScopeTypeIcon';
import {getTopLevelEntryScopes} from '../../../utils/getTopLevelEntryScopes';
import {getIconDataById} from '../../../utils/icons';
Expand Down Expand Up @@ -94,5 +95,6 @@ export const registerCommonPlugins = () => {
getTopLevelEntryScopes,
getScopeTypeIcon,
getEntryScopesWithRevisionsList,
getRevisionsPanelEntryScopesTexts,
});
};
20 changes: 20 additions & 0 deletions src/ui/utils/getRevisionsPanelEntryScopesTexts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {I18n} from 'i18n';

const i18n = I18n.keyset('component.revisions-panel.view');

const ENTRY_SCOPE_TEXTS = {
dash: {
scopeText: i18n('label_dash'),
panelText: i18n('label_of-dash'),
},
widget: {
scopeText: i18n('label_chart'),
panelText: i18n('label_of-chart'),
},
editor: {
scopeText: i18n('label_editor'),
panelText: i18n('label_of-editor'),
},
};

export const getRevisionsPanelEntryScopesTexts = () => ENTRY_SCOPE_TEXTS;

0 comments on commit dff1f71

Please sign in to comment.