mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[MNT-25584] Hide edit offline option when node is checked out (#5132)
* [MNT-25584] Hide edit offline option when node is checked out * [MNT-25584] CR fix * [MNT-25584] Missing docs changes
This commit is contained in:
@@ -58,6 +58,7 @@ Application related evaluators which can be used to check various different aspe
|
|||||||
| 5.1.1 | isSmartFolder | Checks if the selected folder has the 'smf:customConfigSmartFolder' or the 'smf:systemConfigSmartFolder' aspect or not |
|
| 5.1.1 | isSmartFolder | Checks if the selected folder has the 'smf:customConfigSmartFolder' or the 'smf:systemConfigSmartFolder' aspect or not |
|
||||||
| 5.1.1 | isMultiSelection | Checks if the user has selected multiple files |
|
| 5.1.1 | isMultiSelection | Checks if the user has selected multiple files |
|
||||||
| 6.1.0 | canPrintFile | Checks if current file can be printed or not (media files such as audio/video cannot be printed). |
|
| 6.1.0 | canPrintFile | Checks if current file can be printed or not (media files such as audio/video cannot be printed). |
|
||||||
|
| 7.4.0 | app.selection.isCheckedOut | Checks if selected node contains `cm:checkedOut` aspect. |
|
||||||
|
|
||||||
#### Navigation Rules/Evaluators
|
#### Navigation Rules/Evaluators
|
||||||
|
|
||||||
|
|||||||
@@ -535,7 +535,8 @@
|
|||||||
"visible": [
|
"visible": [
|
||||||
"app.selection.file",
|
"app.selection.file",
|
||||||
"!app.navigation.isTrashcan",
|
"!app.navigation.isTrashcan",
|
||||||
"canToggleFileLock"
|
"canToggleFileLock",
|
||||||
|
"!app.selection.isCheckedOut"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -873,7 +874,8 @@
|
|||||||
"visible": [
|
"visible": [
|
||||||
"app.selection.file",
|
"app.selection.file",
|
||||||
"!app.navigation.isTrashcan",
|
"!app.navigation.isTrashcan",
|
||||||
"canToggleFileLock"
|
"canToggleFileLock",
|
||||||
|
"!app.selection.isCheckedOut"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1297,7 +1299,8 @@
|
|||||||
"visible": [
|
"visible": [
|
||||||
"app.selection.file",
|
"app.selection.file",
|
||||||
"!app.navigation.isTrashcan",
|
"!app.navigation.isTrashcan",
|
||||||
"canToggleFileLock"
|
"canToggleFileLock",
|
||||||
|
"!app.selection.isCheckedOut"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ import { IsFeatureSupportedInCurrentAcsPipe } from './pipes/is-feature-supported
|
|||||||
'app.selection.folder': rules.hasFolderSelected,
|
'app.selection.folder': rules.hasFolderSelected,
|
||||||
'app.selection.folder.canUpdate': rules.canUpdateSelectedFolder,
|
'app.selection.folder.canUpdate': rules.canUpdateSelectedFolder,
|
||||||
'app.selection.displayedKnowledgeRetrievalButton': rules.canDisplayKnowledgeRetrievalButton,
|
'app.selection.displayedKnowledgeRetrievalButton': rules.canDisplayKnowledgeRetrievalButton,
|
||||||
|
'app.selection.isCheckedOut': rules.isCheckedOut,
|
||||||
|
|
||||||
'app.navigation.folder.canCreate': rules.canCreateFolder,
|
'app.navigation.folder.canCreate': rules.canCreateFolder,
|
||||||
'app.navigation.isTrashcan': rules.isTrashcan,
|
'app.navigation.isTrashcan': rules.isTrashcan,
|
||||||
|
|||||||
@@ -1204,6 +1204,25 @@ describe('app.evaluators', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isCheckedOut', () => {
|
||||||
|
it('should return false when there is no selection', () => {
|
||||||
|
context.selection.isEmpty = true;
|
||||||
|
expect(app.isCheckedOut(context)).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when selected node does not have checked out aspect', () => {
|
||||||
|
context.selection.isEmpty = false;
|
||||||
|
context.selection.first = { entry: { aspectNames: ['test'] } } as any;
|
||||||
|
expect(app.isCheckedOut(context)).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true when selected node contains checked out aspect', () => {
|
||||||
|
context.selection.isEmpty = false;
|
||||||
|
context.selection.first = { entry: { aspectNames: ['cm:checkedOut'] } } as any;
|
||||||
|
expect(app.isCheckedOut(context)).toBeTrue();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('isSSOEnabled', () => {
|
describe('isSSOEnabled', () => {
|
||||||
it('should return true if sso is enabled', () => {
|
it('should return true if sso is enabled', () => {
|
||||||
context.appConfig = { get: () => 'OAUTH' } as any;
|
context.appConfig = { get: () => 'OAUTH' } as any;
|
||||||
|
|||||||
@@ -563,3 +563,17 @@ export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boo
|
|||||||
((navigation.isSearchResults(context) || navigation.isLibraryContent(context)) && !navigation.isLibraries(context)));
|
((navigation.isSearchResults(context) || navigation.isLibraryContent(context)) && !navigation.isLibraries(context)));
|
||||||
|
|
||||||
export const isSSOEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('authType') === 'OAUTH';
|
export const isSSOEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('authType') === 'OAUTH';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if node contains checked out aspect.
|
||||||
|
* JSON ref: `app.selection.isCheckedOut`
|
||||||
|
*
|
||||||
|
* @param context Rule execution context
|
||||||
|
*/
|
||||||
|
export const isCheckedOut = (context: RuleContext): boolean => {
|
||||||
|
if (!context.selection?.isEmpty) {
|
||||||
|
const nodeAspects = context.selection.first.entry?.aspectNames ?? [];
|
||||||
|
return nodeAspects.includes('cm:checkedOut');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user