Skip to content

Commit 5230b2f

Browse files
committed
remove refresh since it could cause additional billing. we want to define the costs before expose it.
1 parent c0556ea commit 5230b2f

File tree

8 files changed

+2182
-763
lines changed

8 files changed

+2182
-763
lines changed

dist/powerbi.js

+2,115-658
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

+66-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/report.d.ts

-8
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ export declare class Report extends embed.Embed implements IReportNode, IFiltera
106106
* Prints the active page of the report by invoking `window.print()` on the embed iframe component.
107107
*/
108108
print(): Promise<void>;
109-
/**
110-
* Refreshes data sources for the report.
111-
*
112-
* ```javascript
113-
* report.refresh();
114-
* ```
115-
*/
116-
refresh(): Promise<void>;
117109
/**
118110
* Removes all filters at the report level.
119111
*

src/report.ts

-17
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,6 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
174174
});
175175
}
176176

177-
/**
178-
* Refreshes data sources for the report.
179-
*
180-
* ```javascript
181-
* report.refresh();
182-
* ```
183-
*/
184-
refresh(): Promise<void> {
185-
return this.service.hpm.post<models.IError[]>('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)
186-
.then(response => {
187-
return response.body;
188-
})
189-
.catch(response => {
190-
throw response.body;
191-
});
192-
}
193-
194177
/**
195178
* Removes all filters at the report level.
196179
*

test/test.spec.ts

-68
Original file line numberDiff line numberDiff line change
@@ -1154,26 +1154,6 @@ describe('Protocol', function () {
11541154
});
11551155
});
11561156

1157-
describe('refresh', function () {
1158-
it('POST /report/refresh returns 202 if the request is valid', function (done) {
1159-
// Arrange
1160-
iframeLoaded
1161-
.then(() => {
1162-
spyApp.refreshData.and.returnValue(Promise.resolve(null));
1163-
// Act
1164-
hpm.post<void>('/report/refresh', null)
1165-
.then(response => {
1166-
// Assert
1167-
expect(spyApp.refreshData).toHaveBeenCalled();
1168-
expect(response.statusCode).toEqual(202);
1169-
// Cleanup
1170-
spyApp.refreshData.calls.reset();
1171-
done();
1172-
});
1173-
});
1174-
});
1175-
});
1176-
11771157
describe('filters (report level)', function () {
11781158
it('GET /report/filters returns 200 with body as array of filters', function (done) {
11791159
// Arrange
@@ -2214,36 +2194,6 @@ describe('SDK-to-HPM', function () {
22142194
});
22152195
});
22162196

2217-
describe('refresh', function () {
2218-
it('report.refresh() sends POST /report/refresh', function () {
2219-
// Arrange
2220-
spyHpm.post.and.returnValue(Promise.resolve({
2221-
body: {}
2222-
}));
2223-
2224-
// Act
2225-
report.refresh();
2226-
2227-
// Assert
2228-
expect(spyHpm.post).toHaveBeenCalledWith('/report/refresh', null, { uid: uniqueId }, iframe.contentWindow);
2229-
});
2230-
2231-
it('report.refresh() returns promise that resolves if the request is accepted', function (done) {
2232-
// Arrange
2233-
spyHpm.post.and.returnValue(Promise.resolve({
2234-
body: {}
2235-
}));
2236-
2237-
// Act
2238-
report.refresh()
2239-
.then(() => {
2240-
// Assert
2241-
expect(spyHpm.post).toHaveBeenCalledWith('/report/refresh', null, { uid: uniqueId }, iframe.contentWindow);
2242-
done();
2243-
});
2244-
});
2245-
});
2246-
22472197
describe('reload', function () {
22482198
it('report.reload() sends POST /report/load with configuration in body', function () {
22492199
// Arrange
@@ -3125,24 +3075,6 @@ describe('SDK-to-MockApp', function () {
31253075
});
31263076
});
31273077

3128-
describe('refresh', function () {
3129-
it('report.refresh() returns promise that resolves with null if the report refresh command was accepted', function (done) {
3130-
// Arrange
3131-
iframeLoaded
3132-
.then(() => {
3133-
spyApp.refreshData.and.returnValue(Promise.resolve(null));
3134-
// Act
3135-
report.refresh()
3136-
.then(response => {
3137-
// Assert
3138-
expect(spyApp.refreshData).toHaveBeenCalled();
3139-
expect(response).toEqual(undefined);
3140-
done();
3141-
});
3142-
});
3143-
});
3144-
});
3145-
31463078
describe('settings', function () {
31473079
it('report.updateSettings(setting) returns promise that rejects with validation error if object is invalid', function (done) {
31483080
// Arrange

test/utility/mockApp.ts

-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export interface IApp {
1919
validateFilter(filter: models.IFilter): Promise<models.IError[]>;
2020
// Other
2121
print(): Promise<void>;
22-
refreshData(): Promise<void>;
2322
exportData(): Promise<void>;
2423
}
2524

@@ -42,7 +41,6 @@ export const mockAppSpyObj = {
4241
validateFilter: jasmine.createSpy("validateFilter").and.callFake(models.validateFilter),
4342
// Other
4443
print: jasmine.createSpy("print").and.returnValue(Promise.resolve(null)),
45-
refreshData: jasmine.createSpy("refreshData").and.returnValue(Promise.resolve(null)),
4644
exportData: jasmine.createSpy("exportData").and.returnValue(Promise.resolve(null)),
4745

4846
reset() {
@@ -59,7 +57,6 @@ export const mockAppSpyObj = {
5957
mockAppSpyObj.setFilters.calls.reset();
6058
mockAppSpyObj.validateFilter.calls.reset();
6159
mockAppSpyObj.print.calls.reset();
62-
mockAppSpyObj.refreshData.calls.reset();
6360
mockAppSpyObj.exportData.calls.reset();
6461
}
6562
};

test/utility/mockEmbed.ts

-5
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,6 @@ export function setupEmbedMockApp(iframeContentWindow: Window, parentWindow: Win
206206
});
207207
});
208208

209-
router.post('/report/refresh', (req, res) => {
210-
app.refreshData();
211-
res.send(202);
212-
});
213-
214209
router.patch('/report/settings', (req, res) => {
215210
const uniqueId = req.headers['uid'];
216211
const settings = req.body;

0 commit comments

Comments
 (0)