mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Support custom URLS for Diagrams.net
This commit is contained in:
parent
607a2d5797
commit
1a909dd046
8 changed files with 40 additions and 9 deletions
|
@ -217,7 +217,11 @@ func (h *Handler) GetInstanceSetting(w http.ResponseWriter, r *http.Request) {
|
||||||
key := request.Query(r, "key")
|
key := request.Query(r, "key")
|
||||||
setting, _ := h.Store.Setting.GetUser(orgID, "", key, "")
|
setting, _ := h.Store.Setting.GetUser(orgID, "", key, "")
|
||||||
if len(setting) == 0 {
|
if len(setting) == 0 {
|
||||||
setting = "{}"
|
if key == "flowchart" {
|
||||||
|
setting = fmt.Sprintf(`{ "url": "%s" }`, "https://embed.diagrams.net/?embed=1&ui=Kennedy&spin=0&proto=json&splash=0")
|
||||||
|
} else {
|
||||||
|
setting = "{}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response.WriteJSON(w, setting)
|
response.WriteJSON(w, setting)
|
||||||
|
|
|
@ -45,6 +45,14 @@ export default Component.extend(Notifier, {
|
||||||
|
|
||||||
this.set('trelloCreds', trello);
|
this.set('trelloCreds', trello);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let flowchart = this.get('flowchart');
|
||||||
|
if (_.isEmpty(flowchart) || !_.isObject(flowchart)) {
|
||||||
|
flowchart = {
|
||||||
|
url: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.set('flowchart', flowchart);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -61,6 +69,8 @@ export default Component.extend(Notifier, {
|
||||||
this.get('orgSvc').saveGlobalSetting('SECTION-TRELLO', this.get('trelloCreds'));
|
this.get('orgSvc').saveGlobalSetting('SECTION-TRELLO', this.get('trelloCreds'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.get('orgSvc').saveOrgSetting(orgId, 'flowchart', this.get('flowchart'));
|
||||||
|
|
||||||
this.notifySuccess(this.i18n.localize('saved'));
|
this.notifySuccess(this.i18n.localize('saved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import Component from '@ember/component';
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
appMeta: service(),
|
appMeta: service(),
|
||||||
sectionSvc: service('section'),
|
sectionSvc: service('section'),
|
||||||
|
orgService: service('organization'),
|
||||||
i18n: service(),
|
i18n: service(),
|
||||||
isDirty: false,
|
isDirty: false,
|
||||||
waiting: false,
|
waiting: false,
|
||||||
|
@ -26,6 +27,7 @@ export default Component.extend({
|
||||||
readyToSave: false,
|
readyToSave: false,
|
||||||
previewButtonCaption: '',
|
previewButtonCaption: '',
|
||||||
flowCallback: null,
|
flowCallback: null,
|
||||||
|
serviceUrl: '',
|
||||||
editorId: computed('page', function () {
|
editorId: computed('page', function () {
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
return `flowchart-editor-${page.id}`;
|
return `flowchart-editor-${page.id}`;
|
||||||
|
@ -41,10 +43,16 @@ export default Component.extend({
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.previewButtonCaption = this.i18n.localize('preview');
|
|
||||||
|
|
||||||
schedule('afterRender', () => {
|
let orgId = this.get("appMeta.orgId");
|
||||||
this.setupEditor();
|
this.get('orgService').getOrgSetting(orgId, 'flowchart').then((s) => {
|
||||||
|
this.set('serviceUrl', s.url);
|
||||||
|
|
||||||
|
this.previewButtonCaption = this.i18n.localize('preview');
|
||||||
|
|
||||||
|
schedule('afterRender', () => {
|
||||||
|
this.setupEditor();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,13 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
if (this.get("session.isGlobalAdmin")) {
|
if (this.get("session.isGlobalAdmin")) {
|
||||||
return RSVP.hash({
|
return RSVP.hash({
|
||||||
jira: this.get('orgService').getOrgSetting(orgId, 'jira'),
|
jira: this.get('orgService').getOrgSetting(orgId, 'jira'),
|
||||||
|
flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'),
|
||||||
trello: this.get('orgService').getGlobalSetting('SECTION-TRELLO')
|
trello: this.get('orgService').getGlobalSetting('SECTION-TRELLO')
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return RSVP.hash({
|
return RSVP.hash({
|
||||||
jira: this.get('orgService').getOrgSetting(orgId, 'jira'),
|
jira: this.get('orgService').getOrgSetting(orgId, 'jira'),
|
||||||
|
flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'),
|
||||||
trello: { appKey: '' }
|
trello: { appKey: '' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
desc=(localize 'admin_integrations_explain')
|
desc=(localize 'admin_integrations_explain')
|
||||||
icon=constants.Icon.Integrations}}
|
icon=constants.Icon.Integrations}}
|
||||||
|
|
||||||
{{customize/integration-settings jira=model.jira trello=model.trello}}
|
{{customize/integration-settings jira=model.jira trello=model.trello flowchart=model.flowchart}}
|
||||||
|
|
|
@ -17,11 +17,18 @@
|
||||||
<small class="form-text text-muted">{{localize 'integration_jira_password_explain'}}</small>
|
<small class="form-text text-muted">{{localize 'integration_jira_password_explain'}}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2>Diagrams.net</h2>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="flowchart-url">{{localize 'integration_jira_url'}}</label>
|
||||||
|
{{focus-input id="flowchart-url" type="text" value=flowchart.url class="form-control"}}
|
||||||
|
<small class="form-text text-muted">https://embed.diagrams.net/?embed=1&ui=Kennedy&spin=0&proto=json&splash=0</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{#if session.isGlobalAdmin}}
|
{{#if session.isGlobalAdmin}}
|
||||||
<h2>Trello</h2>
|
<h2>Trello</h2>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="trello-key">{{localize 'integration_trello_appkey'}}</label>
|
<label for="trello-key">{{localize 'integration_trello_appkey'}}</label>
|
||||||
{{input id="trello-key" type="text" value=trelloCreds.appKey class="form-control"}}
|
{{input id="trello-key" type="text" value=trelloCreds.appKey class="form-control"}}
|
||||||
<small class="form-text text-muted"><a href="https://trello.com/app-key">https://trello.com/app-key</a></small>
|
<small class="form-text text-muted"><a href="https://trello.com/app-key">https://trello.com/app-key</a></small>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{{#section/base-editor document=document folder=folder page=page busy=waiting isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
|
{{#section/base-editor document=document folder=folder page=page busy=waiting isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
|
||||||
<div class="section-flowchart-diagram">
|
<div class="section-flowchart-diagram">
|
||||||
<iframe id={{editorId}}
|
<iframe id={{editorId}}
|
||||||
src="https://embed.diagrams.net/?embed=1&ui=Kennedy&spin=0&proto=json&splash=0"
|
src={{serviceUrl}}
|
||||||
style="frameborder:0; border: 0; width: 100%; height: 1000px;">
|
style="frameborder:0; border: 0; width: 100%; height: 1000px;">
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -401,8 +401,8 @@
|
||||||
"section_airtable_explain": "Part spreadsheet, part database, and entirely flexible (https://airtable.com)",
|
"section_airtable_explain": "Part spreadsheet, part database, and entirely flexible (https://airtable.com)",
|
||||||
"section_airtable_code": "Airtable embed code",
|
"section_airtable_code": "Airtable embed code",
|
||||||
"section_code_tip": "Concise name that describes code snippet",
|
"section_code_tip": "Concise name that describes code snippet",
|
||||||
"section_drawio": "Draw.io",
|
"section_drawio": "Diagrams.net",
|
||||||
"section_drawio_explain": "For making flowcharts, process diagrams, org charts, UML, ER diagrams, network diagrams and much more (https://about.draw.io)",
|
"section_drawio_explain": "For making flowcharts, process diagrams, org charts, UML, ER diagrams, network diagrams and much more (https://www.diagrams.net)",
|
||||||
"section_iframe": "iFrame",
|
"section_iframe": "iFrame",
|
||||||
"section_iframe_explain": "Embed an iFrame",
|
"section_iframe_explain": "Embed an iFrame",
|
||||||
"section_iframe_code": "iFrame embed code",
|
"section_iframe_code": "iFrame embed code",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue