checking if theme is already installed
This commit is contained in:
parent
9be41520d2
commit
f655b8f1aa
2 changed files with 19 additions and 4 deletions
|
@ -431,7 +431,7 @@ export class BrowserWindow {
|
|||
description: themeJson.description || themeDescription,
|
||||
path: themePath,
|
||||
file: theme,
|
||||
test: join(themePath, "theme.json")
|
||||
github_repo: themeJson.github_repo || ""
|
||||
});
|
||||
} else {
|
||||
themeObjects.push({
|
||||
|
@ -439,7 +439,7 @@ export class BrowserWindow {
|
|||
description: themeDescription,
|
||||
path: themePath,
|
||||
file: theme,
|
||||
test: join(themePath, "theme.json")
|
||||
github_repo: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-auto nopadding flex-center">
|
||||
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">Install</button>
|
||||
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">
|
||||
<span v-if="!themesInstalled.includes(openRepo.full_name)">Install</span>
|
||||
<span v-else>Update</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -67,13 +70,25 @@
|
|||
avatar_url: ''
|
||||
},
|
||||
readme: ""
|
||||
}
|
||||
},
|
||||
themesInstalled: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRepos();
|
||||
this.getInstalledThemes();
|
||||
},
|
||||
methods: {
|
||||
getInstalledThemes() {
|
||||
let self = this
|
||||
const themes = ipcRenderer.sendSync("get-themes")
|
||||
// for each theme, get the github_repo property and push it to the themesInstalled array, if not blank
|
||||
themes.forEach(theme => {
|
||||
if (theme.github_repo !== "") {
|
||||
self.themesInstalled.push(theme.github_repo)
|
||||
}
|
||||
})
|
||||
},
|
||||
showRepo(repo) {
|
||||
const self = this
|
||||
const readmeUrl = `https://raw.githubusercontent.com/${repo.full_name}/main/README.md`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue