Skip to content

Commit

Permalink
Update Charticulator index. Enable open view in the visual
Browse files Browse the repository at this point in the history
  • Loading branch information
zBritva committed Sep 28, 2024
1 parent 8636c8a commit 4620e1b
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 65 deletions.
8 changes: 8 additions & 0 deletions capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
{
"essential": true,
"name": "ExportContent"
},
{
"essential": false,
"name": "WebAccess",
"parameters": [
"https://ilfat-galiev.im",
"https://raw.githubusercontent.com"
]
}
],
"objects": {
Expand Down
133 changes: 74 additions & 59 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"preinstall": "git submodule update --init --recursive",
"postinstall": "npm run install:charticulator && npm run copyfiles && npm run link:react-dom && npm run link:react && npm run link:icons",
"link": "npm run link:react-dom && npm run link:react && npm run link:icons",
"link:react": "npx link ./charticulator/node_modules/react",
"link:react-dom": "npx link ./charticulator/node_modules/react-dom",
"link:icons": "npx link ./charticulator/node_modules/@fluentui/react-icons",
Expand Down Expand Up @@ -45,12 +46,12 @@
"d3-format": "3.1.0",
"d3-scale": "4.0.2",
"d3-time-format": "4.1.0",
"dompurify": "2.4.0",
"dompurify": "^2.5.7",
"hammerjs": "2.0.8",
"node-fetch": "2.6.7",
"pegjs": "0.10.0",
"pegjs-loader": "0.5.8",
"powerbi-visuals-api": "4.7.0",
"powerbi-visuals-api": "^5.11.0",
"powerbi-visuals-utils-dataviewutils": "2.4.1",
"powerbi-visuals-webpack-plugin": "4.0.1",
"raw-loader": "4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion pbiviz.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"supportUrl": "https://github.com/zBritva/charticulator-visual-community/issues",
"gitHubUrl": "https://github.com/zBritva/charticulator-visual-community"
},
"apiVersion": "4.7.0",
"apiVersion": "5.11.0",
"author": { "name": "Ilfat Galiev", "email": "[email protected]" },
"assets": { "icon": "assets/icon.png" },
"externalJS": [],
Expand Down
4 changes: 4 additions & 0 deletions src/views/Application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ export const Application: React.FC = () => {
await host.downloadService.exportVisualsContent(json, `${template.specification._id}.json`, 'json', 'template');
}
}}
onWebAccessStatus={async () => {
const access = await host.webAccessService.webAccessStatus('https://ilfat-galiev.im/');
return access == powerbi.PrivilegeStatus.Allowed;
}}
onImport={onImportTemplate}
onSupportDev={onUrl('https://github.com/sponsors/zBritva')}
onContactUsLink={onUrl('https://github.com/zBritva/charticulator-visual-community/discussions')}
Expand Down
16 changes: 15 additions & 1 deletion src/views/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { NestedChartEditorOptions } from "charticulator/src/core/prototypes/cont
import { AttributeMap } from "charticulator/src/core/specification";
import { IVisualSettings } from "src/settings";
import { ChartTemplateBuilder } from "charticulator/src/app/template";
import { CDNBackend } from "charticulator/src/app/backend/cdn";

const script = require("raw-loader!charticulator/dist/scripts/worker.bundle.js");
const charticulatorConfig = require("json-loader!../../charticulator/dist/scripts/config.json");
Expand Down Expand Up @@ -74,6 +75,7 @@ export interface EditorProps {

setTemplate?: (template: string | Specification.Template.ChartTemplate, specification: Specification.Chart) => void;
setProperty?: (property: { objectName: string, objectProperty: string, value: any }) => void;
onWebAccessStatus?: () => Promise<boolean>;
}

interface NestedChartStack {
Expand All @@ -100,6 +102,7 @@ export const Editor: React.FC<EditorProps> = ({
onClose,
setTemplate,
setProperty,
onWebAccessStatus,
dataset,
settings,
template,
Expand Down Expand Up @@ -146,7 +149,18 @@ export const Editor: React.FC<EditorProps> = ({
...config,
localization: localization
});
appStore = new AppStore(worker, dataset || defaultDataset, null);

let backend = null;
if (await onWebAccessStatus()) {
backend = new CDNBackend({
resourcesDescriptionUrl: "https://ilfat-galiev.im/charts.json",
createUrl: null,
deleteUrl: null,
updateUrl: null
})
}

appStore = new AppStore(worker, dataset || defaultDataset, backend);
if (isNestedEditor) {
appStore.editorType = EditorType.NestedEmbedded;
} else {
Expand Down
Loading

0 comments on commit 4620e1b

Please sign in to comment.