diff --git a/domain/setting/endpoint.go b/domain/setting/endpoint.go index 6a6a3e83..75f4169f 100644 --- a/domain/setting/endpoint.go +++ b/domain/setting/endpoint.go @@ -217,7 +217,11 @@ func (h *Handler) GetInstanceSetting(w http.ResponseWriter, r *http.Request) { key := request.Query(r, "key") setting, _ := h.Store.Setting.GetUser(orgID, "", key, "") 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) diff --git a/gui/app/components/customize/integration-settings.js b/gui/app/components/customize/integration-settings.js index 7cc06601..f9568509 100644 --- a/gui/app/components/customize/integration-settings.js +++ b/gui/app/components/customize/integration-settings.js @@ -45,6 +45,14 @@ export default Component.extend(Notifier, { this.set('trelloCreds', trello); } + + let flowchart = this.get('flowchart'); + if (_.isEmpty(flowchart) || !_.isObject(flowchart)) { + flowchart = { + url: '', + }; + } + this.set('flowchart', flowchart); }, actions: { @@ -61,6 +69,8 @@ export default Component.extend(Notifier, { this.get('orgSvc').saveGlobalSetting('SECTION-TRELLO', this.get('trelloCreds')); } + this.get('orgSvc').saveOrgSetting(orgId, 'flowchart', this.get('flowchart')); + this.notifySuccess(this.i18n.localize('saved')); }); } diff --git a/gui/app/components/section/flowchart/type-editor.js b/gui/app/components/section/flowchart/type-editor.js index 6aaccf79..5bb82f79 100644 --- a/gui/app/components/section/flowchart/type-editor.js +++ b/gui/app/components/section/flowchart/type-editor.js @@ -17,6 +17,7 @@ import Component from '@ember/component'; export default Component.extend({ appMeta: service(), sectionSvc: service('section'), + orgService: service('organization'), i18n: service(), isDirty: false, waiting: false, @@ -26,6 +27,7 @@ export default Component.extend({ readyToSave: false, previewButtonCaption: '', flowCallback: null, + serviceUrl: '', editorId: computed('page', function () { let page = this.get('page'); return `flowchart-editor-${page.id}`; @@ -41,10 +43,16 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - this.previewButtonCaption = this.i18n.localize('preview'); - schedule('afterRender', () => { - this.setupEditor(); + let orgId = this.get("appMeta.orgId"); + this.get('orgService').getOrgSetting(orgId, 'flowchart').then((s) => { + this.set('serviceUrl', s.url); + + this.previewButtonCaption = this.i18n.localize('preview'); + + schedule('afterRender', () => { + this.setupEditor(); + }); }); }, diff --git a/gui/app/pods/customize/integrations/route.js b/gui/app/pods/customize/integrations/route.js index 225f86eb..a75ea445 100644 --- a/gui/app/pods/customize/integrations/route.js +++ b/gui/app/pods/customize/integrations/route.js @@ -32,11 +32,13 @@ export default Route.extend(AuthenticatedRouteMixin, { if (this.get("session.isGlobalAdmin")) { return RSVP.hash({ jira: this.get('orgService').getOrgSetting(orgId, 'jira'), + flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'), trello: this.get('orgService').getGlobalSetting('SECTION-TRELLO') }); } else { return RSVP.hash({ jira: this.get('orgService').getOrgSetting(orgId, 'jira'), + flowchart: this.get('orgService').getOrgSetting(orgId, 'flowchart'), trello: { appKey: '' } }); } diff --git a/gui/app/pods/customize/integrations/template.hbs b/gui/app/pods/customize/integrations/template.hbs index d6168b92..b4a71a07 100644 --- a/gui/app/pods/customize/integrations/template.hbs +++ b/gui/app/pods/customize/integrations/template.hbs @@ -3,4 +3,4 @@ desc=(localize 'admin_integrations_explain') 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}} diff --git a/gui/app/templates/components/customize/integration-settings.hbs b/gui/app/templates/components/customize/integration-settings.hbs index a5bf67dc..b4a33d26 100644 --- a/gui/app/templates/components/customize/integration-settings.hbs +++ b/gui/app/templates/components/customize/integration-settings.hbs @@ -17,11 +17,18 @@ {{localize 'integration_jira_password_explain'}} +

Diagrams.net

+
+ + {{focus-input id="flowchart-url" type="text" value=flowchart.url class="form-control"}} + https://embed.diagrams.net/?embed=1&ui=Kennedy&spin=0&proto=json&splash=0 +
+ {{#if session.isGlobalAdmin}}

Trello

- {{input id="trello-key" type="text" value=trelloCreds.appKey class="form-control"}} + {{input id="trello-key" type="text" value=trelloCreds.appKey class="form-control"}} https://trello.com/app-key
{{/if}} diff --git a/gui/app/templates/components/section/flowchart/type-editor.hbs b/gui/app/templates/components/section/flowchart/type-editor.hbs index 3da14b4d..3a7900bf 100644 --- a/gui/app/templates/components/section/flowchart/type-editor.hbs +++ b/gui/app/templates/components/section/flowchart/type-editor.hbs @@ -6,7 +6,7 @@ {{#section/base-editor document=document folder=folder page=page busy=waiting isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
diff --git a/gui/public/i18n/en-US.json b/gui/public/i18n/en-US.json index 12c36324..743a72d7 100644 --- a/gui/public/i18n/en-US.json +++ b/gui/public/i18n/en-US.json @@ -401,8 +401,8 @@ "section_airtable_explain": "Part spreadsheet, part database, and entirely flexible (https://airtable.com)", "section_airtable_code": "Airtable embed code", "section_code_tip": "Concise name that describes code snippet", - "section_drawio": "Draw.io", - "section_drawio_explain": "For making flowcharts, process diagrams, org charts, UML, ER diagrams, network diagrams and much more (https://about.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://www.diagrams.net)", "section_iframe": "iFrame", "section_iframe_explain": "Embed an iFrame", "section_iframe_code": "iFrame embed code",