Skip to content

Commit

Permalink
[Feature]: 微页面、选项卡元数据支持hidden属性 #6248
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhaolin committed Jan 20, 2024
1 parent 334b6aa commit c2ac35f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
12 changes: 10 additions & 2 deletions services/service-metadata-apps/src/actionsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function getAllTabs(ctx: any) {
async function getContext(ctx: any) {
const allTabs = await getAllTabs(ctx)
// const allObject = await getSteedosSchema().getAllObject()
let hiddenTabNames = await getHiddenTabNames(ctx)
let hiddenTabNames = await getHiddenTabNames(ctx, allTabs)
const notLicensedTabNames = await getNotLicensedTabNames(ctx, allTabs)
hiddenTabNames = hiddenTabNames.concat(notLicensedTabNames)
return {
Expand Down Expand Up @@ -151,7 +151,7 @@ function checkAppMobile(app, mobile) {
* @param ctx
* @return ['tabName', ...]
*/
async function getHiddenTabNames(ctx) {
async function getHiddenTabNames(ctx, allTabs) {
const userSession = ctx.meta.user
if (!userSession) {
throw new Error('no permission.')
Expand All @@ -169,6 +169,14 @@ async function getHiddenTabNames(ctx) {
hiddenTabNames.push(permissionTab.tab)
}
}

// .tab.yml中配置了hidden:true
for (const config of allTabs) {
if (config.metadata && config.metadata.hidden) {
hiddenTabNames.push(config.metadata.name)
}
}

return hiddenTabNames
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: [email protected]
* @Date: 2022-03-28 17:09:20
* @LastEditors: baozhoutao@steedos.com
* @LastEditTime: 2023-05-30 15:53:12
* @LastEditors: 孙浩林 sunhaolin@steedos.com
* @LastEditTime: 2024-01-20 17:08:08
* @Description:
*/
const objectql = require('@steedos/objectql');
Expand All @@ -12,7 +12,12 @@ const _ = require('underscore');
async function getAll(){
const schema = objectql.getSteedosSchema();
const configs = await register.registerPage.getAll(schema.broker)
const dataList = _.pluck(configs, 'metadata');
const dataList = [];
for (const config of configs) {
if (config.metadata && !config.metadata.hidden) {
dataList.push(config.metadata);
}
}

_.each(dataList, function(item){
if(!item._id){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: [email protected]
* @Date: 2022-08-05 14:17:44
* @LastEditors: baozhoutao@steedos.com
* @LastEditTime: 2023-05-30 15:07:13
* @LastEditors: 孙浩林 sunhaolin@steedos.com
* @LastEditTime: 2024-01-20 17:08:17
* @Description:
*/
const objectql = require('@steedos/objectql');
Expand All @@ -12,7 +12,12 @@ const _ = require('underscore');
async function getAll(){
const schema = objectql.getSteedosSchema();
const configs = await register.registerTab.getAll(schema.broker)
const dataList = _.pluck(configs, 'metadata');
const dataList = [];
for (const config of configs) {
if (config.metadata && !config.metadata.hidden) {
dataList.push(config.metadata);
}
}

_.each(dataList, function(item){
if(!item._id){
Expand Down

0 comments on commit c2ac35f

Please sign in to comment.