Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>
});
});
});
+
+ it('copies project URL to clipboard', () => {
+ const projectName = `Test project (${Math.floor(999999 * Math.random())})`;
+
+ cy.loginAs(activeUser);
+ cy.get('[data-cy=side-panel-button]').click();
+ cy.get('[data-cy=side-panel-new-project]').click();
+ cy.get('[data-cy=form-dialog]')
+ .should('contain', 'New Project')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input').type(projectName);
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+
+ cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
+ cy.get('[data-cy=project-panel]').contains(projectName).rightclick();
+ cy.get('[data-cy=context-menu]').contains('Copy to clipboard').click();
+ cy.window().then((win) => (
+ win.navigator.clipboard.readText().then((text) => {
+ expect(text).to.match(/https\:\/\/localhost\:[0-9]+\/projects\/[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/,);
+ })
+ ));
+
+ });
});
});
});
+ it('can search items using quotes', function() {
+ const random = Math.floor(Math.random() * Math.floor(999999));
+ const colName = `Collection ${random}`;
+ const colName2 = `Collection test ${random}`;
+
+ // Creates the collection using the admin token so we can set up
+ // a bogus manifest text without block signatures.
+ cy.createCollection(adminUser.token, {
+ name: colName,
+ owner_uuid: activeUser.user.uuid,
+ preserve_version: true,
+ manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+ }).as('collection1');
+
+ cy.createCollection(adminUser.token, {
+ name: colName2,
+ owner_uuid: activeUser.user.uuid,
+ preserve_version: true,
+ manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+ }).as('collection2');
+
+ cy.getAll('@collection1', '@collection2')
+ .then(function() {
+ cy.loginAs(activeUser);
+
+ cy.doSearch(colName);
+ cy.get('[data-cy=search-results] table tbody tr').should('have.length', 2);
+
+ cy.doSearch(`"${colName}"`);
+ cy.get('[data-cy=search-results] table tbody tr').should('have.length', 1);
+ });
+ });
+
it('can display owner of the item', function() {
const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
}
public addFullTextSearch(value: string) {
- const terms = value.trim().split(/(\s+)/);
+ const regex = /"[^"]*"/;
+ const matches: any[] = [];
+
+ let match = value.match(regex);
+
+ while (match) {
+ value = value.replace(match[0], "");
+ matches.push(match[0].replace(/"/g, ''));
+ match = value.match(regex);
+ }
+
+ const terms = value.trim().split(/(\s+)/).concat(matches);
terms.forEach(term => {
if (term !== " ") {
this.addCondition("any", "ilike", term, "%", "%");
// Copy to clipboard omits token to avoid accidental sharing
const url = getNavUrl(resource.uuid, getState().auth, false);
- if (url) {
+ if (url[0] === '/') {
+ copy(`${window.location.origin}${url}`);
+ } else if (url.length) {
copy(url);
}
};