diff --git a/ProcessMaker/Models/ScriptExecutor.php b/ProcessMaker/Models/ScriptExecutor.php index cc86f6f5e1..e36a90b580 100644 --- a/ProcessMaker/Models/ScriptExecutor.php +++ b/ProcessMaker/Models/ScriptExecutor.php @@ -154,7 +154,10 @@ public static function list($language = null) } foreach ($executors->get() as $executor) { - $list[$executor->id] = $executor->language . ' - ' . $executor->title; + $list[$executor->id] = [ + 'language' => $executor->language, + 'title' => $executor->title, + ]; } return $list; diff --git a/resources/img/script_lang/default.svg b/resources/img/script_lang/default.svg new file mode 100644 index 0000000000..f2e3da27cf --- /dev/null +++ b/resources/img/script_lang/default.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/img/script_lang/javascript.svg b/resources/img/script_lang/javascript.svg new file mode 100644 index 0000000000..bc0e4d5fa2 --- /dev/null +++ b/resources/img/script_lang/javascript.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/img/script_lang/lua.svg b/resources/img/script_lang/lua.svg new file mode 100644 index 0000000000..b4ed3b20ee --- /dev/null +++ b/resources/img/script_lang/lua.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/img/script_lang/php.svg b/resources/img/script_lang/php.svg new file mode 100644 index 0000000000..05d8c7574a --- /dev/null +++ b/resources/img/script_lang/php.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/resources/js/processes/scripts/components/CreateScriptModal.vue b/resources/js/processes/scripts/components/CreateScriptModal.vue index 61456cc198..baf7797635 100644 --- a/resources/js/processes/scripts/components/CreateScriptModal.vue +++ b/resources/js/processes/scripts/components/CreateScriptModal.vue @@ -9,179 +9,261 @@ > {{ $t("Script") }} - - + + + +
+ + +
+ @@ -192,6 +274,7 @@ import Required from "../../../components/shared/Required.vue"; import ProjectSelect from "../../../components/shared/ProjectSelect.vue"; import SliderWithInput from "../../../components/shared/SliderWithInput.vue"; import { isQuickCreate as isQuickCreateFunc } from "../../../utils/isQuickCreate"; +import LanguageScript from "./LanguageScript.vue"; const channel = new BroadcastChannel("assetCreation"); @@ -201,6 +284,7 @@ export default { Required, SliderWithInput, ProjectSelect, + LanguageScript, }, mixins: [FormErrorsMixin], props: [ @@ -236,6 +320,7 @@ export default { script: null, projects: [], isQuickCreate: isQuickCreateFunc(), + userRunScript: 1, }; }, computed: { @@ -259,10 +344,20 @@ export default { return this.$t("Create Script"); }, }, + mounted() { + this.getAdminUser(); + }, methods: { show() { this.$bvModal.show("createScript"); }, + getAdminUser() { + ProcessMaker.apiClient + .get(`/users/${this.userRunScript}`) + .then((response) => { + this.selectedUser = response.data; + }); + }, onClose() { this.title = ""; this.language = ""; @@ -275,6 +370,9 @@ export default { this.retry_attempts = 0; this.retry_wait_time = 5; this.addError = {}; + this.getAdminUser(); + this.projects = []; + this.close(); }, close() { this.$bvModal.hide("createScript"); @@ -338,6 +436,36 @@ export default { } }); }, + /** + * Set the ID of the language selected + */ + onSelect(langId) { + this.script_executor_id = langId; + }, }, }; + + diff --git a/resources/js/processes/scripts/components/LanguageScript.vue b/resources/js/processes/scripts/components/LanguageScript.vue new file mode 100644 index 0000000000..95e4799691 --- /dev/null +++ b/resources/js/processes/scripts/components/LanguageScript.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/resources/views/processes/scripts/edit.blade.php b/resources/views/processes/scripts/edit.blade.php index 0c29391e64..55816f4217 100644 --- a/resources/views/processes/scripts/edit.blade.php +++ b/resources/views/processes/scripts/edit.blade.php @@ -59,15 +59,20 @@ :errors="errors.projects">
- +
- + @php + $scriptExecutorsLang = []; + foreach ($scriptExecutors as $key => $value) { + $scriptExecutorsLang[$key] = $value["language"] . " - " . $value["title"]; + } + @endphp
{!!Form::label('script_executor_id', __('Script Executor'))!!}* - {!!Form::select('script_executor_id', [''=>__('Select')] + $scriptExecutors, null, ['class'=> + {!!Form::select('script_executor_id', [''=>__('Select')] + $scriptExecutorsLang, null, ['class'=> 'form-control', 'v-model'=> 'formData.script_executor_id', 'v-bind:class' => '{\'form-control\':true, \'is-invalid\':errors.script_executor_id}', 'required', 'aria-required' => 'true']);!!} diff --git a/webpack.mix.js b/webpack.mix.js index 5d729dde12..5fa355a8ed 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -54,6 +54,7 @@ mix.extract([ "@fortawesome/vue-fontawesome" ]) .copy("resources/img/*", "public/img") + .copy("resources/img/script_lang/*", "public/img/script_lang") .copy("node_modules/snapsvg/dist/snap.svg.js", "public/js") .copy("resources/js/components/CustomActions.vue", "public/js") .copy("resources/js/components/DetailRow.vue", "public/js")