[FIX] mail: download logs
- disable when no logs available - log file contains undefined in its name Part-of: odoo/odoo#115677
This commit is contained in:
committed by
Sébastien Theys
parent
9824634e7c
commit
62b736be2d
@@ -62,16 +62,17 @@ export class CallSettings extends Component {
|
||||
}
|
||||
|
||||
onClickDownloadLogs() {
|
||||
const data = window.JSON.stringify(Object.fromEntries(this.rtc.state.logs));
|
||||
const blob = new window.Blob([data], { type: "application/json" });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `RtcLogs_Channel_${this.rtc.state.logs.channelId}_Session_${
|
||||
this.rtc.state.logs.selfSessionId
|
||||
}_${luxon.DateTime.now().toFormat("yyyy-ll-dd_HH-mm")}.json`;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
const data = JSON.stringify(Object.fromEntries(this.rtc.state.logs));
|
||||
const blob = new Blob([data], { type: "application/json" });
|
||||
const downloadLink = document.createElement("a");
|
||||
const channelId = this.rtc.state.logs.get("channelId");
|
||||
const sessionId = this.rtc.state.logs.get("selfSessionId");
|
||||
const now = luxon.DateTime.now().toFormat("yyyy-ll-dd_HH-mm");
|
||||
downloadLink.download = `RtcLogs_Channel_${channelId}_Session_${sessionId}_${now}.json`;
|
||||
const url = URL.createObjectURL(blob);
|
||||
downloadLink.href = url;
|
||||
downloadLink.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
onClickRegisterKeyButton() {
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div t-if="userSettings.logRtc" class="mb-3 d-flex align-items-center flex-wrap">
|
||||
<button class="btn btn-primary" t-on-click="onClickDownloadLogs">Download logs</button>
|
||||
<button class="btn btn-primary" t-att-disabled="rtc.state.logs.size === 0" t-on-click="onClickDownloadLogs">Download logs</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1464,8 +1464,6 @@ export const rtcService = {
|
||||
}
|
||||
}
|
||||
});
|
||||
// debugging. remove this
|
||||
window.rtc = rtc;
|
||||
return rtc;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user