Skip to content

Commit bb85be1

Browse files
fuyloon2018gloriajwtunguyentk
authored
Task/fix bugs301122 (#1043)
* Release 2.0.2 * Task/fix bug delete stage (#1027) * Fix bug at backstage can not delete stage * Fix Bug Studio UI load file i18n form dashboard get 403 code * Task/fix statis duplicate delete (#1040) * Move button Clone, Delete from Stage to Stage Management * Update Code Sort by Created Date and Id DESC * FIx bug statistics worng * sort by created date decs * fix bug statistics wrong * debug fix statistics on dev-app env * debug fix statistics wrong * debug * debug * debug * Fix bug Created_on have the same date after clone * change "manage stage" to "manage" * Check upload file limit on studio * implement player upload limit enhancement * Update format size * Fix does not return to start at end of playing (once mode) * Add Create_On and last access in backstage * add create date and last access on backstage * delete notify * update "without time zone" Co-authored-by: TU_COMPUTER\justr <nhtu160220@gmail.com> * with player-only access on a stage, i can still change status & visibility #1019 * fix bug hide backstage * Implement #1039 Format Date and sort date * make button to change font size in player chat * fix bug author * fix bug duplicate stage last_access = null, and sort stage on backstage interface * Debug task send mail * Debug task sendmail * Permission system email notifications #790 * fix build fail in github * debug git build fail * debug build fail * debug * debug * debug1 * debug11 * playwright1.22.2 * Fix bug install playwright failed * update test case * debug githubJob * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug Co-authored-by: gloriajw <gloriajw@users.noreply.github.com> Co-authored-by: TU_COMPUTER\justr <nhtu160220@gmail.com>
1 parent a7b7fbd commit bb85be1

File tree

31 files changed

+614
-254
lines changed

31 files changed

+614
-254
lines changed

.github/workflows/devapp1.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: DEVAPP1 CI
66
on:
77
# Triggers the workflow on push or approved pull request on R1-2021 branch
88
push:
9-
branches: [ GnarlyPine-24 ]
9+
branches: [ BlueMoon-2.0.2 ]
1010

1111
# Allows you to run this workflow manually from the Actions tab
1212
workflow_dispatch:
@@ -32,7 +32,7 @@ jobs:
3232
script: |
3333
cd /home/upstage/upstage/ui/dashboard/
3434
git fetch
35-
git checkout GnarlyPine-24
35+
git checkout BlueMoon-2.0.2
3636
git pull
3737
yarn
3838
yarn build:dev

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install Playwright Browsers
2020
working-directory: ./ui/dashboard
2121
run: npx playwright install --with-deps
22-
- name: Run Playwright tests
22+
- name: Run Playwright tests
2323
working-directory: ./ui/dashboard
2424
run: yarn playwright test
2525
- uses: actions/upload-artifact@v2

asset/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class Stage(Base, db.Model):
6262
owner_id = Column(Integer, ForeignKey(User.id), nullable=False, default=0)
6363
file_location = Column(Text, nullable=False)
6464
created_on = Column(DateTime, nullable=False, default=datetime.utcnow)
65+
last_access = Column(DateTime, nullable=True)
6566
owner = relationship(User, foreign_keys=[owner_id])
6667
attributes = relationship(lambda: StageAttribute, lazy='dynamic', back_populates='stage')
6768
assets = relationship('ParentStage', lazy='dynamic', back_populates='stage')

asset/sqlfiles/create.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CREATE TABLE "public"."stage" (
3333
"owner_id" integer NOT NULL,
3434
"file_location" character varying NOT NULL,
3535
"created_on" timestamp DEFAULT (now() at time zone 'utc'),
36+
"last_access" timestamp without time zone,
3637
PRIMARY KEY ("id"),
3738
FOREIGN KEY (owner_id) REFERENCES upstage_user(id)
3839
);

config/sqlfiles/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ CREATE TABLE "public"."config" (
1111
INSERT INTO "config" ("name", "value") VALUES ('FOYER_TITLE', 'CYBERFORMANCE PLATFORM');
1212
INSERT INTO "config" ("name", "value") VALUES ('FOYER_DESCRIPTION', 'UpStage is an online venue for live performance: remote performers collaborate in real time using digital media, and online audiences anywhere in the world join events by going to a web page, without having to download and install any additional software. UpStage is available free to anyone who would like to use it.');
1313
INSERT INTO "config" ("name", "value") VALUES ('FOYER_MENU', 'UpStage User Manual (https://docs.upstage.live/)
14-
Customise Foyer (/backstage/admin/foyer-customisation)');
14+
Customise Foyer (/backstage/admin/foyer-customisation) (8,32)');
1515

1616
INSERT INTO "config" ("name", "value") VALUES ('ENABLE_DONATE', 'true');

mail/templates.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,30 @@ def request_permission_for_media(user, media, note, studio_url):
100100
{footer}
101101
"""
102102

103+
def waiting_request_media_approve(user, media):
104+
return f"""
105+
<p>
106+
Hi <b>{display_user(user)}</b>,
107+
<br>
108+
<br>
109+
Your permission request for media <b>{media.name}</b> has been sent to the owner, please wait to approve.
110+
<br>
111+
<br>
112+
{footer}
113+
"""
114+
115+
def request_permission_acknowledgement(user, media):
116+
return f"""
117+
<p>
118+
Hi <b>{display_user(media.owner)}</b>,
119+
<br>
120+
<br>
121+
{display_user(user)} has indicated that they wish to use your media <b>{media.name}</b> and will acknoweldege it as you have specified.
122+
<br>
123+
<br>
124+
{footer}
125+
"""
126+
103127
def permission_response_for_media(user, media, note, approved, studio_url):
104128
return f"""
105129
<p>

stage/schema.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import os
66
import json
7+
import datetime
78

89
appdir = os.path.abspath(os.path.dirname(__file__))
910
projdir = os.path.abspath(os.path.join(appdir, '..'))
@@ -250,7 +251,7 @@ def mutate(self, info, input):
250251
local_db_session.commit()
251252
stage = DBSession.query(StageModel).filter(
252253
StageModel.id == data['id']).first()
253-
254+
254255
return UpdateStage(stage=stage)
255256

256257

@@ -308,6 +309,29 @@ def mutate(self, info, stage_id):
308309
local_db_session.commit()
309310
return UpdateAttributeVisibility(result=attribute.description)
310311

312+
313+
class UpdateLastAccess(graphene.Mutation):
314+
"""Mutation to update a stage last access attribute."""
315+
result = graphene.String()
316+
317+
class Arguments:
318+
stage_id = graphene.ID(
319+
required=True, description="Global Id of the stage.")
320+
321+
322+
# decorate this with jwt login decorator.
323+
def mutate(self, info, stage_id):
324+
with ScopedSession() as local_db_session:
325+
_id = int(stage_id)
326+
stage = local_db_session.query(StageModel).filter(StageModel.id == _id);
327+
if stage:
328+
stage.update({
329+
StageModel.last_access: datetime.datetime.utcnow()
330+
}, synchronize_session="fetch")
331+
332+
local_db_session.commit()
333+
return UpdateLastAccess(result= datetime.datetime.utcnow())
334+
311335
class AssignMediaInput(graphene.InputObjectType):
312336
id = graphene.ID(required=True, description="Global Id of the stage.")
313337
media_ids = graphene.List(graphene.Int, description="Id of assigned media")
@@ -403,6 +427,9 @@ def mutate(self, info, id):
403427
ParentStage.stage_id == id).delete(synchronize_session=False)
404428
local_db_session.query(StageAttributeModel).filter(
405429
StageAttributeModel.stage_id == id).delete(synchronize_session=False)
430+
local_db_session.query(SceneModel).filter(
431+
SceneModel.stage_id == id).delete(synchronize_session=False)
432+
406433
for performance in local_db_session.query(PerformanceModel).filter(
407434
PerformanceModel.stage_id == id).all():
408435
local_db_session.query(EventModel).filter(
@@ -444,6 +471,8 @@ def mutate(self, info, id, name):
444471
stage.id = None
445472
stage.name = name
446473
stage.owner_id = user.id
474+
stage.last_access = None
475+
stage.created_on = datetime.datetime.utcnow()
447476
shortname = re.sub(
448477
'\s+', '-', re.sub('[^A-Za-z0-9 ]+', '', name)).lower()
449478

@@ -498,12 +527,13 @@ class Mutation(graphene.ObjectType):
498527
saveRecording = SaveRecording.Field()
499528
updateStatus = UpdateAttributeStatus.Field()
500529
updateVisibility = UpdateAttributeVisibility.Field()
530+
updateLastAccess = UpdateLastAccess.Field()
501531

502532

503533
class Query(graphene.ObjectType):
504534
node = relay.Node.Field()
505535
stageList = StageConnectionField(
506-
Stage.connection, id=graphene.ID(), name_like=graphene.String(), file_location=graphene.String())
536+
Stage.connection, id=graphene.ID(), name_like=graphene.String(), file_location=graphene.String(), created_on=graphene.DateTime())
507537
assetList = AssetConnectionField(
508538
Asset.connection, id=graphene.ID(), name_like=graphene.String(), asset_type=graphene.String(), file_location=graphene.String())
509539
assetTypeList = StageConnectionField(

studio/media.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from asset.models import Asset as AssetModel, MediaTag, Stage as StageModel, Tag
2020
from asset.models import AssetType as AssetTypeModel
2121
from mail.mail_utils import send
22-
from mail.templates import permission_response_for_media, request_permission_for_media
22+
from mail.templates import permission_response_for_media, request_permission_for_media, waiting_request_media_approve, request_permission_acknowledgement, display_user
2323
from user.models import GUEST, PLAYER, User as UserModel
2424
from config.project_globals import DBSession, ScopedSession, appdir
2525
from config.settings import STREAM_EXPIRY_DAYS, STREAM_KEY
@@ -505,13 +505,15 @@ async def mutate(self, info, asset_id, note=None):
505505
user_id=user.id, asset_id=asset_id, note=note)
506506
if asset.copyright_level == 2:
507507
asset_usage.approved = False
508+
studio_url = f"{request.url_root}studio"
509+
await send([asset.owner.email], f"Pending permission request for media {asset.name}", request_permission_for_media(user, asset, note, studio_url))
510+
await send(user.email,f"Waiting permission request for media {asset.name} approve", waiting_request_media_approve(user,asset))
508511
else:
509512
asset_usage.approved = True
513+
await send(user.email, f"{display_user(user)} want to use yout media {asset.name} acknowledge media", request_permission_acknowledgement(user, asset, note))
510514
local_db_session.add(asset_usage)
511515
local_db_session.flush()
512516
local_db_session.commit()
513-
studio_url = f"{request.url_root}studio"
514-
await send([asset.owner.email], f"Pending permission request for media {asset.name}", request_permission_for_media(user, asset, note, studio_url))
515517
return ConfirmPermission(success=True)
516518

517519

ui/dashboard/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"moveable": "^0.24.5",
3939
"mqtt": "^4.2.6",
4040
"object-hash": "^2.1.1",
41+
"playwright": "1.23.0",
4142
"qr-code-styling": "^1.6.0-rc.1",
4243
"register-service-worker": "^1.7.1",
4344
"vue": "^3.2.2",
@@ -47,7 +48,7 @@
4748
"vuex-persistedstate": "^4.0.0-beta.1"
4849
},
4950
"devDependencies": {
50-
"@playwright/test": "^1.22.2",
51+
"@playwright/test": "1.23.0",
5152
"@vue/cli-plugin-babel": "~4.5.13",
5253
"@vue/cli-plugin-eslint": "~4.5.13",
5354
"@vue/cli-plugin-pwa": "~4.5.13",

ui/dashboard/src/components/DataTable/index.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
</template>
7070
<template v-else-if="header.type === 'date'">
7171
<span :title="moment(item[header.key])">
72-
{{ fromNow(item[header.key]) }}
72+
{{ handleFormatDate(item[header.key]) }}
7373
</span>
7474
</template>
7575
<template v-else>{{ item[header.key] }}</template>
@@ -154,6 +154,18 @@ export default {
154154
this.sortBy = header;
155155
}
156156
},
157+
158+
handleFormatDate(date){
159+
if (date == null) {
160+
return null;
161+
}
162+
163+
if (moment(this.now).diff(date, "weeks") > 1) {
164+
return moment(date).format('DD/MM/yyyy')
165+
}
166+
167+
return this.fromNow(date);
168+
}
157169
},
158170
computed: {
159171
offset() {
@@ -174,7 +186,7 @@ export default {
174186
return render(a).localeCompare(render(b));
175187
}
176188
if (key) {
177-
return a[key].localeCompare(b[key]);
189+
return a[key]?.localeCompare(b[key]);
178190
}
179191
});
180192
}

0 commit comments

Comments
 (0)