+
{activeEditor.provider}
)}
diff --git a/packages/dashboard-frontend/src/components/EditorSelector/Gallery/__tests__/index.spec.tsx b/packages/dashboard-frontend/src/components/EditorSelector/Gallery/__tests__/index.spec.tsx
index 5b811f839..dc05b044c 100644
--- a/packages/dashboard-frontend/src/components/EditorSelector/Gallery/__tests__/index.spec.tsx
+++ b/packages/dashboard-frontend/src/components/EditorSelector/Gallery/__tests__/index.spec.tsx
@@ -130,6 +130,34 @@ describe('EditorGallery', () => {
expect(sortedEditors[1].version).toEqual('1.0.0');
});
+ test('1.0.0(Deprecated) <=> latest', () => {
+ const editorA = editors[0];
+ editorA.tags = ['Deprecated'];
+ editorA.version = '1.0.0';
+ editorA.id = `${editorA.publisher}/${editorA.name}/${editorA.version}`;
+
+ const editorB = editors[1]; // latest
+
+ const sortedEditors = sortEditors([editorA, editorB]);
+
+ expect(sortedEditors[0].version).toEqual('latest');
+ expect(sortedEditors[1].version).toEqual('1.0.0'); // Deprecated
+ });
+
+ test('1.0.0 <=> latest(Deprecated)', () => {
+ const editorA = editors[0];
+ editorA.version = '1.0.0';
+ editorA.id = `${editorA.publisher}/${editorA.name}/${editorA.version}`;
+
+ const editorB = editors[1]; // latest
+ editorB.tags = ['Deprecated'];
+
+ const sortedEditors = sortEditors([editorA, editorB]);
+
+ expect(sortedEditors[0].version).toEqual('1.0.0');
+ expect(sortedEditors[1].version).toEqual('latest'); // Deprecated
+ });
+
test('insiders <=> 1.0.0', () => {
const editorA = editors[0]; // insiders
const editorB = editors[1];
@@ -141,6 +169,34 @@ describe('EditorGallery', () => {
expect(sortedEditors[0].version).toEqual('insiders');
expect(sortedEditors[1].version).toEqual('1.0.0');
});
+
+ test('insiders(Deprecated) <=> 1.0.0', () => {
+ const editorA = editors[0]; // insiders
+ editorA.id = `${editorA.publisher}/${editorA.name}/${editorA.version}`;
+ editorA.tags = ['Deprecated'];
+
+ const editorB = editors[1];
+ editorB.version = '1.0.0';
+
+ const sortedEditors = sortEditors([editorA, editorB]);
+
+ expect(sortedEditors[0].version).toEqual('insiders');
+ expect(sortedEditors[1].version).toEqual('1.0.0');
+ });
+
+ test('insiders <=> 1.0.0(Deprecated)', () => {
+ const editorA = editors[0]; // insiders
+ editorA.id = `${editorA.publisher}/${editorA.name}/${editorA.version}`;
+
+ const editorB = editors[1];
+ editorB.version = '1.0.0';
+ editorB.tags = ['Deprecated'];
+
+ const sortedEditors = sortEditors([editorA, editorB]);
+
+ expect(sortedEditors[0].version).toEqual('insiders');
+ expect(sortedEditors[1].version).toEqual('1.0.0'); // Deprecated
+ });
});
describe('select editor', () => {
diff --git a/packages/dashboard-frontend/src/components/EditorSelector/Gallery/index.tsx b/packages/dashboard-frontend/src/components/EditorSelector/Gallery/index.tsx
index ae2c0bcb5..1969d5357 100644
--- a/packages/dashboard-frontend/src/components/EditorSelector/Gallery/index.tsx
+++ b/packages/dashboard-frontend/src/components/EditorSelector/Gallery/index.tsx
@@ -135,11 +135,12 @@ export class EditorGallery extends React.PureComponent
{
}
const VERSION_PRIORITY: ReadonlyArray = ['insiders', 'next', 'latest'];
+const DEPRECATED_TAG = 'Deprecated';
export function sortEditors(editors: che.Plugin[]) {
const sorted = editors.sort((a, b) => {
if (a.name === b.name) {
- const aPriority = VERSION_PRIORITY.indexOf(a.version);
- const bPriority = VERSION_PRIORITY.indexOf(b.version);
+ const aPriority = a.tags?.includes(DEPRECATED_TAG) ? -1 : VERSION_PRIORITY.indexOf(a.version);
+ const bPriority = b.tags?.includes(DEPRECATED_TAG) ? -1 : VERSION_PRIORITY.indexOf(b.version);
if (aPriority !== -1 && bPriority !== -1) {
return aPriority - bPriority;