aboutsummaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/src
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-02-12 18:11:13 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-02-13 15:29:52 +0100
commit90bcc8e63c52b5c4028d242af9ca5a0c00b34587 (patch)
tree439c29c980dfa78e0f426448b7a6a6a7a2238220 /apps/updatenotification/src
parentcc69038c921228ab5f0f972cbee131722861be51 (diff)
downloadnextcloud-server-90bcc8e63c52b5c4028d242af9ca5a0c00b34587.tar.gz
nextcloud-server-90bcc8e63c52b5c4028d242af9ca5a0c00b34587.zip
Improve update channel layout to be a popup menu
* now the entries are in a popup menu * if a non-default channel is used the entry will be at the bottom * channel descriptions are embeded into the menu * use nextcloud-vue componenets for the channel selector * update nextcloud-vue dependency from 0.6.1 to 0.6.3 * fixes #13806 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/updatenotification/src')
-rw-r--r--apps/updatenotification/src/components/root.vue171
1 files changed, 135 insertions, 36 deletions
diff --git a/apps/updatenotification/src/components/root.vue b/apps/updatenotification/src/components/root.vue
index be50b8b53ca..e9771e3af09 100644
--- a/apps/updatenotification/src/components/root.vue
+++ b/apps/updatenotification/src/components/root.vue
@@ -63,22 +63,24 @@
</template>
</div>
+ <h3 class="update-channel-selector">
+ {{ t('updatenotification', 'Update channel:') }}
+ <div class="update-menu">
+ <span class="icon-update-menu" @click="toggleUpdateChannelMenu">
+ {{ localizedChannelName }}
+ <span class="icon-triangle-s"></span>
+ </span>
+ <div class="popovermenu menu menu-center" v-bind:class="{ 'show-menu': openedUpdateChannelMenu}">
+ <popover-menu :menu="channelList" />
+ </div>
+ </div>
+ </h3>
+ <span id="channel_save_msg" class="msg"></span><br />
<p>
- <label for="release-channel">{{ t('updatenotification', 'Update channel:') }}</label>
- <select id="release-channel" v-model="currentChannel" @change="changeReleaseChannel">
- <option v-for="channel in channels" :value="channel">{{channel}}</option>
- </select>
- <span id="channel_save_msg" class="msg"></span><br />
- <em>{{ t('updatenotification', 'You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel.') }}</em><br />
+ <em>{{ t('updatenotification', 'You can always update to a newer version. But you can never downgrade to a more stable version.') }}</em><br />
<em>{{ t('updatenotification', 'Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found.') }}</em>
</p>
- <p class="channel-description">
- <span v-html="productionInfoString"></span><br>
- <span v-html="stableInfoString"></span><br>
- <span v-html="betaInfoString"></span>
- </p>
-
<p id="oca_updatenotification_groups">
{{ t('updatenotification', 'Notify members of the following groups about available updates:') }}
<multiselect v-model="notifyGroups" :options="availableGroups" :multiple="true" label="label" track-by="value" :tag-width="75" /><br />
@@ -131,11 +133,11 @@
hideMissingUpdates: false,
hideAvailableUpdates: true,
openedWhatsNew: false,
+ openedUpdateChannelMenu: false,
};
},
_$el: null,
- _$releaseChannel: null,
_$notifyGroups: null,
watch: {
@@ -211,19 +213,7 @@
this.missingAppUpdates.length);
},
- productionInfoString: function() {
- return t('updatenotification', '<strong>production</strong> will always provide the latest patch level, but not update to the next major release immediately. That update usually happens with the second minor release (x.0.2).');
- },
-
- stableInfoString: function() {
- return t('updatenotification', '<strong>stable</strong> is the most recent stable version. It is suited for regular use and will always update to the latest major version.');
- },
-
- betaInfoString: function() {
- return t('updatenotification', '<strong>beta</strong> is a pre-release version only for testing new features, not for production environments.');
- },
-
- whatsNew: function () {
+ whatsNew: function() {
if(this.whatsNewData.length === 0) {
return null;
}
@@ -241,6 +231,65 @@
});
}
return whatsNew;
+ },
+
+ channelList: function() {
+ let channelList = [];
+
+ channelList.push({
+ text: t('updatenotificaiton', 'Stable'),
+ longtext: t('updatenotification', 'The most recent stable version. It is suited for regular use and will always update to the latest major version.'),
+ icon: 'icon-checkmark',
+ active: this.currentChannel === 'stable',
+ action: this.changeReleaseChannelToStable
+ });
+
+ channelList.push({
+ text: t('updatenotificaiton', 'Production'),
+ longtext: t('updatenotification', 'Will always provide the latest patch level, but not update to the next major release immediately. That update usually happens with the second minor release (x.0.2) and only if the instance is already on the latest minor version.'),
+ icon: 'icon-star',
+ active: this.currentChannel === 'production',
+ action: this.changeReleaseChannelToProduction
+ });
+
+ channelList.push({
+ text: t('updatenotificaiton', 'Beta'),
+ longtext: t('updatenotification', 'A pre-release version only for testing new features, not for production environments.'),
+ icon: 'icon-category-customization',
+ active: this.currentChannel === 'beta',
+ action: this.changeReleaseChannelToBeta
+ });
+
+ if (this.isNonDefaultChannel) {
+ channelList.push({
+ text: this.currentChannel,
+ icon: 'icon-rename',
+ active: true
+ });
+ }
+
+ return channelList;
+ },
+
+ isNonDefaultChannel: function() {
+ return this.currentChannel !== 'production' && this.currentChannel !== 'stable' && this.currentChannel !== 'beta';
+ },
+
+ localizedChannelName: function() {
+ switch (this.currentChannel) {
+ case 'production':
+ return t('updatenotificaiton', 'Production');
+ break;
+ case 'stable':
+ return t('updatenotificaiton', 'Stable');
+ break;
+ case 'beta':
+ return t('updatenotificaiton', 'Beta');
+ break;
+ default:
+ return this.currentChannel;
+ break;
+ }
}
},
@@ -268,8 +317,17 @@
form.submit();
}.bind(this));
},
- changeReleaseChannel: function() {
- this.currentChannel = this._$releaseChannel.val();
+ changeReleaseChannelToStable: function() {
+ this.changeReleaseChannel('stable')
+ },
+ changeReleaseChannelToProduction: function() {
+ this.changeReleaseChannel('production')
+ },
+ changeReleaseChannelToBeta: function() {
+ this.changeReleaseChannel('beta')
+ },
+ changeReleaseChannel: function(channel) {
+ this.currentChannel = channel;
$.ajax({
url: OC.generateUrl('/apps/updatenotification/channel'),
@@ -281,6 +339,11 @@
OC.msg.finishedAction('#channel_save_msg', data);
}
});
+
+ this.openedUpdateChannelMenu = false;
+ },
+ toggleUpdateChannelMenu: function() {
+ this.openedUpdateChannelMenu = !this.openedUpdateChannelMenu;
},
toggleHideMissingUpdates: function() {
this.hideMissingUpdates = !this.hideMissingUpdates;
@@ -324,7 +387,6 @@
},
mounted: function () {
this._$el = $(this.$el);
- this._$releaseChannel = this._$el.find('#release-channel');
this._$notifyGroups = this._$el.find('#oca_updatenotification_groups_list');
this._$notifyGroups.on('change', function () {
this.$emit('input');
@@ -350,6 +412,7 @@
<style lang="sass" scoped>
#updatenotification {
margin-top: -25px;
+ margin-bottom: 200px;
div.update,
p:not(.inlineblock) {
margin-bottom: 25px;
@@ -365,6 +428,10 @@
&:first-of-type {
margin-top: 0;
}
+ &.update-channel-selector {
+ display: inline-block;
+ cursor: inherit;
+ }
}
.icon {
display: inline-block;
@@ -373,13 +440,6 @@
.icon-triangle-s, .icon-triangle-n {
opacity: 0.5;
}
- .channel-description span {
- color: var(--color-text-lighter);
- strong {
- color: var(--color-main-text);
- font-weight: normal;
- }
- }
.whatsNew {
display: inline-block;
}
@@ -397,5 +457,44 @@
.applist {
margin-bottom: 25px;
}
+
+ .update-menu {
+ position: relative;
+ cursor: pointer;
+ margin-left: 3px;
+ display: inline-block;
+ .icon-update-menu {
+ cursor: inherit;
+ .icon-triangle-s {
+ display: inline-block;
+ vertical-align: middle;
+ cursor: inherit;
+ opacity: 1;
+ }
+ }
+ .popovermenu {
+ display: none;
+ top: 28px;
+ &.show-menu {
+ display: block;
+ }
+ }
+ }
+ }
+</style>
+<style lang="sass">
+ /* override needed to make menu wider */
+ #updatenotification .popovermenu {
+ p {
+ margin-top: 5px;
+ width: 100%;
+ }
+ margin-top: 5px;
+ width: 300px;
+ }
+ /* override needed to replace yellow hover state with a dark one */
+ #updatenotification .update-menu .icon-star:hover,
+ #updatenotification .update-menu .icon-star:focus {
+ background-image: var(--icon-star-000);
}
</style>