window.CreateForm = CreateForm = function() { this.scope = '#generate'; this.form = new Form(this.scope); this.scenarios = window.scenarios; this.select = $(`${this.scope} .scenario`); this.desc = $(`${this.scope} .description`); let self = this; this.form.errorContent = function(payload, output, cb) { window.utils.waterfallWithHooks({ data: { alert: `An unexpected error occured. Looks like something went wrong while generating your new entity. This migth be a bug, or an unexpected feature. It could be a temporary issue. When is is persistent contact your friendly API Instrumentation administrator.`, output: output, payload: payload, pre: '', post: '' }, pre: window.hooks.preCreateError, post: window.hooks.postCreateError, action: (payload, innerCb) => { cb(null, ` ${payload.pre}
${payload.output}${window.utils.clipboardButton()} ${payload.post} `); innerCb(null, payload); } }); }; this.form.resultContent = function(payload, output, cb) { let card = window.utils.card({ body: `
${output}${window.utils.clipboardButton()} ` }); window.utils.waterfallWithHooks({ data: { alert: `A new ${self.scenario().name.toLowerCase()} was created.`, output: output, payload: payload, cards: [card], pre: '', post: '', openCard: '#details' }, pre: window.hooks.preCreateResult, post: window.hooks.postCreateResult, action: (payload, innerCb) => { cb(null, ` ${payload.pre}