mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-02 20:17:45 +08:00
[Core] [Query] Remove old api
This commit is contained in:
parent
6e05ce30c2
commit
bff202d31f
@ -28,9 +28,17 @@ ALTER TABLE `datacap_pipeline`
|
||||
CHANGE `start_time` `create_time` DATETIME,
|
||||
CHANGE `end_time` `update_time` DATETIME;
|
||||
|
||||
UPDATE `datacap_pipeline`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_scheduled`
|
||||
ADD COLUMN `code` varchar(100);
|
||||
|
||||
UPDATE `datacap_scheduled`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `role` TO `datacap_role`;
|
||||
|
||||
@ -39,36 +47,76 @@ ALTER TABLE `datacap_role`
|
||||
ADD COLUMN `code` VARCHAR(100),
|
||||
ADD COLUMN `update_time` DATETIME;
|
||||
|
||||
UPDATE `datacap_role`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `role_menu_relation` TO `datacap_role_menu_relation`;
|
||||
|
||||
ALTER TABLE `datacap_dashboard`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_dashboard`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_source`
|
||||
ADD COLUMN `active` BOOLEAN DEFAULT TRUE;
|
||||
|
||||
UPDATE `datacap_source`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `snippet` TO `datacap_snippet`;
|
||||
|
||||
UPDATE `datacap_snippet`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_report`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_report`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_metadata_database`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_metadata_database`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_metadata_table`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_metadata_table`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_metadata_column`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_metadata_column`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
ALTER TABLE `datacap_scheduled_history`
|
||||
ADD COLUMN `code` VARCHAR(100);
|
||||
|
||||
UPDATE `datacap_scheduled_history`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `menus` TO `datacap_menu`;
|
||||
|
||||
UPDATE `datacap_menu`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `pipeline_user_relation` TO `datacap_pipeline_user_relation`;
|
||||
|
||||
@ -78,9 +126,17 @@ TABLE `user_roles` TO `datacap_user_role_relation`;
|
||||
RENAME
|
||||
TABLE `functions` TO `datacap_function`;
|
||||
|
||||
UPDATE `datacap_function`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `template_sql` TO `datacap_template`;
|
||||
|
||||
UPDATE `datacap_template`
|
||||
SET `code` = REPLACE(UUID(), '-', '')
|
||||
WHERE `code` IS NULL;
|
||||
|
||||
RENAME
|
||||
TABLE `user_log` TO `datacap_user_log`;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package io.edurt.datacap.server.controller;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.service.body.FilterBody;
|
||||
import io.edurt.datacap.service.entity.BaseEntity;
|
||||
import io.edurt.datacap.service.repository.BaseRepository;
|
||||
import io.edurt.datacap.service.service.BaseService;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class BaseController<T>
|
||||
public abstract class BaseController<T extends BaseEntity>
|
||||
implements Serializable
|
||||
{
|
||||
private final BaseRepository repository;
|
||||
@ -69,4 +70,10 @@ public abstract class BaseController<T>
|
||||
{
|
||||
return service.getById(repository, id);
|
||||
}
|
||||
|
||||
@GetMapping(value = "info/{code}")
|
||||
public CommonResponse<T> getByCode(@PathVariable(value = "code") String code)
|
||||
{
|
||||
return service.findByCode(repository, code);
|
||||
}
|
||||
}
|
||||
|
@ -77,12 +77,6 @@ public class DataSetController
|
||||
return service.adhoc(code, configure);
|
||||
}
|
||||
|
||||
@GetMapping(value = "info/{code}")
|
||||
public CommonResponse<DataSetEntity> info(@PathVariable String code)
|
||||
{
|
||||
return service.getInfo(code);
|
||||
}
|
||||
|
||||
@PostMapping(value = "history/{code}")
|
||||
public CommonResponse<Object> history(@PathVariable String code,
|
||||
@RequestBody FilterBody filter)
|
||||
|
@ -0,0 +1,43 @@
|
||||
package io.edurt.datacap.server.controller;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.service.body.FunctionsImportBody;
|
||||
import io.edurt.datacap.service.entity.FunctionEntity;
|
||||
import io.edurt.datacap.service.entity.PageEntity;
|
||||
import io.edurt.datacap.service.repository.FunctionsRepository;
|
||||
import io.edurt.datacap.service.service.FunctionService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController()
|
||||
@RequestMapping(value = {"/api/v1/admin/function", "/api/v1/function"})
|
||||
public class FunctionController
|
||||
extends BaseController<FunctionEntity>
|
||||
{
|
||||
private final FunctionsRepository repository;
|
||||
private final FunctionService service;
|
||||
|
||||
public FunctionController(FunctionsRepository repository, FunctionService service)
|
||||
{
|
||||
super(repository, service);
|
||||
this.repository = repository;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@PutMapping(value = "import")
|
||||
public CommonResponse<Object> batchImport(@RequestBody @Validated FunctionsImportBody configure)
|
||||
{
|
||||
return this.service.batchImport(configure);
|
||||
}
|
||||
|
||||
@GetMapping(value = "list/{plugin}")
|
||||
public CommonResponse<PageEntity<FunctionEntity>> getAllByPlugin(@PathVariable(value = "plugin") String plugin)
|
||||
{
|
||||
return this.service.getAllByPlugin(plugin);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package io.edurt.datacap.server.controller;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.service.entity.PluginAuditEntity;
|
||||
import io.edurt.datacap.service.repository.PluginAuditRepository;
|
||||
import io.edurt.datacap.service.service.PluginAuditService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController()
|
||||
@RequestMapping(value = "/api/v1/audit/plugin")
|
||||
public class PluginAuditController
|
||||
extends BaseController<PluginAuditEntity>
|
||||
{
|
||||
private final PluginAuditRepository repository;
|
||||
private final PluginAuditService service;
|
||||
|
||||
public PluginAuditController(PluginAuditRepository repository, PluginAuditService service)
|
||||
{
|
||||
super(repository, service);
|
||||
this.repository = repository;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping(value = "data/{id}")
|
||||
public CommonResponse<Object> getData(@PathVariable Long id)
|
||||
{
|
||||
return service.getData(id);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package io.edurt.datacap.server.controller.admin;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.service.body.FilterBody;
|
||||
import io.edurt.datacap.service.body.FunctionsImportBody;
|
||||
import io.edurt.datacap.service.entity.FunctionEntity;
|
||||
import io.edurt.datacap.service.entity.PageEntity;
|
||||
import io.edurt.datacap.service.service.FunctionsService;
|
||||
import io.edurt.datacap.service.validation.ValidationGroup;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController()
|
||||
@RequestMapping(value = {"/api/v1/admin/function", "/api/v1/function"})
|
||||
public class FunctionsController
|
||||
{
|
||||
private final FunctionsService functionsService;
|
||||
|
||||
public FunctionsController(FunctionsService functionsService)
|
||||
{
|
||||
this.functionsService = functionsService;
|
||||
}
|
||||
|
||||
@PostMapping(value = "list")
|
||||
public CommonResponse<PageEntity<FunctionEntity>> getAllByFilter(@RequestBody FilterBody filter)
|
||||
{
|
||||
return this.functionsService.getAllByFilter(filter);
|
||||
}
|
||||
|
||||
@PostMapping(produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public CommonResponse<FunctionEntity> save(@RequestBody @Validated(ValidationGroup.Crud.Create.class) FunctionEntity configure)
|
||||
{
|
||||
return this.functionsService.saveOrUpdate(configure);
|
||||
}
|
||||
|
||||
@PutMapping(produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public CommonResponse<FunctionEntity> update(@RequestBody @Validated(ValidationGroup.Crud.Update.class) FunctionEntity configure)
|
||||
{
|
||||
return this.functionsService.saveOrUpdate(configure);
|
||||
}
|
||||
|
||||
@GetMapping(value = "{id}")
|
||||
public CommonResponse<FunctionEntity> getInfo(@PathVariable(value = "id") Long id)
|
||||
{
|
||||
return this.functionsService.getById(id);
|
||||
}
|
||||
|
||||
@PutMapping(value = "import")
|
||||
public CommonResponse<Object> batchImport(@RequestBody @Validated FunctionsImportBody configure)
|
||||
{
|
||||
return this.functionsService.batchImport(configure);
|
||||
}
|
||||
|
||||
@GetMapping(value = "list/{plugin}")
|
||||
public CommonResponse<PageEntity<FunctionEntity>> getAllByPlugin(@PathVariable(value = "plugin") String plugin)
|
||||
{
|
||||
return this.functionsService.getAllByPlugin(plugin);
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package io.edurt.datacap.server.controller.user;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.service.body.FilterBody;
|
||||
import io.edurt.datacap.service.entity.PageEntity;
|
||||
import io.edurt.datacap.service.entity.PluginAuditEntity;
|
||||
import io.edurt.datacap.service.service.PluginAuditService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController()
|
||||
@RequestMapping(value = "/api/v1/audit/plugin")
|
||||
public class PluginAuditController
|
||||
{
|
||||
private final PluginAuditService pluginAuditService;
|
||||
|
||||
public PluginAuditController(PluginAuditService pluginAuditService)
|
||||
{
|
||||
this.pluginAuditService = pluginAuditService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Deprecated
|
||||
public CommonResponse<PageEntity<PluginAuditEntity>> getAll(@RequestParam(value = "page", defaultValue = "1") int start,
|
||||
@RequestParam(value = "size", defaultValue = "10") int end)
|
||||
{
|
||||
return this.pluginAuditService.getAll(start, end);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResponse<PageEntity<PluginAuditEntity>> getAllByFilter(@RequestBody FilterBody filter)
|
||||
{
|
||||
return this.pluginAuditService.getAllByFilter(filter);
|
||||
}
|
||||
|
||||
@GetMapping(value = "{id}")
|
||||
public CommonResponse<PluginAuditEntity> getInfo(@PathVariable(value = "id") Long id)
|
||||
{
|
||||
return this.pluginAuditService.getById(id);
|
||||
}
|
||||
|
||||
@GetMapping(value = "data/{id}")
|
||||
public CommonResponse<Object> getData(@PathVariable Long id)
|
||||
{
|
||||
return pluginAuditService.getData(id);
|
||||
}
|
||||
}
|
@ -61,13 +61,19 @@ public class BaseEntity
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@PrePersist
|
||||
public void generateCode()
|
||||
public void prePersist()
|
||||
{
|
||||
if (this.code == null) {
|
||||
this.code = UUID.randomUUID()
|
||||
.toString()
|
||||
.replace("-", "");
|
||||
}
|
||||
this.updateTime = new Date();
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,9 @@ package io.edurt.datacap.service.repository;
|
||||
import io.edurt.datacap.service.entity.FunctionEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
|
||||
public interface FunctionsRepository
|
||||
extends PagingAndSortingRepository<FunctionEntity, Long>
|
||||
extends BaseRepository<FunctionEntity, Long>
|
||||
{
|
||||
Page<FunctionEntity> findAllByPluginContaining(Pageable pageable, String plugin);
|
||||
}
|
||||
|
@ -6,14 +6,13 @@ import io.edurt.datacap.service.entity.UserEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PluginAuditRepository
|
||||
extends PagingAndSortingRepository<PluginAuditEntity, Long>
|
||||
extends BaseRepository<PluginAuditEntity, Long>
|
||||
{
|
||||
Page<PluginAuditEntity> findAllByUser(UserEntity user, Pageable pageable);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.edurt.datacap.service.service;
|
||||
|
||||
import io.edurt.datacap.common.response.CommonResponse;
|
||||
import io.edurt.datacap.common.utils.NullAwareBeanUtils;
|
||||
import io.edurt.datacap.service.adapter.PageRequestAdapter;
|
||||
import io.edurt.datacap.service.body.FilterBody;
|
||||
import io.edurt.datacap.service.entity.BaseEntity;
|
||||
@ -8,7 +9,7 @@ import io.edurt.datacap.service.entity.PageEntity;
|
||||
import io.edurt.datacap.service.repository.BaseRepository;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface BaseService<T>
|
||||
public interface BaseService<T extends BaseEntity>
|
||||
{
|
||||
default CommonResponse<PageEntity<T>> getAll(BaseRepository repository, FilterBody filter)
|
||||
{
|
||||
@ -23,6 +24,10 @@ public interface BaseService<T>
|
||||
|
||||
default CommonResponse<T> saveOrUpdate(BaseRepository repository, T configure)
|
||||
{
|
||||
if (configure.getId() != null) {
|
||||
repository.findById(configure.getId())
|
||||
.ifPresent(value -> NullAwareBeanUtils.copyNullProperties(value, configure));
|
||||
}
|
||||
return CommonResponse.success(repository.save(configure));
|
||||
}
|
||||
|
||||
@ -32,8 +37,10 @@ public interface BaseService<T>
|
||||
return CommonResponse.success(id);
|
||||
}
|
||||
|
||||
default CommonResponse<BaseEntity> findByCode(BaseRepository repository, String code)
|
||||
default CommonResponse<T> findByCode(BaseRepository repository, String code)
|
||||
{
|
||||
return CommonResponse.success(repository.findByCode(code));
|
||||
return (CommonResponse<T>) repository.findByCode(code)
|
||||
.map(CommonResponse::success)
|
||||
.orElseGet(() -> CommonResponse.failure(String.format("Resource [ %s ] not found", code)));
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,9 @@ import io.edurt.datacap.service.body.FunctionsImportBody;
|
||||
import io.edurt.datacap.service.entity.FunctionEntity;
|
||||
import io.edurt.datacap.service.entity.PageEntity;
|
||||
|
||||
public interface FunctionsService
|
||||
public interface FunctionService
|
||||
extends BaseService<FunctionEntity>
|
||||
{
|
||||
CommonResponse<FunctionEntity> saveOrUpdate(FunctionEntity configure);
|
||||
|
||||
CommonResponse<PageEntity<FunctionEntity>> getAllByFilter(FilterBody filter);
|
||||
|
||||
CommonResponse<FunctionEntity> getById(Long id);
|
@ -10,6 +10,7 @@ import io.edurt.datacap.service.itransient.ContributionRadar;
|
||||
import java.util.List;
|
||||
|
||||
public interface PluginAuditService
|
||||
extends BaseService<PluginAuditEntity>
|
||||
{
|
||||
@Deprecated
|
||||
CommonResponse<PageEntity<PluginAuditEntity>> getAll(int offset, int limit);
|
||||
|
@ -9,7 +9,7 @@ import io.edurt.datacap.service.body.FunctionsImportBody;
|
||||
import io.edurt.datacap.service.entity.FunctionEntity;
|
||||
import io.edurt.datacap.service.entity.PageEntity;
|
||||
import io.edurt.datacap.service.repository.FunctionsRepository;
|
||||
import io.edurt.datacap.service.service.FunctionsService;
|
||||
import io.edurt.datacap.service.service.FunctionService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -22,22 +22,16 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FunctionsServiceImpl
|
||||
implements FunctionsService
|
||||
public class FunctionServiceImpl
|
||||
implements FunctionService
|
||||
{
|
||||
private final FunctionsRepository functionsRepository;
|
||||
|
||||
public FunctionsServiceImpl(FunctionsRepository functionsRepository)
|
||||
public FunctionServiceImpl(FunctionsRepository functionsRepository)
|
||||
{
|
||||
this.functionsRepository = functionsRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResponse<FunctionEntity> saveOrUpdate(FunctionEntity configure)
|
||||
{
|
||||
return CommonResponse.success(this.functionsRepository.save(configure));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResponse<PageEntity<FunctionEntity>> getAllByFilter(FilterBody filter)
|
||||
{
|
@ -4,11 +4,11 @@ import { FilterModel } from '@/model/filter'
|
||||
|
||||
export abstract class BaseService
|
||||
{
|
||||
private readonly baseUrl: string;
|
||||
private readonly baseUrl: string
|
||||
|
||||
protected constructor(baseUrl: string)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
this.baseUrl = baseUrl
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,7 +26,7 @@ export abstract class BaseService
|
||||
*/
|
||||
getAll(filter: FilterModel): Promise<ResponseModel>
|
||||
{
|
||||
return new HttpUtils().post(`${this.baseUrl}/list`, filter)
|
||||
return new HttpUtils().post(`${ this.baseUrl }/list`, filter)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,7 +35,12 @@ export abstract class BaseService
|
||||
*/
|
||||
getById(id: number): Promise<ResponseModel>
|
||||
{
|
||||
return new HttpUtils().get(`${this.baseUrl}/${id}`)
|
||||
return new HttpUtils().get(`${ this.baseUrl }/${ id }`)
|
||||
}
|
||||
|
||||
getByCode(code: string): Promise<ResponseModel>
|
||||
{
|
||||
return new HttpUtils().get(`${ this.baseUrl }/info/${ code }`)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,6 +59,6 @@ export abstract class BaseService
|
||||
|
||||
deleteById(id: number): Promise<ResponseModel>
|
||||
{
|
||||
return new HttpUtils().delete(`${this.baseUrl}/${id}`)
|
||||
return new HttpUtils().delete(`${ this.baseUrl }/${ id }`)
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ export default defineComponent({
|
||||
handlerInitialize()
|
||||
{
|
||||
this.loading = true
|
||||
AuditService.getPluginAudits(this.filter)
|
||||
AuditService.getAll(this.filter)
|
||||
.then((response) => {
|
||||
if (response.status) {
|
||||
this.data = response.data.content
|
||||
|
@ -88,7 +88,7 @@
|
||||
</TabsList>
|
||||
<VAceEditor lang="mysql" :value="selectEditor.editorInstance?.instance?.getValue() as string" :theme="selectEditor.editorInstance?.configure?.theme"
|
||||
:style="{ height: '300px', fontSize: selectEditor.editorInstance?.configure?.fontSize + 'px' }"
|
||||
:key="selectEditor.editorInstance?.key" :options="{ enableSnippets: true, enableLiveAutocompletion: true }"
|
||||
:key="selectEditor.editorInstance?.key" :options="{ enableSnippets: true, enableLiveAutocompletion: true, readOnly: loading.froming }"
|
||||
@init="handlerEditorDidMount($event, 'mysql', selectEditor.editorInstance?.key)"/>
|
||||
</Tabs>
|
||||
</CardContent>
|
||||
@ -138,6 +138,7 @@ import QueryHelp from '@/views/pages/admin/query/QueryHelp.vue'
|
||||
import DataStructureLazyTree from '@/views/components/tree/DataStructureLazyTree.vue'
|
||||
import { SnippetModel, SnippetRequest } from '@/model/snippet'
|
||||
import SnippetInfo from '@/views/pages/admin/snippet/SnippetInfo.vue'
|
||||
import CircularLoading from '@/views/components/loading/CircularLoading.vue'
|
||||
import Editor = Ace.Editor
|
||||
|
||||
interface EditorInstance
|
||||
@ -151,6 +152,7 @@ interface EditorInstance
|
||||
export default defineComponent({
|
||||
name: 'QueryHome',
|
||||
components: {
|
||||
CircularLoading,
|
||||
SnippetInfo,
|
||||
DataStructureLazyTree,
|
||||
QueryHelp,
|
||||
@ -168,7 +170,8 @@ export default defineComponent({
|
||||
return {
|
||||
loading: {
|
||||
running: false,
|
||||
formatting: false
|
||||
formatting: false,
|
||||
froming: false
|
||||
},
|
||||
visibility: {
|
||||
queryHelp: false
|
||||
@ -215,8 +218,9 @@ export default defineComponent({
|
||||
const type = params.type
|
||||
if (code && type) {
|
||||
if (type === 'snippet') {
|
||||
this.loading.froming = true
|
||||
this.queryConfigure.configure.mode = 'SNIPPET'
|
||||
SnippetService.getById(id)
|
||||
SnippetService.getByCode(code as string)
|
||||
.then((response) => {
|
||||
if (response.status && response.data?.code) {
|
||||
const instance = this.selectEditor.editorMaps.get(this.selectEditor.activeKey as string)
|
||||
@ -225,19 +229,22 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => this.loading.froming = false)
|
||||
}
|
||||
else if (type === 'history') {
|
||||
this.loading.froming = true
|
||||
this.queryConfigure.configure.mode = 'HISTORY'
|
||||
AuditService.getById(id)
|
||||
AuditService.getByCode(code as string)
|
||||
.then((response) => {
|
||||
if (response.status && response.data?.content) {
|
||||
const instance = this.selectEditor.editorMaps.get(this.selectEditor.activeKey as string)
|
||||
if (instance) {
|
||||
instance.instance?.setValue(response.data.content)
|
||||
this.handlerChangeValue(`${ response.data.plugin.id }:${ response.data.plugin.type }`)
|
||||
this.handlerChangeValue(`${ response.data.source.id }:${ response.data.source.type }`)
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => this.loading.froming = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrig
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import CircularLoading from '@/views/components/loading/CircularLoading.vue'
|
||||
import MultipleSelect from '@/views/components/select/MultipleSelect.vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { cloneDeep, omit } from 'lodash'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'FunctionInfo',
|
||||
@ -130,7 +130,7 @@ export default defineComponent({
|
||||
{
|
||||
this.title = `${ this.$t('function.common.create') }`
|
||||
if (this.info) {
|
||||
this.formState = cloneDeep(this.info)
|
||||
this.formState = cloneDeep(omit(this.info, ['createTime', 'updateTime']))
|
||||
this.title = `${ this.$t('function.common.modify').replace('$NAME', this.info.name as string) }`
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user