add: 新增登出 command

This commit is contained in:
千反田丷 2021-12-08 15:20:54 +08:00
parent d0d68743d3
commit 4281346993
8 changed files with 59 additions and 1 deletions

View File

@ -4,7 +4,7 @@
"description": "iBiz建模工场",
"publisher": "ibizlab",
"preview": true,
"version": "0.0.4",
"version": "0.0.5",
"engines": {
"vscode": "^1.62.0"
},
@ -27,6 +27,11 @@
"title": "%command.ibiz-modeling-studio.user.login%",
"category": "%command.ibiz-modeling-studio.category%"
},
{
"command": "ibiz-modeling-studio.user.logout",
"title": "%command.ibiz-modeling-studio.user.logout%",
"category": "%command.ibiz-modeling-studio.category%"
},
{
"command": "ibiz-modeling-studio.open-ibiz-modeling",
"title": "%command.ibiz-modeling-studio.open-ibiz-modeling%",

View File

@ -2,6 +2,7 @@
"global.ibiz-modeling-studio.title": "IBiz Modeling Studio",
"command.ibiz-modeling-studio.category": "iBizModeling",
"command.ibiz-modeling-studio.user.login": "Login",
"command.ibiz-modeling-studio.user.logout": "Logout",
"command.ibiz-modeling-studio.open-ibiz-modeling": "Open iBizModeling Tool",
"command.ibiz-modeling-studio.system-info-terminal.show": "Open Information Terminal",
"command.ibiz-modeling-studio.system.publish.code": "Publish Code",

View File

@ -2,6 +2,7 @@
"global.ibiz-modeling-studio.title": "iBiz建模工场",
"command.ibiz-modeling-studio.category": "iBiz建模工场",
"command.ibiz-modeling-studio.user.login": "登录",
"command.ibiz-modeling-studio.user.logout": "登出",
"command.ibiz-modeling-studio.open-ibiz-modeling": "打开 iBizModeling 工具",
"command.ibiz-modeling-studio.system-info-terminal.show": "打开信息终端",
"command.ibiz-modeling-studio.system.publish.code": "发布代码",

View File

@ -10,6 +10,7 @@ import { SystemInfoTerminalShowCommand } from './system-info-terminal/show';
import { SystemPublishCommand } from './system/publish';
import { TemplatePublishCommand } from './template/publish';
import { UserLoginCommand } from './user/login';
import { UserLogoutCommand } from './user/logout';
/**
*
@ -34,4 +35,5 @@ export function installCommands(_context: ExtensionContext): void {
new SystemInfoTerminalShowCommand();
new TemplatePublishCommand();
new UserLoginCommand();
new UserLogoutCommand();
}

View File

@ -2,6 +2,14 @@ import { commands } from 'vscode';
import { CommandConst } from '../../constants';
import { login } from '../../service';
/**
*
*
* @author chitanda
* @date 2021-12-08 15:12:46
* @export
* @class UserLoginCommand
*/
export class UserLoginCommand {
constructor() {
commands.registerCommand(CommandConst.USER.LOGIN, this.execute.bind(this));

View File

@ -0,0 +1,21 @@
import { commands } from 'vscode';
import { CommandConst } from '../../constants';
import { login } from '../../service';
/**
*
*
* @author chitanda
* @date 2021-12-08 15:12:52
* @export
* @class UserLogoutCommand
*/
export class UserLogoutCommand {
constructor() {
commands.registerCommand(CommandConst.USER.LOGOUT, this.execute.bind(this));
}
protected async execute(): Promise<void> {
login.logout();
}
}

View File

@ -15,6 +15,13 @@ export class UserConst {
* @date 2021-12-01 15:12:23
*/
readonly LOGIN = 'ibiz-modeling-studio.user.login';
/**
*
*
* @author chitanda
* @date 2021-12-08 15:12:42
*/
readonly LOGOUT = 'ibiz-modeling-studio.user.logout';
/**
*
*

View File

@ -161,6 +161,19 @@ export class LoginService {
return false;
}
/**
*
*
* @author chitanda
* @date 2021-12-08 15:12:35
* @return {*} {Promise<boolean>}
*/
async logout(): Promise<boolean> {
ctx.setToken('');
window.showInformationMessage('已登出当前用户');
return true;
}
/**
*
*