-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post news feed to user menu #1807
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ac8c545
Post news feed to user menu
jmthomas bd3ea81
Update news every hour
jmthomas 73ad8c7
Make news feed a setting
jmthomas f826f5c
Remove console.log and simplify migration
jmthomas e4904b0
Improve news feed handling
jmthomas f5ca53b
Always set news_feed when deploying scope
jmthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
openc3-cosmos-cmd-tlm-api/app/controllers/news_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# encoding: ascii-8bit | ||
|
||
# Copyright 2025 OpenC3, Inc. | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can modify and/or redistribute it | ||
# under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation; version 3 with | ||
# attribution addendums as found in the LICENSE.txt | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
|
||
# This file may also be used under the terms of a commercial license | ||
# if purchased from OpenC3, Inc. | ||
|
||
require 'openc3/models/news_model' | ||
|
||
class NewsController < ApplicationController | ||
def index | ||
render json: OpenC3::NewsModel.all() | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...nit/plugins/packages/openc3-vue-common/src/tools/admin/tabs/settings/NewsFeedSettings.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!-- | ||
# Copyright 2025 OpenC3, Inc. | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can modify and/or redistribute it | ||
# under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation; version 3 with | ||
# attribution addendums as found in the LICENSE.txt | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
|
||
# This file may also be used under the terms of a commercial license | ||
# if purchased from OpenC3, Inc. | ||
--> | ||
|
||
<template> | ||
<v-card> | ||
<v-card-title>News Feed Settings</v-card-title> | ||
<v-alert v-model="errorLoading" type="error" closable density="compact"> | ||
Error loading previous configuration due to {{ errorText }} | ||
</v-alert> | ||
<v-alert v-model="errorSaving" type="error" closable density="compact"> | ||
Error saving due to {{ errorText }} | ||
</v-alert> | ||
<v-alert v-model="successSaving" type="success" closable density="compact"> | ||
Saved! (Refresh the page to see changes) | ||
</v-alert> | ||
<v-card-text class="pb-0"> | ||
<v-switch | ||
label="Allow COSMOS backend to pull the news feed from the COSMOS external news site. | ||
This is a low bandwidth poll which only happens every 12 hrs. To immediately update the news feed, click the 'Refresh' in the User Menu." | ||
v-model="newsFeed" | ||
color="primary" | ||
/> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-btn | ||
@click="save" | ||
color="success" | ||
variant="text" | ||
data-test="save-news-feed" | ||
> | ||
Save | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</template> | ||
|
||
<script> | ||
import Settings from './settings.js' | ||
|
||
const settingName = 'news_feed' | ||
export default { | ||
mixins: [Settings], | ||
data() { | ||
return { | ||
newsFeed: true, | ||
} | ||
}, | ||
created() { | ||
this.loadSetting(settingName) | ||
}, | ||
methods: { | ||
save() { | ||
this.saveSetting(settingName, this.newsFeed) | ||
if (this.newsFeed) { | ||
this.api.update_news() | ||
} | ||
}, | ||
parseSetting: function (response) { | ||
this.newsFeed = response | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want to have an HTML version of this page too, and return either json or html based on extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a news site (https://www.openc3.com/news) so I can't imagine having another one for the little blurb news that goes in this json feed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine either way. It wouldn't really be used, just a pretty response when people poke around at the domain