Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PlayWallCompanion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PlayWall
PlayWallCompanion
Commits
ff85e873
Commit
ff85e873
authored
1 year ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
#187 - Update feedback on page change, add option for pad index based feedback
parent
aa8a5ab9
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
feedbacks.js
+16
-2
16 additions, 2 deletions
feedbacks.js
main.js
+3
-1
3 additions, 1 deletion
main.js
project.js
+45
-0
45 additions, 0 deletions
project.js
receive/current_page_update.js
+9
-0
9 additions, 0 deletions
receive/current_page_update.js
with
73 additions
and
3 deletions
feedbacks.js
+
16
−
2
View file @
ff85e873
...
@@ -12,11 +12,25 @@ module.exports = async function (self) {
...
@@ -12,11 +12,25 @@ module.exports = async function (self) {
type
:
'
textinput
'
,
type
:
'
textinput
'
,
label
:
'
Pad Name
'
,
label
:
'
Pad Name
'
,
default
:
''
,
default
:
''
,
required
:
false
},
{
id
:
'
index
'
,
type
:
'
number
'
,
label
:
'
Pad ID
'
,
default
:
''
,
required
:
false
},
},
],
],
callback
:
(
feedback
,
context
)
=>
{
callback
:
(
feedback
,
context
)
=>
{
let
pad
;
if
(
feedback
.
options
.
name
)
{
self
.
log
(
'
debug
'
,
`Update feedback for pad name
${
feedback
.
options
.
name
}
`
);
self
.
log
(
'
debug
'
,
`Update feedback for pad name
${
feedback
.
options
.
name
}
`
);
const
pad
=
self
.
currentProject
.
findPadByName
(
feedback
.
options
.
name
);
pad
=
self
.
currentProject
.
findPadByName
(
feedback
.
options
.
name
);
}
else
{
self
.
log
(
'
debug
'
,
`Update feedback for pad index
${
feedback
.
options
.
index
}
`
);
pad
=
self
.
currentProject
.
findPadByIndexInCurrentPage
(
feedback
.
options
.
index
-
1
);
}
if
(
pad
!=
null
)
{
if
(
pad
!=
null
)
{
self
.
log
(
'
debug
'
,
`Update feedback for pad id
${
pad
.
id
}
with status
${
pad
.
status
}
`
);
self
.
log
(
'
debug
'
,
`Update feedback for pad id
${
pad
.
id
}
with status
${
pad
.
status
}
`
);
if
(
pad
.
status
===
'
PLAY
'
)
{
if
(
pad
.
status
===
'
PLAY
'
)
{
...
...
This diff is collapsed.
Click to expand it.
main.js
+
3
−
1
View file @
ff85e873
...
@@ -7,6 +7,7 @@ const ProjectUpdate = require("./receive/project_update");
...
@@ -7,6 +7,7 @@ const ProjectUpdate = require("./receive/project_update");
const
Project
=
require
(
"
./project
"
);
const
Project
=
require
(
"
./project
"
);
const
PadNameUpdate
=
require
(
"
./receive/pad_name_update
"
);
const
PadNameUpdate
=
require
(
"
./receive/pad_name_update
"
);
const
PadStatusUpdate
=
require
(
"
./receive/pad_status_update
"
);
const
PadStatusUpdate
=
require
(
"
./receive/pad_status_update
"
);
const
CurrentPageUpdate
=
require
(
"
./receive/current_page_update
"
);
const
uuid
=
require
(
'
uuid
'
);
const
uuid
=
require
(
'
uuid
'
);
class
ModuleInstance
extends
InstanceBase
{
class
ModuleInstance
extends
InstanceBase
{
...
@@ -17,7 +18,8 @@ class ModuleInstance extends InstanceBase {
...
@@ -17,7 +18,8 @@ class ModuleInstance extends InstanceBase {
messageHandlers
=
{
messageHandlers
=
{
'
project-current
'
:
new
ProjectUpdate
(),
'
project-current
'
:
new
ProjectUpdate
(),
'
pad-name-changed
'
:
new
PadNameUpdate
(),
'
pad-name-changed
'
:
new
PadNameUpdate
(),
'
pad-status-changed
'
:
new
PadStatusUpdate
()
'
pad-status-changed
'
:
new
PadStatusUpdate
(),
'
current-page-changed
'
:
new
CurrentPageUpdate
()
};
};
currentProject
=
new
Project
({});
currentProject
=
new
Project
({});
...
...
This diff is collapsed.
Click to expand it.
project.js
+
45
−
0
View file @
ff85e873
module
.
exports
=
class
Project
{
module
.
exports
=
class
Project
{
constructor
(
data
)
{
constructor
(
data
)
{
this
.
padCache
=
{}
this
.
padCache
=
{}
this
.
currentPage
=
0
;
// Prefill with current project
// Prefill with current project
if
(
data
)
{
if
(
data
)
{
this
.
data
=
data
;
console
.
log
(
'
Create pad cache
'
)
console
.
log
(
'
Create pad cache
'
)
for
(
const
pageId
in
data
.
pages
)
{
for
(
const
pageId
in
data
.
pages
)
{
const
page
=
data
.
pages
[
pageId
]
const
page
=
data
.
pages
[
pageId
]
...
@@ -18,6 +20,30 @@ module.exports = class Project {
...
@@ -18,6 +20,30 @@ module.exports = class Project {
}
}
}
}
/*
Page
*/
/**
*
* @returns {number}
*/
getCurrentPage
()
{
return
this
.
currentPage
;
}
/**
*
* @param {number} newPage
*/
updateCurrentPage
(
newPage
)
{
this
.
currentPage
=
newPage
;
}
/*
Pads
*/
/**
/**
*
*
* @param {string} oldName
* @param {string} oldName
...
@@ -49,6 +75,25 @@ module.exports = class Project {
...
@@ -49,6 +75,25 @@ module.exports = class Project {
return
this
.
padCache
[
name
];
return
this
.
padCache
[
name
];
}
}
/**
*
* @param {number} index
*/
findPadByIndexInCurrentPage
(
index
)
{
for
(
const
pageId
in
this
.
data
.
pages
)
{
const
page
=
this
.
data
.
pages
[
pageId
]
if
(
page
.
position
===
this
.
currentPage
)
{
for
(
const
padId
in
page
.
pads
)
{
const
pad
=
page
.
pads
[
padId
];
if
(
pad
.
position
===
index
)
{
return
pad
;
}
}
}
}
return
null
;
}
/**
/**
*
*
* @param {string} padId
* @param {string} padId
...
...
This diff is collapsed.
Click to expand it.
receive/current_page_update.js
0 → 100644
+
9
−
0
View file @
ff85e873
const
MessageExecutable
=
require
(
"
./message_executable
"
);
module
.
exports
=
class
CurrentPageUpdate
extends
MessageExecutable
{
handleMessage
(
plugin
,
message
)
{
plugin
.
currentProject
.
updateCurrentPage
(
message
.
newPage
);
plugin
.
checkFeedbacks
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment