Skip to content

Commit 310f257

Browse files
authored
Merge pull request #310 from ccheraa/rename
Improved renaming items in the tree
2 parents 89cfd00 + 70e8012 commit 310f257

File tree

16 files changed

+327
-141
lines changed

16 files changed

+327
-141
lines changed

browser-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "browser-app",
4-
"version": "1.0.3",
4+
"version": "1.1.0",
55
"dependencies": {
66
"@theia/core": "^1.9.0",
77
"@theia/filesystem": "^1.9.0",

cypress/integration/operations_spec.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="Cypress" />
2-
import { mkApiPathUrl, fsUrl } from '../support/config.js';
2+
import { mkApiPathUrl, fsUrl, apiScheme, apiHost, apiPort } from '../support/config.js';
33
import '@4tw/cypress-drag-drop'
44
import { treenode, dialogTitle, dialogBody, dialogMainButton, dialog } from '../support/utils';
55
context('Fusion Studio', function () {
@@ -35,23 +35,23 @@ context('Fusion Studio', function () {
3535
it('drag move document', function () {
3636
cy.waitForLoading();
3737
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/text_file.txt')).should('be.visible')
38-
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col1')));
38+
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col1')), { hoverTime: 1000 });
3939
cy.waitForLoading();
4040
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/text_file.txt')).should('not.exist');
4141
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1/text_file.txt')).should('be.visible');
4242
})
4343
it('drag copy document', function () {
4444
cy.waitForLoading();
4545
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1/text_file.txt'))
46-
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col2')), { ctrlKey: true });
46+
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col2')), { ctrlKey: true, hoverTime: 1000 });
4747
cy.waitForLoading();
4848
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1/text_file.txt')).should('be.visible');
4949
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/text_file.txt')).should('be.visible');
5050
})
5151
it('drag copy collection', function () {
5252
cy.waitForLoading();
5353
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1')).should('be.visible')
54-
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col2')), { ctrlKey: true });
54+
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col2')), { ctrlKey: true, hoverTime: 1000 });
5555
cy.waitForLoading();
5656
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1')).should('be.visible');
5757
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/col1')).should('be.visible').click();
@@ -61,7 +61,7 @@ context('Fusion Studio', function () {
6161
it('drag move collection', function () {
6262
cy.waitForLoading();
6363
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1')).should('be.visible')
64-
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col3')));
64+
.drag(treenode(mkApiPathUrl('admin', '/db/test_col/col3')), { hoverTime: 1000 });
6565
cy.waitForLoading();
6666
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col3/col1')).should('be.visible');
6767
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col1')).should('not.exist');
@@ -86,6 +86,14 @@ context('Fusion Studio', function () {
8686
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/col1')).should('not.exist');
8787
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/col2/other_col1')).should('be.visible');
8888
})
89+
it('rename a connection', function () {
90+
cy.waitForLoading();
91+
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').rightclick();
92+
cy.getMenuCommand('fusion.rename').should('be.visible').click()
93+
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'localhost').clear().type('new_name{enter}');
94+
cy.waitForLoading();
95+
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').contains('new_name');
96+
})
8997
})
9098
describe('Deleting', function () {
9199
it('delete a document', function () {
@@ -129,5 +137,19 @@ context('Fusion Studio', function () {
129137
cy.waitForLoading();
130138
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col')).should('not.exist');
131139
})
140+
it('delete a connection', function () {
141+
cy.waitForLoading();
142+
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').rightclick();
143+
cy.getMenuCommand('fusion.disconnect').should('be.visible').click()
144+
cy.get(dialogTitle).should('contain.text', 'Remove Connection');
145+
cy.get(dialogBody).should('be.visible').find('p')
146+
.should('contain.text', 'Are you sure you want to remove the connection: new_name?')
147+
.should('contain.text', `Server URI: ${apiScheme}://${apiHost}:${apiPort}`)
148+
.should('contain.text', 'Username: admin');
149+
cy.get(dialogMainButton).should('be.visible').click();
150+
cy.get(dialog).should('not.exist');
151+
cy.waitForLoading();
152+
cy.getTreeNode(mkApiPathUrl('admin')).should('not.exist');
153+
})
132154
})
133155
})

cypress/integration/properties.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="Cypress" />
2-
import { mkApiPathUrl, fsUrl } from '../support/config.js';
2+
import { mkApiPathUrl, fsUrl, apiHost, apiPort, apiScheme } from '../support/config.js';
33
import '@4tw/cypress-drag-drop'
44
import { dialogTitle, dialogBody, dialogMainButton, dialogSecondaryButton, dialog } from '../support/utils';
55
context('Properties dialog', function () {
@@ -136,8 +136,43 @@ context('Properties dialog', function () {
136136
cy.get(dialog).should('not.exist');
137137
});
138138
})
139+
it('Connection properties', function () {
140+
cy.waitForLoading();
141+
cy.getTreeNode(mkApiPathUrl('admin')).rightclick()
142+
.getMenuCommand('fusion.properties').should('be.visible').click()
143+
cy.get(dialogTitle).should('contain.text', 'Edit Connection');
144+
cy.get(dialogBody).should('be.visible').then(body => {
145+
cy.wrap(body).find('.vertical-form .name-field span').contains('Connection Name:')
146+
.find('+ input.theia-input[type=text]').should('have.value', apiHost);
147+
cy.wrap(body).find('.vertical-form .server-field span').contains('Server URI:')
148+
.find('+ input.theia-input[type=text]').should('have.value', apiScheme + '://' + apiHost + ':' + apiPort);
149+
cy.wrap(body).find('.vertical-form .username-field span').contains('Username:')
150+
.find('+ input.theia-input[type=text]').should('have.value', 'admin');
151+
cy.wrap(body).find('.vertical-form .password-field span').contains('Password')
152+
.find('+ input.theia-input[type=password]').should('have.value', '');
153+
cy.get(dialogSecondaryButton).should('be.visible').click();
154+
cy.get(dialog).should('not.exist');
155+
});
156+
})
139157
})
140158
describe('Renaming objects', function () {
159+
it('Rename a connection', function () {
160+
cy.waitForLoading();
161+
cy.getTreeNode(mkApiPathUrl('admin')).rightclick()
162+
.getMenuCommand('fusion.properties').should('be.visible').click()
163+
cy.get(dialogTitle).should('contain.text', 'Edit Connection');
164+
cy.get(dialogBody).should('be.visible').then(body => {
165+
cy.wrap(body).find('.vertical-form .name-field span').contains('Connection Name:')
166+
.find('+ input.theia-input[type=text]').should('have.value', apiHost).clear().type('new_name');
167+
cy.get(dialogMainButton).should('be.visible').click();
168+
cy.get(dialog).should('not.exist');
169+
});
170+
cy.getTreeNode(mkApiPathUrl('admin')).should('be.visible').contains('new_name');
171+
cy.waitForLoading();
172+
cy.getTreeNode(mkApiPathUrl('admin', '/db')).click();
173+
cy.waitForLoading();
174+
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col')).click();
175+
})
141176
it('rename a document', function () {
142177
cy.waitForLoading();
143178
cy.getTreeNode(mkApiPathUrl('admin', '/db/test_col/text_file.txt')).should('be.visible').rightclick();

cypress/integration/tree_spec.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,20 @@ context('Fusion Studio', function() {
100100
});
101101
it('display users and groups', function() {
102102
// expand users and groups
103-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security]').should('be.visible').click();
104-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/user]').should('be.visible');
105-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/group]').should('be.visible');
103+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security]').should('be.visible').click();
104+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/user]').should('be.visible');
105+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/group]').should('be.visible');
106106
// expand and check users
107-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/user]').click();
108-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [id*=security\\/user\\/]').should('have.length.gt', 0);
107+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/user]').click();
108+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [node-id*=security\\/user\\/]').should('have.length.gt', 0);
109109
// expand and check groups
110-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/group]').click();
111-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [id*=security\\/group\\/]').should('have.length.gt', 0);
110+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/group]').click();
111+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [node-id*=security\\/group\\/]').should('have.length.gt', 0);
112112
})
113113
it('open user information', function() {
114-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/user]').should('be.visible');
115-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [id*=security\\/user\\/]').should('have.length.gt', 0);
116-
const firstUser = cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [id*=security\\/user\\/]').first();
114+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/user]').should('be.visible');
115+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [node-id*=security\\/user\\/]').should('have.length.gt', 0);
116+
const firstUser = cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-user.fs-icon + [node-id*=security\\/user\\/]').first();
117117
firstUser.then(user => {
118118
const userName = user.text();
119119
firstUser.rightclick();
@@ -125,9 +125,9 @@ context('Fusion Studio', function() {
125125
});
126126
})
127127
it('open group information', function() {
128-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [data-node-id$=security\\/group]').should('be.visible');
129-
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [id*=security\\/group\\/]').should('have.length.gt', 0);
130-
const firstGroup = cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [id*=security\\/group\\/]').first();
128+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item [node-id$=security\\/group]').should('be.visible');
129+
cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [node-id*=security\\/group\\/]').should('have.length.gt', 0);
130+
const firstGroup = cy.get('.p-Widget.theia-Tree .theia-TreeNode.fusion-item .fa-users.fs-icon + [node-id*=security\\/group\\/]').first();
131131
firstGroup.then(group => {
132132
const groupName = group.text();
133133
firstGroup.rightclick();

cypress/support/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const apiUrl = apiScheme + "://" + apiHost + ":" + apiPort + "/exist/res
66
export function mkApiUrl(apiService) {
77
return apiUrl + apiService;
88
};
9-
export function mkApiPathUrl(username, dbPath) {
9+
export function mkApiPathUrl(username, dbPath = '') {
1010
return username + '@' + apiScheme + '://' + apiHost + ':' + apiPort + dbPath;
1111
};
1212

cypress/support/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { apiScheme, apiHost, apiPort } from '../support/config.js';
22

33
export function treenode(id) {
4-
return '[id=' + CSS.escape(id) + ']';
4+
return '[node-id=' + CSS.escape(id) + ']';
55
}
66
export function checkbox() {
77
return 'span.checkbox';
@@ -59,7 +59,8 @@ Cypress.Commands.add('addCollection', (id, name) => {
5959
cy.waitForLoading();
6060
cy.getTreeNode(id).rightclick()
6161
cy.getMenuCommand('fusion.new-collection').should('be.visible').click();
62-
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'untitled').type(name + '{enter}').should('not.exist');
62+
cy.get('.fs-inline-input').should('exist').find('input.theia-input[type=text]').should('contain.value', 'untitled').type(name + '{enter}');
63+
cy.get('.fs-inline-input').should('not.exist');
6364
cy.waitForLoading();
6465
cy.getTreeNode(id + '/' + name).should('be.visible');
6566
});

electron-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "electron-app",
4-
"version": "1.0.3",
4+
"version": "1.1.0",
55
"dependencies": {
66
"@theia/core": "^1.9.0",
77
"@theia/filesystem": "^1.9.0",

fusion-studio-extension/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"keywords": [
44
"theia-extension"
55
],
6-
"version": "1.0.3",
6+
"version": "1.1.0",
77
"author": "Evolved Binary <[email protected]>",
88
"license": "GPL-3.0",
99
"main": "./lib/index.js",
@@ -20,7 +20,8 @@
2020
"mime-types": "2.1.27",
2121
"moment": "2.29.1",
2222
"ripemd160": "2.0.2",
23-
"typescript": "4.1.3"
23+
"typescript": "4.1.3",
24+
"uuid": "^8.3.2"
2425
},
2526
"devDependencies": {
2627
"@types/awesomplete": "1.1.10",

fusion-studio-extension/src/browser/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const actRename: FSAction = {
9090
icon: 'fa fa-i-cursor',
9191
execute: core => () => core.renameItem(),
9292
enabled: core => () => !core.isLoading,
93-
visible: core => () => core.isItem,
93+
visible: core => () => core.isItem || core.isConnection,
9494
};
9595
export const actCut: FSAction = {
9696
id: 'cut',

0 commit comments

Comments
 (0)