display whats new info in admin settings
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
61842f66ee
commit
bafb6b3c29
|
@ -44,3 +44,30 @@
|
||||||
#updatenotification .warning {
|
#updatenotification .warning {
|
||||||
color: #ce3702;
|
color: #ce3702;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#updatenotification .whatsNew {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#updatenotification .toggleWhatsNews {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#updatenotification .item-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
#updatenotification .item-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
#updatenotification .item-wrapper p {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#updatenotification .item-wrapper span[class^="icon-"] {
|
||||||
|
padding: 0 19px 0 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<template>
|
||||||
|
<ul>
|
||||||
|
<popover-item v-for="(item, key) in menu" :item="item" :key="key" />
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import popoverItem from './popoverMenu/popoverItem';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'popoverMenu',
|
||||||
|
props: ['menu'],
|
||||||
|
components: {
|
||||||
|
popoverItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<li>
|
||||||
|
<!-- If item.href is set, a link will be directly used -->
|
||||||
|
<a @click="item.action" v-if="item.href" :href="(item.href) ? item.href : '#' " :target="(item.target) ? item.target : '' " rel="noreferrer noopener">
|
||||||
|
<span :class="item.icon"></span>
|
||||||
|
<span v-if="item.text">{{item.text}}</span>
|
||||||
|
<p v-else-if="item.longtext">{{item.longtext}}</p>
|
||||||
|
</a>
|
||||||
|
<!-- If item.action is set instead, a button will be used -->
|
||||||
|
<button @click="item.action" v-else-if="item.action">
|
||||||
|
<span :class="item.icon"></span>
|
||||||
|
<span v-if="item.text">{{item.text}}</span>
|
||||||
|
<p v-else-if="item.longtext">{{item.longtext}}</p>
|
||||||
|
</button>
|
||||||
|
<!-- If item.longtext is set AND the item does not have an action -->
|
||||||
|
<span class="item-wrapper" v-else>
|
||||||
|
<span :class="item.icon"></span>
|
||||||
|
<span v-if="item.text">{{item.text}}</span>
|
||||||
|
<p v-else-if="item.longtext">{{item.longtext}}</p>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['item']
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -39,6 +39,14 @@
|
||||||
|
|
||||||
<a v-if="updaterEnabled" href="#" class="button" @click="clickUpdaterButton">{{ t('updatenotification', 'Open updater') }}</a>
|
<a v-if="updaterEnabled" href="#" class="button" @click="clickUpdaterButton">{{ t('updatenotification', 'Open updater') }}</a>
|
||||||
<a v-if="downloadLink" :href="downloadLink" class="button" :class="{ hidden: !updaterEnabled }">{{ t('updatenotification', 'Download now') }}</a>
|
<a v-if="downloadLink" :href="downloadLink" class="button" :class="{ hidden: !updaterEnabled }">{{ t('updatenotification', 'Download now') }}</a>
|
||||||
|
<div class="whatsNew" v-if="whatsNew">
|
||||||
|
<div class="toggleWhatsNews">
|
||||||
|
<span v-click-outside="hideMenu" @click="toggleMenu">{{ t('updatenotification', 'What\'s new?') }}</span>
|
||||||
|
<div class="popovermenu" :class="{ 'open': openedWhatsNew }">
|
||||||
|
<popover-menu :menu="whatsNew" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="!isUpdateChecked">{{ t('updatenotification', 'The update check is not yet finished. Please refresh the page.') }}</template>
|
<template v-else-if="!isUpdateChecked">{{ t('updatenotification', 'The update check is not yet finished. Please refresh the page.') }}</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -80,11 +88,17 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import vSelect from 'vue-select';
|
import vSelect from 'vue-select';
|
||||||
|
import popoverMenu from './popoverMenu';
|
||||||
|
import ClickOutside from 'vue-click-outside';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
components: {
|
components: {
|
||||||
vSelect,
|
vSelect,
|
||||||
|
popoverMenu,
|
||||||
|
},
|
||||||
|
directives: {
|
||||||
|
ClickOutside
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
@ -96,6 +110,8 @@
|
||||||
downloadLink: '',
|
downloadLink: '',
|
||||||
isNewVersionAvailable: false,
|
isNewVersionAvailable: false,
|
||||||
updateServerURL: '',
|
updateServerURL: '',
|
||||||
|
changelogURL: '',
|
||||||
|
whatsNewData: [],
|
||||||
currentChannel: '',
|
currentChannel: '',
|
||||||
channels: [],
|
channels: [],
|
||||||
notifyGroups: '',
|
notifyGroups: '',
|
||||||
|
@ -109,7 +125,8 @@
|
||||||
appStoreDisabled: false,
|
appStoreDisabled: false,
|
||||||
isListFetched: false,
|
isListFetched: false,
|
||||||
hideMissingUpdates: false,
|
hideMissingUpdates: false,
|
||||||
hideAvailableUpdates: true
|
hideAvailableUpdates: true,
|
||||||
|
openedWhatsNew: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -202,6 +219,24 @@
|
||||||
|
|
||||||
betaInfoString: function() {
|
betaInfoString: function() {
|
||||||
return t('updatenotification', '<strong>beta</strong> is a pre-release version only for testing new features, not for production environments.');
|
return t('updatenotification', '<strong>beta</strong> is a pre-release version only for testing new features, not for production environments.');
|
||||||
|
},
|
||||||
|
|
||||||
|
whatsNew: function () {
|
||||||
|
console.warn("fobar");
|
||||||
|
var whatsNew = [];
|
||||||
|
for (var i in this.whatsNewData) {
|
||||||
|
whatsNew[i] = { icon: 'icon-star-dark', longtext: this.whatsNewData[i] };
|
||||||
|
}
|
||||||
|
if(this.changelogURL) {
|
||||||
|
whatsNew.push({
|
||||||
|
href: this.changelogURL,
|
||||||
|
text: t('updatenotificaiton', 'View changelog'),
|
||||||
|
icon: 'icon-link',
|
||||||
|
target: '_blank',
|
||||||
|
action: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return whatsNew;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -261,11 +296,18 @@
|
||||||
},
|
},
|
||||||
toggleHideAvailableUpdates: function() {
|
toggleHideAvailableUpdates: function() {
|
||||||
this.hideAvailableUpdates = !this.hideAvailableUpdates;
|
this.hideAvailableUpdates = !this.hideAvailableUpdates;
|
||||||
}
|
},
|
||||||
|
toggleMenu() {
|
||||||
|
this.openedWhatsNew = !this.openedWhatsNew;
|
||||||
|
},
|
||||||
|
hideMenu() {
|
||||||
|
this.openedWhatsNew = false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
beforeMount: function() {
|
beforeMount: function() {
|
||||||
// Parse server data
|
// Parse server data
|
||||||
var data = JSON.parse($('#updatenotification').attr('data-json'));
|
var data = JSON.parse($('#updatenotification').attr('data-json'));
|
||||||
|
console.warn(data);
|
||||||
|
|
||||||
this.newVersionString = data.newVersionString;
|
this.newVersionString = data.newVersionString;
|
||||||
this.lastCheckedDate = data.lastChecked;
|
this.lastCheckedDate = data.lastChecked;
|
||||||
|
@ -279,6 +321,7 @@
|
||||||
this.notifyGroups = data.notifyGroups;
|
this.notifyGroups = data.notifyGroups;
|
||||||
this.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
|
this.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
|
||||||
this.versionIsEol = data.versionIsEol;
|
this.versionIsEol = data.versionIsEol;
|
||||||
|
this.whatsNewData = data.whatsNew;
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this._$el = $(this.$el);
|
this._$el = $(this.$el);
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -93,6 +93,8 @@ class Admin implements ISettings {
|
||||||
'channels' => $channels,
|
'channels' => $channels,
|
||||||
'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
|
'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
|
||||||
'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
|
'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
|
||||||
|
'changelogURL' => empty($updateState['changelog']) ? false : $updateState['changelog'],
|
||||||
|
'whatsNew' => empty($updateState['whatsNew']) ? false : $updateState['whatsNew'],
|
||||||
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
|
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
|
||||||
'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
|
'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
|
||||||
'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
|
'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
|
||||||
|
|
|
@ -56,6 +56,12 @@ class UpdateChecker {
|
||||||
if (strpos($data['url'], 'https://') === 0) {
|
if (strpos($data['url'], 'https://') === 0) {
|
||||||
$result['downloadLink'] = $data['url'];
|
$result['downloadLink'] = $data['url'];
|
||||||
}
|
}
|
||||||
|
if (strpos($data['changelog'], 'https://') === 0) {
|
||||||
|
$result['changelog'] = $data['changelog'];
|
||||||
|
}
|
||||||
|
if($data['whatsNew'] !== null) {
|
||||||
|
$result['whatsNew'] = $data['whatsNew'];
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2076,7 +2076,8 @@
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
@ -2491,7 +2492,8 @@
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
@ -2547,6 +2549,7 @@
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
@ -2590,12 +2593,14 @@
|
||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6839,6 +6844,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-2.5.16.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-2.5.16.tgz",
|
||||||
"integrity": "sha512-/ffmsiVuPC8PsWcFkZngdpas19ABm5mh2wA7iDqcltyCTwlgZjHGeJYOXkBMo422iPwIcviOtrTCUpSfXmToLQ=="
|
"integrity": "sha512-/ffmsiVuPC8PsWcFkZngdpas19ABm5mh2wA7iDqcltyCTwlgZjHGeJYOXkBMo422iPwIcviOtrTCUpSfXmToLQ=="
|
||||||
},
|
},
|
||||||
|
"vue-click-outside": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/vue-click-outside/-/vue-click-outside-1.0.7.tgz",
|
||||||
|
"integrity": "sha1-zdKxYF48SUR4TheU6uShKg9wC9Y="
|
||||||
|
},
|
||||||
"vue-hot-reload-api": {
|
"vue-hot-reload-api": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz",
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
"homepage": "https://github.com/nextcloud/notifications#readme",
|
"homepage": "https://github.com/nextcloud/notifications#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^2.5.16",
|
"vue": "^2.5.16",
|
||||||
|
"vue-click-outside": "^1.0.7",
|
||||||
"vue-select": "^2.4.0"
|
"vue-select": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -55,7 +55,7 @@ class VersionCheck {
|
||||||
*/
|
*/
|
||||||
public function check() {
|
public function check() {
|
||||||
// Look up the cache - it is invalidated all 30 minutes
|
// Look up the cache - it is invalidated all 30 minutes
|
||||||
if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) {
|
if (false && ((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) {
|
||||||
return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
|
return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class VersionCheck {
|
||||||
$version = Util::getVersion();
|
$version = Util::getVersion();
|
||||||
$version['installed'] = $this->config->getAppValue('core', 'installedat');
|
$version['installed'] = $this->config->getAppValue('core', 'installedat');
|
||||||
$version['updated'] = $this->config->getAppValue('core', 'lastupdatedat');
|
$version['updated'] = $this->config->getAppValue('core', 'lastupdatedat');
|
||||||
$version['updatechannel'] = \OC_Util::getChannel();
|
$version['updatechannel'] = 'stable'; //\OC_Util::getChannel();
|
||||||
$version['edition'] = '';
|
$version['edition'] = '';
|
||||||
$version['build'] = \OC_Util::getBuild();
|
$version['build'] = \OC_Util::getBuild();
|
||||||
$version['php_major'] = PHP_MAJOR_VERSION;
|
$version['php_major'] = PHP_MAJOR_VERSION;
|
||||||
|
@ -97,6 +97,10 @@ class VersionCheck {
|
||||||
$tmp['versionstring'] = (string)$data->versionstring;
|
$tmp['versionstring'] = (string)$data->versionstring;
|
||||||
$tmp['url'] = (string)$data->url;
|
$tmp['url'] = (string)$data->url;
|
||||||
$tmp['web'] = (string)$data->web;
|
$tmp['web'] = (string)$data->web;
|
||||||
|
$tmp['changelog'] = isset($data->changelog) ? (string)$data->changelog : null;
|
||||||
|
// TODO: one's it is decided, use the proper field…
|
||||||
|
$tmp['whatsNew'] = isset($data->whatsNew) ? ((array)$data->whatsNew)['item'] : null;
|
||||||
|
$tmp['whatsNew'] = isset($data->whatsNew_admin) ? ((array)$data->whatsNew_admin)['item'] : (string)$data->whatsNew;
|
||||||
$tmp['autoupdater'] = (string)$data->autoupdater;
|
$tmp['autoupdater'] = (string)$data->autoupdater;
|
||||||
$tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0';
|
$tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue