Skip to content

Commit

Permalink
Split the Maven repository from dependency
Browse files Browse the repository at this point in the history
Makes it easier to see what is needed. This also fixes vaadin#45
  • Loading branch information
samie committed Apr 20, 2023
1 parent 25d975d commit 60e6b2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
8 changes: 4 additions & 4 deletions frontend/views/addon/addon-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ addon-view install-tabsheet {
font-size: var(--text-size-md);
}

[theme~="addon-version-menu"] :is(a, button) {
[theme~="addon-version-menu"] :is(a, button, p) {
-webkit-appearance: none;
appearance: none;
margin: 0;
Expand All @@ -437,18 +437,18 @@ addon-view install-tabsheet {
border-radius: var(--roundness-md);
}

[theme~="addon-version-menu"] :is(a, button):hover {
[theme~="addon-version-menu"] :is(a, button, p):hover {
background-color: var(--blue-100);
color: var(--blue-600);
text-decoration: none;
}

[theme~="addon-version-menu"] :is(a, button):focus {
[theme~="addon-version-menu"] :is(a, button, p):focus {
outline: none;
box-shadow: inset 0 0 0 2px var(--blue-400);
}

[theme~="addon-version-menu"] :is(a, button) span {
[theme~="addon-version-menu"] :is(a, button, p) span {
display: block;
font-size: 0.8em;
color: var(--secondary-text-color);
Expand Down
20 changes: 15 additions & 5 deletions frontend/views/addon/install-tabsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,27 @@ export class InstallTabSheet extends Layout {
create.onclick = () => { logAddonInstall(this.addon?.urlIdentifier, this.version?.name, "create", this.getCurrentUserId()); }
create.innerHTML = '<div>Create project</div><span>Create and download a new project using this add-on</span>';

const copyMaven = document.createElement('button');
const copyMaven = document.createElement('p');
copyMaven.onclick = () => {
logAddonInstall(this.addon?.urlIdentifier, this.version?.name, "maven", this.getCurrentUserId());
this.copyToClipboard(this.version?.installs['Maven']);
const text = this.version?.installs['Maven'] || '';
const [textDep,textRepo] = text.split('\n<!-- Vaadin Maven repository -->\n') || '';
this.copyToClipboard(textDep);

if (copyMaven.getElementsByTagName('pre').length == 0) {
const snippet = document.createElement('pre');
snippet.innerText = this.version?.installs['Maven'] || '';
copyMaven.appendChild(snippet);
snippet.textContent = textDep;
copyMaven.appendChild(snippet);
if (textRepo) {
const repoInfo = document.createElement('span');
const repoSnippet = document.createElement('pre');
repoInfo.textContent = "Make sure you also have Vaadin Maven repository:"
repoSnippet.textContent = textRepo;
copyMaven.appendChild(repoInfo);
copyMaven.appendChild(repoSnippet);
}
}
copyMaven.firstElementChild!.textContent = 'Copied ✔';
copyMaven.firstElementChild!.textContent = 'Copied dependency to clipboard ✔';
setTimeout(() => {
copyMaven.firstElementChild!.textContent = 'Maven POM';
this.updateInstallInfo();
Expand Down

0 comments on commit 60e6b2a

Please sign in to comment.