Skip to content

Commit 61275b5

Browse files
committed
feat: add get mr list logic
1 parent a7d3035 commit 61275b5

File tree

28 files changed

+1280
-124
lines changed

28 files changed

+1280
-124
lines changed

out/commands.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

out/constants/tree.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

out/extension.js

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,56 @@
11
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
211
var __importDefault = (this && this.__importDefault) || function (mod) {
312
return (mod && mod.__esModule) ? mod : { "default": mod };
413
};
514
Object.defineProperty(exports, "__esModule", { value: true });
615
exports.deactivate = exports.activate = void 0;
7-
const tree_1 = __importDefault(require("./tree"));
16+
const init_1 = __importDefault(require("./init"));
817
const webview_1 = __importDefault(require("./webview"));
9-
const commands_1 = require("./commands");
10-
const tree_2 = require("./constants/tree");
18+
const codingServer_1 = __importDefault(require("./services/codingServer"));
19+
const proxy_1 = require("./utils/proxy");
1120
function activate(context) {
12-
const webviewProvider = new webview_1.default();
13-
const treeDataProvider = new tree_1.default(tree_2.treeData);
14-
context.ctx = {
15-
webviewProvider,
16-
treeDataProvider
17-
};
18-
commands_1.registerCommands(context);
21+
return __awaiter(this, void 0, void 0, function* () {
22+
const webviewProvider = new webview_1.default();
23+
const repoInfo = yield codingServer_1.default.getRepoParams();
24+
console.log('repoInfo ==> ', repoInfo);
25+
const codingServer = new codingServer_1.default({
26+
id: '123',
27+
user: {
28+
avatar: 'string',
29+
global_key: 'string',
30+
name: 'string',
31+
path: 'string',
32+
team: 'string'
33+
},
34+
accessToken: '1b7fca3bd7594a89b0f5e2a0250c1147',
35+
refreshToken: 'abc'
36+
}, repoInfo || {
37+
team: 'codingcorp',
38+
project: 'mo-test',
39+
repo: 'mo-test'
40+
});
41+
let userInfo = null;
42+
if (repoInfo) {
43+
userInfo = yield codingServer.getUserInfo(repoInfo.team);
44+
}
45+
context.ctx = {
46+
webviewProvider,
47+
codingServer,
48+
repoInfo,
49+
userInfo
50+
};
51+
proxy_1.proxyCtx(context);
52+
init_1.default(context);
53+
});
1954
}
2055
exports.activate = activate;
2156
function deactivate() {

out/init.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.registerTreeViews = exports.registerCommands = void 0;
7+
const hbuilderx_1 = __importDefault(require("hbuilderx"));
8+
const depot_1 = __importDefault(require("./trees/depot"));
9+
const mr_1 = __importDefault(require("./trees/mr"));
10+
const repo_1 = require("./utils/repo");
11+
function registerCommands(context) {
12+
const { webviewProvider, repoInfo } = context;
13+
context.subscriptions.push(hbuilderx_1.default.commands.registerCommand('codingPlugin.helloWorld', () => {
14+
hbuilderx_1.default.window.showInformationMessage('你好,这是我的第一个插件扩展。');
15+
// webviewProvider.panel.webView.postMessage('hhhhh');
16+
}));
17+
context.subscriptions.push(hbuilderx_1.default.commands.registerCommand('codingPlugin.mrTreeItemClick', function (param) {
18+
// hx.window.showInformationMessage('选中了TreeItem:' + param[0]);
19+
// webviewProvider.update(param[0]);
20+
hbuilderx_1.default.env.openExternal(repo_1.getMRUrl(repoInfo.team, param[0]));
21+
}));
22+
}
23+
exports.registerCommands = registerCommands;
24+
function registerTreeViews(context) {
25+
context.subscriptions.push(hbuilderx_1.default.window.createTreeView('codingPlugin.treeMR', {
26+
showCollapseAll: true,
27+
treeDataProvider: new mr_1.default(context)
28+
}));
29+
context.subscriptions.push(hbuilderx_1.default.window.createTreeView('codingPlugin.treeDepot', {
30+
showCollapseAll: true,
31+
treeDataProvider: new depot_1.default(context, [
32+
{ name: '仓库列表', children: [{ name: '111' }] },
33+
{ name: '创建仓库' }
34+
])
35+
}));
36+
}
37+
exports.registerTreeViews = registerTreeViews;
38+
function init(context) {
39+
registerCommands(context);
40+
registerTreeViews(context);
41+
}
42+
exports.default = init;

out/mock/index.js

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.MR_LIST = void 0;
4+
exports.MR_LIST = {
5+
"code": 0,
6+
"data": {
7+
"list": [
8+
{
9+
"id": 6605831,
10+
"srcBranch": "dev",
11+
"desBranch": "dev2",
12+
"title": "ttt",
13+
"iid": 30,
14+
"merge_status": "CANMERGE",
15+
"path": "/p/mo-test/d/mo-test/git/merge/30",
16+
"created_at": 1597042547000,
17+
"updated_at": 1602817972000,
18+
"author": {
19+
"sex": 2,
20+
"location": "",
21+
"company": "",
22+
"slogan": "",
23+
"website": "",
24+
"introduction": "",
25+
"avatar": "https://coding-net-production-static-ci.codehub.cn/1ee218e2-64a6-4e96-adfb-b2a3c805f19d.jpeg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0",
26+
"gravatar": "",
27+
"lavatar": "https://coding-net-production-static-ci.codehub.cn/1ee218e2-64a6-4e96-adfb-b2a3c805f19d.jpeg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0",
28+
"created_at": 1595816413000,
29+
"last_logined_at": 1605247086000,
30+
"global_key": "dHzOCagiSb",
31+
"name": "莫泳欣",
32+
"name_pinyin": "myx|mx|moyongxin|muyongxin",
33+
"updated_at": 1605247086000,
34+
"path": "/u/dHzOCagiSb",
35+
"status": 1,
36+
"is_member": 0,
37+
"id": 8003868,
38+
"follows_count": 0,
39+
"fans_count": 0,
40+
"tweets_count": 0,
41+
"followed": false,
42+
"follow": false,
43+
"email_validation": 1,
44+
"regist_channel_id": 0,
45+
"account_type": 0
46+
},
47+
"action_author": {
48+
"status": 0,
49+
"is_member": 0,
50+
"id": 0,
51+
"follows_count": 0,
52+
"fans_count": 0,
53+
"tweets_count": 0,
54+
"followed": false,
55+
"follow": false
56+
},
57+
"action_at": 1602817972000,
58+
"granted": 0,
59+
"comment_count": 2,
60+
"reviewers": [],
61+
"labels": [],
62+
"reminded": false,
63+
"depot": {
64+
"id": 7955235,
65+
"name": "mo-test",
66+
"isDefault": false,
67+
"projectId": 7900453,
68+
"vcsType": "git"
69+
}
70+
},
71+
{
72+
"id": 6577486,
73+
"srcBranch": "dev2",
74+
"desBranch": "master",
75+
"title": "feat: publish version 1",
76+
"iid": 2,
77+
"merge_status": "CANMERGE",
78+
"path": "/p/mo-test/d/mo-test/git/merge/2",
79+
"created_at": 1595840079000,
80+
"updated_at": 1602489813000,
81+
"author": {
82+
"sex": 2,
83+
"location": "",
84+
"company": "",
85+
"slogan": "",
86+
"website": "",
87+
"introduction": "",
88+
"avatar": "https://coding-net-production-static-ci.codehub.cn/1ee218e2-64a6-4e96-adfb-b2a3c805f19d.jpeg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0",
89+
"gravatar": "",
90+
"lavatar": "https://coding-net-production-static-ci.codehub.cn/1ee218e2-64a6-4e96-adfb-b2a3c805f19d.jpeg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0",
91+
"created_at": 1595816413000,
92+
"last_logined_at": 1605247086000,
93+
"global_key": "dHzOCagiSb",
94+
"name": "莫泳欣",
95+
"name_pinyin": "myx|mx|moyongxin|muyongxin",
96+
"updated_at": 1605247086000,
97+
"path": "/u/dHzOCagiSb",
98+
"status": 1,
99+
"is_member": 0,
100+
"id": 8003868,
101+
"follows_count": 0,
102+
"fans_count": 0,
103+
"tweets_count": 0,
104+
"followed": false,
105+
"follow": false,
106+
"email_validation": 1,
107+
"regist_channel_id": 0,
108+
"account_type": 0
109+
},
110+
"action_author": {
111+
"status": 0,
112+
"is_member": 0,
113+
"id": 0,
114+
"follows_count": 0,
115+
"fans_count": 0,
116+
"tweets_count": 0,
117+
"followed": false,
118+
"follow": false
119+
},
120+
"action_at": 1595923496000,
121+
"granted": 0,
122+
"comment_count": 2,
123+
"reviewers": [],
124+
"labels": [
125+
{
126+
"id": 12777496,
127+
"project_id": 7900453,
128+
"name": "哈哈",
129+
"color": "#D379E8",
130+
"owner_id": 8003868,
131+
"count": 0,
132+
"processing": 0,
133+
"task_count": 0,
134+
"merge_request_count": 0
135+
},
136+
{
137+
"id": 12777498,
138+
"project_id": 7900453,
139+
"name": "咔咔",
140+
"color": "#BF781A",
141+
"owner_id": 8003868,
142+
"count": 0,
143+
"processing": 0,
144+
"task_count": 0,
145+
"merge_request_count": 0
146+
},
147+
{
148+
"id": 12777501,
149+
"project_id": 7900453,
150+
"name": "哇哇",
151+
"color": "#A894B1",
152+
"owner_id": 8003868,
153+
"count": 0,
154+
"processing": 0,
155+
"task_count": 0,
156+
"merge_request_count": 0
157+
},
158+
{
159+
"id": 12777551,
160+
"project_id": 7900453,
161+
"name": "中华人民共和国合同法哈哈哈哈哈",
162+
"color": "#060CDD",
163+
"owner_id": 8003868,
164+
"count": 0,
165+
"processing": 0,
166+
"task_count": 0,
167+
"merge_request_count": 0
168+
}
169+
],
170+
"reminded": false,
171+
"depot": {
172+
"id": 7955235,
173+
"name": "mo-test",
174+
"isDefault": false,
175+
"projectId": 7900453,
176+
"vcsType": "git"
177+
}
178+
}
179+
],
180+
"page": 1,
181+
"pageSize": 15,
182+
"totalPage": 1,
183+
"totalRow": 2
184+
}
185+
};
186+
exports.default = {
187+
MR_LIST: exports.MR_LIST
188+
};

0 commit comments

Comments
 (0)