Skip to content

Commit

Permalink
ui: show warning if testing repositories are enabled (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoScarpetta authored Feb 28, 2024
1 parent c57e650 commit 05b5dbe
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@
"search_placeholder": "Search apps",
"software_updates": "Updates",
"you_have_updates": "You have {numUpdates} app to update | You have {numUpdates} apps to update",
"testing_warning_title": "Testing repositories enabled",
"testing_warning_description": "Some software repositories include non-stable versions of applications",
"testing_warning_action_label": "Go to Software repositories",
"all": "All",
"installed": "Installed",
"updates": "Updates",
Expand Down
35 changes: 35 additions & 0 deletions core/ui/src/views/SoftwareCenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@
/>
</cv-column>
</cv-row>
<cv-row v-if="repositories.find((repository) => repository.testing)">
<cv-column>
<NsInlineNotification
kind="warning"
:title="$t('software_center.testing_warning_title')"
:description="$t('software_center.testing_warning_description')"
:showCloseButton="false"
@action="goToSettingsSoftwareRepositories"
:actionLabel="$t('software_center.testing_warning_action_label')"
/>
</cv-column>
</cv-row>
<div>
<cv-search
:label="$t('software_center.search_placeholder')"
Expand Down Expand Up @@ -383,6 +395,7 @@ export default {
modules: [],
appUpdates: [],
coreModules: [],
repositories: [],
updateAllAppsTimeout: 0,
updateCoreTimeout: 0,
isShownInstallModal: false,
Expand Down Expand Up @@ -451,6 +464,7 @@ export default {
},
created() {
this.listModules();
this.listRepositories();

// register to events
this.$root.$on("willUpdateCore", this.onWillUpdateCore);
Expand Down Expand Up @@ -487,6 +501,27 @@ export default {
return;
}
},
// List repositories to show the warning inline message in case some of them have testing switch turned on
async listRepositories() {
const taskAction = "list-repositories";

this.$root.$once(
taskAction + "-completed",
this.listRepositoriesCompleted
);

await to(
this.createClusterTask({
action: taskAction,
extra: {
isNotificationHidden: true,
},
})
);
},
listRepositoriesCompleted(taskContext, taskResult) {
this.repositories = taskResult.output;
},
listModulesCompleted(taskContext, taskResult) {
this.loading.listModules = false;
let modules = taskResult.output;
Expand Down

0 comments on commit 05b5dbe

Please sign in to comment.