Lin Qilong 2 meses atrás
pai
commit
9871fb9ba5

+ 7 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PluginController.java

@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
 
 import cn.com.goldenwater.common.plugin.SpringPluginManager;
 import cn.com.goldenwater.common.plugin.autoconfigure.PluginProperties;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.R;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
@@ -134,12 +135,14 @@ public class PluginController {
     /**
      * 启动指定插件
      *
-     * @param pluginId 插件唯一标识符
+     * @param pluginIds 插件唯一标识符
      * @return 插件启动后的状态信息
      */
-    @GetMapping("start/{pluginId}")
-    public PluginState startPlugin(@PathVariable String pluginId) {
-        return pluginManager.startPlugin(pluginId);
+    @GetMapping("start/{pluginIds}")
+    public AjaxResult startPlugin(@PathVariable String pluginIds) {
+        Arrays.stream(pluginIds.split(","))
+                .forEach(pluginId -> pluginManager.startPlugin(pluginId));
+        return AjaxResult.success();
     }
 
 

+ 3 - 3
ruoyi-ui/src/views/container/containerDetail.vue

@@ -146,21 +146,21 @@ function getContainerStatus(status) {
 
 function startContainers(id) {
   startContainer(id).then(() => {
-    proxy.$message.success('启动成功')
+    proxy.$modal.msgSuccess('启动成功')
     getModelListTable()
   })
 }
 
 function stopContainers(id) {
   stopContainer(id).then(() => {
-    proxy.$message.success('关闭成功')
+    proxy.$modal.msgSuccess('关闭成功')
     getModelListTable()
   })
 }
 
 function restartContainers(id) {
   restartContainer(id).then(() => {
-    proxy.$message.success('重启成功')
+    proxy.$modal.msgSuccess('重启成功')
     getModelListTable()
   })
 }

+ 12 - 11
ruoyi-ui/src/views/system/plugin/index.vue

@@ -21,7 +21,7 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button v-hasPermi="['system:plugin:remove']" type="primary" plain icon="Delete" :disabled="multiple"
-                   @click="handleLoadPlugin">
+                   @click="handlePluginStart(null)">
           启动插件
         </el-button>
       </el-col>
@@ -49,12 +49,14 @@
       <el-table-column label="运行状态" align="center" prop="state">
         <template #default="scope">
           <el-tag type="primary" v-if="scope.row.state==='STARTED'">启用</el-tag>
-          <el-tag type="danger" v-if="scope.row.state==='DISABLED'">停用</el-tag>
+          <el-tag type="warning" v-if="scope.row.state==='DISABLED'">未运行</el-tag>
+          <el-tag type="danger" v-if="scope.row.state==='STOPPED'">停用</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template #default="scope">
-          <el-button v-if="scope.row.state==='DISABLED'" v-hasPermi="['system:plugin:start']" link type="primary"
+          <el-button v-if="scope.row.state==='DISABLED' || scope.row.state==='STOPPED'"
+                     v-hasPermi="['system:plugin:start']" link type="primary"
                      @click="handlePluginStart(scope.row)">
             启动
           </el-button>
@@ -294,7 +296,7 @@ const handleLoadPlugin = async () => {
 
 /** 插件【启动】操作 */
 const handlePluginStart = async (row) => {
-  const pluginIds = row?.id || ids.value;
+  const pluginIds = row?.id || ids.value.join(',');
   await proxy.$modal.confirm('确认【启动】所选择的插件吗?');
   pluginStart(pluginIds).then((response) => {
     getList();
@@ -305,13 +307,12 @@ const handlePluginStart = async (row) => {
 /** 插件【停止】操作 */
 const handlePluginStop = async (row) => {
   const pluginIds = row?.id || ids.value;
-  const [err] = await to(proxy.$modal.confirm('是否【停止】所选择的插件"' + pluginIds + '"?'));
-  if (!err) {
-    pluginStop(pluginIds).then((response) => {
-      getList();
-      proxy.$modal.msgSuccess('停止成功');
-    });
-  }
+  proxy.$modal.confirm('是否【停止】所选择的插件"' + pluginIds + '"?')
+      .then(() => pluginStop(pluginIds))
+      .then(() => {
+        getList();
+        proxy.$modal.msgSuccess('停止成功');
+      });
 };
 
 function handleDelete() {