-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
394 additions
and
203 deletions.
There are no files selected for viewing
154 changes: 0 additions & 154 deletions
154
services/static-webserver/client/source/class/osparc/AnnouncementTracker.js
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
services/static-webserver/client/source/class/osparc/AnnouncementsTracker.js
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,62 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2023 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.AnnouncementsTracker", { | ||
extend: qx.core.Object, | ||
type: "singleton", | ||
|
||
statics: { | ||
CHECK_INTERVAL: 60*60*1000 // Check every 60' | ||
}, | ||
|
||
members: { | ||
__checkInternval: null, | ||
__announcements: null, | ||
|
||
startTracker: function() { | ||
const checkAnnouncements = () => { | ||
osparc.data.Resources.get("announcements") | ||
.then(announcements => { | ||
if (announcements && announcements.length) { | ||
this.__setAnnouncements(announcements); | ||
} else { | ||
this.__setAnnouncements(null); | ||
} | ||
}) | ||
.catch(err => console.error(err)); | ||
}; | ||
checkAnnouncements(); | ||
this.__checkInternval = setInterval(checkAnnouncements, this.self().CHECK_INTERVAL); | ||
}, | ||
|
||
stopTracker: function() { | ||
if (this.__checkInternval) { | ||
clearInterval(this.__checkInternval); | ||
} | ||
}, | ||
|
||
__setAnnouncements: function(announcementsData) { | ||
this.__announcements = {}; | ||
if (announcementsData) { | ||
announcementsData.forEach(announcementData => { | ||
const announcement = new osparc.component.announcement.Announcement(announcementData); | ||
osparc.component.announcement.AnnouncementUIFactory.getInstance().setAnnouncement(announcement); | ||
}); | ||
} | ||
} | ||
} | ||
}); |
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
85 changes: 85 additions & 0 deletions
85
services/static-webserver/client/source/class/osparc/component/announcement/Announcement.js
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,85 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2018 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.component.announcement.Announcement", { | ||
extend: qx.core.Object, | ||
|
||
construct: function(announcementData) { | ||
this.base(arguments); | ||
|
||
this.set({ | ||
id: announcementData.id, | ||
products: announcementData.products, | ||
start: new Date(announcementData.start), | ||
end: new Date(announcementData.end), | ||
title: announcementData.title, | ||
description: announcementData.description, | ||
link: announcementData.link, | ||
widgets: announcementData.widgets | ||
}); | ||
}, | ||
|
||
properties: { | ||
id: { | ||
check: "String", | ||
init: null, | ||
nullable: false | ||
}, | ||
|
||
products: { | ||
check: "Array", | ||
init: [], | ||
nullable: false | ||
}, | ||
|
||
start: { | ||
check: "Date", | ||
init: null, | ||
nullable: false | ||
}, | ||
|
||
end: { | ||
check: "Date", | ||
init: null, | ||
nullable: false | ||
}, | ||
|
||
title: { | ||
check: "String", | ||
init: null, | ||
nullable: true | ||
}, | ||
|
||
description: { | ||
check: "String", | ||
init: null, | ||
nullable: true | ||
}, | ||
|
||
link: { | ||
check: "String", | ||
init: null, | ||
nullable: true | ||
}, | ||
|
||
widgets: { | ||
check: "Array", | ||
init: [], | ||
nullable: true | ||
} | ||
} | ||
}); |
Oops, something went wrong.