Skip to content

Commit

Permalink
2.7.6 workflow suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobaidadada committed Feb 5, 2025
1 parent 3b194c6 commit c7b3e42
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filecat",
"version": "2.7.5",
"version": "2.7.6",
"description": "filecat 文件管理器",
"author": "xiaobaidadada",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/common/FileMenuType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export function getFileFormat(filename:string): FileTypeEnum {
return FileTypeEnum.uncompress;
} else if(image_list.has(extension)) {
return FileTypeEnum.image;
} else if (extension === "excalidraw") {
} else if (extension === FileTypeEnum.excalidraw || extension === FileTypeEnum.draw) {
return FileTypeEnum.excalidraw;
} else if(extension === FileTypeEnum.workflow_act) {
return FileTypeEnum.workflow_act;
}
return FileTypeEnum.unknow;
}
2 changes: 2 additions & 0 deletions src/common/file.pojo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export enum FileTypeEnum {
uncompress = "uncompress", // 压缩文件
md = "md",
excalidraw = "excalidraw",
draw = "draw",
workflow_act = "act",
dev = "dev" // linux设备 不是文件或者目录
}

Expand Down
13 changes: 9 additions & 4 deletions src/web/meta/resources/css/listing-icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
{ content: 'album' }

/* 绘图 */
.file-icons [aria-label$=".excalidraw"] i::before
.file-icons [aria-label$=".excalidraw"] i::before,
.file-icons [aria-label$=".draw"] i::before
{ content: 'draw' }

/* #999 - Font */
Expand Down Expand Up @@ -204,7 +205,8 @@
.file-icons [aria-label$=".iso"] i,
.file-icons [aria-label$=".php"] i,
.file-icons [aria-label$=".rar"] i,
.file-icons [aria-label$=".excalidraw"] i
.file-icons [aria-label$=".excalidraw"] i,
.file-icons [aria-label$=".draw"] i
{ color: var(--icon-violet) }

.file-icons [aria-label$=".md"] i::before
Expand All @@ -220,8 +222,11 @@

/*特殊的 filecat work flow*/
.file-icons [aria-label$=".workflow.yml"] i { color: var(--icon-blue) }
.file-icons [aria-label$=".workflow.yml"] i::before
{ content: 'api' }
.file-icons [aria-label$=".workflow.yml"] i::before { content: 'api' }

.file-icons [aria-label$=".act"] i { color: var(--icon-blue) }
.file-icons [aria-label$=".act"] i::before { content: 'api' }




2 changes: 1 addition & 1 deletion src/web/project/component/prompts/FileMenu/FileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function FileMenu() {
case FileTypeEnum.unknow:
default:
{
if(pojo.filename.endsWith("workflow.yml")) {
if(pojo.filename.endsWith(".workflow.yml") || pojo.filename.endsWith(".act")) {
if(file_is_running(pojo.filename)) {
items.unshift({r: t("停止workflow"),v:4})
items.unshift({r: t("实时查看workflow"),v:5})
Expand Down
8 changes: 4 additions & 4 deletions src/web/project/component/prompts/FileNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export function FileNew(props) {

const select_item = [
{title:`${t("空")}`,value:""},
{title:`excalidraw${t("格式")}`,value:".excalidraw"},
{title: `workflow${t("格式")}`, value:".workflow.yml"},
{title:`excalidraw${t("格式")}`,value:".draw"},
{title: `workflow${t("格式")}`, value:".act"},
]
const cancel=()=> {
setShowPrompt({show: false,type: "",overlay: false,data:{}})
Expand All @@ -90,9 +90,9 @@ export function FileNew(props) {
if (!name.endsWith(format)) {
r_name = name+format;
}
if (format === ".excalidraw") {
if (format === ".draw" ) {
context = "{}";
} else if (format === ".workflow.yml") {
} else if (format === ".act") {
context = workflow_txt;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ export function RemoteLinuxFileItem(props: FileItemData & { index?: number,itemW
Object.assign(req,sshInfo);
req.file = joinPaths(...shellNowDir,name);
const rsq = await sshHttp.post("get/file/text",req);
let m = undefined;
if(name.endsWith(FileTypeEnum.workflow_act)){
m = "ace/mode/yaml"
} else if(name.endsWith(FileTypeEnum.draw) || name.endsWith(FileTypeEnum.excalidraw)){
m = "ace/mode/json"
}
setEditorSetting({
// model,
model:m,
open: true,
fileName: props.name,
save: async (context) => {
Expand Down
19 changes: 15 additions & 4 deletions src/web/project/util/store.util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {FileTypeEnum} from "../../../common/file.pojo";
import {getFileNameByLocation} from "../component/file/FileUtil";
import {cryptoHttp, fileHttp} from "./config";
import {NotyFail, NotySucess} from "./noty";
import {fileHttp} from "./config";
import {NotyFail} from "./noty";
import {getEditModelType} from "../../../common/StringUtil";
import {getFileFormat} from "../../../common/FileMenuType";
import {getRouterAfter, getRouterPath} from "./WebPath";
Expand All @@ -11,7 +11,7 @@ import {$stroe} from "./store";
import {saveTxtReq} from "../../../common/req/file.req";
import {useTranslation} from "react-i18next";
import {MAX_SIZE_TXT} from "../../../common/ValueUtil";
import {Ace as AceItem, version as ace_version} from "ace-builds";
import {Ace as AceItem} from "ace-builds";
import {UserAuth} from "../../../common/req/user.req";
import {useEffect} from "react";

Expand Down Expand Up @@ -75,9 +75,15 @@ export const user_click_file = () => {
// if (!model) {
// model = "text";
// }
let m = undefined;
if(type === FileTypeEnum.workflow_act){
m = "ace/mode/yaml"
} else if(type === FileTypeEnum.draw || type === FileTypeEnum.excalidraw){
m = "ace/mode/json"
}
setEditorSetting({
menu_list: param.menu_list,
// model,
model:m,
open: true,
fileName: name,
save: async (context) => {
Expand All @@ -97,6 +103,7 @@ export const user_click_file = () => {
} else {
let url = fileHttp.getDownloadUrl(getFileNameByLocation(name));
switch (type) {
case FileTypeEnum.draw:
case FileTypeEnum.excalidraw:
set_excalidraw_editor({path: "", name});
break;
Expand All @@ -111,6 +118,10 @@ export const user_click_file = () => {
case FileTypeEnum.pdf:
setFilePreview({open: true, type: type, name, url})
break;
case FileTypeEnum.workflow_act:
param.model = "text";
click_file(param);
break;
case FileTypeEnum.unknow:
default:
if (model) {
Expand Down

0 comments on commit c7b3e42

Please sign in to comment.